From 7ba07db63d84b696b5f4e201ba344da90028c3d1 Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Wed, 11 Nov 2026 20:13:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor(feature):=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=B7=B2=E5=BA=9F=E5=BC=83=E7=9A=84=20feature/main=20=E4=B8=8E?= =?UTF-8?q?=20feature/splash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MainActivity/MainViewModel/RestartFragment 与 SplashActivity 均未在清单中启用,HomeActivity 才是唯一启动页,整条链路为死代码;同步删除仅被其引用的布局与清单注释块。 验证::app:assembleOfficialZhanRuiRelease 编译通过。 --- app/src/main/AndroidManifest.xml | 13 - .../fuying/sn/feature/main/MainActivity.java | 479 ------------------ .../fuying/sn/feature/main/MainViewModel.java | 111 ---- .../sn/feature/main/RestartFragment.java | 125 ----- .../sn/feature/splash/SplashActivity.java | 42 -- .../main/res/layout-land/activity_main.xml | 330 ------------ .../main/res/layout-port/activity_main.xml | 330 ------------ .../res/layout/fragment_dialog_restart.xml | 101 ---- 8 files changed, 1531 deletions(-) delete mode 100644 app/src/main/java/com/fuying/sn/feature/main/MainActivity.java delete mode 100644 app/src/main/java/com/fuying/sn/feature/main/MainViewModel.java delete mode 100644 app/src/main/java/com/fuying/sn/feature/main/RestartFragment.java delete mode 100644 app/src/main/java/com/fuying/sn/feature/splash/SplashActivity.java delete mode 100644 app/src/main/res/layout-land/activity_main.xml delete mode 100644 app/src/main/res/layout-port/activity_main.xml delete mode 100644 app/src/main/res/layout/fragment_dialog_restart.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b4ef56a..6cb9b04 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -99,16 +99,6 @@ android:theme="@style/ImmerseTheme" android:usesCleartextTraffic="true" tools:replace="android:allowBackup"> - - - - - - - - - - @@ -119,9 +109,6 @@ - - - implements NetworkUtils.OnNetworkStatusChangedListener { - private final DeviceRepository mRepository = DeviceRepository.getInstance(); - private final CompositeDisposable mDisposables = new CompositeDisposable(); - private static final String TAG = "MainActivity"; - - @Override - public boolean setNightMode() { - return true; - } - - @Override - public void onDisconnected() { - Log.e(TAG, "onDisconnected: "); - } - - @Override - public void onConnected(NetworkUtils.NetworkType networkType) { - Log.e(TAG, "onConnected: "); - mViewModel.getSnInfo(); - } - - @Override - public int getLayoutId() { - return R.layout.activity_main; - } - - @Override - protected Class getViewModelClass() { - return MainViewModel.class; - } - - @Override - protected void initDataBinding() { - mViewDataBinding.setClick(new BtnClick()); - } - - @SuppressLint("SetTextI18n") - @Override - public void initView() { - HardwareInfoUtils.getAndroiodScreenProperty(this); - -// Settings.Global.putInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1); -// Settings.Global.putInt(getContentResolver(), Settings.Global.ADB_ENABLED, 1); - - NetworkUtils.registerNetworkStatusChangedListener(this); - - try { - PackageManager pm = getPackageManager(); - pm.setApplicationEnabledSetting("com.uiui.os", PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0); - } catch (Exception e) { - Log.e(TAG, "initView: " + e.getMessage()); - } - - mViewDataBinding.tvBuildVersion.setText(JgyUtils.getCustomVersion()); - if (JgyUtils.getInstance().checkAppPlatform() == JgyUtils.G13Platform - || JgyUtils.getInstance().checkAppPlatform() == JgyUtils.iPlay50SEPlatform - ) { - mViewDataBinding.tvImei.setText("SN:" + DeviceIdUtils.getSerial()); - } else { - mViewDataBinding.tvImei.setText("IMEI:" + DeviceIdUtils.getIMEI(MainActivity.this)); - } - - mViewDataBinding.tvAppVersion.setText(BuildConfig.VERSION_NAME); - - task = new TimeTask(); - task.execute("ntp.aliyun.com"); - - //更新设备信息之后停止停止这两个应用以免获取不到信息 - int versionCode = (int) SPUtils.get(this, "versionCode", 0); - if (versionCode < BuildConfig.VERSION_CODE) { - SPUtils.put(this, "versionCode", BuildConfig.VERSION_CODE); - } - JgyUtils.getInstance().wakeUpAppstore(); - JgyUtils.getInstance().wakeUpUpdateTools(); - - HardwareInfoUtils.getBattery(this); - HardwareInfoUtils.getBatterymAh(this); - } - - - private boolean mCheckUpdate = false; - - private void checkUpdate() { - Disposable disposable = mRepository.getUpdateObservable(BuildConfig.APPLICATION_ID) - .subscribeWith(new DisposableObserver>() { - @Override - public void onNext(@NonNull BaseResponse appInfoBaseResponse) { - Log.e("checkUpdate", "onSubscribe: " + appInfoBaseResponse); - if (appInfoBaseResponse.code == 200) { - AppInfo appInfo = appInfoBaseResponse.data; - if (appInfo.getApp_version_code() > BuildConfig.VERSION_CODE) { - ToastUtil.show("正在下载更新"); - } else { - ToastUtil.show("已是最新版本"); - } - } else { - ToastUtil.show("没有找到更新"); - } - } - - @Override - public void onError(@NonNull Throwable e) { - Log.e("checkUpdate", "onError: " + e.getMessage()); - ToastUtil.show("请稍后重试"); - onComplete(); - } - - @Override - public void onComplete() { - Log.e("checkUpdate", "onComplete: "); - mCheckUpdate = true; - } - }); - mDisposables.add(disposable); - } - - private TimeTask task; - - private static class TimeTask extends AsyncTask { - @Override - protected Long doInBackground(String... strings) { - return TimeUtils.getTimeFromNtpServer(strings[0]); - } - - @Override - protected void onPostExecute(Long aLong) { - super.onPostExecute(aLong); - SystemClock.setCurrentTimeMillis(aLong); - Log.e(TAG, "getTimeFromNtpServer: " + aLong); - } - } - - @Override - protected void observeViewModel() { - mViewModel.mSnInfoData.observe(this, new androidx.lifecycle.Observer>() { - @Override - public void onChanged(BaseResponse snInfoBaseResponse) { - if (snInfoBaseResponse != null) { - //设备已经绑定 - if (snInfoBaseResponse.code == 200) { - SnInfo snInfo = snInfoBaseResponse.data; - AppUpdateCoordinator.getInstance().checkDeviceType(snInfo.getType_id()); - mViewDataBinding.tvBindStatu.setText("设备已绑定"); - } - //设备没有绑定 - else if (snInfoBaseResponse.code == 300) { - ControlManager.getInstance().setDisableSetting(); - mViewDataBinding.tvBindStatu.setText("设备未绑定"); - } - //没有授权的设备 - else if (snInfoBaseResponse.code == 400) { - ToastUtil.show(getString(R.string.device_unauthorized)); - Log.e(TAG, "setSnInfo: " + getString(R.string.device_unauthorized)); - ControlManager.getInstance().setDisableSetting(); - mViewDataBinding.tvBindStatu.setText("设备未绑定"); - } - } - mViewModel.getAllApp(); - mViewModel.checkUpdate(); - mViewModel.checkFXYUpdate(); - mViewModel.getOverallApp(); - } - }); - - mViewModel.mQRCodeData.observe(this, new androidx.lifecycle.Observer() { - @Override - public void onChanged(Bitmap bitmap) { -// mViewDataBinding.qrCode.setImageBitmap(bitmap); - } - }); - mViewModel.getQRCode(); - - if (DeviceManager.isDebugMode()) { - Log.e(TAG, "getAllSPUtils: " + GsonUtils.toJSONString(SPUtils.getAll(this))); - Log.e(TAG, "getWeekDay: " + TimeUtils.inWeekDay()); - Log.e(TAG, "getWeekDay: " + TimeUtils.inWeekDay(1627702095000L)); - Log.e(TAG, "getWeekDayString: " + new TimeUtils().getWeekDayString()); - Log.e(TAG, "getWeekDayString: " + new TimeUtils().getWeekDayString(1627702095000L)); - Log.e(TAG, "initData: sn = " + DeviceIdUtils.getSerial()); - } - if (DeviceManager.isDebugMode()) { - Settings.System.putInt(getContentResolver(), CommonConfig.AOLE_ACTION_DEVELOPER_OPTIONS, 0); - } - startService(); - registerReceiver(); - Intent intent = new Intent(MainActivity.this, MainService.class); - bindService(intent, mMainServiceConnection, BIND_AUTO_CREATE); - startService(intent); - } - - MainService.MainBinder mMainBinder; - - private MainServiceConnection mMainServiceConnection = new MainServiceConnection(); - - private class MainServiceConnection implements ServiceConnection { - @Override - public void onServiceConnected(ComponentName componentName, IBinder iBinder) { - Log.e(TAG, "onServiceConnected: "); - mMainBinder = (MainService.MainBinder) iBinder; -// mMainBinder.getService().getLocked(); - } - - @Override - public void onServiceDisconnected(ComponentName componentName) { - Log.e(TAG, "onServiceDisconnected: "); - - } - } - - @Override - protected void onResume() { - super.onResume(); - Log.e(TAG, "onResume: "); - mViewModel.getSnInfo(); - } - - @Override - protected void onPause() { - super.onPause(); - } - - @Override - protected void onDestroy() { - ReceiverCompat.unregisterReceiver(this, mRefreshReceiver); - mDisposables.dispose(); - super.onDestroy(); - task.cancel(true); - task = null; - NetworkUtils.unregisterNetworkStatusChangedListener(this); - startService(); - } - - @Override - protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - Log.e(TAG, "onNewIntent: "); - if (REFRESHACTION.equals(intent.getAction())) { - mViewModel.getSnInfo(); - } - } - - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == KeyEvent.ACTION_DOWN) { - lazyExit(); - return true; - } - return super.onKeyDown(keyCode, event); - } - - private boolean isDebugMode() { - if (DeviceManager.isDebugMode()) { - return true; - } else { - return (boolean) SPUtils.get(this, CommonConfig.userDebugMode, false); - } - } - - final static int DEBUGCOUNTS = 8;//点击次数 - final static long DEBUGDURATION = 4 * 1000;//规定有效时间 - long[] mDEBUGHits = new long[DEBUGCOUNTS]; - - private void enterUserDebug() { - //每次点击时,数组向前移动一位 - System.arraycopy(mDEBUGHits, 1, mDEBUGHits, 0, mDEBUGHits.length - 1); - //为数组最后一位赋值 - mDEBUGHits[mDEBUGHits.length - 1] = SystemClock.uptimeMillis(); - if (mDEBUGHits[0] >= SystemClock.uptimeMillis() - DEBUGDURATION) { - mDEBUGHits = new long[DEBUGCOUNTS]; //重新初始化数组 - if ((boolean) SPUtils.get(MainActivity.this, CommonConfig.EnableDebug, false)) { - ToastUtil.show("已经是Debug模式"); - } else { - showDebugDialog(); - } - } - } - - private void showDebugDialog() { - UserDebugDialog dialog = new UserDebugDialog(this); - dialog.setOnClickBottomListener(new UserDebugDialog.OnClickBottomListener() { - @Override - public void onPositiveClick() { - if (DebugPasswordVerifier.verify(dialog.getEdittext())) { - SPUtils.put(MainActivity.this, CommonConfig.EnableDebug, true); - ToastUtil.show("进入用户Debug模式"); - } else { - ToastUtil.show("密码错误"); - } - dialog.dismiss(); - } - - @Override - public void onNegtiveClick() { - dialog.dismiss(); - } - }); - dialog.show(); - dialog.getWindow().setGravity(Gravity.CENTER); - dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); - dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); - } - - private void initTabLayout() { - List fragmentList = new ArrayList<>(); - FragmentManager fragmentManager = getSupportFragmentManager(); - fragmentList.add(new AppletQRCodeFragment()); - fragmentList.add(new QRCodeFragment()); - BaseFragmentPagerAdapter adapter = new BaseFragmentPagerAdapter(fragmentManager, fragmentList); - } - - private long mPreClickTime; - - private void lazyExit() { - if (System.currentTimeMillis() - mPreClickTime > 3000) { - ToastUtil.show("再按一次,退出"); - mPreClickTime = System.currentTimeMillis(); - } else { - finish(); - } - } - - private final int COUNTS = 4; // 点击次数 - private final long DURATION = 2 * 1000; // 规定有效时间 - private long[] mHits = new long[COUNTS]; - - private void continuousClick(int count, long time) { - //每次点击时,数组向前移动一位 - System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1); - //为数组最后一位赋值 - mHits[mHits.length - 1] = SystemClock.uptimeMillis(); - if (mHits[0] >= SystemClock.uptimeMillis() - DURATION) { - mHits = new long[COUNTS]; //重新初始化数组 - ToastUtil.show("正在检查更新"); - } - } - - private void startService() { - startService(new Intent(this, MainService.class)); - startService(new Intent(this, SocketService.class)); - startService(new Intent(this, DownloadService.class)); - startService(new Intent(this, ManagerService.class)); - } - - private void registerReceiver() { - registerRefreshReceiver(); - } - - public static final String REFRESHACTION = BuildConfig.APPLICATION_ID + ".REFRESH"; - - private RefreshReceiver mRefreshReceiver = new RefreshReceiver(); - - private void registerRefreshReceiver() { - IntentFilter filter = new IntentFilter(); - filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); - filter.addAction(REFRESHACTION); - ReceiverCompat.registerReceiver(this, mRefreshReceiver, filter, ReceiverCompat.RECEIVER_NOT_EXPORTED); - } - - class RefreshReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - Log.e("RefreshReceiver", "onReceive: "); - if (REFRESHACTION.equals(intent.getAction())) { - mViewModel.getSnInfo(); - } - } - } - - public class BtnClick { - - public void exit(View view) { - lazyExit(); - } - - public void debug(View view) { - if (isDebugMode()) { - enterUserDebug(); - } - } - - public void checkAppUpdate(View view) { - mViewModel.getAllApp(); - if (mCheckUpdate) { - ToastUtil.show("您已检查过更新,请稍后再试"); - } else { - ToastUtil.show("正在检查更新"); - checkUpdate(); - } - } - - public void openOta(View view) { - Intent intent = new Intent(Intent.ACTION_MAIN); - ComponentName componentName = new ComponentName("com.adups.fota", "com.adups.fota.GoogleOtaClient"); - intent.setComponent(componentName); - intent.addCategory(Intent.CATEGORY_LAUNCHER); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - try { - startActivity(intent); - } catch (Exception e) { - Log.e(TAG, "openComponentNameApp: " + e.getMessage()); - ToastUtil.show("打开失败"); - } - } - - public void restart(View view) { -// AppProcessUtils.triggerRebirth(MainActivity.this); - new RestartFragment().show(getSupportFragmentManager(), "RestartFragment"); - } - - } - -} diff --git a/app/src/main/java/com/fuying/sn/feature/main/MainViewModel.java b/app/src/main/java/com/fuying/sn/feature/main/MainViewModel.java deleted file mode 100644 index 0a99898..0000000 --- a/app/src/main/java/com/fuying/sn/feature/main/MainViewModel.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.fuying.sn.feature.main; - -import android.app.Application; -import android.graphics.Bitmap; -import android.util.Log; - -import androidx.annotation.NonNull; -import androidx.lifecycle.MutableLiveData; - -import com.fuying.sn.core.base.mvvm.BaseAndroidViewModel; -import com.fuying.sn.core.common.image.BitmapUtils; -import com.fuying.sn.core.common.crypto.CXAESUtil; -import com.fuying.sn.core.common.device.DeviceIdUtils; -import com.fuying.sn.core.data.dto.BaseResponse; -import com.fuying.sn.core.data.dto.SnInfo; -import com.fuying.sn.core.data.remote.RequestCompletion; -import com.fuying.sn.core.data.repository.DeviceRepository; -import com.fuying.sn.runtime.sync.AppInventorySync; -import com.fuying.sn.runtime.sync.AppUpdateCoordinator; -import com.fuying.sn.runtime.sync.DeviceProfileSync; -import com.fuying.sn.runtime.sync.RequestCallbacks; - -import io.reactivex.rxjava3.disposables.Disposable; - -@Deprecated -public class MainViewModel extends BaseAndroidViewModel { - private final DeviceRepository mRepository = DeviceRepository.getInstance(); - - public MainViewModel(@NonNull Application application) { - super(application); - } - - public MutableLiveData> mSnInfoData = new MutableLiveData<>(); - - public void getSnInfo() { - Disposable disposable = DeviceProfileSync.getInstance() - .getSnInfoRequest(new DeviceProfileSync.ObserverCallback() { - @Override - public void onNext(BaseResponse response) { - Log.e("getSnInfo", "onNext: " + response); - mSnInfoData.setValue(response); - } - - @Override - public void onError(Throwable e) { - Log.e("getSnInfo", "onError: " + e.getMessage()); - Disposable disposable = mRepository.getCachedSnInfo() - .subscribe(mSnInfoData::setValue, - error -> Log.e("MainViewModel", "getCachedSnInfo: ", error), - () -> mSnInfoData.setValue(null)); - mDisposables.add(disposable); - } - - @Override - public void onComplete() { - Log.e("getSnInfo", "onComplete: "); - } - }) - .subscribeWith(new RequestCompletion(mDisposables, "getSnInfo")); - mDisposables.add(disposable); - } - - public MutableLiveData mQRCodeData = new MutableLiveData<>(); - - public void getQRCode() { - String encryptString = CXAESUtil.encrypt(DeviceIdUtils.getIMEI(getAppContext())); - Log.e("getQRCode", "setImageAndText: " + encryptString); - Bitmap bitmap = BitmapUtils.createQRImage(encryptString, 400, 400); - mQRCodeData.setValue(bitmap); - } - - public void getAllApp() { - Disposable disposable = AppInventorySync.getInstance().getAppWhiteListRequest(new AppInventorySync.WhiteListCallback() { - @Override - public void onComplet() { - } - }) - .subscribeWith(new RequestCompletion(mDisposables, "getAppWhiteList")); - mDisposables.add(disposable); - } - - public void checkUpdate() { - Disposable disposable = AppUpdateCoordinator.getInstance().checkAllAppUpdateRequest(new RequestCallbacks.CompleteCallback() { - @Override - public void onComplete() { - } - }) - .subscribeWith(new RequestCompletion(mDisposables, "checkAllAppUpdate")); - mDisposables.add(disposable); - } - - public void checkFXYUpdate() { -// AppUpdateCoordinator.getInstance().checkFXYAppUpdate(new RequestCallbacks.CompleteCallback() { -// @Override -// public void onComplete() { -// mView.checkFXYUpdateFinish(); -// } -// }); - } - - public void getOverallApp() { - Disposable disposable = AppUpdateCoordinator.getInstance().getOverallAppRequest(new RequestCallbacks.CompleteCallback() { - @Override - public void onComplete() { - - } - }) - .subscribeWith(new RequestCompletion(mDisposables, "getOverallApp")); - mDisposables.add(disposable); - } -} diff --git a/app/src/main/java/com/fuying/sn/feature/main/RestartFragment.java b/app/src/main/java/com/fuying/sn/feature/main/RestartFragment.java deleted file mode 100644 index 5e3d0d2..0000000 --- a/app/src/main/java/com/fuying/sn/feature/main/RestartFragment.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.fuying.sn.feature.main; - -import android.app.Dialog; -import android.content.Context; -import android.content.DialogInterface; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import android.util.Log; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowManager; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.databinding.DataBindingUtil; -import androidx.fragment.app.DialogFragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentTransaction; - -import com.fuying.sn.R; -import com.fuying.sn.core.base.BaseDialogFragment; -import com.fuying.sn.databinding.FragmentDialogRestartBinding; -import com.fuying.sn.platform.app.AppProcessUtils; - -public class RestartFragment extends BaseDialogFragment { - private static final String TAG = "RestartFragment"; - - - private FragmentDialogRestartBinding mBinding; - private View rootView; - private Context mContext; - - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - // Inflate the layout for this fragment - Log.e(TAG, "onCreateView: "); - mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_dialog_restart, container, false); - mBinding.setClick(new BtnClick()); - rootView = mBinding.getRoot(); - mContext = rootView.getContext(); - initView(); - return rootView; - } - - @NonNull - @Override - public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - return super.onCreateDialog(savedInstanceState); - } - - private void initView() { - mBinding.tvContent.setText("应用将会重启并重新获取数据"); - } - - @Override - public void onStart() { - super.onStart(); - if (getDialog() != null) { - Window window = getDialog().getWindow(); - if (window == null) return; - WindowManager.LayoutParams params = window.getAttributes(); - params.width = WindowManager.LayoutParams.MATCH_PARENT; - params.height = WindowManager.LayoutParams.WRAP_CONTENT; - params.gravity = Gravity.CENTER; - window.setAttributes(params); - window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - getDialog().setCancelable(true); - getDialog().setCanceledOnTouchOutside(true); - } - } - - @Override - public void show(FragmentManager manager, String tag) { - DialogFragment fragment = (DialogFragment) manager.findFragmentByTag(tag); - if (fragment != null && fragment.isAdded() - && fragment.getDialog() != null && fragment.getDialog().isShowing()) { - return; - } - - try { - FragmentTransaction ft = manager.beginTransaction(); - ft.add(this, tag); - ft.commitAllowingStateLoss(); - } catch (Exception e) { - Log.e(TAG, "show: " + e.getMessage()); - } - } - - @Override - public void onDestroy() { - super.onDestroy(); - } - - @Override - public void onDismiss(@NonNull DialogInterface dialog) { - super.onDismiss(dialog); - - } - - public class BtnClick { - public void cancel(View view) { - dismiss(); - } - - public void restart(View view) { - AppProcessUtils.triggerRebirth(mContext); - } - } - - @Override - public void fetchData() { - - } -} diff --git a/app/src/main/java/com/fuying/sn/feature/splash/SplashActivity.java b/app/src/main/java/com/fuying/sn/feature/splash/SplashActivity.java deleted file mode 100644 index 61cf7f0..0000000 --- a/app/src/main/java/com/fuying/sn/feature/splash/SplashActivity.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fuying.sn.feature.splash; - -import android.content.Intent; -import android.os.Bundle; -import android.os.Handler; -import android.view.WindowManager; - -import androidx.appcompat.app.AppCompatActivity; - -import com.fuying.sn.R; -import com.fuying.sn.feature.main.MainActivity; -import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX; - -public class SplashActivity extends AppCompatActivity { - private static final String TAG = "SplashActivity"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - setBar(); - setContentView(R.layout.activity_home); - - new Handler().postDelayed(() -> { - startActivity(new Intent(SplashActivity.this, MainActivity.class)); - finish(); - }, 2000); - } - - private void setBar() { - UltimateBarX.statusBar(this) - .transparent() - .colorRes(R.color.colorPrimaryDark) - .light(true) - .apply(); - UltimateBarX.navigationBar(this) - .transparent() - .colorRes(R.color.colorPrimaryDark) - .light(true) - .apply(); - } -} diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml deleted file mode 100644 index 47e5f24..0000000 --- a/app/src/main/res/layout-land/activity_main.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-port/activity_main.xml b/app/src/main/res/layout-port/activity_main.xml deleted file mode 100644 index 47e5f24..0000000 --- a/app/src/main/res/layout-port/activity_main.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_dialog_restart.xml b/app/src/main/res/layout/fragment_dialog_restart.xml deleted file mode 100644 index 7cf5316..0000000 --- a/app/src/main/res/layout/fragment_dialog_restart.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file