Skip to content

Commit

Permalink
v3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JackuXL committed Aug 18, 2021
1 parent 2daa631 commit b69fb34
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "cn.wearbbs.music"
minSdkVersion 23
targetSdkVersion 30
versionCode 8
versionName "3.1"
versionCode 9
versionName "3.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -49,4 +49,8 @@ dependencies {
implementation 'cn.carbs.android:ExpandableTextView:1.0.3'
implementation 'me.panpf:sketch:2.7.1'
implementation 'com.google.zxing:core:3.4.0'

def appCenterSdkVersion = '4.1.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 8,
"versionName": "3.1",
"versionCode": 9,
"versionName": "3.2",
"outputFile": "app-release.apk"
}
],
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
tools:ignore="ScopedStorage" />

<application
android:name=".application.MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cn.wearbbs.music.application;

import android.app.Application;
import android.content.Context;
import android.content.Intent;

import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes;

/**
* @author JackuXL
*/
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
AppCenter.start(this, "2d48333f-2592-446d-a227-7102be9ab4dd", Analytics.class, Crashes.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
musicIndex = getArguments().getInt("musicIndex");
local = getArguments().getBoolean("local");
lrcView = view.findViewById(R.id.lv_main);
lrcView.setDraggable(true, (lrcView, time) -> {
PlayerFragment.seekTo(time);
return true;
});
updateLyric(requireContext());
new Thread(){
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class PlayerFragment extends Fragment {
private static JSONArray data;
private static int musicIndex;
private static MusicPlayerService.MyBinder binder;
public static MusicPlayerService.MyBinder binder;
private boolean local;
public static int order = 0;
public static final int PLAY_ORDER = 0,
Expand Down Expand Up @@ -338,4 +338,8 @@ public static void setPlayOrder(int orderId){
public static int getPlayOrder(){
return order;
}

public static void seekTo(long time){
binder.seekTo(time);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,12 @@ public void setPlayOrder(int orderId){
break;
}
}

public void seekTo(long time){
if(mMediaPlayer!=null){
mMediaPlayer.seekTo((int)time);
}

}
}
}
3 changes: 3 additions & 0 deletions app/src/main/java/cn/wearbbs/music/ui/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ public void onClick(View view) {
}

}
public void crash(View view){
findViewById(R.id.iv_thumb).setVisibility(View.VISIBLE);
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/cn/wearbbs/music/ui/AddMusicActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
Expand Down Expand Up @@ -57,6 +58,9 @@ public void onClick(View view){
case R.id.main_title:
finish();
break;
case R.id.tv_path:
startActivity(new Intent(AddMusicActivity.this,QRCodeActivity.class).putExtra("url", String.format("%s\n%s\n%s", getString(R.string.musicRoot), getString(R.string.lyricsRoot),getString(R.string.coverRoot))));
break;
}
}

Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/cn/wearbbs/music/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import androidx.appcompat.app.AppCompatDelegate;
import androidx.viewpager2.widget.ViewPager2;

import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes;

import api.MusicApi;
import cn.wearbbs.music.R;
import cn.wearbbs.music.adapter.ViewPagerAdapter;
Expand All @@ -27,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) {
NetWorkUtil.setDomain("https://music.wearbbs.cn");
}
else{
NetWorkUtil.setDomain("https://netease-cloud-music-api-dun-nine.vercel.app");
NetWorkUtil.setDomain("https://netease-cloud-music-api-jackuxl.vercel.app");
}

if (SharedPreferencesUtil.getBoolean("dark", false, this)) {
Expand Down Expand Up @@ -90,4 +94,5 @@ public void hideTip() {
findViewById(R.id.tv_tip_background).setVisibility(View.GONE);
findViewById(R.id.ll_tip).setVisibility(View.GONE);
}

}
15 changes: 15 additions & 0 deletions app/src/main/java/cn/wearbbs/music/ui/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;

import cn.wearbbs.music.R;
import util.NetWorkUtil;

/**
* 设置
Expand Down Expand Up @@ -60,6 +62,19 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
startActivity(new Intent(getActivity(), OpenSourceActivity.class));
return true;
});

findPreference("server").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if(newValue.equals("vercel")){
NetWorkUtil.setDomain("https://netease-cloud-music-api-jackuxl.vercel.app");
}
else{
NetWorkUtil.setDomain("https://music.wearbbs.cn");
}
return true;
}
});
}
}
}
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_addmusic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@

</RelativeLayout>

<TextView
android:id="@+id/tv_path"
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="#BF2175F3"
android:gravity="center"
android:onClick="onClick"
android:text="@string/path_hint"
android:textColor="#FFFFFF"
android:textSize="10sp"
tools:ignore="SmallSp,TextContrastCheck,TouchTargetSizeCheck" />

<LinearLayout
android:id="@+id/ll_ftp"
android:layout_width="match_parent"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@
<string name="send">发送</string>
<string name="server">服务器偏好</string>
<string name="noLogin">未登录</string>
<string name="path_hint"><![CDATA[储存位置 >]]></string>
<string name="musicRoot">音乐储存位置:\n/storage/emulated/0/Android/data/cn.wearbbs.music/files/download/music/</string>
<string name="lyricsRoot">歌词储存位置:\n/storage/emulated/0/Android/data/cn.wearbbs.music/files/download/lrc/</string>
<string name="coverRoot">封面储存位置:\n/storage/emulated/0/Android/data/cn.wearbbs.music/files/download/cover/</string>

</resources>

0 comments on commit b69fb34

Please sign in to comment.