Browse Source

remove unnecessarily menus and helpers

main
Distopico Vegan 6 years ago
parent
commit
ca9302cd58
5 changed files with 3 additions and 132 deletions
  1. +0
    -5
      app/src/main/java/org/dystopia/email/ActivityMain.java
  2. +2
    -54
      app/src/main/java/org/dystopia/email/ActivityView.java
  3. +0
    -3
      app/src/main/java/org/dystopia/email/ApplicationEx.java
  4. +1
    -69
      app/src/main/java/org/dystopia/email/Helper.java
  5. +0
    -1
      app/src/main/res/values/strings.xml

+ 0
- 5
app/src/main/java/org/dystopia/email/ActivityMain.java View File

@ -41,11 +41,6 @@ public class ActivityMain extends AppCompatActivity implements FragmentManager.O
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(this); prefs.registerOnSharedPreferenceChangeListener(this);
if (!Helper.isPlayStoreInstall(this)) {
Log.i(Helper.TAG, "Third party install");
prefs.edit().putBoolean("play_store", false).apply();
}
if (prefs.getBoolean("eula", false)) { if (prefs.getBoolean("eula", false)) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
DB.getInstance(this).account().liveAccounts(true).observe(this, new Observer<List<EntityAccount>>() { DB.getInstance(this).account().liveAccounts(true).observe(this, new Observer<List<EntityAccount>>() {


+ 2
- 54
app/src/main/java/org/dystopia/email/ActivityView.java View File

@ -178,15 +178,9 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
case R.string.menu_about: case R.string.menu_about:
onMenuAbout(); onMenuAbout();
break; break;
case R.string.menu_rate:
onMenuRate();
break;
case R.string.menu_invite: case R.string.menu_invite:
onMenuInvite(); onMenuInvite();
break; break;
case R.string.menu_other:
onMenuOtherApps();
break;
} }
drawerLayout.closeDrawer(drawerList); drawerLayout.closeDrawer(drawerList);
@ -241,12 +235,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
if (getIntentInvite().resolveActivity(getPackageManager()) != null) if (getIntentInvite().resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_people_24, R.string.menu_invite)); drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_people_24, R.string.menu_invite));
if (getIntentRate().resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_star_24, R.string.menu_rate));
if (getIntentOtherApps().resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_get_app_24, R.string.menu_other));
drawerList.setAdapter(drawerArray); drawerList.setAdapter(drawerArray);
} }
}); });
@ -268,8 +256,8 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
checkFirst(); checkFirst();
checkCrash(); checkCrash();
if (!Helper.isPlayStoreInstall(this))
checkUpdate();
// TODO: check update from menu
// checkUpdate();
pgpService = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain"); pgpService = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain");
pgpService.bindToService(); pgpService.bindToService();
@ -636,13 +624,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
return intent; return intent;
} }
private Intent getIntentRate() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + BuildConfig.APPLICATION_ID));
if (intent.resolveActivity(getPackageManager()) == null)
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID));
return intent;
}
private Intent getIntentInvite() { private Intent getIntentInvite() {
Intent intent = new Intent("com.google.android.gms.appinvite.ACTION_APP_INVITE"); Intent intent = new Intent("com.google.android.gms.appinvite.ACTION_APP_INVITE");
intent.setPackage("com.google.android.gms"); intent.setPackage("com.google.android.gms");
@ -653,12 +634,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
return intent; return intent;
} }
private Intent getIntentOtherApps() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://play.google.com/store/apps/dev?id=8420080860664580239"));
return intent;
}
private void onMenuFolders(long account) { private void onMenuFolders(long account) {
getSupportFragmentManager().popBackStack("unified", 0); getSupportFragmentManager().popBackStack("unified", 0);
@ -709,37 +684,10 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
fragmentTransaction.commit(); fragmentTransaction.commit();
} }
private void onMenuRate() {
Intent faq = getIntentFAQ();
if (faq.resolveActivity(getPackageManager()) == null)
Helper.view(this, getIntentRate());
else {
new DialogBuilderLifecycle(this, this)
.setMessage(R.string.title_issue)
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Helper.view(ActivityView.this, getIntentFAQ());
}
})
.setNegativeButton(R.string.title_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Helper.view(ActivityView.this, getIntentRate());
}
})
.show();
}
}
private void onMenuInvite() { private void onMenuInvite() {
startActivityForResult(getIntentInvite(), REQUEST_INVITE); startActivityForResult(getIntentInvite(), REQUEST_INVITE);
} }
private void onMenuOtherApps() {
Helper.view(this, getIntentOtherApps());
}
private class DrawerItem { private class DrawerItem {
private int layout; private int layout;
private int id; private int id;


+ 0
- 3
app/src/main/java/org/dystopia/email/ApplicationEx.java View File

@ -88,9 +88,6 @@ public class ApplicationEx extends Application {
} }
public boolean ownFault(Throwable ex) { public boolean ownFault(Throwable ex) {
//if (!Helper.isPlayStoreInstall(this))
// return true;
if (ex instanceof OutOfMemoryError) if (ex instanceof OutOfMemoryError)
return false; return false;


+ 1
- 69
app/src/main/java/org/dystopia/email/Helper.java View File

@ -185,7 +185,7 @@ public class Helper {
} }
static Address myAddress() throws UnsupportedEncodingException { static Address myAddress() throws UnsupportedEncodingException {
return new InternetAddress("marcel+fairemail@faircode.eu", "FairCode");
return new InternetAddress("distopico@riseup.net", "Distopico");
} }
static String canonicalAddress(String address) { static String canonicalAddress(String address) {
@ -258,17 +258,6 @@ public class Helper {
return null; return null;
} }
static boolean isPlayStoreInstall(Context context) {
if (false && BuildConfig.DEBUG)
return true;
try {
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
} catch (Throwable ex) {
Log.e(TAG, Log.getStackTraceString(ex));
return false;
}
}
static String sha256(String data) throws NoSuchAlgorithmException { static String sha256(String data) throws NoSuchAlgorithmException {
return sha256(data.getBytes()); return sha256(data.getBytes());
} }
@ -281,57 +270,6 @@ public class Helper {
return sb.toString(); return sb.toString();
} }
static String getBillingResponseText(@BillingClient.BillingResponse int responseCode) {
switch (responseCode) {
case BillingClient.BillingResponse.BILLING_UNAVAILABLE:
// Billing API version is not supported for the type requested
return "BILLING_UNAVAILABLE";
case BillingClient.BillingResponse.DEVELOPER_ERROR:
// Invalid arguments provided to the API.
return "DEVELOPER_ERROR";
case BillingClient.BillingResponse.ERROR:
// Fatal error during the API action
return "ERROR";
case BillingClient.BillingResponse.FEATURE_NOT_SUPPORTED:
// Requested feature is not supported by Play Store on the current device.
return "FEATURE_NOT_SUPPORTED";
case BillingClient.BillingResponse.ITEM_ALREADY_OWNED:
// Failure to purchase since item is already owned
return "ITEM_ALREADY_OWNED";
case BillingClient.BillingResponse.ITEM_NOT_OWNED:
// Failure to consume since item is not owned
return "ITEM_NOT_OWNED";
case BillingClient.BillingResponse.ITEM_UNAVAILABLE:
// Requested product is not available for purchase
return "ITEM_UNAVAILABLE";
case BillingClient.BillingResponse.OK:
// Success
return "OK";
case BillingClient.BillingResponse.SERVICE_DISCONNECTED:
// Play Store service is not connected now - potentially transient state.
return "SERVICE_DISCONNECTED";
case BillingClient.BillingResponse.SERVICE_UNAVAILABLE:
// Network connection is down
return "SERVICE_UNAVAILABLE";
case BillingClient.BillingResponse.USER_CANCELED:
// User pressed back or canceled a dialog
return "USER_CANCELED";
default:
return Integer.toString(responseCode);
}
}
public static String getFingerprint(Context context) { public static String getFingerprint(Context context) {
try { try {
PackageManager pm = context.getPackageManager(); PackageManager pm = context.getPackageManager();
@ -356,12 +294,6 @@ public class Helper {
return (signed != null && signed.equals(expected)); return (signed != null && signed.equals(expected));
} }
static boolean isPro(Context context) {
if (false && BuildConfig.DEBUG)
return true;
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false);
}
static long[] toLongArray(List<Long> list) { static long[] toLongArray(List<Long> list) {
long[] result = new long[list.size()]; long[] result = new long[list.size()];
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)


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

@ -39,7 +39,6 @@
<string name="menu_operations">Operations</string> <string name="menu_operations">Operations</string>
<string name="menu_legend">Legend</string> <string name="menu_legend">Legend</string>
<string name="menu_faq">FAQ/support</string> <string name="menu_faq">FAQ/support</string>
<string name="menu_pro">Pro features</string>
<string name="menu_privacy">Privacy</string> <string name="menu_privacy">Privacy</string>
<string name="menu_about">About</string> <string name="menu_about">About</string>
<string name="menu_invite">Invite</string> <string name="menu_invite">Invite</string>


Loading…
Cancel
Save