start main activity as new task to reset activity history
This commit is contained in:
parent
b9a9e5a0b3
commit
521d8ef388
4 changed files with 23 additions and 8 deletions
|
|
@ -106,7 +106,10 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
|
|||
if (result.getAccessToken() == null) return;
|
||||
serverCredentials.GetServer(result.getServerId()).setAccessToken(result.getAccessToken());
|
||||
credentialProvider.SaveCredentials(serverCredentials);
|
||||
context.startActivity(new Intent(context, MainActivity.class));
|
||||
|
||||
Intent intent = new Intent(context, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,8 +200,10 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
} else {
|
||||
drawerLayout.openDrawer(navigationView);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
|
@ -211,6 +213,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
drawerLayout.closeDrawers();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.handleBackPress() || (currentFragment != null && currentFragment.handleBackPress());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import org.jellyfin.apiclient.interaction.VolleyHttpClient;
|
|||
import org.jellyfin.apiclient.interaction.connectionmanager.ConnectionManager;
|
||||
import org.jellyfin.apiclient.interaction.http.IAsyncHttpClient;
|
||||
import org.jellyfin.apiclient.logging.AndroidLogger;
|
||||
import org.jellyfin.apiclient.model.apiclient.ConnectionState;
|
||||
import org.jellyfin.apiclient.model.logging.ILogger;
|
||||
import org.jellyfin.apiclient.model.serialization.GsonJsonSerializer;
|
||||
import org.jellyfin.apiclient.model.serialization.IJsonSerializer;
|
||||
|
|
@ -49,9 +50,17 @@ public class SplashActivity extends AbsBaseActivity {
|
|||
connectionManager.Connect(credentialProvider.GetCredentials().getServers().get(0), new Response<ConnectionResult>() {
|
||||
@Override
|
||||
public void onResponse(ConnectionResult result) {
|
||||
//if (result.getState() != ConnectionState.SignedIn) return;
|
||||
App.setApiClient(result.getApiClient());
|
||||
context.startActivity(new Intent(context, MainActivity.class));
|
||||
if (result.getState() != ConnectionState.SignedIn) {
|
||||
Intent intent = new Intent(context, LoginActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
App.setApiClient(result.getApiClient());
|
||||
|
||||
Intent intent = new Intent(context, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
include ':app'
|
||||
|
||||
include ':apiclient'
|
||||
project(':apiclient').projectDir = new File(settingsDir, '../jellyfin-apiclient-java/android')
|
||||
// include ':apiclient'
|
||||
// project(':apiclient').projectDir = new File(settingsDir, '../jellyfin-apiclient-java/android')
|
||||
|
||||
include ':library'
|
||||
project(':library').projectDir = new File(settingsDir, '../jellyfin-apiclient-java/library')
|
||||
// include ':library'
|
||||
// project(':library').projectDir = new File(settingsDir, '../jellyfin-apiclient-java/library')
|
||||
Loading…
Add table
Add a link
Reference in a new issue