Bring back "Update repos" to the main menu

This can later be removed again if the user still has a way to easily update
repos manually without having to enter "Manage Repos" and exit again. A good
option would be a pull-to-refresh action.
This commit is contained in:
Daniel Martí 2014-03-28 17:59:07 +01:00
parent 8efa9d609a
commit abdd2fbb8e

View File

@ -63,11 +63,12 @@ public class FDroid extends FragmentActivity {
public static final String EXTRA_TAB_UPDATE = "extraTab"; public static final String EXTRA_TAB_UPDATE = "extraTab";
private static final int MANAGE_REPO = Menu.FIRST; private static final int UPDATE_REPO = Menu.FIRST;
private static final int PREFERENCES = Menu.FIRST + 1; private static final int MANAGE_REPO = Menu.FIRST + 1;
private static final int ABOUT = Menu.FIRST + 2; private static final int PREFERENCES = Menu.FIRST + 2;
private static final int SEARCH = Menu.FIRST + 3; private static final int ABOUT = Menu.FIRST + 3;
private static final int BLUETOOTH_APK = Menu.FIRST + 4; private static final int SEARCH = Menu.FIRST + 4;
private static final int BLUETOOTH_APK = Menu.FIRST + 5;
/* request codes for Bluetooth flows */ /* request codes for Bluetooth flows */
private BluetoothAdapter mBluetoothAdapter = null; private BluetoothAdapter mBluetoothAdapter = null;
@ -143,6 +144,8 @@ public class FDroid extends FragmentActivity {
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
menu.add(Menu.NONE, UPDATE_REPO, 1, R.string.menu_update_repo).setIcon(
android.R.drawable.ic_menu_rotate);
menu.add(Menu.NONE, MANAGE_REPO, 2, R.string.menu_manage).setIcon( menu.add(Menu.NONE, MANAGE_REPO, 2, R.string.menu_manage).setIcon(
android.R.drawable.ic_menu_agenda); android.R.drawable.ic_menu_agenda);
MenuItem search = menu.add(Menu.NONE, SEARCH, 3, R.string.menu_search).setIcon( MenuItem search = menu.add(Menu.NONE, SEARCH, 3, R.string.menu_search).setIcon(
@ -162,6 +165,10 @@ public class FDroid extends FragmentActivity {
switch (item.getItemId()) { switch (item.getItemId()) {
case UPDATE_REPO:
updateRepos();
return true;
case MANAGE_REPO: case MANAGE_REPO:
Intent i = new Intent(this, ManageRepo.class); Intent i = new Intent(this, ManageRepo.class);
startActivityForResult(i, REQUEST_MANAGEREPOS); startActivityForResult(i, REQUEST_MANAGEREPOS);