diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index 22e0cd1a2..77f4831f5 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -134,6 +134,7 @@ public class ViewPagerActivity extends SimpleActivity @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.viewpager_menu, menu); + menu.findItem(R.id.menu_set_as_wallpaper).setVisible(getCurrentMedium().isImage()); return true; } @@ -141,6 +142,8 @@ public class ViewPagerActivity extends SimpleActivity public boolean onOptionsItemSelected(MenuItem item) { deleteFile(); switch (item.getItemId()) { + case R.id.menu_set_as_wallpaper: + return true; case R.id.menu_share: shareMedium(); return true; @@ -385,6 +388,7 @@ public class ViewPagerActivity extends SimpleActivity public void onPageSelected(int position) { updateActionbarTitle(); mPos = position; + supportInvalidateOptionsMenu(); } @Override diff --git a/app/src/main/java/com/simplemobiletools/gallery/models/Medium.java b/app/src/main/java/com/simplemobiletools/gallery/models/Medium.java index b951a93d3..c4e69063b 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/models/Medium.java +++ b/app/src/main/java/com/simplemobiletools/gallery/models/Medium.java @@ -39,6 +39,10 @@ public class Medium implements Serializable, Comparable { return getPath().endsWith(".gif"); } + public boolean isImage() { + return !isGif() && !getIsVideo(); + } + @Override public int compareTo(Object object) { final Medium medium = (Medium) object; diff --git a/app/src/main/res/menu/viewpager_menu.xml b/app/src/main/res/menu/viewpager_menu.xml index 243dc202a..608b1091c 100644 --- a/app/src/main/res/menu/viewpager_menu.xml +++ b/app/src/main/res/menu/viewpager_menu.xml @@ -1,6 +1,10 @@