Fixed visibility of MenuItems
Use custom namespace for "showAsAction" and "getMenuInflater" instead of "new MenuInflater"
This commit is contained in:
parent
4a2a25a551
commit
813614bb28
|
@ -1,7 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/add_feed" android:icon="?attr/content_new" android:title="@string/add_new_feed_label" android:showAsAction="ifRoom"></item>
|
||||
<item android:id="@+id/visit_website_item" android:title="@string/visit_website_label" android:showAsAction="ifRoom" android:icon="?attr/location_web_site"></item>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/add_feed"
|
||||
android:icon="?attr/content_new"
|
||||
android:title="@string/add_new_feed_label"
|
||||
custom:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/visit_website_item"
|
||||
android:title="@string/visit_website_label"
|
||||
custom:showAsAction="ifRoom"
|
||||
android:icon="?attr/location_web_site"/>
|
||||
|
||||
|
||||
</menu>
|
|
@ -1,7 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@+id/new_folder_item" android:title="@string/create_folder_label" android:showAsAction="ifRoom|withText"></item>
|
||||
<item android:id="@+id/set_to_default_folder_item" android:showAsAction="collapseActionView" android:title="@string/set_to_default_folder"></item>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/new_folder_item"
|
||||
android:title="@string/create_folder_label"
|
||||
custom:showAsAction="ifRoom|withText"/>
|
||||
<item
|
||||
android:id="@+id/set_to_default_folder_item"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/set_to_default_folder"/>
|
||||
|
||||
|
||||
</menu>
|
|
@ -1,26 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/visit_website_item"
|
||||
android:icon="?attr/location_web_site"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/visit_website_label"
|
||||
android:visible="true">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/support_item"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/support_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/share_link_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/share_link_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/share_source_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/share_source_label">
|
||||
</item>
|
||||
|
||||
|
|
|
@ -1,75 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/download_item"
|
||||
android:icon="?attr/av_download"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/download_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/stream_item"
|
||||
android:icon="?attr/action_stream"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/stream_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/play_item"
|
||||
android:icon="?attr/av_play"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/play_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/remove_item"
|
||||
android:icon="?attr/content_discard"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/remove_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@id/skip_episode_item"
|
||||
android:title="@string/skip_episode_label"
|
||||
android:showAsAction="collapseActionView">
|
||||
custom:showAsAction="collapseActionView">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/cancel_download_item"
|
||||
android:icon="?attr/navigation_cancel"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/cancel_download_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/mark_read_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/mark_read_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/mark_unread_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/mark_unread_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/add_to_queue_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/add_to_queue_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/remove_from_queue_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/remove_from_queue_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/share_link_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/share_link_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/visit_website_item"
|
||||
android:icon="?attr/location_web_site"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/visit_website_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/support_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/support_label">
|
||||
</item>
|
||||
|
||||
|
|
|
@ -1,40 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/refresh_item"
|
||||
android:icon="?attr/navigation_refresh"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/refresh_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/mark_all_read_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/mark_all_read_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/show_info_item"
|
||||
android:icon="?attr/action_about"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/show_info_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/remove_item"
|
||||
android:icon="?attr/content_discard"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/remove_feed_label"
|
||||
android:visible="true">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/visit_website_item"
|
||||
android:icon="?attr/location_web_site"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/visit_website_label"
|
||||
android:visible="true">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/support_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/support_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
|
|
|
@ -1,45 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/all_feed_refresh"
|
||||
android:title="@string/refresh_label"
|
||||
android:icon="?attr/navigation_refresh"
|
||||
android:showAsAction="ifRoom|collapseActionView">
|
||||
custom:showAsAction="ifRoom|collapseActionView">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/add_feed"
|
||||
android:title="@string/add_feed_label"
|
||||
android:icon="?attr/content_new"
|
||||
android:showAsAction="ifRoom|collapseActionView">
|
||||
custom:showAsAction="ifRoom|collapseActionView">
|
||||
</item>
|
||||
|
||||
|
||||
<item
|
||||
android:id="@id/search_item"
|
||||
android:icon="?attr/action_search"
|
||||
android:title="@string/search_label"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:actionViewClass="android.support.v7.widget.SearchView"/>
|
||||
<item
|
||||
android:id="@+id/show_player"
|
||||
android:title="@string/show_player_label"
|
||||
android:icon="@drawable/av_play"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
custom:showAsAction="collapseActionView"/>
|
||||
<item
|
||||
android:id="@+id/show_playback_history"
|
||||
android:title="@string/playback_history_label"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
custom:showAsAction="collapseActionView"/>
|
||||
<item
|
||||
android:id="@+id/show_downloads"
|
||||
android:title="@string/downloads_label"
|
||||
android:icon="@drawable/av_download"
|
||||
android:showAsAction="collapseActionView">
|
||||
custom:showAsAction="collapseActionView">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/show_preferences"
|
||||
android:title="@string/settings_label"
|
||||
android:icon="?attr/action_settings"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
custom:showAsAction="collapseActionView"/>
|
||||
|
||||
|
||||
</menu>
|
||||
|
|
|
@ -1,38 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/disable_sleeptimer_item"
|
||||
android:icon="?attr/device_access_time"
|
||||
android:showAsAction="always"
|
||||
custom:showAsAction="always"
|
||||
android:title="@string/sleep_timer_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/set_sleeptimer_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/set_sleeptimer_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/share_link_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/share_link_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/visit_website_item"
|
||||
android:icon="?attr/location_web_site"
|
||||
android:showAsAction="ifRoom|collapseActionView"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/visit_website_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/support_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/support_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
<item
|
||||
android:id="@id/skip_episode_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
custom:showAsAction="collapseActionView"
|
||||
android:title="@string/skip_episode_label"
|
||||
android:visible="true"/>
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ public class DirectoryChooserActivity extends ActionBarActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.directory_chooser, menu);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class FeedInfoActivity extends ActionBarActivity {
|
|||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (feed != null) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.feedinfo, menu);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class FeedItemlistActivity extends ActionBarActivity {
|
|||
searchView.setSearchableInfo(
|
||||
searchManager.getSearchableInfo(getComponentName()));
|
||||
return FeedMenuHandler
|
||||
.onCreateOptionsMenu(new MenuInflater(this), menu);
|
||||
.onCreateOptionsMenu(getMenuInflater(), menu);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -128,11 +128,6 @@ public class ItemviewActivity extends ActionBarActivity {
|
|||
if (item != null) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.feeditem, menu);
|
||||
// MenuItem visibility has to be set programmatically here; TODO remove this workaround
|
||||
MenuItemCompat.setShowAsAction(menu.findItem(R.id.download_item), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
MenuItemCompat.setShowAsAction(menu.findItem(R.id.stream_item), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
MenuItemCompat.setShowAsAction(menu.findItem(R.id.play_item), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
MenuItemCompat.setShowAsAction(menu.findItem(R.id.cancel_download_item), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -178,7 +178,7 @@ public class MainActivity extends ActionBarActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.main, menu);
|
||||
|
||||
SearchManager searchManager =
|
||||
|
|
|
@ -222,7 +222,7 @@ public abstract class MediaplayerActivity extends ActionBarActivity
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.mediaplayer, menu);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class MiroGuideChannelViewActivity extends ActionBarActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.channelview, menu);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue