[and] Back navigation in browser.
This commit is contained in:
parent
945a6f0c87
commit
fe65d3a286
3 changed files with 36 additions and 3 deletions
|
@ -18,6 +18,8 @@ import android.view.MenuItem;
|
|||
public class ArticleInfoDetailActivity extends FragmentActivity
|
||||
{
|
||||
|
||||
private ArticleInfoDetailFragment mArticleInfoDetailFragment;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
|
@ -44,9 +46,12 @@ public class ArticleInfoDetailActivity extends FragmentActivity
|
|||
arguments.putSerializable(ArticleInfoDetailFragment.ARTICLE_INFO,
|
||||
getIntent().getSerializableExtra(ArticleInfoDetailFragment.ARTICLE_INFO));
|
||||
|
||||
ArticleInfoDetailFragment fragment = new ArticleInfoDetailFragment();
|
||||
fragment.setArguments(arguments);
|
||||
getSupportFragmentManager().beginTransaction().add(R.id.articleinfo_detail_container, fragment).commit();
|
||||
mArticleInfoDetailFragment = new ArticleInfoDetailFragment();
|
||||
mArticleInfoDetailFragment.setArguments(arguments);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(R.id.articleinfo_detail_container, mArticleInfoDetailFragment)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,4 +73,13 @@ public class ArticleInfoDetailActivity extends FragmentActivity
|
|||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
if (mArticleInfoDetailFragment.canGoBack())
|
||||
mArticleInfoDetailFragment.goBack();
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,4 +134,14 @@ public class ArticleInfoDetailFragment extends Fragment implements OnClickListen
|
|||
mIconClickedListener = listener;
|
||||
}
|
||||
|
||||
public boolean canGoBack()
|
||||
{
|
||||
return mWebView.canGoBack();
|
||||
}
|
||||
|
||||
public void goBack()
|
||||
{
|
||||
mWebView.goBack();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,4 +106,13 @@ public class ArticleInfoListActivity extends FragmentActivity implements Article
|
|||
{
|
||||
mArtInfoDetailFragment.setArticleInfo(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
if (mTwoPane && mArtInfoDetailFragment.canGoBack())
|
||||
mArtInfoDetailFragment.goBack();
|
||||
else
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue