mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Refactoring
This commit is contained in:
parent
336d2947d0
commit
eb18e56886
23 changed files with 24 additions and 25 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue