Search in sources :

Example 1 with InternalWebviewFragment

use of com.instructure.candroid.fragment.InternalWebviewFragment in project instructure-android by instructure.

the class InternalWebViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getToolbar() != null) {
        ViewStyler.themeToolbar(this, getToolbar(), Color.WHITE, Color.BLACK, false);
    }
    if (savedInstanceState == null) {
        Bundle bundle = getIntent().getBundleExtra(Const.EXTRAS);
        if (bundle.containsKey(Const.ACTION_BAR_TITLE)) {
            getToolbar().setTitle(bundle.getString(Const.ACTION_BAR_TITLE));
        }
        if (bundle.containsKey(Const.CANVAS_CONTEXT)) {
            CanvasContext canvasContext = bundle.getParcelable(Const.CANVAS_CONTEXT);
            if (canvasContext != null) {
                // want the internalWebViewFragment to hide its toolbar
                if (canvasContext.getId() == 0) {
                    bundle.putBoolean(HIDE_TOOLBAR, true);
                } else {
                    // todo fix actionbar setting with viewstyler
                    final int color = ColorKeeper.getOrGenerateColor(canvasContext);
                    setActionBarStatusBarColors(color, color);
                    getSupportActionBar().setTitle(canvasContext.getName());
                }
            }
        }
        InternalWebviewFragment fragment = FragUtils.getFrag(InternalWebviewFragment.class, bundle);
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.container, fragment, InternalWebviewFragment.class.getName());
        ft.commitAllowingStateLoss();
    }
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) InternalWebviewFragment(com.instructure.candroid.fragment.InternalWebviewFragment) Bundle(android.os.Bundle) CanvasContext(com.instructure.canvasapi2.models.CanvasContext)

Aggregations

Bundle (android.os.Bundle)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 InternalWebviewFragment (com.instructure.candroid.fragment.InternalWebviewFragment)1 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)1