Also show "add repo" and "update/install" in action bar.
The "update" icon was a "+" (add icon) which looked a bit weird, so a quick search of other UI's shows that the "refresh" icon is used for "update". The official Android reference docs say to copy icons that aren't part of the android.R.drawable.* constants into your own drawable-* folders, so I've done that here. The icons are from android SDK version 17.
This commit is contained in:
parent
7a83557772
commit
8679a1241f
BIN
res/drawable-hdpi/ic_menu_refresh.png
Normal file
BIN
res/drawable-hdpi/ic_menu_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
res/drawable-ldpi/ic_menu_refresh.png
Normal file
BIN
res/drawable-ldpi/ic_menu_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-mdpi/ic_menu_refresh.png
Normal file
BIN
res/drawable-mdpi/ic_menu_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-xhdpi/ic_menu_refresh.png
Normal file
BIN
res/drawable-xhdpi/ic_menu_refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
@ -135,7 +135,7 @@ public class AppDetails extends ListActivity {
|
||||
buildtype.setText("bin");
|
||||
}
|
||||
TextView added = (TextView) v.findViewById(R.id.added);
|
||||
if (apk.added != null && apk.added != null) {
|
||||
if (apk.added != null) {
|
||||
added.setVisibility(View.VISIBLE);
|
||||
added.setText(df.format(apk.added));
|
||||
} else {
|
||||
@ -462,18 +462,18 @@ public class AppDetails extends ListActivity {
|
||||
if (app == null)
|
||||
return true;
|
||||
DB.Apk curver = app.getCurrentVersion();
|
||||
List<MenuItem> toShow = new ArrayList<MenuItem>(2);
|
||||
if (app.installedVersion != null && curver != null
|
||||
&& !app.installedVersion.equals(curver.version)) {
|
||||
menu.add(Menu.NONE, INSTALL, 0, R.string.menu_update).setIcon(
|
||||
android.R.drawable.ic_menu_add);
|
||||
toShow.add(menu.add(Menu.NONE, INSTALL, 0, R.string.menu_update).setIcon(
|
||||
R.drawable.ic_menu_refresh));
|
||||
}
|
||||
if (app.installedVersion == null && curver != null) {
|
||||
menu.add(Menu.NONE, INSTALL, 1, R.string.menu_install).setIcon(
|
||||
android.R.drawable.ic_menu_add);
|
||||
toShow.add(menu.add(Menu.NONE, INSTALL, 1, R.string.menu_install).setIcon(
|
||||
android.R.drawable.ic_menu_add));
|
||||
} else {
|
||||
MenuItem launch = menu.add( Menu.NONE, LAUNCH, 1, R.string.menu_launch ).setIcon(
|
||||
android.R.drawable.ic_media_play );
|
||||
CompatabilityUtils.showAsAction( launch );
|
||||
toShow.add(menu.add( Menu.NONE, LAUNCH, 1, R.string.menu_launch ).setIcon(
|
||||
android.R.drawable.ic_media_play));
|
||||
menu.add(Menu.NONE, UNINSTALL, 1, R.string.menu_uninstall).setIcon(
|
||||
android.R.drawable.ic_menu_delete);
|
||||
}
|
||||
@ -495,7 +495,7 @@ public class AppDetails extends ListActivity {
|
||||
menu.add(Menu.NONE, DONATE, 6, R.string.menu_donate).setIcon(
|
||||
android.R.drawable.ic_menu_view);
|
||||
}
|
||||
|
||||
CompatabilityUtils.showAsAction(toShow);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,16 @@ package org.fdroid.fdroid;
|
||||
import android.os.Build;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CompatabilityUtils {
|
||||
|
||||
protected static void showAsAction(List<MenuItem> items) {
|
||||
for ( MenuItem item : items ) {
|
||||
showAsAction(item);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void showAsAction( MenuItem item ) {
|
||||
if ( Build.VERSION.SDK_INT >= 11 ) {
|
||||
item.setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM );
|
||||
|
@ -149,10 +149,11 @@ public class ManageRepo extends ListActivity {
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
super.onCreateOptionsMenu(menu);
|
||||
menu.add(Menu.NONE, ADD_REPO, 1, R.string.menu_add_repo).setIcon(
|
||||
MenuItem item = menu.add(Menu.NONE, ADD_REPO, 1, R.string.menu_add_repo).setIcon(
|
||||
android.R.drawable.ic_menu_add);
|
||||
menu.add(Menu.NONE, REM_REPO, 2, R.string.menu_rem_repo).setIcon(
|
||||
android.R.drawable.ic_menu_close_clear_cancel);
|
||||
CompatabilityUtils.showAsAction(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user