mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 01:36:55 +00:00
Small behavior improvement
This commit is contained in:
parent
189f9bff0c
commit
712f7553f3
3 changed files with 27 additions and 19 deletions
|
@ -103,6 +103,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
|
@ -269,11 +270,12 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onMenuFAQ();
|
onMenuFAQ();
|
||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Callable<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public Boolean call() {
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onDebugInfo();
|
onDebugInfo();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).setExternal(true));
|
}).setExternal(true));
|
||||||
|
|
||||||
|
@ -299,10 +301,11 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onMenuAbout();
|
onMenuAbout();
|
||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Callable<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public Boolean call() {
|
||||||
startActivity(new Intent(ActivitySetup.this, ActivityBilling.class));
|
startActivity(new Intent(ActivitySetup.this, ActivityBilling.class));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).setSubtitle(BuildConfig.VERSION_NAME));
|
}).setSubtitle(BuildConfig.VERSION_NAME));
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
@ -797,9 +798,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onMenuSetup();
|
onMenuSetup();
|
||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Callable<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public Boolean call() {
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG)
|
||||||
try {
|
try {
|
||||||
DnsBlockList.clearCache();
|
DnsBlockList.clearCache();
|
||||||
|
@ -808,6 +809,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.unexpectedError(getSupportFragmentManager(), ex);
|
Log.unexpectedError(getSupportFragmentManager(), ex);
|
||||||
}
|
}
|
||||||
|
return BuildConfig.DEBUG;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -833,12 +835,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onMenuFAQ();
|
onMenuFAQ();
|
||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Callable<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public Boolean call() {
|
||||||
if (!drawerLayout.isLocked(drawerContainer))
|
if (!drawerLayout.isLocked(drawerContainer))
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onDebugInfo();
|
onDebugInfo();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}).setExternal(true));
|
}).setExternal(true));
|
||||||
|
|
||||||
|
@ -849,12 +852,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
onMenuIssue();
|
onMenuIssue();
|
||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Callable<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public Boolean call() {
|
||||||
Intent canary = CoalMine.getIntent();
|
Intent canary = CoalMine.getIntent();
|
||||||
if (canary != null)
|
if (canary != null)
|
||||||
startActivity(canary);
|
startActivity(canary);
|
||||||
|
return (canary != null);
|
||||||
}
|
}
|
||||||
}).setExternal(true));
|
}).setExternal(true));
|
||||||
|
|
||||||
|
@ -891,14 +895,16 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||||
public void run() {
|
public void run() {
|
||||||
onMenuAbout();
|
onMenuAbout();
|
||||||
}
|
}
|
||||||
}, new Runnable() {
|
}, new Callable<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public Boolean call() {
|
||||||
if (!Helper.isPlayStoreInstall()) {
|
boolean play = Helper.isPlayStoreInstall();
|
||||||
|
if (!play) {
|
||||||
if (!drawerLayout.isLocked(drawerContainer))
|
if (!drawerLayout.isLocked(drawerContainer))
|
||||||
drawerLayout.closeDrawer(drawerContainer);
|
drawerLayout.closeDrawer(drawerContainer);
|
||||||
checkUpdate(true);
|
checkUpdate(true);
|
||||||
}
|
}
|
||||||
|
return !play;
|
||||||
}
|
}
|
||||||
}).setSeparated().setSubtitle(BuildConfig.VERSION_NAME));
|
}).setSeparated().setSubtitle(BuildConfig.VERSION_NAME));
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
public class NavMenuItem {
|
public class NavMenuItem {
|
||||||
private int icon;
|
private int icon;
|
||||||
|
@ -31,7 +32,7 @@ public class NavMenuItem {
|
||||||
private boolean warning = false;
|
private boolean warning = false;
|
||||||
private boolean separated = false;
|
private boolean separated = false;
|
||||||
private Runnable click;
|
private Runnable click;
|
||||||
private Runnable longClick;
|
private Callable<Boolean> longClick;
|
||||||
|
|
||||||
NavMenuItem(int icon, int title, Runnable click) {
|
NavMenuItem(int icon, int title, Runnable click) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
|
@ -39,7 +40,7 @@ public class NavMenuItem {
|
||||||
this.click = click;
|
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.icon = icon;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.click = click;
|
this.click = click;
|
||||||
|
@ -124,13 +125,11 @@ public class NavMenuItem {
|
||||||
|
|
||||||
boolean onLongClick() {
|
boolean onLongClick() {
|
||||||
try {
|
try {
|
||||||
if (longClick != null)
|
return longClick.call();
|
||||||
longClick.run();
|
|
||||||
return (longClick != null);
|
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue