show repo name in ActionBar in "Repo Details"
Before, "Repo Details" always had a title of "Repositories". Now it shows the name of the repo as the title. This also enables the ActionBar back button (aka "display home as up") to return to "Manage Repos".
This commit is contained in:
parent
526c978328
commit
62008e85c6
@ -114,7 +114,8 @@
|
||||
|
||||
<activity
|
||||
android:name=".views.RepoDetailsActivity"
|
||||
android:label="@string/menu_manage" />
|
||||
android:label="@string/menu_manage"
|
||||
android:parentActivityName=".ManageRepo" />
|
||||
|
||||
<activity
|
||||
android:name=".AppDetails"
|
||||
|
@ -3,7 +3,9 @@ package org.fdroid.fdroid.views;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import org.fdroid.fdroid.DB;
|
||||
import org.fdroid.fdroid.DB.Repo;
|
||||
import org.fdroid.fdroid.compat.ActionBarCompat;
|
||||
import org.fdroid.fdroid.views.fragments.RepoDetailsFragment;
|
||||
|
||||
@ -16,6 +18,8 @@ public class RepoDetailsActivity extends FragmentActivity implements RepoDetails
|
||||
|
||||
public static final String DATA_REPO_ID = "repoId";
|
||||
|
||||
private int repoId;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -30,13 +34,21 @@ public class RepoDetailsActivity extends FragmentActivity implements RepoDetails
|
||||
.commit();
|
||||
}
|
||||
|
||||
ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
|
||||
repoId = getIntent().getIntExtra(RepoDetailsFragment.ARG_REPO_ID, -1);
|
||||
|
||||
DB db = DB.getDB();
|
||||
Repo repo = db.getRepo(repoId);
|
||||
DB.releaseDB();
|
||||
|
||||
ActionBarCompat abCompat = ActionBarCompat.create(this);
|
||||
abCompat.setDisplayHomeAsUpEnabled(true);
|
||||
abCompat.setTitle(repo.getName());
|
||||
}
|
||||
|
||||
private void finishWithAction(String actionName) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(actionName, true);
|
||||
data.putExtra(DATA_REPO_ID, getIntent().getIntExtra(RepoDetailsFragment.ARG_REPO_ID, -1));
|
||||
data.putExtra(DATA_REPO_ID, repoId);
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user