reinstate context menus for gallery/video views

This commit is contained in:
Andrew Dolgov 2015-12-03 13:13:57 +03:00
parent 0ca93b827c
commit 51eef8f2da
2 changed files with 14 additions and 38 deletions

View File

@ -25,6 +25,7 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
@ -62,14 +63,6 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
@Override
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
/*ActionBar bar = getSupportActionBar();
if (bar.isShowing()) {
bar.hide();
} else {
bar.show();
}*/
return false;
}
@ -92,10 +85,6 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
m_urls = urls;
}
public ArticleImagesPagerAdapter() {
super();
}
@Override
public int getCount() {
return m_urls.size();
@ -136,7 +125,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
ViewCompat.setTransitionName(imgView, "gallery:" + url);
}
//registerForContextMenu(imgView);
registerForContextMenu(imgView);
view.findViewById(R.id.flavor_image_overflow).setOnClickListener(new View.OnClickListener() {
@Override
@ -350,6 +339,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
m_pager = (ViewPager) findViewById(R.id.article_images_pager);
m_pager.setAdapter(m_adapter);
m_pager.setPageTransformer(true, new DepthPageTransformer());
}
@SuppressLint("NewApi")
@ -358,16 +348,14 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
super.onResume();
}
/*@Override
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
getMenuInflater().inflate(R.menu.context_article_content_img, menu);
super.onCreateContextMenu(menu, v, menuInfo);
}*/
}
@Override
public void onSaveInstanceState(Bundle out) {
@ -378,18 +366,13 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
out.putString("content", m_content);
}
/*@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.context_article_content_img, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return onContextItemSelected(item); // this is really bad :()
}*/
public boolean onContextItemSelected(MenuItem item) {
int position = m_pager.getCurrentItem();
String url = m_checkedUrls.get(position);
return onImageMenuItemSelected(item, url);
}
public boolean onImageMenuItemSelected(MenuItem item, String url) {
switch (item.getItemId()) {

View File

@ -263,13 +263,6 @@ public class VideoPlayerActivity extends CommonActivity {
}
/*@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_video_player, menu);
return true;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
@ -281,9 +274,9 @@ public class VideoPlayerActivity extends CommonActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return onContextItemSelected(item); // this is really bad :()
} */
public boolean onContextItemSelected(MenuItem item) {
return onVideoMenuItemSelected(item);
}
public boolean onVideoMenuItemSelected(android.view.MenuItem item) {
switch (item.getItemId()) {