Skip to content
Snippets Groups Projects
Commit 95749744 authored by Jawnnypoo's avatar Jawnnypoo
Browse files

Save the project and ref across rotation

parent 2760620a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -42,6 +42,9 @@ public class ProjectActivity extends BaseActivity {
private static final String EXTRA_PROJECT_NAMESPACE = "extra_project_namespace";
private static final String EXTRA_PROJECT_NAME = "extra_project_name";
 
private static final String STATE_REF = "ref";
private static final String STATE_PROJECT = "project";
private static final int REQUEST_BRANCH_OR_TAG = 1;
 
public static Intent newIntent(Context context, Project project) {
Loading
Loading
@@ -139,6 +142,10 @@ public class ProjectActivity extends BaseActivity {
ButterKnife.bind(this);
Project project = Parcels.unwrap(getIntent().getParcelableExtra(EXTRA_PROJECT));
 
if (savedInstanceState != null) {
project = Parcels.unwrap(savedInstanceState.getParcelable(STATE_PROJECT));
mRef = Parcels.unwrap(savedInstanceState.getParcelable(STATE_REF));
}
mToolbar.setNavigationIcon(R.drawable.ic_back_24dp);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
Loading
Loading
@@ -178,6 +185,13 @@ public class ProjectActivity extends BaseActivity {
}
}
 
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable(STATE_REF, Parcels.wrap(mRef));
outState.putParcelable(STATE_PROJECT, Parcels.wrap(mProject));
}
private void loadProject(String projectId) {
showProgress();
App.instance().getGitLab().getProject(projectId).enqueue(mProjectCallback);
Loading
Loading
@@ -223,7 +237,9 @@ public class ProjectActivity extends BaseActivity {
 
private void bindProject(Project project) {
mProject = project;
mRef = new Ref(Ref.TYPE_BRANCH, mProject.getDefaultBranch());
if (mRef == null) {
mRef = new Ref(Ref.TYPE_BRANCH, mProject.getDefaultBranch());
}
mToolbar.setTitle(mProject.getName());
mToolbar.setSubtitle(mProject.getNamespace().getName());
setupTabs();
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
//check with ./gradlew dependencyUpdates
classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment