diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index d6b2bb835cab..00ff344e1be7 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -30,7 +30,7 @@ } # DelegateWorker --keep,allowobfuscation class * extends com.topjohnwu.magisk.components.DelegateWorker +-keep,allowobfuscation class * extends com.topjohnwu.magisk.model.worker.DelegateWorker # BootSigner -keepclassmembers class com.topjohnwu.signing.BootSigner { *; } @@ -49,3 +49,8 @@ # Excessive obfuscation -repackageclasses 'a' -allowaccessmodification + +# QOL +-dontnote ** +-dontwarn com.caverock.androidsvg.** +-dontwarn ru.noties.markwon.** diff --git a/app/src/main/java/a/b.java b/app/src/main/java/a/b.java index 0e0409f89eb7..db9475e9cc63 100644 --- a/app/src/main/java/a/b.java +++ b/app/src/main/java/a/b.java @@ -1,6 +1,6 @@ package a; -import com.topjohnwu.magisk.MainActivity; +import com.topjohnwu.magisk.ui.MainActivity; public class b extends MainActivity { /* stub */ diff --git a/app/src/main/java/a/c.java b/app/src/main/java/a/c.java index 5e7bea238a1d..73073ef6a1f1 100644 --- a/app/src/main/java/a/c.java +++ b/app/src/main/java/a/c.java @@ -1,6 +1,6 @@ package a; -import com.topjohnwu.magisk.SplashActivity; +import com.topjohnwu.magisk.ui.SplashActivity; public class c extends SplashActivity { /* stub */ diff --git a/app/src/main/java/a/f.java b/app/src/main/java/a/f.java index a40a5c70f181..08d136b287ce 100644 --- a/app/src/main/java/a/f.java +++ b/app/src/main/java/a/f.java @@ -1,6 +1,6 @@ package a; -import com.topjohnwu.magisk.FlashActivity; +import com.topjohnwu.magisk.ui.flash.FlashActivity; public class f extends FlashActivity { /* stub */ diff --git a/app/src/main/java/a/g.java b/app/src/main/java/a/g.java index 13771c54762c..ceaf4ff41977 100644 --- a/app/src/main/java/a/g.java +++ b/app/src/main/java/a/g.java @@ -2,7 +2,7 @@ import android.content.Context; -import com.topjohnwu.magisk.components.UpdateCheckService; +import com.topjohnwu.magisk.model.update.UpdateCheckService; import androidx.annotation.NonNull; import androidx.work.WorkerParameters; diff --git a/app/src/main/java/a/h.java b/app/src/main/java/a/h.java index 5b8709277d35..0be3819f778f 100644 --- a/app/src/main/java/a/h.java +++ b/app/src/main/java/a/h.java @@ -1,6 +1,6 @@ package a; -import com.topjohnwu.magisk.components.GeneralReceiver; +import com.topjohnwu.magisk.model.receiver.GeneralReceiver; public class h extends GeneralReceiver { /* stub */ diff --git a/app/src/main/java/a/j.java b/app/src/main/java/a/j.java index bdf1407cbc30..937100012943 100644 --- a/app/src/main/java/a/j.java +++ b/app/src/main/java/a/j.java @@ -1,6 +1,6 @@ package a; -import com.topjohnwu.magisk.components.DownloadModuleService; +import com.topjohnwu.magisk.model.download.DownloadModuleService; public class j extends DownloadModuleService { /* stub */ diff --git a/app/src/main/java/a/m.java b/app/src/main/java/a/m.java index d879fcd723c2..3d727085dc1c 100644 --- a/app/src/main/java/a/m.java +++ b/app/src/main/java/a/m.java @@ -1,6 +1,6 @@ package a; -import com.topjohnwu.magisk.SuRequestActivity; +import com.topjohnwu.magisk.ui.surequest.SuRequestActivity; public class m extends SuRequestActivity { /* stub */ diff --git a/app/src/main/java/a/w.java b/app/src/main/java/a/w.java index 7be9efa374f4..e5a2fd89ae8a 100644 --- a/app/src/main/java/a/w.java +++ b/app/src/main/java/a/w.java @@ -2,7 +2,7 @@ import android.content.Context; -import com.topjohnwu.magisk.components.DelegateWorker; +import com.topjohnwu.magisk.model.worker.DelegateWorker; import java.lang.reflect.ParameterizedType; diff --git a/app/src/main/java/com/topjohnwu/magisk/App.java b/app/src/main/java/com/topjohnwu/magisk/App.java index 14284d949612..179419249eed 100644 --- a/app/src/main/java/com/topjohnwu/magisk/App.java +++ b/app/src/main/java/com/topjohnwu/magisk/App.java @@ -10,13 +10,9 @@ import android.os.Bundle; import android.preference.PreferenceManager; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatDelegate; - -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.database.MagiskDB; -import com.topjohnwu.magisk.database.RepoDatabaseHelper; +import com.topjohnwu.magisk.data.database.MagiskDB; +import com.topjohnwu.magisk.data.database.RepoDatabaseHelper; +import com.topjohnwu.magisk.ui.base.BaseActivity; import com.topjohnwu.magisk.utils.LocaleManager; import com.topjohnwu.magisk.utils.RootUtils; import com.topjohnwu.net.Networking; @@ -24,6 +20,10 @@ import java.util.concurrent.ThreadPoolExecutor; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatDelegate; + public class App extends Application implements Application.ActivityLifecycleCallbacks { public static App self; diff --git a/app/src/main/java/com/topjohnwu/magisk/ClassMap.java b/app/src/main/java/com/topjohnwu/magisk/ClassMap.java index 5bd8ace31984..4013d5918d7f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ClassMap.java +++ b/app/src/main/java/com/topjohnwu/magisk/ClassMap.java @@ -1,8 +1,12 @@ package com.topjohnwu.magisk; -import com.topjohnwu.magisk.components.DownloadModuleService; -import com.topjohnwu.magisk.components.GeneralReceiver; -import com.topjohnwu.magisk.components.UpdateCheckService; +import com.topjohnwu.magisk.model.download.DownloadModuleService; +import com.topjohnwu.magisk.model.receiver.GeneralReceiver; +import com.topjohnwu.magisk.model.update.UpdateCheckService; +import com.topjohnwu.magisk.ui.MainActivity; +import com.topjohnwu.magisk.ui.SplashActivity; +import com.topjohnwu.magisk.ui.flash.FlashActivity; +import com.topjohnwu.magisk.ui.surequest.SuRequestActivity; import java.util.HashMap; import java.util.Map; diff --git a/app/src/main/java/com/topjohnwu/magisk/database/MagiskDB.java b/app/src/main/java/com/topjohnwu/magisk/data/database/MagiskDB.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/database/MagiskDB.java rename to app/src/main/java/com/topjohnwu/magisk/data/database/MagiskDB.java index 69a3ee383692..96b703cd1100 100644 --- a/app/src/main/java/com/topjohnwu/magisk/database/MagiskDB.java +++ b/app/src/main/java/com/topjohnwu/magisk/data/database/MagiskDB.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.database; +package com.topjohnwu.magisk.data.database; import android.content.ContentValues; import android.content.Context; @@ -7,8 +7,8 @@ import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.container.Policy; -import com.topjohnwu.magisk.container.SuLogEntry; +import com.topjohnwu.magisk.model.entity.Policy; +import com.topjohnwu.magisk.model.entity.SuLogEntry; import com.topjohnwu.magisk.utils.LocaleManager; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.superuser.Shell; diff --git a/app/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java b/app/src/main/java/com/topjohnwu/magisk/data/database/RepoDatabaseHelper.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java rename to app/src/main/java/com/topjohnwu/magisk/data/database/RepoDatabaseHelper.java index 852a2e88733b..8bb2bd369c9c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java +++ b/app/src/main/java/com/topjohnwu/magisk/data/database/RepoDatabaseHelper.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.database; +package com.topjohnwu.magisk.data.database; import android.content.Context; import android.database.Cursor; @@ -6,7 +6,7 @@ import android.database.sqlite.SQLiteOpenHelper; import com.topjohnwu.magisk.Config; -import com.topjohnwu.magisk.container.Repo; +import com.topjohnwu.magisk.model.entity.Repo; import java.util.HashSet; import java.util.Set; diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/ApplicationAdapter.java similarity index 99% rename from app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/ApplicationAdapter.java index 8c6363e3f3f4..6c7d86eebe19 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/ApplicationAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.content.Context; import android.content.pm.ApplicationInfo; @@ -13,20 +13,14 @@ import android.widget.ImageView; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.WorkerThread; -import androidx.collection.ArraySet; -import androidx.recyclerview.widget.RecyclerView; - import com.buildware.widget.indeterm.IndeterminateCheckBox; import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.uicomponents.ArrowExpandable; -import com.topjohnwu.magisk.uicomponents.Expandable; import com.topjohnwu.magisk.utils.Event; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.ArrowExpandable; +import com.topjohnwu.magisk.view.Expandable; import com.topjohnwu.superuser.Shell; import com.topjohnwu.superuser.internal.UiThreadHandler; @@ -35,6 +29,11 @@ import java.util.List; import java.util.Set; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; +import androidx.collection.ArraySet; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import java9.util.Comparators; import java9.util.Lists; diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/ModulesAdapter.java similarity index 96% rename from app/src/main/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/ModulesAdapter.java index 604cba6f524c..e82481ffa475 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/ModulesAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/ModulesAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.content.Context; import android.text.TextUtils; @@ -9,17 +9,16 @@ import android.widget.ImageView; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - import com.google.android.material.snackbar.Snackbar; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.container.Module; -import com.topjohnwu.magisk.uicomponents.SnackbarMaker; +import com.topjohnwu.magisk.model.entity.Module; +import com.topjohnwu.magisk.view.SnackbarMaker; import com.topjohnwu.superuser.Shell; import java.util.List; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; public class ModulesAdapter extends RecyclerView.Adapter { diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/PolicyAdapter.java similarity index 93% rename from app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/PolicyAdapter.java index 72fdcba1a32b..6b285dcc745f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/PolicyAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/PolicyAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.app.Activity; import android.content.DialogInterface; @@ -9,24 +9,23 @@ import android.widget.ImageView; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.SwitchCompat; -import androidx.recyclerview.widget.RecyclerView; - import com.google.android.material.snackbar.Snackbar; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.container.Policy; -import com.topjohnwu.magisk.database.MagiskDB; -import com.topjohnwu.magisk.dialogs.CustomAlertDialog; -import com.topjohnwu.magisk.dialogs.FingerprintAuthDialog; -import com.topjohnwu.magisk.uicomponents.ArrowExpandable; -import com.topjohnwu.magisk.uicomponents.Expandable; -import com.topjohnwu.magisk.uicomponents.ExpandableViewHolder; -import com.topjohnwu.magisk.uicomponents.SnackbarMaker; +import com.topjohnwu.magisk.data.database.MagiskDB; +import com.topjohnwu.magisk.model.entity.Policy; import com.topjohnwu.magisk.utils.FingerprintHelper; +import com.topjohnwu.magisk.view.ArrowExpandable; +import com.topjohnwu.magisk.view.Expandable; +import com.topjohnwu.magisk.view.ExpandableViewHolder; +import com.topjohnwu.magisk.view.SnackbarMaker; +import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog; +import com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog; import java.util.List; +import androidx.annotation.NonNull; +import androidx.appcompat.widget.SwitchCompat; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; public class PolicyAdapter extends RecyclerView.Adapter { diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/ReposAdapter.java similarity index 95% rename from app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/ReposAdapter.java index 764fd3f63d0e..162b809fb992 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/ReposAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.content.Context; import android.content.Intent; @@ -13,25 +13,24 @@ import android.widget.SearchView; import android.widget.TextView; -import androidx.recyclerview.widget.RecyclerView; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.components.DownloadModuleService; -import com.topjohnwu.magisk.container.Module; -import com.topjohnwu.magisk.container.Repo; -import com.topjohnwu.magisk.database.RepoDatabaseHelper; -import com.topjohnwu.magisk.dialogs.CustomAlertDialog; -import com.topjohnwu.magisk.uicomponents.MarkDownWindow; +import com.topjohnwu.magisk.data.database.RepoDatabaseHelper; +import com.topjohnwu.magisk.model.download.DownloadModuleService; +import com.topjohnwu.magisk.model.entity.Module; +import com.topjohnwu.magisk.model.entity.Repo; +import com.topjohnwu.magisk.ui.base.BaseActivity; import com.topjohnwu.magisk.utils.Event; +import com.topjohnwu.magisk.view.MarkDownWindow; +import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import java9.util.stream.StreamSupport; diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/SectionedAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/SectionedAdapter.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/adapters/SectionedAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/SectionedAdapter.java index de181cc195a8..e04ec20c7f83 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/SectionedAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/SectionedAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.view.ViewGroup; diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/StringListAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/StringListAdapter.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/adapters/StringListAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/StringListAdapter.java index fb13c87bdf3d..b76064220473 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/StringListAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/StringListAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.app.Activity; import android.util.DisplayMetrics; @@ -7,13 +7,13 @@ import android.view.ViewGroup; import android.widget.TextView; +import java.util.List; + import androidx.annotation.IdRes; import androidx.annotation.LayoutRes; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import java.util.List; - public abstract class StringListAdapter extends RecyclerView.Adapter { diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/SuLogAdapter.java similarity index 96% rename from app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/SuLogAdapter.java index 84c0a344929f..b1afdd51dbce 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/SuLogAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/SuLogAdapter.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; import android.content.Context; import android.view.LayoutInflater; @@ -9,18 +9,17 @@ import android.widget.ImageView; import android.widget.TextView; -import androidx.recyclerview.widget.RecyclerView; - import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.container.SuLogEntry; -import com.topjohnwu.magisk.database.MagiskDB; -import com.topjohnwu.magisk.uicomponents.ExpandableViewHolder; +import com.topjohnwu.magisk.data.database.MagiskDB; +import com.topjohnwu.magisk.model.entity.SuLogEntry; +import com.topjohnwu.magisk.view.ExpandableViewHolder; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; public class SuLogAdapter extends SectionedAdapter { diff --git a/app/src/main/java/com/topjohnwu/magisk/adapters/TabFragmentAdapter.java b/app/src/main/java/com/topjohnwu/magisk/model/adapters/TabFragmentAdapter.java similarity index 95% rename from app/src/main/java/com/topjohnwu/magisk/adapters/TabFragmentAdapter.java rename to app/src/main/java/com/topjohnwu/magisk/model/adapters/TabFragmentAdapter.java index d0eea2be7394..eddb897fbfa6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/adapters/TabFragmentAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/adapters/TabFragmentAdapter.java @@ -1,13 +1,13 @@ -package com.topjohnwu.magisk.adapters; +package com.topjohnwu.magisk.model.adapters; +import java.util.ArrayList; +import java.util.List; + import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; -import java.util.ArrayList; -import java.util.List; - public class TabFragmentAdapter extends FragmentPagerAdapter { private List fragmentList; diff --git a/app/src/main/java/com/topjohnwu/magisk/components/DownloadModuleService.java b/app/src/main/java/com/topjohnwu/magisk/model/download/DownloadModuleService.java similarity index 94% rename from app/src/main/java/com/topjohnwu/magisk/components/DownloadModuleService.java rename to app/src/main/java/com/topjohnwu/magisk/model/download/DownloadModuleService.java index a17333cb898a..8b1ce786a518 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/DownloadModuleService.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/download/DownloadModuleService.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.components; +package com.topjohnwu.magisk.model.download; import android.app.PendingIntent; import android.app.Service; @@ -6,15 +6,13 @@ import android.net.Uri; import android.os.IBinder; -import androidx.annotation.Nullable; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.FlashActivity; -import com.topjohnwu.magisk.container.Repo; -import com.topjohnwu.magisk.uicomponents.Notifications; -import com.topjohnwu.magisk.uicomponents.ProgressNotification; +import com.topjohnwu.magisk.model.entity.Repo; +import com.topjohnwu.magisk.ui.flash.FlashActivity; +import com.topjohnwu.magisk.view.Notifications; +import com.topjohnwu.magisk.view.ProgressNotification; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; import com.topjohnwu.superuser.ShellUtils; @@ -25,12 +23,15 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; +import androidx.annotation.Nullable; + public class DownloadModuleService extends Service { private List notifications; @@ -136,7 +137,7 @@ private void processZip(InputStream in, OutputStream out, boolean inject) ShellUtils.pump(update_bin, zout); } zout.putNextEntry(new ZipEntry("META-INF/com/google/android/updater-script")); - zout.write("#MAGISK\n".getBytes("UTF-8")); + zout.write("#MAGISK\n".getBytes(StandardCharsets.UTF_8)); } int off = -1; diff --git a/app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java b/app/src/main/java/com/topjohnwu/magisk/model/entity/BaseModule.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java rename to app/src/main/java/com/topjohnwu/magisk/model/entity/BaseModule.java index 259d1a98506a..20ccc4bec985 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/BaseModule.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/BaseModule.java @@ -1,14 +1,14 @@ -package com.topjohnwu.magisk.container; +package com.topjohnwu.magisk.model.entity; import android.content.ContentValues; import android.database.Cursor; import android.os.Parcel; import android.os.Parcelable; -import androidx.annotation.NonNull; - import java.util.List; +import androidx.annotation.NonNull; + public abstract class BaseModule implements Comparable, Parcelable { private String mId, mName, mVersion, mAuthor, mDescription; diff --git a/app/src/main/java/com/topjohnwu/magisk/container/Module.java b/app/src/main/java/com/topjohnwu/magisk/model/entity/Module.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/container/Module.java rename to app/src/main/java/com/topjohnwu/magisk/model/entity/Module.java index 3c2cd032e856..ed04b2830e66 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/Module.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/Module.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.container; +package com.topjohnwu.magisk.model.entity; import android.os.Parcel; import android.os.Parcelable; @@ -76,4 +76,4 @@ public boolean isUpdated() { return mUpdated; } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/topjohnwu/magisk/container/Policy.java b/app/src/main/java/com/topjohnwu/magisk/model/entity/Policy.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/container/Policy.java rename to app/src/main/java/com/topjohnwu/magisk/model/entity/Policy.java index 6ff51f25aeab..10cc6dac6aac 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/Policy.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/Policy.java @@ -1,13 +1,13 @@ -package com.topjohnwu.magisk.container; +package com.topjohnwu.magisk.model.entity; import android.content.ContentValues; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import androidx.annotation.NonNull; - import com.topjohnwu.magisk.utils.Utils; +import androidx.annotation.NonNull; + public class Policy implements Comparable{ public static final int INTERACTIVE = 0; diff --git a/app/src/main/java/com/topjohnwu/magisk/container/Repo.java b/app/src/main/java/com/topjohnwu/magisk/model/entity/Repo.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/container/Repo.java rename to app/src/main/java/com/topjohnwu/magisk/model/entity/Repo.java index 63ffe197a08c..43f85f12eaab 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/Repo.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/Repo.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.container; +package com.topjohnwu.magisk.model.entity; import android.content.ContentValues; import android.database.Cursor; diff --git a/app/src/main/java/com/topjohnwu/magisk/container/SuLogEntry.java b/app/src/main/java/com/topjohnwu/magisk/model/entity/SuLogEntry.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/container/SuLogEntry.java rename to app/src/main/java/com/topjohnwu/magisk/model/entity/SuLogEntry.java index 2638105f4f9b..aa778d65e38f 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/SuLogEntry.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/SuLogEntry.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.container; +package com.topjohnwu.magisk.model.entity; import android.content.ContentValues; diff --git a/app/src/main/java/com/topjohnwu/magisk/components/GeneralReceiver.java b/app/src/main/java/com/topjohnwu/magisk/model/receiver/GeneralReceiver.java similarity index 94% rename from app/src/main/java/com/topjohnwu/magisk/components/GeneralReceiver.java rename to app/src/main/java/com/topjohnwu/magisk/model/receiver/GeneralReceiver.java index 40c103f356ed..dd71c7f0933d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/GeneralReceiver.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/receiver/GeneralReceiver.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.components; +package com.topjohnwu.magisk.model.receiver; import android.content.BroadcastReceiver; import android.content.Context; @@ -8,11 +8,11 @@ import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.SuRequestActivity; -import com.topjohnwu.magisk.uicomponents.Notifications; -import com.topjohnwu.magisk.uicomponents.Shortcuts; +import com.topjohnwu.magisk.ui.surequest.SuRequestActivity; import com.topjohnwu.magisk.utils.DownloadApp; import com.topjohnwu.magisk.utils.SuLogger; +import com.topjohnwu.magisk.view.Notifications; +import com.topjohnwu.magisk.view.Shortcuts; import com.topjohnwu.superuser.Shell; public class GeneralReceiver extends BroadcastReceiver { diff --git a/app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java b/app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.java similarity index 85% rename from app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java rename to app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.java index 79d6241a4955..87c6544ef0b1 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.java @@ -1,15 +1,16 @@ -package com.topjohnwu.magisk.components; - -import androidx.annotation.NonNull; -import androidx.work.ListenableWorker; +package com.topjohnwu.magisk.model.update; import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.BuildConfig; import com.topjohnwu.magisk.Config; +import com.topjohnwu.magisk.model.worker.DelegateWorker; import com.topjohnwu.magisk.tasks.CheckUpdates; -import com.topjohnwu.magisk.uicomponents.Notifications; +import com.topjohnwu.magisk.view.Notifications; import com.topjohnwu.superuser.Shell; +import androidx.annotation.NonNull; +import androidx.work.ListenableWorker; + public class UpdateCheckService extends DelegateWorker { @NonNull diff --git a/app/src/main/java/com/topjohnwu/magisk/components/DelegateWorker.java b/app/src/main/java/com/topjohnwu/magisk/model/worker/DelegateWorker.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/components/DelegateWorker.java rename to app/src/main/java/com/topjohnwu/magisk/model/worker/DelegateWorker.java index 609cbb1148cd..670e88d1c49b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/DelegateWorker.java +++ b/app/src/main/java/com/topjohnwu/magisk/model/worker/DelegateWorker.java @@ -1,9 +1,15 @@ -package com.topjohnwu.magisk.components; +package com.topjohnwu.magisk.model.worker; import android.content.Context; import android.net.Network; import android.net.Uri; +import com.google.common.util.concurrent.ListenableFuture; + +import java.util.List; +import java.util.Set; +import java.util.UUID; + import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -11,12 +17,6 @@ import androidx.work.Data; import androidx.work.ListenableWorker; -import com.google.common.util.concurrent.ListenableFuture; - -import java.util.List; -import java.util.Set; -import java.util.UUID; - public abstract class DelegateWorker { private ListenableWorker worker; diff --git a/app/src/main/java/com/topjohnwu/magisk/tasks/UpdateRepos.java b/app/src/main/java/com/topjohnwu/magisk/tasks/UpdateRepos.java index d13dd6546765..9d6e4457168e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/tasks/UpdateRepos.java +++ b/app/src/main/java/com/topjohnwu/magisk/tasks/UpdateRepos.java @@ -6,7 +6,7 @@ import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.container.Repo; +import com.topjohnwu.magisk.model.entity.Repo; import com.topjohnwu.magisk.utils.Event; import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.Utils; diff --git a/app/src/main/java/com/topjohnwu/magisk/MainActivity.java b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.java similarity index 91% rename from app/src/main/java/com/topjohnwu/magisk/MainActivity.java rename to app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.java index f98f1977f30f..3da71cf37a12 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.ui; import android.content.Intent; import android.os.Build; @@ -8,26 +8,29 @@ import android.view.MenuItem; import android.view.View; +import com.google.android.material.navigation.NavigationView; +import com.topjohnwu.magisk.ClassMap; +import com.topjohnwu.magisk.Config; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.ui.base.BaseActivity; +import com.topjohnwu.magisk.ui.hide.MagiskHideFragment; +import com.topjohnwu.magisk.ui.home.MagiskFragment; +import com.topjohnwu.magisk.ui.log.LogFragment; +import com.topjohnwu.magisk.ui.module.ModulesFragment; +import com.topjohnwu.magisk.ui.module.ReposFragment; +import com.topjohnwu.magisk.ui.settings.SettingsFragment; +import com.topjohnwu.magisk.ui.superuser.SuperuserFragment; +import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.net.Networking; +import com.topjohnwu.superuser.Shell; + import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.widget.Toolbar; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; - -import com.google.android.material.navigation.NavigationView; -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.fragments.LogFragment; -import com.topjohnwu.magisk.fragments.MagiskFragment; -import com.topjohnwu.magisk.fragments.MagiskHideFragment; -import com.topjohnwu.magisk.fragments.ModulesFragment; -import com.topjohnwu.magisk.fragments.ReposFragment; -import com.topjohnwu.magisk.fragments.SettingsFragment; -import com.topjohnwu.magisk.fragments.SuperuserFragment; -import com.topjohnwu.magisk.utils.Utils; -import com.topjohnwu.net.Networking; -import com.topjohnwu.superuser.Shell; - import butterknife.BindView; public class MainActivity extends BaseActivity diff --git a/app/src/main/java/com/topjohnwu/magisk/SplashActivity.java b/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.java similarity index 87% rename from app/src/main/java/com/topjohnwu/magisk/SplashActivity.java rename to app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.java index 91c3722af9ac..ee0d8014dc63 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SplashActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.java @@ -1,23 +1,28 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.ui; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.text.TextUtils; -import androidx.appcompat.app.AlertDialog; - -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.database.RepoDatabaseHelper; +import com.topjohnwu.magisk.BuildConfig; +import com.topjohnwu.magisk.ClassMap; +import com.topjohnwu.magisk.Config; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.data.database.RepoDatabaseHelper; import com.topjohnwu.magisk.tasks.CheckUpdates; import com.topjohnwu.magisk.tasks.UpdateRepos; -import com.topjohnwu.magisk.uicomponents.Notifications; -import com.topjohnwu.magisk.uicomponents.Shortcuts; +import com.topjohnwu.magisk.ui.base.BaseActivity; import com.topjohnwu.magisk.utils.LocaleManager; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.Notifications; +import com.topjohnwu.magisk.view.Shortcuts; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; +import androidx.appcompat.app.AlertDialog; + public class SplashActivity extends BaseActivity { public static boolean DONE = false; diff --git a/app/src/main/java/com/topjohnwu/magisk/components/BaseActivity.java b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseActivity.java similarity index 99% rename from app/src/main/java/com/topjohnwu/magisk/components/BaseActivity.java rename to app/src/main/java/com/topjohnwu/magisk/ui/base/BaseActivity.java index 9db327987a0a..ed42d5b10d03 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/BaseActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseActivity.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.components; +package com.topjohnwu.magisk.ui.base; import android.Manifest; import android.content.Context; @@ -11,6 +11,13 @@ import android.text.TextUtils; import android.view.WindowManager; +import com.topjohnwu.magisk.App; +import com.topjohnwu.magisk.Config; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.utils.Event; +import com.topjohnwu.magisk.utils.LocaleManager; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StyleRes; @@ -19,13 +26,6 @@ import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; -import com.topjohnwu.magisk.App; -import com.topjohnwu.magisk.Config; -import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.utils.Event; -import com.topjohnwu.magisk.utils.LocaleManager; - public abstract class BaseActivity extends AppCompatActivity implements Event.AutoListener { static int[] EMPTY_INT_ARRAY = new int[0]; diff --git a/app/src/main/java/com/topjohnwu/magisk/components/BaseFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseFragment.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/components/BaseFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/base/BaseFragment.java index fbaa8f71afd4..3594a4c19305 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/BaseFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseFragment.java @@ -1,12 +1,11 @@ -package com.topjohnwu.magisk.components; +package com.topjohnwu.magisk.ui.base; import android.content.Intent; -import androidx.fragment.app.Fragment; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.utils.Event; +import androidx.fragment.app.Fragment; import butterknife.Unbinder; public abstract class BaseFragment extends Fragment implements Event.AutoListener { diff --git a/app/src/main/java/com/topjohnwu/magisk/components/BasePreferenceFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/base/BasePreferenceFragment.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/components/BasePreferenceFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/base/BasePreferenceFragment.java index f6512518f023..02e04ac3e4e4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/BasePreferenceFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/BasePreferenceFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.components; +package com.topjohnwu.magisk.ui.base; import android.annotation.SuppressLint; import android.content.SharedPreferences; @@ -8,6 +8,10 @@ import android.view.View; import android.view.ViewGroup; +import com.topjohnwu.magisk.App; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.utils.Event; + import androidx.preference.Preference; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceFragmentCompat; @@ -16,10 +20,6 @@ import androidx.preference.PreferenceViewHolder; import androidx.recyclerview.widget.RecyclerView; -import com.topjohnwu.magisk.App; -import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.utils.Event; - public abstract class BasePreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Event.AutoListener { diff --git a/app/src/main/java/com/topjohnwu/magisk/FlashActivity.java b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/FlashActivity.java rename to app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.java index 974f2dfb42fb..741050e77d61 100644 --- a/app/src/main/java/com/topjohnwu/magisk/FlashActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashActivity.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.ui.flash; import android.content.Intent; import android.net.Uri; @@ -8,15 +8,12 @@ import android.widget.LinearLayout; import android.widget.Toast; -import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.widget.Toolbar; -import androidx.recyclerview.widget.RecyclerView; - -import com.topjohnwu.magisk.adapters.StringListAdapter; -import com.topjohnwu.magisk.components.BaseActivity; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.model.adapters.StringListAdapter; import com.topjohnwu.magisk.tasks.FlashZip; import com.topjohnwu.magisk.tasks.MagiskInstaller; +import com.topjohnwu.magisk.ui.base.BaseActivity; import com.topjohnwu.magisk.utils.RootUtils; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.superuser.CallbackList; @@ -32,6 +29,10 @@ import java.util.List; import java.util.Locale; +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.widget.Toolbar; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindColor; import butterknife.BindView; import butterknife.OnClick; diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/hide/MagiskHideFragment.java similarity index 95% rename from app/src/main/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/hide/MagiskHideFragment.java index 1f31e27d2296..c7f4c3356994 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/MagiskHideFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.hide; import android.os.Bundle; import android.view.LayoutInflater; @@ -9,17 +9,16 @@ import android.view.ViewGroup; import android.widget.SearchView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.ApplicationAdapter; -import com.topjohnwu.magisk.components.BaseFragment; +import com.topjohnwu.magisk.model.adapters.ApplicationAdapter; +import com.topjohnwu.magisk.ui.base.BaseFragment; import com.topjohnwu.magisk.utils.Event; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import butterknife.BindView; public class MagiskHideFragment extends BaseFragment { diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/MagiskFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/home/MagiskFragment.java similarity index 93% rename from app/src/main/java/com/topjohnwu/magisk/fragments/MagiskFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/home/MagiskFragment.java index 455307d468d1..4a18642146c9 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/MagiskFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/MagiskFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.home; import android.net.Uri; import android.os.Bundle; @@ -9,41 +9,40 @@ import android.widget.ImageView; import android.widget.LinearLayout; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.cardview.widget.CardView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import androidx.transition.ChangeBounds; -import androidx.transition.Fade; -import androidx.transition.Transition; -import androidx.transition.TransitionManager; -import androidx.transition.TransitionSet; - import com.topjohnwu.magisk.BuildConfig; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.MainActivity; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.components.BaseFragment; -import com.topjohnwu.magisk.dialogs.EnvFixDialog; -import com.topjohnwu.magisk.dialogs.MagiskInstallDialog; -import com.topjohnwu.magisk.dialogs.ManagerInstallDialog; -import com.topjohnwu.magisk.dialogs.UninstallDialog; import com.topjohnwu.magisk.tasks.CheckUpdates; -import com.topjohnwu.magisk.uicomponents.ArrowExpandable; -import com.topjohnwu.magisk.uicomponents.Expandable; -import com.topjohnwu.magisk.uicomponents.ExpandableViewHolder; -import com.topjohnwu.magisk.uicomponents.MarkDownWindow; -import com.topjohnwu.magisk.uicomponents.SafetyNet; -import com.topjohnwu.magisk.uicomponents.UpdateCardHolder; +import com.topjohnwu.magisk.ui.MainActivity; +import com.topjohnwu.magisk.ui.base.BaseActivity; +import com.topjohnwu.magisk.ui.base.BaseFragment; import com.topjohnwu.magisk.utils.Event; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.ArrowExpandable; +import com.topjohnwu.magisk.view.Expandable; +import com.topjohnwu.magisk.view.ExpandableViewHolder; +import com.topjohnwu.magisk.view.MarkDownWindow; +import com.topjohnwu.magisk.view.SafetyNet; +import com.topjohnwu.magisk.view.UpdateCardHolder; +import com.topjohnwu.magisk.view.dialogs.EnvFixDialog; +import com.topjohnwu.magisk.view.dialogs.MagiskInstallDialog; +import com.topjohnwu.magisk.view.dialogs.ManagerInstallDialog; +import com.topjohnwu.magisk.view.dialogs.UninstallDialog; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; import java.util.Locale; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.cardview.widget.CardView; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.transition.ChangeBounds; +import androidx.transition.Fade; +import androidx.transition.Transition; +import androidx.transition.TransitionManager; +import androidx.transition.TransitionSet; import butterknife.BindColor; import butterknife.BindView; import butterknife.OnClick; diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/LogFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.java similarity index 87% rename from app/src/main/java/com/topjohnwu/magisk/fragments/LogFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.java index d068b3bb1544..d684e1d6f1d6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/LogFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/LogFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.log; import android.os.Build; @@ -7,14 +7,13 @@ import android.view.View; import android.view.ViewGroup; -import androidx.viewpager.widget.ViewPager; - import com.google.android.material.tabs.TabLayout; -import com.topjohnwu.magisk.MainActivity; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.TabFragmentAdapter; -import com.topjohnwu.magisk.components.BaseFragment; +import com.topjohnwu.magisk.model.adapters.TabFragmentAdapter; +import com.topjohnwu.magisk.ui.MainActivity; +import com.topjohnwu.magisk.ui.base.BaseFragment; +import androidx.viewpager.widget.ViewPager; import butterknife.BindView; public class LogFragment extends BaseFragment { diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/log/MagiskLogFragment.java similarity index 95% rename from app/src/main/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/log/MagiskLogFragment.java index dee954f78d06..0e44c25e9fd2 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/MagiskLogFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.log; import android.os.Bundle; import android.view.LayoutInflater; @@ -8,17 +8,13 @@ import android.view.View; import android.view.ViewGroup; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; - import com.google.android.material.snackbar.Snackbar; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.StringListAdapter; -import com.topjohnwu.magisk.components.BaseFragment; -import com.topjohnwu.magisk.uicomponents.SnackbarMaker; +import com.topjohnwu.magisk.model.adapters.StringListAdapter; +import com.topjohnwu.magisk.ui.base.BaseFragment; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.SnackbarMaker; import com.topjohnwu.superuser.Shell; import com.topjohnwu.superuser.internal.NOPList; @@ -27,6 +23,9 @@ import java.util.Calendar; import java.util.List; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; public class MagiskLogFragment extends BaseFragment { diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/SuLogFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/log/SuLogFragment.java similarity index 93% rename from app/src/main/java/com/topjohnwu/magisk/fragments/SuLogFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/log/SuLogFragment.java index e22b415e67b9..9f6595d00022 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/SuLogFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/log/SuLogFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.log; import android.os.Bundle; import android.view.LayoutInflater; @@ -9,13 +9,12 @@ import android.view.ViewGroup; import android.widget.TextView; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; - import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.SuLogAdapter; -import com.topjohnwu.magisk.components.BaseFragment; +import com.topjohnwu.magisk.model.adapters.SuLogAdapter; +import com.topjohnwu.magisk.ui.base.BaseFragment; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; public class SuLogFragment extends BaseFragment { diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/ModulesFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModulesFragment.java similarity index 94% rename from app/src/main/java/com/topjohnwu/magisk/fragments/ModulesFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/module/ModulesFragment.java index 06affa253213..78d5989a7e21 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/ModulesFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ModulesFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.module; import android.app.Activity; import android.content.Intent; @@ -11,18 +11,13 @@ import android.view.ViewGroup; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.FlashActivity; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.ModulesAdapter; -import com.topjohnwu.magisk.components.BaseFragment; -import com.topjohnwu.magisk.container.Module; +import com.topjohnwu.magisk.model.adapters.ModulesAdapter; +import com.topjohnwu.magisk.model.entity.Module; +import com.topjohnwu.magisk.ui.base.BaseFragment; +import com.topjohnwu.magisk.ui.flash.FlashActivity; import com.topjohnwu.magisk.utils.Event; import com.topjohnwu.magisk.utils.RootUtils; import com.topjohnwu.magisk.utils.Utils; @@ -32,6 +27,10 @@ import java.util.List; import java.util.Map; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import butterknife.BindView; import butterknife.OnClick; diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/ReposFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/module/ReposFragment.java similarity index 95% rename from app/src/main/java/com/topjohnwu/magisk/fragments/ReposFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/module/ReposFragment.java index b45e2acf036f..4c12fee70657 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/ReposFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/module/ReposFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.module; import android.app.AlertDialog; import android.os.Bundle; @@ -11,18 +11,17 @@ import android.widget.SearchView; import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.ReposAdapter; -import com.topjohnwu.magisk.components.BaseFragment; +import com.topjohnwu.magisk.model.adapters.ReposAdapter; import com.topjohnwu.magisk.tasks.UpdateRepos; +import com.topjohnwu.magisk.ui.base.BaseFragment; import com.topjohnwu.magisk.utils.Event; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import butterknife.BindView; public class ReposFragment extends BaseFragment { diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/SettingsFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/fragments/SettingsFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java index 4902aa3920e2..7938275b8c02 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/SettingsFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.settings; import android.content.SharedPreferences; import android.os.Build; @@ -8,26 +8,19 @@ import android.widget.EditText; import android.widget.Toast; -import androidx.appcompat.app.AlertDialog; -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceScreen; -import androidx.preference.SwitchPreferenceCompat; - import com.topjohnwu.magisk.BuildConfig; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.BasePreferenceFragment; -import com.topjohnwu.magisk.dialogs.FingerprintAuthDialog; import com.topjohnwu.magisk.tasks.CheckUpdates; +import com.topjohnwu.magisk.ui.base.BasePreferenceFragment; import com.topjohnwu.magisk.utils.DownloadApp; import com.topjohnwu.magisk.utils.Event; import com.topjohnwu.magisk.utils.FingerprintHelper; import com.topjohnwu.magisk.utils.LocaleManager; import com.topjohnwu.magisk.utils.PatchAPK; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; @@ -35,6 +28,13 @@ import java.util.Arrays; import java.util.Locale; +import androidx.appcompat.app.AlertDialog; +import androidx.preference.ListPreference; +import androidx.preference.Preference; +import androidx.preference.PreferenceCategory; +import androidx.preference.PreferenceScreen; +import androidx.preference.SwitchPreferenceCompat; + public class SettingsFragment extends BasePreferenceFragment { private ListPreference updateChannel, autoRes, suNotification, diff --git a/app/src/main/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.java similarity index 89% rename from app/src/main/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java rename to app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.java index 26132abb737b..2f5beaf7b881 100644 --- a/app/src/main/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.fragments; +package com.topjohnwu.magisk.ui.superuser; import android.content.pm.PackageManager; import android.os.Bundle; @@ -7,16 +7,15 @@ import android.view.ViewGroup; import android.widget.TextView; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; - import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.adapters.PolicyAdapter; -import com.topjohnwu.magisk.components.BaseFragment; -import com.topjohnwu.magisk.container.Policy; +import com.topjohnwu.magisk.model.adapters.PolicyAdapter; +import com.topjohnwu.magisk.model.entity.Policy; +import com.topjohnwu.magisk.ui.base.BaseFragment; import java.util.List; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; public class SuperuserFragment extends BaseFragment { diff --git a/app/src/main/java/com/topjohnwu/magisk/SuRequestActivity.java b/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.java similarity index 96% rename from app/src/main/java/com/topjohnwu/magisk/SuRequestActivity.java rename to app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.java index e5b482e473d8..481956be5585 100644 --- a/app/src/main/java/com/topjohnwu/magisk/SuRequestActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/ui/surequest/SuRequestActivity.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.ui.surequest; import android.annotation.SuppressLint; import android.content.Intent; @@ -17,11 +17,12 @@ import android.widget.Spinner; import android.widget.TextView; -import androidx.annotation.Nullable; -import androidx.appcompat.content.res.AppCompatResources; - -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.container.Policy; +import com.topjohnwu.magisk.App; +import com.topjohnwu.magisk.BuildConfig; +import com.topjohnwu.magisk.Config; +import com.topjohnwu.magisk.R; +import com.topjohnwu.magisk.model.entity.Policy; +import com.topjohnwu.magisk.ui.base.BaseActivity; import com.topjohnwu.magisk.utils.FingerprintHelper; import com.topjohnwu.magisk.utils.SuConnector; import com.topjohnwu.magisk.utils.SuLogger; @@ -30,6 +31,8 @@ import java.util.ArrayList; import java.util.List; +import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; import butterknife.BindView; import java9.lang.Iterables; diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java b/app/src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java index 14f9329e4eea..39727e52d75c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java @@ -7,8 +7,8 @@ import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.SplashActivity; -import com.topjohnwu.magisk.uicomponents.ProgressNotification; +import com.topjohnwu.magisk.ui.SplashActivity; +import com.topjohnwu.magisk.view.ProgressNotification; import com.topjohnwu.net.Networking; import com.topjohnwu.net.ResponseListener; import com.topjohnwu.superuser.Shell; diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.java b/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.java index d7f8eddf22b0..0d77c058a4f8 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.java @@ -3,16 +3,14 @@ import android.content.ComponentName; import android.widget.Toast; -import androidx.core.app.NotificationCompat; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.BuildConfig; import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.SplashActivity; -import com.topjohnwu.magisk.uicomponents.Notifications; +import com.topjohnwu.magisk.ui.SplashActivity; +import com.topjohnwu.magisk.view.Notifications; import com.topjohnwu.signing.JarMap; import com.topjohnwu.signing.SignAPK; import com.topjohnwu.superuser.Shell; @@ -29,6 +27,8 @@ import java.util.List; import java.util.jar.JarEntry; +import androidx.core.app.NotificationCompat; + public class PatchAPK { public static final String LOWERALPHA = "abcdefghijklmnopqrstuvwxyz"; diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.java b/app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.java index 0a41cedfeddb..888a652623a0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/SuLogger.java @@ -9,8 +9,8 @@ import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.container.Policy; -import com.topjohnwu.magisk.container.SuLogEntry; +import com.topjohnwu.magisk.model.entity.Policy; +import com.topjohnwu.magisk.model.entity.SuLogEntry; import java.util.Date; diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java index 9cb213c7adc4..1cbcb06d52f4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.java @@ -12,21 +12,14 @@ import android.provider.OpenableColumns; import android.widget.Toast; -import androidx.work.Constraints; -import androidx.work.ExistingPeriodicWorkPolicy; -import androidx.work.NetworkType; -import androidx.work.PeriodicWorkRequest; -import androidx.work.WorkManager; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.BuildConfig; import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.UpdateCheckService; -import com.topjohnwu.magisk.container.Module; -import com.topjohnwu.magisk.container.ValueSortedMap; +import com.topjohnwu.magisk.model.entity.Module; +import com.topjohnwu.magisk.model.update.UpdateCheckService; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; import com.topjohnwu.superuser.internal.UiThreadHandler; @@ -37,6 +30,12 @@ import java.util.Map; import java.util.concurrent.TimeUnit; +import androidx.work.Constraints; +import androidx.work.ExistingPeriodicWorkPolicy; +import androidx.work.NetworkType; +import androidx.work.PeriodicWorkRequest; +import androidx.work.WorkManager; + public class Utils { public static void toast(CharSequence msg, int duration) { diff --git a/app/src/main/java/com/topjohnwu/magisk/container/ValueSortedMap.java b/app/src/main/java/com/topjohnwu/magisk/utils/ValueSortedMap.java similarity index 95% rename from app/src/main/java/com/topjohnwu/magisk/container/ValueSortedMap.java rename to app/src/main/java/com/topjohnwu/magisk/utils/ValueSortedMap.java index 9f5047d75847..babd8ba7970d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/container/ValueSortedMap.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/ValueSortedMap.java @@ -1,6 +1,4 @@ -package com.topjohnwu.magisk.container; - -import androidx.annotation.NonNull; +package com.topjohnwu.magisk.utils; import java.util.ArrayList; import java.util.Collection; @@ -9,6 +7,8 @@ import java.util.List; import java.util.Map; +import androidx.annotation.NonNull; + public class ValueSortedMap> extends HashMap { private List sorted = new ArrayList<>(); diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/ArrowExpandable.java b/app/src/main/java/com/topjohnwu/magisk/view/ArrowExpandable.java similarity index 96% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/ArrowExpandable.java rename to app/src/main/java/com/topjohnwu/magisk/view/ArrowExpandable.java index c49d402cd314..81478cdddf69 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/ArrowExpandable.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/ArrowExpandable.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.view.View; import android.view.animation.Animation; diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/Expandable.java b/app/src/main/java/com/topjohnwu/magisk/view/Expandable.java similarity index 94% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/Expandable.java rename to app/src/main/java/com/topjohnwu/magisk/view/Expandable.java index e854d929b4a6..82471b66d70a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/Expandable.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/Expandable.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; public abstract class Expandable { diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/ExpandableViewHolder.java b/app/src/main/java/com/topjohnwu/magisk/view/ExpandableViewHolder.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/ExpandableViewHolder.java rename to app/src/main/java/com/topjohnwu/magisk/view/ExpandableViewHolder.java index 015ce3fdba5f..f27b96b317c0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/ExpandableViewHolder.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/ExpandableViewHolder.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.animation.ValueAnimator; import android.view.View; diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/MarkDownWindow.java b/app/src/main/java/com/topjohnwu/magisk/view/MarkDownWindow.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/MarkDownWindow.java rename to app/src/main/java/com/topjohnwu/magisk/view/MarkDownWindow.java index a161d916aa82..f7e3b3dae58c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/MarkDownWindow.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/MarkDownWindow.java @@ -1,11 +1,9 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; -import androidx.appcompat.app.AlertDialog; - import com.topjohnwu.magisk.R; import com.topjohnwu.net.Networking; import com.topjohnwu.net.ResponseListener; @@ -13,6 +11,7 @@ import java.io.InputStream; import java.util.Scanner; +import androidx.appcompat.app.AlertDialog; import ru.noties.markwon.Markwon; import ru.noties.markwon.html.HtmlPlugin; import ru.noties.markwon.image.ImagesPlugin; diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/Notifications.java b/app/src/main/java/com/topjohnwu/magisk/view/Notifications.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/Notifications.java rename to app/src/main/java/com/topjohnwu/magisk/view/Notifications.java index e90956f3517b..244c51b256d7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/Notifications.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/Notifications.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -7,19 +7,19 @@ import android.content.Intent; import android.os.Build; -import androidx.core.app.NotificationCompat; -import androidx.core.app.NotificationManagerCompat; -import androidx.core.app.TaskStackBuilder; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.SplashActivity; -import com.topjohnwu.magisk.components.GeneralReceiver; +import com.topjohnwu.magisk.model.receiver.GeneralReceiver; +import com.topjohnwu.magisk.ui.SplashActivity; import com.topjohnwu.magisk.utils.Utils; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; +import androidx.core.app.TaskStackBuilder; + public class Notifications { public static NotificationManagerCompat mgr = NotificationManagerCompat.from(App.self); diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/ProgressNotification.java b/app/src/main/java/com/topjohnwu/magisk/view/ProgressNotification.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/ProgressNotification.java rename to app/src/main/java/com/topjohnwu/magisk/view/ProgressNotification.java index 19b1ddcd74fd..a7ff7721db53 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/ProgressNotification.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/ProgressNotification.java @@ -1,17 +1,17 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.app.Notification; import android.app.PendingIntent; import android.content.Intent; import android.widget.Toast; -import androidx.core.app.NotificationCompat; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.net.DownloadProgressListener; +import androidx.core.app.NotificationCompat; + public class ProgressNotification implements DownloadProgressListener { private NotificationCompat.Builder builder; diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/SafetyNet.java b/app/src/main/java/com/topjohnwu/magisk/view/SafetyNet.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/SafetyNet.java rename to app/src/main/java/com/topjohnwu/magisk/view/SafetyNet.java index 8b08d9674a03..8796bac8de1a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/SafetyNet.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/SafetyNet.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.app.Activity; import android.content.Context; @@ -10,19 +10,18 @@ import android.widget.ProgressBar; import android.widget.TextView; -import androidx.annotation.StringRes; -import androidx.cardview.widget.CardView; - import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.dialogs.CustomAlertDialog; import com.topjohnwu.magisk.utils.ISafetyNetHelper; +import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; import java.io.File; +import androidx.annotation.StringRes; +import androidx.cardview.widget.CardView; import butterknife.BindColor; import butterknife.BindView; import butterknife.OnClick; diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/Shortcuts.java b/app/src/main/java/com/topjohnwu/magisk/view/Shortcuts.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/Shortcuts.java rename to app/src/main/java/com/topjohnwu/magisk/view/Shortcuts.java index a0c313556703..ba841564c53e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/Shortcuts.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/Shortcuts.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.content.Context; import android.content.Intent; @@ -7,18 +7,18 @@ import android.graphics.drawable.Icon; import android.os.Build; -import androidx.annotation.RequiresApi; - import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.SplashActivity; +import com.topjohnwu.magisk.ui.SplashActivity; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.superuser.Shell; import java.util.ArrayList; +import androidx.annotation.RequiresApi; + public class Shortcuts { public static void setup(Context context) { diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/SnackbarMaker.java b/app/src/main/java/com/topjohnwu/magisk/view/SnackbarMaker.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/SnackbarMaker.java rename to app/src/main/java/com/topjohnwu/magisk/view/SnackbarMaker.java index 431eb222142a..dc0f1ca6123b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/SnackbarMaker.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/SnackbarMaker.java @@ -1,16 +1,16 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.app.Activity; import android.net.Uri; import android.view.View; import android.widget.TextView; -import androidx.annotation.StringRes; - import com.google.android.material.snackbar.Snackbar; import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.utils.Utils; +import androidx.annotation.StringRes; + public class SnackbarMaker { public static Snackbar make(Activity activity, CharSequence text, int duration) { diff --git a/app/src/main/java/com/topjohnwu/magisk/uicomponents/UpdateCardHolder.java b/app/src/main/java/com/topjohnwu/magisk/view/UpdateCardHolder.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/uicomponents/UpdateCardHolder.java rename to app/src/main/java/com/topjohnwu/magisk/view/UpdateCardHolder.java index 03486deeece4..3e657e4580d4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/uicomponents/UpdateCardHolder.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/UpdateCardHolder.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.uicomponents; +package com.topjohnwu.magisk.view; import android.view.LayoutInflater; import android.view.View; diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/CustomAlertDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/CustomAlertDialog.java similarity index 99% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/CustomAlertDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/CustomAlertDialog.java index e45ea5cdd715..4c6919a33a4b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/CustomAlertDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/CustomAlertDialog.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.app.Activity; import android.content.DialogInterface; @@ -8,14 +8,13 @@ import android.widget.LinearLayout; import android.widget.TextView; +import com.topjohnwu.magisk.R; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.annotation.StyleRes; import androidx.appcompat.app.AlertDialog; - -import com.topjohnwu.magisk.R; - import butterknife.BindView; public class CustomAlertDialog extends AlertDialog.Builder { diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/EnvFixDialog.java similarity index 97% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/EnvFixDialog.java index 9c7328bba424..95e1364b6abd 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/EnvFixDialog.java @@ -1,11 +1,9 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.app.Activity; import android.app.ProgressDialog; import android.widget.Toast; -import androidx.annotation.NonNull; - import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.tasks.MagiskInstaller; import com.topjohnwu.magisk.utils.RootUtils; @@ -14,6 +12,8 @@ import com.topjohnwu.superuser.internal.UiThreadHandler; import com.topjohnwu.superuser.io.SuFile; +import androidx.annotation.NonNull; + public class EnvFixDialog extends CustomAlertDialog { public EnvFixDialog(@NonNull Activity activity) { diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/FingerprintAuthDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/FingerprintAuthDialog.java similarity index 98% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/FingerprintAuthDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/FingerprintAuthDialog.java index 725e1f54d78d..d9f7642e293c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/FingerprintAuthDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/FingerprintAuthDialog.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.annotation.TargetApi; import android.app.Activity; @@ -11,13 +11,13 @@ import android.view.Gravity; import android.widget.Toast; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; - import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.utils.FingerprintHelper; import com.topjohnwu.magisk.utils.Utils; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; + @TargetApi(Build.VERSION_CODES.M) public class FingerprintAuthDialog extends CustomAlertDialog { diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/InstallMethodDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/InstallMethodDialog.java similarity index 93% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/InstallMethodDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/InstallMethodDialog.java index 83c3acf7b3b5..6b2970c1fd73 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/InstallMethodDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/InstallMethodDialog.java @@ -1,26 +1,26 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.app.Activity; import android.content.Intent; import android.widget.Toast; -import androidx.appcompat.app.AlertDialog; - import com.google.android.material.snackbar.Snackbar; import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.FlashActivity; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.uicomponents.ProgressNotification; -import com.topjohnwu.magisk.uicomponents.SnackbarMaker; +import com.topjohnwu.magisk.ui.base.BaseActivity; +import com.topjohnwu.magisk.ui.flash.FlashActivity; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.ProgressNotification; +import com.topjohnwu.magisk.view.SnackbarMaker; import com.topjohnwu.net.Networking; import java.io.File; import java.util.List; +import androidx.appcompat.app.AlertDialog; + class InstallMethodDialog extends AlertDialog.Builder { InstallMethodDialog(BaseActivity activity, List options) { diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/MagiskInstallDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/MagiskInstallDialog.java similarity index 92% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/MagiskInstallDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/MagiskInstallDialog.java index 681aab0d3eaa..64426c65669d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/MagiskInstallDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/MagiskInstallDialog.java @@ -1,13 +1,13 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.net.Uri; import android.text.TextUtils; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.BaseActivity; -import com.topjohnwu.magisk.uicomponents.MarkDownWindow; +import com.topjohnwu.magisk.ui.base.BaseActivity; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.MarkDownWindow; import com.topjohnwu.superuser.Shell; import com.topjohnwu.superuser.ShellUtils; diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/ManagerInstallDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/ManagerInstallDialog.java similarity index 91% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/ManagerInstallDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/ManagerInstallDialog.java index d13d5372f996..debb76719e50 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/ManagerInstallDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/ManagerInstallDialog.java @@ -1,15 +1,15 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.app.Activity; import android.text.TextUtils; -import androidx.annotation.NonNull; - import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.uicomponents.MarkDownWindow; import com.topjohnwu.magisk.utils.DownloadApp; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.MarkDownWindow; + +import androidx.annotation.NonNull; public class ManagerInstallDialog extends CustomAlertDialog { diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/UninstallDialog.java b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/UninstallDialog.java similarity index 93% rename from app/src/main/java/com/topjohnwu/magisk/dialogs/UninstallDialog.java rename to app/src/main/java/com/topjohnwu/magisk/view/dialogs/UninstallDialog.java index 8460e314f2d3..4fae38407a4e 100644 --- a/app/src/main/java/com/topjohnwu/magisk/dialogs/UninstallDialog.java +++ b/app/src/main/java/com/topjohnwu/magisk/view/dialogs/UninstallDialog.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk.dialogs; +package com.topjohnwu.magisk.view.dialogs; import android.app.Activity; import android.app.ProgressDialog; @@ -7,20 +7,20 @@ import android.text.TextUtils; import android.widget.Toast; -import androidx.annotation.NonNull; - import com.topjohnwu.magisk.ClassMap; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; -import com.topjohnwu.magisk.FlashActivity; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.uicomponents.ProgressNotification; +import com.topjohnwu.magisk.ui.flash.FlashActivity; import com.topjohnwu.magisk.utils.Utils; +import com.topjohnwu.magisk.view.ProgressNotification; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; import java.io.File; +import androidx.annotation.NonNull; + public class UninstallDialog extends CustomAlertDialog { public UninstallDialog(@NonNull Activity activity) {