From a794fc0ea57173b667d6a7045e84749637414771 Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Wed, 7 Nov 2018 22:06:24 -0500 Subject: [PATCH] feat: remove Eula annoying initial view --- .../java/org/dystopia/email/ActivityMain.java | 57 +++++------------ .../java/org/dystopia/email/FragmentEula.java | 62 ------------------- app/src/main/res/values-af/strings.xml | 2 +- app/src/main/res/values-cs/strings.xml | 2 +- app/src/main/res/values-el/strings.xml | 2 +- app/src/main/res/values-en/strings.xml | 2 +- app/src/main/res/values-fi/strings.xml | 2 +- app/src/main/res/values-he/strings.xml | 2 +- app/src/main/res/values-iw/strings.xml | 2 +- app/src/main/res/values-ja/strings.xml | 2 +- app/src/main/res/values-ko/strings.xml | 2 +- app/src/main/res/values-nb/strings.xml | 2 +- app/src/main/res/values-no/strings.xml | 2 +- app/src/main/res/values-pt-rBR/strings.xml | 2 +- app/src/main/res/values-pt-rPT/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values-sr/strings.xml | 2 +- app/src/main/res/values-uk/strings.xml | 2 +- app/src/main/res/values-vi/strings.xml | 2 +- app/src/main/res/values-zh-rTW/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 21 files changed, 35 insertions(+), 122 deletions(-) delete mode 100644 app/src/main/java/org/dystopia/email/FragmentEula.java diff --git a/app/src/main/java/org/dystopia/email/ActivityMain.java b/app/src/main/java/org/dystopia/email/ActivityMain.java index 5db0bba5..499cbb5c 100644 --- a/app/src/main/java/org/dystopia/email/ActivityMain.java +++ b/app/src/main/java/org/dystopia/email/ActivityMain.java @@ -33,56 +33,31 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.Observer; -public class ActivityMain extends AppCompatActivity implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener { +public class ActivityMain extends AppCompatActivity implements FragmentManager.OnBackStackChangedListener { @Override protected void onCreate(Bundle savedInstanceState) { getSupportFragmentManager().addOnBackStackChangedListener(this); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - prefs.registerOnSharedPreferenceChangeListener(this); - - if (prefs.getBoolean("eula", false)) { - super.onCreate(savedInstanceState); - DB.getInstance(this).account().liveAccounts(true).observe(this, new Observer>() { - @Override - public void onChanged(@Nullable List accounts) { - if (accounts == null || accounts.size() == 0) - startActivity(new Intent(ActivityMain.this, ActivitySetup.class)); - else { - startActivity(new Intent(ActivityMain.this, ActivityView.class)); - ServiceSynchronize.init(ActivityMain.this); - } - finish(); + super.onCreate(savedInstanceState); + DB.getInstance(this).account().liveAccounts(true).observe(this, new Observer>() { + @Override + public void onChanged(@Nullable List accounts) { + if (accounts == null || accounts.size() == 0) { + startActivity(new Intent(ActivityMain.this, ActivitySetup.class)); + } else { + startActivity(new Intent(ActivityMain.this, ActivityView.class)); + ServiceSynchronize.init(ActivityMain.this); } - }); - } else { - setTheme(R.style.AppThemeLight); - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); - fragmentTransaction.replace(R.id.content_frame, new FragmentEula()).addToBackStack("eula"); - fragmentTransaction.commit(); - } + finish(); + } + }); } - - @Override - protected void onDestroy() { - PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this); - super.onDestroy(); - } - + @Override public void onBackStackChanged() { int count = getSupportFragmentManager().getBackStackEntryCount(); - if (count == 0) + if (count == 0) { finish(); - } - - @Override - public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { - if ("eula".equals(key)) - if (prefs.getBoolean(key, false)) - recreate(); + } } } diff --git a/app/src/main/java/org/dystopia/email/FragmentEula.java b/app/src/main/java/org/dystopia/email/FragmentEula.java deleted file mode 100644 index ea76ec54..00000000 --- a/app/src/main/java/org/dystopia/email/FragmentEula.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.dystopia.email; - -/* - This file is part of FairEmail. - - FairEmail is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - FairEmail is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with FairEmail. If not, see . - - Copyright 2018, Marcel Bokhorst (M66B) -*/ - -import android.content.SharedPreferences; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public class FragmentEula extends FragmentEx { - - @Override - @Nullable - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - setSubtitle(R.string.title_eula); - - View view = inflater.inflate(R.layout.fragment_eula, container, false); - - Button btnAgree = view.findViewById(R.id.btnOk); - Button btnDisagree = view.findViewById(R.id.btnCancel); - - btnAgree.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - prefs.edit().putBoolean("eula", true).apply(); - } - }); - - btnDisagree.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - getActivity().finish(); - } - }); - - return view; - } -} diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml index b18cceb1..fb39a2bf 100644 --- a/app/src/main/res/values-af/strings.xml +++ b/app/src/main/res/values-af/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index c99bde98..ef8e1865 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -40,7 +40,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index b18cceb1..fb39a2bf 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 1ade8b77..0f68f15b 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index b18cceb1..fb39a2bf 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index fc3c240c..1c449c7a 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -40,7 +40,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index fc3c240c..1c449c7a 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -40,7 +40,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d372ace2..0927d8a1 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -28,7 +28,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index d372ace2..0927d8a1 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -28,7 +28,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index b18cceb1..fb39a2bf 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index b18cceb1..fb39a2bf 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index a91eb061..c0af5a4e 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + Eu concordo Eu discordo Versão %1$s diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index b18cceb1..fb39a2bf 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -32,7 +32,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index c99bde98..ef8e1865 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -40,7 +40,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 2fb9838c..2e90d4fb 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -36,7 +36,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index c99bde98..ef8e1865 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -40,7 +40,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index d372ace2..0927d8a1 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -28,7 +28,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d372ace2..0927d8a1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -28,7 +28,7 @@ Invite Rate this app Other apps - End-user license agreement + I agree I disagree Version %1$s diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ee634596..6a67f875 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -47,7 +47,7 @@ SimpleEmail does not collect any information, does not require unnecessary permissions and is 100% Free Software. Permissions are needed and why • have full network access (INTERNET): \nto send and receive email \n• view network connections (ACCESS_NETWORK_STATE): \nto monitor internet connectivity changes \n• run at startup (RECEIVE_BOOT_COMPLETED): \nto start monitoring on device start \n• foreground service (FOREGROUND_SERVICE): \nto run a foreground service on Android 9 Pie and later \n• prevent device from sleeping (WAKE_LOCK): \nto keep the device awake while synchronizing messages \n• [Optional] read your contacts (READ_CONTACTS): \nto autocomplete addresses and to show photos \n• [Optional] find accounts on the device (GET_ACCOUNTS): \nto use OAuth instead of passwords - End-user license agreement + I agree I disagree