mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Do not show splash screen when signed in
This commit is contained in:
@@ -94,6 +94,7 @@ public class AppModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean databaseExists() {
|
public boolean databaseExists() {
|
||||||
|
// FIXME should not run on UiThread #620
|
||||||
if (!dir.isDirectory()) return false;
|
if (!dir.isDirectory()) return false;
|
||||||
File[] files = dir.listFiles();
|
File[] files = dir.listFiles();
|
||||||
return files != null && files.length > 0;
|
return files != null && files.length > 0;
|
||||||
|
|||||||
@@ -17,4 +17,7 @@ public interface ConfigController {
|
|||||||
void deleteAccount(Context ctx);
|
void deleteAccount(Context ctx);
|
||||||
|
|
||||||
boolean accountExists();
|
boolean accountExists();
|
||||||
|
|
||||||
|
boolean accountSignedIn();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,4 +52,10 @@ public class ConfigControllerImpl implements ConfigController {
|
|||||||
String hex = getEncryptedDatabaseKey();
|
String hex = getEncryptedDatabaseKey();
|
||||||
return hex != null && databaseConfig.databaseExists();
|
return hex != null && databaseConfig.databaseExists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean accountSignedIn() {
|
||||||
|
return databaseConfig.getEncryptionKey() != null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static android.os.Build.MANUFACTURER;
|
|
||||||
import static android.os.Build.VERSION.SDK_INT;
|
|
||||||
import static android.support.v4.app.FragmentManager.POP_BACK_STACK_INCLUSIVE;
|
import static android.support.v4.app.FragmentManager.POP_BACK_STACK_INCLUSIVE;
|
||||||
import static android.support.v4.view.GravityCompat.START;
|
import static android.support.v4.view.GravityCompat.START;
|
||||||
import static android.support.v4.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED;
|
import static android.support.v4.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED;
|
||||||
@@ -214,18 +212,6 @@ public class NavDrawerActivity extends BriarActivity implements
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (drawerLayout.isDrawerOpen(START)) {
|
if (drawerLayout.isDrawerOpen(START)) {
|
||||||
drawerLayout.closeDrawer(START);
|
drawerLayout.closeDrawer(START);
|
||||||
} else if (getSupportFragmentManager().getBackStackEntryCount() == 0 &&
|
|
||||||
getSupportFragmentManager()
|
|
||||||
.findFragmentByTag(ContactListFragment.TAG) != null) {
|
|
||||||
if (SDK_INT == 19 && MANUFACTURER.equalsIgnoreCase("Samsung")) {
|
|
||||||
// workaround for #1116 causes splash screen to show again
|
|
||||||
super.onBackPressed();
|
|
||||||
} else {
|
|
||||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
|
||||||
i.addCategory(Intent.CATEGORY_HOME);
|
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(i);
|
|
||||||
}
|
|
||||||
} else if (getSupportFragmentManager().getBackStackEntryCount() == 0 &&
|
} else if (getSupportFragmentManager().getBackStackEntryCount() == 0 &&
|
||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.findFragmentByTag(ContactListFragment.TAG) == null) {
|
.findFragmentByTag(ContactListFragment.TAG) == null) {
|
||||||
|
|||||||
@@ -43,10 +43,15 @@ public class SplashScreenActivity extends BaseActivity {
|
|||||||
|
|
||||||
setContentView(R.layout.splash);
|
setContentView(R.layout.splash);
|
||||||
|
|
||||||
new Handler().postDelayed(() -> {
|
if (configController.accountSignedIn()) {
|
||||||
startNextActivity();
|
startActivity(new Intent(this, NavDrawerActivity.class));
|
||||||
supportFinishAfterTransition();
|
finish();
|
||||||
}, 500);
|
} else {
|
||||||
|
new Handler().postDelayed(() -> {
|
||||||
|
startNextActivity();
|
||||||
|
supportFinishAfterTransition();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user