diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b77f34322..4c04053db 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -27,7 +27,6 @@ + android:screenOrientation="portrait"/> diff --git a/app/src/main/java/gallery/simplemobiletools/com/activities/ViewPagerActivity.java b/app/src/main/java/gallery/simplemobiletools/com/activities/ViewPagerActivity.java index 971f7d743..a6cc699c2 100644 --- a/app/src/main/java/gallery/simplemobiletools/com/activities/ViewPagerActivity.java +++ b/app/src/main/java/gallery/simplemobiletools/com/activities/ViewPagerActivity.java @@ -4,7 +4,10 @@ import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; +import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import java.io.File; @@ -20,6 +23,7 @@ import gallery.simplemobiletools.com.adapters.MyPagerAdapter; public class ViewPagerActivity extends AppCompatActivity { private int pos; private boolean isFullScreen; + private ActionBar actionbar; @Override protected void onCreate(Bundle savedInstanceState) { @@ -27,6 +31,7 @@ public class ViewPagerActivity extends AppCompatActivity { setContentView(R.layout.activity_photo); pos = 0; + actionbar = getSupportActionBar(); isFullScreen = true; hideSystemUI(); @@ -46,6 +51,22 @@ public class ViewPagerActivity extends AppCompatActivity { }); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_share: + return true; + default: + return super.onOptionsItemSelected(item); + } + } + private List getPhotos() { final List photos = new ArrayList<>(); final String path = getIntent().getStringExtra(Constants.PHOTO); @@ -87,6 +108,9 @@ public class ViewPagerActivity extends AppCompatActivity { } private void hideSystemUI() { + if (actionbar != null) + actionbar.hide(); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | @@ -96,6 +120,9 @@ public class ViewPagerActivity extends AppCompatActivity { } private void showSystemUI() { + if (actionbar != null) + actionbar.show(); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml new file mode 100644 index 000000000..de87bba5e --- /dev/null +++ b/app/src/main/res/menu/menu.xml @@ -0,0 +1,10 @@ + + + + +