diff --git a/app/build.gradle b/app/build.gradle index 1814a74..1b3fc8f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ android { //noinspection OldTargetApi targetSdk 31 versionCode 1 - versionName "1.5.0" + versionName "1.5.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { @@ -36,22 +36,6 @@ android { outputFileName = "Cloud_music-${variant.name}-v${variant.versionName}.apk" } } - signingConfigs { - signConfig { - storeFile file('F:/muqing.jks') -// 证书存放位置和名字 - storePassword 'muqing153' -// 密码 - keyAlias 'muqing' -// 别名 - keyPassword 'muqing153' -// 别名对应的密码 - } - release { - v1SigningEnabled true //正式版时对应的签名规则 true使用 false不适用 - v2SigningEnabled true - } - } kotlinOptions { jvmTarget = '1.8' } diff --git a/app/src/main/java/com/dirror/lyricviewx/LyricViewX.kt b/app/src/main/java/com/dirror/lyricviewx/LyricViewX.kt index 71315e6..4b63579 100644 --- a/app/src/main/java/com/dirror/lyricviewx/LyricViewX.kt +++ b/app/src/main/java/com/dirror/lyricviewx/LyricViewX.kt @@ -1090,9 +1090,6 @@ open class LyricViewX : EaseView, LyricViewXInterface { } companion object { - - private const val TAG = "LyricViewX" - // 时间线持续时间 private const val TIMELINE_KEEP_TIME = 3 * DateUtils.SECOND_IN_MILLIS } diff --git a/app/src/main/java/com/dirror/lyricviewx/SmoothInterpolator.kt b/app/src/main/java/com/dirror/lyricviewx/SmoothInterpolator.kt deleted file mode 100644 index 2ad4a4b..0000000 --- a/app/src/main/java/com/dirror/lyricviewx/SmoothInterpolator.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.dirror.lyricviewx - -import android.animation.TimeInterpolator -import kotlin.math.pow - -/** - * Smooth 插值器 - * @author Moriafly - */ -@Deprecated("过时") -class SmoothInterpolator: TimeInterpolator { - override fun getInterpolation(input: Float): Float { - val a = 1.11571230005336 - val b = -1.99852071205059 - val c = 0.272428743837376 - val d = -1.15835562067601E-05 - return ((a - d) / (1.0 + (input.toDouble() / c).pow(b)) + d).toFloat() - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/muqingbfq/MediaPlayer.java b/app/src/main/java/com/muqingbfq/MediaPlayer.java index efcacb0..70ed7e1 100644 --- a/app/src/main/java/com/muqingbfq/MediaPlayer.java +++ b/app/src/main/java/com/muqingbfq/MediaPlayer.java @@ -13,6 +13,7 @@ import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.Target; import com.muqingbfq.api.url; +import com.muqingbfq.fragment.bfq_db; import com.muqingbfq.fragment.mp3; import java.io.IOException; @@ -22,9 +23,9 @@ import java.util.TimerTask; public class MediaPlayer extends android.media.MediaPlayer { public MediaPlayer() { this.setOnCompletionListener(mediaPlayer -> { - if (!home.db.view.isShown()) { +/* if (!home.db.view.isShown()) { home.db.view.setVisibility(View.VISIBLE); - } + }*/ int i = bfqkz.getmti(bfqkz.ms); bfqkz.xm = bfqkz.list.get(i); new Thread() { @@ -50,7 +51,7 @@ public class MediaPlayer extends android.media.MediaPlayer { if (bfq.kg != null) { bfq.kg.setImageResource(R.drawable.zt); } - home.db.txa.setImageResource(R.drawable.zt); + bfq_db.txa.setImageResource(R.drawable.zt); bfqkz.updateNotification(); } } @@ -88,7 +89,7 @@ public class MediaPlayer extends android.media.MediaPlayer { if (bfq.kg != null) { bfq.kg.setImageResource(R.drawable.bf); } - home.db.txa.setImageResource(R.drawable.bf); + bfq_db.txa.setImageResource(R.drawable.bf); bfqkz.updateNotification(); } @@ -99,7 +100,7 @@ public class MediaPlayer extends android.media.MediaPlayer { prepare(); bfqkz.tdt_max = getDuration(); bfqkz.tdt_wz = getCurrentPosition(); - Glide.with(main.context) + Glide.with(home.appCompatActivity) .asBitmap() .load(bfqkz.xm.picurl) .addListener(new RequestListener() { @@ -109,7 +110,6 @@ public class MediaPlayer extends android.media.MediaPlayer { bfqkz.notify.setBitmap(null); return false; } - @Override public boolean onResourceReady(@NonNull Bitmap bitmap, @NonNull Object model, Target target, @NonNull DataSource dataSource, boolean isFirstResource) { @@ -128,8 +128,8 @@ public class MediaPlayer extends android.media.MediaPlayer { bfq.zz.setText(bfqkz.xm.zz); bfq_an.islike(bfq.like.getContext()); } - home.db.name.setText(bfqkz.xm.name); - home.db.zz.setText(bfqkz.xm.zz); + bfq_db.name.setText(bfqkz.xm.name); + bfq_db.zz.setText(bfqkz.xm.zz); if (mp3.lbspq != null) { mp3.lbspq.notifyDataSetChanged(); } diff --git a/app/src/main/java/com/muqingbfq/api/url.java b/app/src/main/java/com/muqingbfq/api/url.java index 40776b4..71344c8 100644 --- a/app/src/main/java/com/muqingbfq/api/url.java +++ b/app/src/main/java/com/muqingbfq/api/url.java @@ -92,7 +92,7 @@ public class url extends Thread { return new JSONObject(hq).getJSONArray("songs").getJSONObject(0) .getJSONObject("al").getString("picUrl"); } catch (Exception e) { - yc.start(main.context, e); + yc.start(e); } return null; } diff --git a/app/src/main/java/com/muqingbfq/bfq.java b/app/src/main/java/com/muqingbfq/bfq.java index 5358851..7fd4a50 100644 --- a/app/src/main/java/com/muqingbfq/bfq.java +++ b/app/src/main/java/com/muqingbfq/bfq.java @@ -71,6 +71,7 @@ public class bfq extends AppCompatActivity { } inflate = inflater.inflate(R.layout.fragment_bfq, container, false); lrcView = inflate.findViewById(R.id.gc); + lrcView.setVisibility(View.GONE); Toolbar toolbar = inflate.findViewById(R.id.toolbar); name = inflate.findViewById(R.id.name); zz = inflate.findViewById(R.id.zz); @@ -119,10 +120,6 @@ public class bfq extends AppCompatActivity { lrcView.setVisibility(View.GONE); kp.setVisibility(View.VISIBLE); }); - inflate.findViewById(R.id.layout).setOnClickListener(view1 -> { - lrcView.setVisibility(View.GONE); - kp.setVisibility(View.VISIBLE); - }); inflate.findViewById(R.id.bfq_list_mp3). setOnClickListener(view1 -> com.muqingbfq.fragment.bflb_db.start(context)); diff --git a/app/src/main/java/com/muqingbfq/bfqkz.java b/app/src/main/java/com/muqingbfq/bfqkz.java index aad4750..f78ce75 100644 --- a/app/src/main/java/com/muqingbfq/bfqkz.java +++ b/app/src/main/java/com/muqingbfq/bfqkz.java @@ -4,8 +4,8 @@ import android.annotation.SuppressLint; import android.os.Bundle; import android.support.v4.media.MediaBrowserCompat; import android.support.v4.media.MediaMetadataCompat; -import android.support.v4.media.session.MediaControllerCompat; import android.support.v4.media.session.MediaSessionCompat; +import android.support.v4.media.session.PlaybackStateCompat; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -29,6 +29,7 @@ public class bfqkz extends MediaBrowserServiceCompat { public static boolean like_bool; @SuppressLint("StaticFieldLeak") public static com.muqingbfq.mq.NotificationManagerCompat notify; + public static int getmti(int s) { int i = bfqkz.list.indexOf(xm); if (s == 1) { @@ -57,54 +58,55 @@ public class bfqkz extends MediaBrowserServiceCompat { gj.sc("bfqkz mp3(String id) :" + e); } } + public static MediaSessionCompat mSession; + public static MediaMetadataCompat build; + public static PlaybackStateCompat playback; + @Override public void onCreate() { super.onCreate(); - mSession = new MediaSessionCompat(this,"MusicService"); + mSession = new MediaSessionCompat(this, "MusicService"); + playback=new PlaybackStateCompat.Builder() + .setState(PlaybackStateCompat.STATE_NONE,0,1.0f) + .build(); mSession.setCallback(new MediaSessionCompat.Callback() { @Override public void onPlay() { mt.start(); - // 处理播放音乐逻辑 } @Override public void onPause() { // 处理暂停音乐逻辑 mt.pause(); + if(playback.getState() == PlaybackStateCompat.STATE_PLAYING){ + playback = new PlaybackStateCompat.Builder() + .setState(PlaybackStateCompat.STATE_PAUSED,0,1.0f) + .build(); + mSession.setPlaybackState(playback); + } } @Override public void onSkipToNext() { // 处理切换到下一首音乐逻辑 } + @Override public void onSkipToPrevious() { // 处理切换到上一首音乐逻辑 } });//设置回调 -/* Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_LAUNCHER); - intent.setComponent(new ComponentName(this, start.class));//用ComponentName得到class对象 - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK - | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);// 关键的一步,设置启动模式,两种情况 - MediaButtonReceiver.handleIntent(mSession,intent);*/ - - MediaMetadataCompat build = new MediaMetadataCompat.Builder() - .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, "歌手名称") - .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, "专辑名称") - .putString(MediaMetadataCompat.METADATA_KEY_TITLE, "歌曲名称") + build = new MediaMetadataCompat.Builder() .build(); mSession.setMetadata(build); + mSession.setPlaybackState(playback); + mSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS); mSession.setActive(true); setSessionToken(mSession.getSessionToken()); notify = new com.muqingbfq.mq.NotificationManagerCompat(this); -/* ; -// 激活MediaSessionCompat - */ - // 初始化通知栏 } @Nullable diff --git a/app/src/main/java/com/muqingbfq/fragment/bflb_db.java b/app/src/main/java/com/muqingbfq/fragment/bflb_db.java index 1ccb6e7..fd675e6 100644 --- a/app/src/main/java/com/muqingbfq/fragment/bflb_db.java +++ b/app/src/main/java/com/muqingbfq/fragment/bflb_db.java @@ -26,15 +26,6 @@ public class bflb_db extends BottomSheetDialog { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_bflb_db); - // 获取对话框窗口 -/* Window window = getWindow(); - if (window != null) { - // 设置高度为默认值(例如:500dp) - WindowManager.LayoutParams params = window.getAttributes(); - params.height = - window.setAttributes(params); - }*/ - // 设置默认弹出高度和最大上拉高度为 400dp int height = main.g - main.g / 2 / 2; getBehavior().setPeekHeight(height); getBehavior().setMaxHeight(height); diff --git a/app/src/main/java/com/muqingbfq/fragment/bfq_db.java b/app/src/main/java/com/muqingbfq/fragment/bfq_db.java index 58e051b..794baa4 100644 --- a/app/src/main/java/com/muqingbfq/fragment/bfq_db.java +++ b/app/src/main/java/com/muqingbfq/fragment/bfq_db.java @@ -1,5 +1,6 @@ package com.muqingbfq.fragment; +import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; @@ -24,9 +25,11 @@ import java.lang.reflect.Type; import java.util.List; public class bfq_db extends Fragment { - public View view; - public TextView name, zz; - public ImageView txa; + @SuppressLint("StaticFieldLeak") + public static View view; + public static TextView name, zz; + public static ImageView txa; + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, diff --git a/app/src/main/java/com/muqingbfq/fragment/sz.java b/app/src/main/java/com/muqingbfq/fragment/sz.java index 0f73eb2..2006a0c 100644 --- a/app/src/main/java/com/muqingbfq/fragment/sz.java +++ b/app/src/main/java/com/muqingbfq/fragment/sz.java @@ -11,9 +11,11 @@ import android.widget.Toast; import com.muqingbfq.R; import com.muqingbfq.activity_about_software; +import com.muqingbfq.home; import com.muqingbfq.login.user_logs; import com.muqingbfq.login.user_message; import com.muqingbfq.mq.gj; +import com.muqingbfq.mq.wl; public class sz { @@ -69,6 +71,9 @@ public class sz { } else if (id == R.id.f) { context.startActivity(new Intent(context, activity_about_software.class)); // 关于软件 + } else if (id == R.id.g) { + new com.muqingbfq.login.visitor(); + home.appCompatActivity.finish(); } } } \ No newline at end of file diff --git a/app/src/main/java/com/muqingbfq/home.java b/app/src/main/java/com/muqingbfq/home.java index d255f14..8a07ee5 100644 --- a/app/src/main/java/com/muqingbfq/home.java +++ b/app/src/main/java/com/muqingbfq/home.java @@ -5,7 +5,6 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.media.AudioManager; import android.os.Bundle; import android.os.RemoteException; import android.support.v4.media.MediaBrowserCompat; @@ -28,10 +27,8 @@ import com.muqingbfq.fragment.bfq_db; import com.muqingbfq.mq.gj; public class home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { - @SuppressLint("StaticFieldLeak") - public static Toolbar toolbar; + public Toolbar toolbar; public static AppCompatActivity appCompatActivity; - @SuppressLint("CommitTransaction") @Override protected void onCreate(Bundle savedInstanceState) { @@ -57,21 +54,10 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati item.setTitle(spannableString); } new com.muqingbfq.fragment.sz(this, chb.getHeaderView(0)); - - db = new bfq_db(); getSupportFragmentManager().beginTransaction() - .add(R.id.bfq_db, db).commit(); + .add(R.id.bfq_db, new bfq_db()).commit(); mediaBrowser = new MediaBrowserCompat(this, - new ComponentName(this, bfqkz.class), connectionCallbacks, null); - mediaBrowser.connect(); - } catch (Exception e) { - gj.sc(e); - } - } - - private MediaBrowserCompat mediaBrowser; - private final MediaBrowserCompat.ConnectionCallback connectionCallbacks = - new MediaBrowserCompat.ConnectionCallback() { + new ComponentName(this, bfqkz.class), new MediaBrowserCompat.ConnectionCallback() { @Override public void onConnected() { // 连接成功后执行的操作 @@ -97,10 +83,14 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati // 连接失败时执行的操作 // gj.ts(home.this,"shibai"); } - }; + }, null); + mediaBrowser.connect(); + } catch (Exception e) { + gj.sc(e); + } + } - @SuppressLint("StaticFieldLeak") - public static bfq_db db; + MediaBrowserCompat mediaBrowser; @Override protected void onPause() { @@ -117,24 +107,8 @@ public class home extends AppCompatActivity implements NavigationView.OnNavigati @Override protected void onDestroy() { super.onDestroy(); - mediaBrowser.disconnect(); +// mediaBrowser.disconnect(); } - @Override - public void onResume() { - super.onResume(); - setVolumeControlStream(AudioManager.STREAM_MUSIC); - } - - @Override - public void onStop() { - super.onStop(); - // (see "stay in sync with the MediaSession") - if (MediaControllerCompat.getMediaController(home.this) != null) { -// MediaControllerCompat.getMediaController(home.this).unregisterCallback(controllerCallback); - } - mediaBrowser.disconnect(); - } - private long time; @Override diff --git a/app/src/main/java/com/muqingbfq/main.java b/app/src/main/java/com/muqingbfq/main.java index 3ab7311..27fdf48 100644 --- a/app/src/main/java/com/muqingbfq/main.java +++ b/app/src/main/java/com/muqingbfq/main.java @@ -7,13 +7,10 @@ import android.content.SharedPreferences; import android.os.Handler; import android.os.Looper; -import com.muqingbfq.mq.MyExceptionHandler; import com.muqingbfq.mq.wj; import com.muqingbfq.mq.wl; public class main extends Application { - @SuppressLint("StaticFieldLeak") - public static Context context; public static Handler handler = new Handler(Looper.getMainLooper()); public static String api = "http://139.196.224.229:3000"; public static String http = "http://139.196.224.229/muqing"; @@ -27,7 +24,6 @@ public class main extends Application { @Override public void onCreate() { super.onCreate(); - context = this; new wj(this); sp = getSharedPreferences("Set_up", MODE_PRIVATE); edit = sp.edit(); @@ -61,6 +57,5 @@ public class main extends Application { edit.commit(); } // 创建全局异常处理器实例 设置全局异常处理器 - Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this)); } } diff --git a/app/src/main/java/com/muqingbfq/mq/MyExceptionHandler.java b/app/src/main/java/com/muqingbfq/mq/MyExceptionHandler.java deleted file mode 100644 index 600fae7..0000000 --- a/app/src/main/java/com/muqingbfq/mq/MyExceptionHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.muqingbfq.mq; - -import android.content.Context; -import android.util.Log; - -import androidx.annotation.NonNull; - -import com.muqingbfq.yc; - -public class MyExceptionHandler implements Thread.UncaughtExceptionHandler { - public static Throwable throwable; - private Context mContext; - public MyExceptionHandler(Context context) { - mContext = context; - } - @Override - public void uncaughtException(@NonNull Thread thread, @NonNull Throwable throwable) { - // 将异常信息打印到日志中 - MyExceptionHandler.throwable = throwable; - String TAG = "MyExceptionHandler"; - Log.e(TAG, "UncaughtException: ", throwable); - // 在这里执行生成错误报告的逻辑,例如将错误信息保存到文件或发送给服务器 - // 可以使用第三方库,如ACRA、Bugsnag等,或者自行实现错误报告的处理逻辑 - // 生成错误报告的逻辑 - // 发送 Intent 重启应用 - yc.start(mContext, throwable); - // 这里可以进行一些其他的操作,例如记录错误日志、弹出错误提示框等 - // 终止程序 -// android.os.Process.killProcess(android.os.Process.myPid()); -// System.exit(0); - } -} diff --git a/app/src/main/java/com/muqingbfq/mq/NotificationManagerCompat.java b/app/src/main/java/com/muqingbfq/mq/NotificationManagerCompat.java index 21580b4..89fbd19 100644 --- a/app/src/main/java/com/muqingbfq/mq/NotificationManagerCompat.java +++ b/app/src/main/java/com/muqingbfq/mq/NotificationManagerCompat.java @@ -15,6 +15,7 @@ import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Build; +import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.PlaybackStateCompat; import androidx.core.app.ActivityCompat; @@ -24,7 +25,11 @@ import androidx.media.session.MediaButtonReceiver; import com.muqingbfq.MyButtonClickReceiver; import com.muqingbfq.R; import com.muqingbfq.bfq; +import com.muqingbfq.bfq_an; import com.muqingbfq.bfqkz; +import com.muqingbfq.fragment.bfq_db; +import com.muqingbfq.fragment.mp3; +import com.muqingbfq.home; import com.muqingbfq.start; import com.muqingbfq.yc; @@ -49,25 +54,21 @@ public class NotificationManagerCompat { } } // 适配12.0及以上 - int flag; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { - flag = PendingIntent.FLAG_IMMUTABLE; - } else { - flag = PendingIntent.FLAG_UPDATE_CURRENT; - } + // 设置启动的程序,如果存在则找出,否则新的启动 Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(new ComponentName(context, start.class));//用ComponentName得到class对象 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);// 关键的一步,设置启动模式,两种情况 - - PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, flag); - pendingIntent_kg = pendingIntent(context, new Intent(context, MyButtonClickReceiver.class). + PendingIntent pendingIntent = getActivity(context, intent); +// PendingIntent.getActivity(context, 0, intent, flag); + Intent my = new Intent(context, MyButtonClickReceiver.class); + pendingIntent_kg = getBroadcast(context, my. setAction("kg")); - pendingIntent_syq = pendingIntent(context, new Intent(context, MyButtonClickReceiver.class). + pendingIntent_syq = getBroadcast(context, my. setAction("syq")); - pendingIntent_xyq = pendingIntent(context, new Intent(context, MyButtonClickReceiver.class). + pendingIntent_xyq = getBroadcast(context, my. setAction("xyq")); // 取消操作的PendingIntent // 取消操作的PendingIntent @@ -79,7 +80,7 @@ public class NotificationManagerCompat { .setMediaSession(bfqkz.mSession.getSessionToken()) .setShowCancelButton(true) .setCancelButtonIntent(cancelIntent); -// + notificationBuilder = getNotificationBuilder(context) .setSmallIcon(R.drawable.icon) .setContentTitle(name).setContentText(zz) @@ -124,7 +125,7 @@ public class NotificationManagerCompat { notificationManager.notify(1, notificationBuilder.build()); } - @SuppressLint({"MissingPermission", "RestrictedApi"}) + @SuppressLint({"MissingPermission", "RestrictedApi", "NotifyDataSetChanged"}) public void setBitmap(Bitmap bitmap) { bfq.bitmap = bitmap; if (bitmap == null) { @@ -140,6 +141,7 @@ public class NotificationManagerCompat { if (bfq.tx != null) { bfq.tx.setImageBitmap(bitmap); } + } private NotificationCompat.Builder getNotificationBuilder(Context context) { @@ -153,12 +155,29 @@ public class NotificationManagerCompat { } @SuppressLint("UnspecifiedImmutableFlag") - private PendingIntent pendingIntent(Context context, Intent intent) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { + private PendingIntent getBroadcast(Context context, Intent intent) { + int flag; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + flag = PendingIntent.FLAG_IMMUTABLE; + } else { + flag = PendingIntent.FLAG_UPDATE_CURRENT; + } + return PendingIntent.getBroadcast(context, 0, intent, flag); +/* if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); } else { return PendingIntent.getBroadcast(context, 0, intent, 0); + }*/ + } + @SuppressLint("UnspecifiedImmutableFlag") + private PendingIntent getActivity(Context context, Intent intent) { + int flag; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + flag = PendingIntent.FLAG_IMMUTABLE; + } else { + flag = PendingIntent.FLAG_UPDATE_CURRENT; } + return PendingIntent.getActivity(context, 0, intent, flag); } } diff --git a/app/src/main/java/com/muqingbfq/mq/gj.java b/app/src/main/java/com/muqingbfq/mq/gj.java index 851a4d9..7535615 100644 --- a/app/src/main/java/com/muqingbfq/mq/gj.java +++ b/app/src/main/java/com/muqingbfq/mq/gj.java @@ -66,7 +66,7 @@ public class gj { } } } catch (SocketException e) { - yc.start(main.context, e); + yc.start(e); } return false; // 默认为流量网络 } diff --git a/app/src/main/java/com/muqingbfq/start.java b/app/src/main/java/com/muqingbfq/start.java index 3c1e280..a5aa18b 100644 --- a/app/src/main/java/com/muqingbfq/start.java +++ b/app/src/main/java/com/muqingbfq/start.java @@ -148,25 +148,24 @@ public class start extends AppCompatActivity { startApp(); } - private void startApp() { - - SharedPreferences theme = getSharedPreferences("theme", MODE_PRIVATE); - @SuppressLint("CommitPrefEdits") SharedPreferences.Editor edit = theme.edit(); - int i = theme.getInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); - if (i == -1) { - edit.putInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); - } - AppCompatDelegate.setDefaultNightMode(i); - - wl.Cookie = main.sp.getString(main.Cookie, ""); - if (wl.Cookie.equals("")) { - new visitor(this, home); - } else { - if (wj.filesdri == null) { - new wj(this); + private void startApp() { + SharedPreferences theme = getSharedPreferences("theme", MODE_PRIVATE); + @SuppressLint("CommitPrefEdits") SharedPreferences.Editor edit = theme.edit(); + int i = theme.getInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + if (i == -1) { + edit.putInt("theme", AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); + } + AppCompatDelegate.setDefaultNightMode(i); + + wl.Cookie = main.sp.getString(main.Cookie, ""); + if (wl.Cookie.equals("")) { + new visitor(this, home); + } else { + if (wj.filesdri == null) { + new wj(this); + } + startActivity(home); + finish(); } - startActivity(home); - finish(); } - } } \ No newline at end of file diff --git a/app/src/main/java/com/muqingbfq/yc.java b/app/src/main/java/com/muqingbfq/yc.java index 8038a75..29ff654 100644 --- a/app/src/main/java/com/muqingbfq/yc.java +++ b/app/src/main/java/com/muqingbfq/yc.java @@ -24,7 +24,7 @@ public class yc extends AppCompatActivity { } public static void start(Object e) { - start(main.context, e); + start(home.appCompatActivity, e); } public static void start(Context context, Object e) { diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 81daddf..077afe8 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -19,11 +19,10 @@ + android:layout_height="wrap_content"> - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_user_logs.xml b/app/src/main/res/layout/activity_user_logs.xml index d2132db..acc6ae3 100644 --- a/app/src/main/res/layout/activity_user_logs.xml +++ b/app/src/main/res/layout/activity_user_logs.xml @@ -22,8 +22,8 @@ diff --git a/app/src/main/res/layout/fragment_bfq.xml b/app/src/main/res/layout/fragment_bfq.xml index 4bcc7a8..ea5f7c2 100644 --- a/app/src/main/res/layout/fragment_bfq.xml +++ b/app/src/main/res/layout/fragment_bfq.xml @@ -33,27 +33,17 @@ android:text="@string/zz" /> - - + android:layout_weight="1" + android:orientation="horizontal"> + android:gravity="center" + android:layout_weight="1"> - + +