From aa374b51f196382099fcfd98cd29367fe8bfd471 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 30 Aug 2018 03:57:48 -0400 Subject: [PATCH] Move fragments to separate package --- app/src/full/java/com/topjohnwu/magisk/MainActivity.java | 9 ++++++++- .../topjohnwu/magisk/{ => fragments}/LogFragment.java | 8 ++++++-- .../topjohnwu/magisk/{ => fragments}/MagiskFragment.java | 7 ++++++- .../magisk/{ => fragments}/MagiskHideFragment.java | 3 ++- .../magisk/{ => fragments}/MagiskLogFragment.java | 4 +++- .../magisk/{ => fragments}/ModulesFragment.java | 5 ++++- .../topjohnwu/magisk/{ => fragments}/ReposFragment.java | 5 ++++- .../magisk/{ => fragments}/SettingsFragment.java | 6 +++++- .../topjohnwu/magisk/{ => fragments}/SuLogFragment.java | 3 ++- .../magisk/{ => fragments}/SuperuserFragment.java | 3 ++- app/src/full/res/layout/fragment_log.xml | 2 +- app/src/full/res/layout/fragment_su_log.xml | 2 +- 12 files changed, 44 insertions(+), 13 deletions(-) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/LogFragment.java (85%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/MagiskFragment.java (98%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/MagiskHideFragment.java (97%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/MagiskLogFragment.java (97%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/ModulesFragment.java (97%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/ReposFragment.java (96%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/SettingsFragment.java (98%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/SuLogFragment.java (97%) rename app/src/full/java/com/topjohnwu/magisk/{ => fragments}/SuperuserFragment.java (96%) diff --git a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java index 1786b8779..6f49485b9 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java @@ -15,6 +15,13 @@ import android.view.MenuItem; import android.view.View; 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.Download; import com.topjohnwu.magisk.utils.Topic; import com.topjohnwu.superuser.Shell; @@ -29,8 +36,8 @@ public class MainActivity extends BaseActivity private int mDrawerItem; private boolean fromShortcut = true; - @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.drawer_layout) DrawerLayout drawer; + @BindView(R.id.toolbar) public Toolbar toolbar; @BindView(R.id.nav_view) public NavigationView navigationView; private float toolbarElevation; diff --git a/app/src/full/java/com/topjohnwu/magisk/LogFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/LogFragment.java similarity index 85% rename from app/src/full/java/com/topjohnwu/magisk/LogFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/LogFragment.java index c2839c24f..0d68820b9 100644 --- a/app/src/full/java/com/topjohnwu/magisk/LogFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/LogFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.os.Bundle; @@ -8,6 +8,10 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.Data; +import com.topjohnwu.magisk.MainActivity; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.adapters.TabFragmentAdapter; import com.topjohnwu.magisk.components.BaseFragment; @@ -29,7 +33,7 @@ public class LogFragment extends BaseFragment { View v = inflater.inflate(R.layout.fragment_log, container, false); unbinder = ButterKnife.bind(this, v); - ((MainActivity) getActivity()).toolbar.setElevation(0); + ((MainActivity) requireActivity()).toolbar.setElevation(0); TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager()); diff --git a/app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java similarity index 98% rename from app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java index 2fce1032f..62cf2a2d3 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.app.NotificationManager; import android.content.Context; @@ -20,6 +20,11 @@ import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; +import com.topjohnwu.magisk.BuildConfig; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.Data; +import com.topjohnwu.magisk.MainActivity; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.asyncs.CheckSafetyNet; import com.topjohnwu.magisk.asyncs.CheckUpdates; import com.topjohnwu.magisk.components.BaseActivity; diff --git a/app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java similarity index 97% rename from app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java index c67c06726..277810204 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskHideFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.os.Bundle; import android.support.annotation.NonNull; @@ -12,6 +12,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.SearchView; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.adapters.ApplicationAdapter; import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.utils.Topic; diff --git a/app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java similarity index 97% rename from app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java index bbd4677b8..f431b3354 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskLogFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.Manifest; import android.os.Bundle; @@ -16,6 +16,8 @@ import android.widget.ProgressBar; import android.widget.ScrollView; import android.widget.TextView; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.components.SnackbarMaker; import com.topjohnwu.magisk.utils.Download; diff --git a/app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/ModulesFragment.java similarity index 97% rename from app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/ModulesFragment.java index 6db89fdb4..59e450b99 100644 --- a/app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/ModulesFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.Manifest; import android.app.Activity; @@ -16,6 +16,9 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +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; diff --git a/app/src/full/java/com/topjohnwu/magisk/ReposFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/ReposFragment.java similarity index 96% rename from app/src/full/java/com/topjohnwu/magisk/ReposFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/ReposFragment.java index 56fe45ec2..8396f0487 100644 --- a/app/src/full/java/com/topjohnwu/magisk/ReposFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/ReposFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.app.AlertDialog; import android.os.Bundle; @@ -15,6 +15,9 @@ import android.view.ViewGroup; import android.widget.SearchView; import android.widget.TextView; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.Data; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.adapters.ReposAdapter; import com.topjohnwu.magisk.asyncs.UpdateRepos; import com.topjohnwu.magisk.components.BaseFragment; diff --git a/app/src/full/java/com/topjohnwu/magisk/SettingsFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java similarity index 98% rename from app/src/full/java/com/topjohnwu/magisk/SettingsFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java index 789287169..5c40a868a 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SettingsFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.content.Context; import android.content.SharedPreferences; @@ -24,6 +24,10 @@ import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; +import com.topjohnwu.magisk.Const; +import com.topjohnwu.magisk.Data; +import com.topjohnwu.magisk.MagiskManager; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.asyncs.CheckUpdates; import com.topjohnwu.magisk.asyncs.PatchAPK; import com.topjohnwu.magisk.components.CustomAlertDialog; diff --git a/app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SuLogFragment.java similarity index 97% rename from app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/SuLogFragment.java index 4294e611c..12dce4f88 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SuLogFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.os.Bundle; import android.support.annotation.Nullable; @@ -11,6 +11,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.adapters.SuLogAdapter; import com.topjohnwu.magisk.components.BaseFragment; diff --git a/app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java similarity index 96% rename from app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java rename to app/src/full/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java index f48606e21..1b1e263a7 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SuperuserFragment.java @@ -1,4 +1,4 @@ -package com.topjohnwu.magisk; +package com.topjohnwu.magisk.fragments; import android.content.pm.PackageManager; import android.os.Bundle; @@ -9,6 +9,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.adapters.PolicyAdapter; import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.container.Policy; diff --git a/app/src/full/res/layout/fragment_log.xml b/app/src/full/res/layout/fragment_log.xml index cb028035e..2d902ce38 100644 --- a/app/src/full/res/layout/fragment_log.xml +++ b/app/src/full/res/layout/fragment_log.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - tools:context="com.topjohnwu.magisk.LogFragment"> + tools:context="com.topjohnwu.magisk.fragments.LogFragment"> + tools:context="com.topjohnwu.magisk.fragments.SuLogFragment">