1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-25 01:06:04 +00:00

Small behavior improvement

This commit is contained in:
M66B 2022-04-17 14:29:48 +02:00
parent 189f9bff0c
commit 712f7553f3
3 changed files with 27 additions and 19 deletions

View file

@ -103,6 +103,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.Callable;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@ -269,11 +270,12 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
drawerLayout.closeDrawer(drawerContainer);
onMenuFAQ();
}
}, new Runnable() {
}, new Callable<Boolean>() {
@Override
public void run() {
public Boolean call() {
drawerLayout.closeDrawer(drawerContainer);
onDebugInfo();
return true;
}
}).setExternal(true));
@ -299,10 +301,11 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
drawerLayout.closeDrawer(drawerContainer);
onMenuAbout();
}
}, new Runnable() {
}, new Callable<Boolean>() {
@Override
public void run() {
public Boolean call() {
startActivity(new Intent(ActivitySetup.this, ActivityBilling.class));
return true;
}
}).setSubtitle(BuildConfig.VERSION_NAME));

View file

@ -92,6 +92,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Callable;
import javax.net.ssl.HttpsURLConnection;
@ -797,9 +798,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerLayout.closeDrawer(drawerContainer);
onMenuSetup();
}
}, new Runnable() {
}, new Callable<Boolean>() {
@Override
public void run() {
public Boolean call() {
if (BuildConfig.DEBUG)
try {
DnsBlockList.clearCache();
@ -808,6 +809,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
} catch (Throwable ex) {
Log.unexpectedError(getSupportFragmentManager(), ex);
}
return BuildConfig.DEBUG;
}
}));
@ -833,12 +835,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerLayout.closeDrawer(drawerContainer);
onMenuFAQ();
}
}, new Runnable() {
}, new Callable<Boolean>() {
@Override
public void run() {
public Boolean call() {
if (!drawerLayout.isLocked(drawerContainer))
drawerLayout.closeDrawer(drawerContainer);
onDebugInfo();
return true;
}
}).setExternal(true));
@ -849,12 +852,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerLayout.closeDrawer(drawerContainer);
onMenuIssue();
}
}, new Runnable() {
}, new Callable<Boolean>() {
@Override
public void run() {
public Boolean call() {
Intent canary = CoalMine.getIntent();
if (canary != null)
startActivity(canary);
return (canary != null);
}
}).setExternal(true));
@ -891,14 +895,16 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
public void run() {
onMenuAbout();
}
}, new Runnable() {
}, new Callable<Boolean>() {
@Override
public void run() {
if (!Helper.isPlayStoreInstall()) {
public Boolean call() {
boolean play = Helper.isPlayStoreInstall();
if (!play) {
if (!drawerLayout.isLocked(drawerContainer))
drawerLayout.closeDrawer(drawerContainer);
checkUpdate(true);
}
return !play;
}
}).setSeparated().setSubtitle(BuildConfig.VERSION_NAME));

View file

@ -20,6 +20,7 @@ package eu.faircode.email;
*/
import java.util.Objects;
import java.util.concurrent.Callable;
public class NavMenuItem {
private int icon;
@ -31,7 +32,7 @@ public class NavMenuItem {
private boolean warning = false;
private boolean separated = false;
private Runnable click;
private Runnable longClick;
private Callable<Boolean> longClick;
NavMenuItem(int icon, int title, Runnable click) {
this.icon = icon;
@ -39,7 +40,7 @@ public class NavMenuItem {
this.click = click;
}
NavMenuItem(int icon, int title, Runnable click, Runnable longClick) {
NavMenuItem(int icon, int title, Runnable click, Callable<Boolean> longClick) {
this.icon = icon;
this.title = title;
this.click = click;
@ -124,13 +125,11 @@ public class NavMenuItem {
boolean onLongClick() {
try {
if (longClick != null)
longClick.run();
return (longClick != null);
return longClick.call();
} catch (Throwable ex) {
Log.e(ex);
return false;
}
return false;
}
@Override