Browse Source

feat: remove Eula annoying initial view

main
Distopico Vegan 6 years ago
parent
commit
a794fc0ea5
21 changed files with 35 additions and 122 deletions
  1. +16
    -41
      app/src/main/java/org/dystopia/email/ActivityMain.java
  2. +0
    -62
      app/src/main/java/org/dystopia/email/FragmentEula.java
  3. +1
    -1
      app/src/main/res/values-af/strings.xml
  4. +1
    -1
      app/src/main/res/values-cs/strings.xml
  5. +1
    -1
      app/src/main/res/values-el/strings.xml
  6. +1
    -1
      app/src/main/res/values-en/strings.xml
  7. +1
    -1
      app/src/main/res/values-fi/strings.xml
  8. +1
    -1
      app/src/main/res/values-he/strings.xml
  9. +1
    -1
      app/src/main/res/values-iw/strings.xml
  10. +1
    -1
      app/src/main/res/values-ja/strings.xml
  11. +1
    -1
      app/src/main/res/values-ko/strings.xml
  12. +1
    -1
      app/src/main/res/values-nb/strings.xml
  13. +1
    -1
      app/src/main/res/values-no/strings.xml
  14. +1
    -1
      app/src/main/res/values-pt-rBR/strings.xml
  15. +1
    -1
      app/src/main/res/values-pt-rPT/strings.xml
  16. +1
    -1
      app/src/main/res/values-ru/strings.xml
  17. +1
    -1
      app/src/main/res/values-sr/strings.xml
  18. +1
    -1
      app/src/main/res/values-uk/strings.xml
  19. +1
    -1
      app/src/main/res/values-vi/strings.xml
  20. +1
    -1
      app/src/main/res/values-zh-rTW/strings.xml
  21. +1
    -1
      app/src/main/res/values/strings.xml

+ 16
- 41
app/src/main/java/org/dystopia/email/ActivityMain.java View File

@ -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<List<EntityAccount>>() {
@Override
public void onChanged(@Nullable List<EntityAccount> 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<List<EntityAccount>>() {
@Override
public void onChanged(@Nullable List<EntityAccount> 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();
}
}
}

+ 0
- 62
app/src/main/java/org/dystopia/email/FragmentEula.java View File

@ -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 <http://www.gnu.org/licenses/>.
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;
}
}

+ 1
- 1
app/src/main/res/values-af/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-cs/strings.xml View File

@ -40,7 +40,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-el/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-en/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-fi/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-he/strings.xml View File

@ -40,7 +40,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-iw/strings.xml View File

@ -40,7 +40,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-ja/strings.xml View File

@ -28,7 +28,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-ko/strings.xml View File

@ -28,7 +28,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-nb/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-no/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-pt-rBR/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">Eu concordo</string>
<string name="title_disagree">Eu discordo</string>
<string name="title_version">Versão %1$s</string>


+ 1
- 1
app/src/main/res/values-pt-rPT/strings.xml View File

@ -32,7 +32,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-ru/strings.xml View File

@ -40,7 +40,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-sr/strings.xml View File

@ -36,7 +36,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-uk/strings.xml View File

@ -40,7 +40,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-vi/strings.xml View File

@ -28,7 +28,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values-zh-rTW/strings.xml View File

@ -28,7 +28,7 @@
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>
<string name="title_version">Version %1$s</string>


+ 1
- 1
app/src/main/res/values/strings.xml View File

@ -47,7 +47,7 @@
<string name="title_privacy_description"><b>SimpleEmail</b> does not collect any information, does not require unnecessary permissions and is <b>100% Free Software</b>.</string>
<string name="title_permissions"><b>Permissions are needed and why</b></string>
<string name="title_permissions_list"><b>• have full network access</b> (INTERNET): \nto send and receive email <b>\n• view network connections</b> (ACCESS_NETWORK_STATE): \nto monitor internet connectivity changes <b>\n• run at startup</b> (RECEIVE_BOOT_COMPLETED): \nto start monitoring on device start <b>\n• foreground service</b> (FOREGROUND_SERVICE): \nto run a foreground service on Android 9 Pie and later <b>\n• prevent device from sleeping</b> (WAKE_LOCK): \nto keep the device awake while synchronizing messages <b>\n• [Optional] read your contacts</b> (READ_CONTACTS): \nto autocomplete addresses and to show photos <b>\n• [Optional] find accounts on the device</b> (GET_ACCOUNTS): \nto use OAuth instead of passwords</string>
<string name="title_eula">End-user license agreement</string>
<string name="title_agree">I agree</string>
<string name="title_disagree">I disagree</string>


Loading…
Cancel
Save