From eb18e56886f86c34a732df3e100468d63ef2a33b Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 15 Jan 2019 17:41:55 +0000 Subject: [PATCH] Refactoring --- app/src/main/java/eu/faircode/email/ActivityBase.java | 4 ++-- app/src/main/java/eu/faircode/email/ActivityView.java | 2 +- app/src/main/java/eu/faircode/email/FragmentAbout.java | 2 +- app/src/main/java/eu/faircode/email/FragmentAccount.java | 2 +- app/src/main/java/eu/faircode/email/FragmentAccounts.java | 2 +- app/src/main/java/eu/faircode/email/FragmentAnswer.java | 2 +- app/src/main/java/eu/faircode/email/FragmentAnswers.java | 2 +- .../eu/faircode/email/{FragmentEx.java => FragmentBase.java} | 2 +- app/src/main/java/eu/faircode/email/FragmentCompose.java | 2 +- app/src/main/java/eu/faircode/email/FragmentEula.java | 2 +- app/src/main/java/eu/faircode/email/FragmentFolder.java | 2 +- app/src/main/java/eu/faircode/email/FragmentFolders.java | 2 +- app/src/main/java/eu/faircode/email/FragmentIdentities.java | 2 +- app/src/main/java/eu/faircode/email/FragmentIdentity.java | 2 +- app/src/main/java/eu/faircode/email/FragmentLegend.java | 2 +- app/src/main/java/eu/faircode/email/FragmentLogs.java | 2 +- app/src/main/java/eu/faircode/email/FragmentMessages.java | 2 +- app/src/main/java/eu/faircode/email/FragmentOperations.java | 2 +- app/src/main/java/eu/faircode/email/FragmentOptions.java | 2 +- app/src/main/java/eu/faircode/email/FragmentPro.java | 2 +- app/src/main/java/eu/faircode/email/FragmentQuickSetup.java | 2 +- app/src/main/java/eu/faircode/email/FragmentSetup.java | 3 +-- app/src/main/java/eu/faircode/email/FragmentWebView.java | 2 +- 23 files changed, 24 insertions(+), 25 deletions(-) rename app/src/main/java/eu/faircode/email/{FragmentEx.java => FragmentBase.java} (98%) diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index 45dda06fbb..d6bff49abe 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -40,7 +40,7 @@ import androidx.fragment.app.Fragment; abstract class ActivityBase extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener { private boolean contacts; - private static String[] restart = new String[]{ + private static String[] SETTINGS_RESTART = new String[]{ "unified", "threading", "avatars", "identicons", "preview", "addresses", "pull", "actionbar", "autoclose", "autonext", "confirm", "debug" }; @@ -115,7 +115,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc finish(); if (this.getClass().equals(ActivitySetup.class)) startActivity(getIntent()); - } else if (!this.getClass().equals(ActivitySetup.class) && Arrays.asList(restart).contains(key)) + } else if (!this.getClass().equals(ActivitySetup.class) && Arrays.asList(SETTINGS_RESTART).contains(key)) finish(); } diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 1908fc9c0d..63e18fa35e 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -338,7 +338,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB if (getSupportFragmentManager().getFragments().size() == 0 && !getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT)) { - FragmentEx fragment = (unified ? new FragmentMessages() : new FragmentFolders()); + FragmentBase fragment = (unified ? new FragmentMessages() : new FragmentFolders()); fragment.setArguments(new Bundle()); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); diff --git a/app/src/main/java/eu/faircode/email/FragmentAbout.java b/app/src/main/java/eu/faircode/email/FragmentAbout.java index 7259991def..e9d551acb3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAbout.java +++ b/app/src/main/java/eu/faircode/email/FragmentAbout.java @@ -28,7 +28,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -public class FragmentAbout extends FragmentEx { +public class FragmentAbout extends FragmentBase { private TextView tvVersion; @Override diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 61bc4282ff..afb69993d0 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -83,7 +83,7 @@ import androidx.fragment.app.FragmentTransaction; import static android.accounts.AccountManager.newChooseAccountIntent; -public class FragmentAccount extends FragmentEx { +public class FragmentAccount extends FragmentBase { private ViewGroup view; private Spinner spProvider; diff --git a/app/src/main/java/eu/faircode/email/FragmentAccounts.java b/app/src/main/java/eu/faircode/email/FragmentAccounts.java index 7ad0747ff5..d2332ce60b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccounts.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccounts.java @@ -39,7 +39,7 @@ import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -public class FragmentAccounts extends FragmentEx { +public class FragmentAccounts extends FragmentBase { private RecyclerView rvAccount; private ContentLoadingProgressBar pbWait; private Group grpReady; diff --git a/app/src/main/java/eu/faircode/email/FragmentAnswer.java b/app/src/main/java/eu/faircode/email/FragmentAnswer.java index 31eb6154f1..0e5544ca12 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAnswer.java +++ b/app/src/main/java/eu/faircode/email/FragmentAnswer.java @@ -36,7 +36,7 @@ import androidx.annotation.Nullable; import androidx.constraintlayout.widget.Group; import androidx.lifecycle.Lifecycle; -public class FragmentAnswer extends FragmentEx { +public class FragmentAnswer extends FragmentBase { private ViewGroup view; private EditText etName; private EditText etText; diff --git a/app/src/main/java/eu/faircode/email/FragmentAnswers.java b/app/src/main/java/eu/faircode/email/FragmentAnswers.java index d10df52745..f5082ab8ef 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAnswers.java +++ b/app/src/main/java/eu/faircode/email/FragmentAnswers.java @@ -36,7 +36,7 @@ import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -public class FragmentAnswers extends FragmentEx { +public class FragmentAnswers extends FragmentBase { private RecyclerView rvAnswer; private ContentLoadingProgressBar pbWait; private Group grpReady; diff --git a/app/src/main/java/eu/faircode/email/FragmentEx.java b/app/src/main/java/eu/faircode/email/FragmentBase.java similarity index 98% rename from app/src/main/java/eu/faircode/email/FragmentEx.java rename to app/src/main/java/eu/faircode/email/FragmentBase.java index 52ac4a82e8..6a4f3ba9d8 100644 --- a/app/src/main/java/eu/faircode/email/FragmentEx.java +++ b/app/src/main/java/eu/faircode/email/FragmentBase.java @@ -32,7 +32,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.lifecycle.Lifecycle; -public class FragmentEx extends Fragment { +public class FragmentBase extends Fragment { private String subtitle = " "; private boolean finish = false; diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b1dbd79532..5bdb9c8054 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -129,7 +129,7 @@ import androidx.recyclerview.widget.RecyclerView; import static android.app.Activity.RESULT_OK; -public class FragmentCompose extends FragmentEx { +public class FragmentCompose extends FragmentBase { private enum State {NONE, LOADING, LOADED} private ViewGroup view; diff --git a/app/src/main/java/eu/faircode/email/FragmentEula.java b/app/src/main/java/eu/faircode/email/FragmentEula.java index 2fd2e71067..4386187e0f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentEula.java +++ b/app/src/main/java/eu/faircode/email/FragmentEula.java @@ -30,7 +30,7 @@ import android.widget.Button; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -public class FragmentEula extends FragmentEx { +public class FragmentEula extends FragmentBase { @Override @Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { diff --git a/app/src/main/java/eu/faircode/email/FragmentFolder.java b/app/src/main/java/eu/faircode/email/FragmentFolder.java index e261fa25cd..e051a76a66 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolder.java @@ -42,7 +42,7 @@ import java.util.Calendar; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -public class FragmentFolder extends FragmentEx { +public class FragmentFolder extends FragmentBase { private ViewGroup view; private EditText etName; private EditText etDisplay; diff --git a/app/src/main/java/eu/faircode/email/FragmentFolders.java b/app/src/main/java/eu/faircode/email/FragmentFolders.java index 03f75c604f..25c9d0b1e4 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolders.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolders.java @@ -41,7 +41,7 @@ import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -public class FragmentFolders extends FragmentEx { +public class FragmentFolders extends FragmentBase { private ImageButton ibHintActions; private ImageButton ibHintSync; private ToggleButton tbShowHidden; diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentities.java b/app/src/main/java/eu/faircode/email/FragmentIdentities.java index e8018dfaf2..d58a590a60 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentities.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentities.java @@ -39,7 +39,7 @@ import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -public class FragmentIdentities extends FragmentEx { +public class FragmentIdentities extends FragmentBase { private RecyclerView rvIdentity; private ContentLoadingProgressBar pbWait; private Group grpReady; diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 08f39f2545..5d78320ad3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -75,7 +75,7 @@ import androidx.constraintlayout.widget.Group; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentTransaction; -public class FragmentIdentity extends FragmentEx { +public class FragmentIdentity extends FragmentBase { private ViewGroup view; private EditText etName; diff --git a/app/src/main/java/eu/faircode/email/FragmentLegend.java b/app/src/main/java/eu/faircode/email/FragmentLegend.java index a22e76e8d9..bdd72b4716 100644 --- a/app/src/main/java/eu/faircode/email/FragmentLegend.java +++ b/app/src/main/java/eu/faircode/email/FragmentLegend.java @@ -27,7 +27,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -public class FragmentLegend extends FragmentEx { +public class FragmentLegend extends FragmentBase { @Override @Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { diff --git a/app/src/main/java/eu/faircode/email/FragmentLogs.java b/app/src/main/java/eu/faircode/email/FragmentLogs.java index 612c6d2be3..a7e16d6195 100644 --- a/app/src/main/java/eu/faircode/email/FragmentLogs.java +++ b/app/src/main/java/eu/faircode/email/FragmentLogs.java @@ -38,7 +38,7 @@ import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -public class FragmentLogs extends FragmentEx { +public class FragmentLogs extends FragmentBase { private RecyclerView rvLog; private ContentLoadingProgressBar pbWait; private Group grpReady; diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index bc15888316..ee2e850aa3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -79,7 +79,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -public class FragmentMessages extends FragmentEx { +public class FragmentMessages extends FragmentBase { private ViewGroup view; private SwipeRefreshLayout swipeRefresh; private View popupAnchor; diff --git a/app/src/main/java/eu/faircode/email/FragmentOperations.java b/app/src/main/java/eu/faircode/email/FragmentOperations.java index 9a628a06d3..e0ffe5eef9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOperations.java +++ b/app/src/main/java/eu/faircode/email/FragmentOperations.java @@ -43,7 +43,7 @@ import androidx.lifecycle.Observer; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -public class FragmentOperations extends FragmentEx { +public class FragmentOperations extends FragmentBase { private TextView tvNoOperation; private RecyclerView rvOperation; private ContentLoadingProgressBar pbWait; diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 35617d4288..badfccbaa9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -53,7 +53,7 @@ import androidx.fragment.app.FragmentActivity; import static android.app.Activity.RESULT_OK; -public class FragmentOptions extends FragmentEx implements SharedPreferences.OnSharedPreferenceChangeListener { +public class FragmentOptions extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private SwitchCompat swEnabled; private SwitchCompat swUpdates; diff --git a/app/src/main/java/eu/faircode/email/FragmentPro.java b/app/src/main/java/eu/faircode/email/FragmentPro.java index a5417aad2c..54126b33f3 100644 --- a/app/src/main/java/eu/faircode/email/FragmentPro.java +++ b/app/src/main/java/eu/faircode/email/FragmentPro.java @@ -35,7 +35,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.localbroadcastmanager.content.LocalBroadcastManager; -public class FragmentPro extends FragmentEx implements SharedPreferences.OnSharedPreferenceChangeListener { +public class FragmentPro extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener { private TextView tvActivated; private TextView tvList; private Button btnPurchase; diff --git a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java index eab4b5dff4..00f645ffc0 100644 --- a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java @@ -68,7 +68,7 @@ import androidx.core.content.ContextCompat; import static android.accounts.AccountManager.newChooseAccountIntent; import static android.app.Activity.RESULT_OK; -public class FragmentQuickSetup extends FragmentEx { +public class FragmentQuickSetup extends FragmentBase { private ViewGroup view; private EditText etName; diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index 39dbd2d1ce..f203592cfb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -40,7 +40,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; -import android.widget.ImageButton; import android.widget.TextView; import java.util.List; @@ -52,7 +51,7 @@ import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.LiveData; import androidx.lifecycle.Observer; -public class FragmentSetup extends FragmentEx { +public class FragmentSetup extends FragmentBase { private ViewGroup view; private Button btnQuick; diff --git a/app/src/main/java/eu/faircode/email/FragmentWebView.java b/app/src/main/java/eu/faircode/email/FragmentWebView.java index e3864ff520..df0d12b74e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentWebView.java +++ b/app/src/main/java/eu/faircode/email/FragmentWebView.java @@ -54,7 +54,7 @@ import androidx.annotation.Nullable; // https://developer.android.com/reference/android/webkit/WebView -public class FragmentWebView extends FragmentEx { +public class FragmentWebView extends FragmentBase { private ProgressBar progressBar; private WebView webview;