update support library

fix articlefragment link context menu
This commit is contained in:
Andrew Dolgov 2013-02-11 16:19:12 +04:00
parent e2adb70fe0
commit 6f95c43765
3 changed files with 25 additions and 32 deletions

Binary file not shown.

View File

@ -44,10 +44,7 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
private SharedPreferences m_prefs;
private Article m_article;
private OnlineActivity m_activity;
//private Article m_nextArticle;
//private Article m_prevArticle;
private GestureDetector m_detector;
private boolean m_visible = true;
public ArticleFragment() {
super();
@ -61,35 +58,6 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
private View.OnTouchListener m_gestureListener;
@Override
public boolean onContextItemSelected(MenuItem item) {
/* AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo(); */
switch (item.getItemId()) {
case R.id.article_link_share:
if (m_visible) {
((OnlineActivity) getActivity()).shareArticle(m_article);
}
return true;
case R.id.article_link_copy:
if (m_visible) {
((OnlineActivity) getActivity()).copyToClipboard(m_article.link);
}
return true;
default:
Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId());
return super.onContextItemSelected(item);
}
}
@Override
public void setUserVisibleHint(boolean visible) {
super.setUserVisibleHint(visible);
m_visible = visible;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {

View File

@ -527,6 +527,31 @@ public class OnlineActivity extends CommonActivity {
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
/* AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo(); */
final ArticlePager ap = (ArticlePager)getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
switch (item.getItemId()) {
case R.id.article_link_share:
if (ap != null && ap.getSelectedArticle() != null) {
shareArticle(ap.getSelectedArticle());
}
return true;
case R.id.article_link_copy:
Log.d(TAG, "article_link_copy");
if (ap != null && ap.getSelectedArticle() != null) {
copyToClipboard(ap.getSelectedArticle().link);
}
return true;
default:
Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId());
return super.onContextItemSelected(item);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);