Search in sources :

Example 1 with ActionBarContainer

use of android.support.v7.widget.ActionBarContainer in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method ensureSubDecor.

final void ensureSubDecor() {
    if (mHasActionBar && !mSubDecorInstalled) {
        if (mOverlayActionBar) {
            mActivity.superSetContentView(R.layout.abc_action_bar_decor_overlay);
        } else {
            mActivity.superSetContentView(R.layout.abc_action_bar_decor);
        }
        mActionBarView = (ActionBarView) mActivity.findViewById(R.id.action_bar);
        mActionBarView.setWindowCallback(mActivity);
        /**
         * Progress Bars
         */
        if (mFeatureProgress) {
            mActionBarView.initProgress();
        }
        if (mFeatureIndeterminateProgress) {
            mActionBarView.initIndeterminateProgress();
        }
        /**
         * Split Action Bar
         */
        boolean splitWhenNarrow = UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata());
        boolean splitActionBar;
        if (splitWhenNarrow) {
            splitActionBar = mActivity.getResources().getBoolean(R.bool.abc_split_action_bar_is_narrow);
        } else {
            TypedArray a = mActivity.obtainStyledAttributes(R.styleable.ActionBarWindow);
            splitActionBar = a.getBoolean(R.styleable.ActionBarWindow_windowSplitActionBar, false);
            a.recycle();
        }
        final ActionBarContainer splitView = (ActionBarContainer) mActivity.findViewById(R.id.split_action_bar);
        if (splitView != null) {
            mActionBarView.setSplitView(splitView);
            mActionBarView.setSplitActionBar(splitActionBar);
            mActionBarView.setSplitWhenNarrow(splitWhenNarrow);
            final ActionBarContextView cab = (ActionBarContextView) mActivity.findViewById(R.id.action_context_bar);
            cab.setSplitView(splitView);
            cab.setSplitActionBar(splitActionBar);
            cab.setSplitWhenNarrow(splitWhenNarrow);
        }
        mSubDecorInstalled = true;
        supportInvalidateOptionsMenu();
    }
}
Also used : ActionBarContainer(android.support.v7.internal.widget.ActionBarContainer) TypedArray(android.content.res.TypedArray) ActionBarContextView(android.support.v7.internal.widget.ActionBarContextView)

Example 2 with ActionBarContainer

use of android.support.v7.widget.ActionBarContainer in project ChatExchange by HueToYou.

the class ChatroomsExplorationActivity method normalOnCreate.

private void normalOnCreate() {
    hueNetworkStatusChanged = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
                new RequestFactory().get("http://www.google.com/", true, new RequestFactory.Listener() {

                    @Override
                    public void onSucceeded(URL url, String data) {
                    }

                    @Override
                    public void onFailed(String message) {
                        Intent hueIntent = new Intent(ChatroomsExplorationActivity.this, OfflineActivity.class);
                        startActivity(hueIntent);
                        finish();
                    }
                });
            }
        }
    };
    this.registerReceiver(hueNetworkStatusChanged, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    setContentView(R.layout.activity_chatrooms_exploration);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    // Set up the action bar.
    final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(android.support.v7.app.ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayHomeAsUpEnabled(true);
    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });
    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
    ActionBarHue.setActionBarColorToSharedPrefsValue(this);
    ActionBarHue.setTabBarColorToSharedPrefsValue(this);
    ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView();
    LinearLayout testb = (LinearLayout) viewGroup.getChildAt(0);
    FrameLayout testc = (FrameLayout) testb.getChildAt(1);
    ActionBarOverlayLayout testd = (ActionBarOverlayLayout) testc.getChildAt(0);
    ActionBarContainer teste = (ActionBarContainer) testd.getChildAt(1);
    LinearLayoutCompat testg;
    if (getResources().getConfiguration().orientation == ORIENTATION_PORTRAIT) {
        ScrollingTabContainerView testf = (ScrollingTabContainerView) teste.getChildAt(2);
        testg = (LinearLayoutCompat) testf.getChildAt(0);
    } else // Landscape
    {
        Toolbar teste2 = (Toolbar) teste.getChildAt(0);
        ScrollingTabContainerView testf = (ScrollingTabContainerView) teste2.getChildAt(0);
        testg = (LinearLayoutCompat) testf.getChildAt(0);
    }
    testg.setId(android.R.id.tabcontent);
    // String IdAsString = testg.getResources().getResourceName(testg.getId());
    // Log.e("TestG", IdAsString);
    TutorialStuff.chatsExplorationTutorial(this, testg);
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) ActionBarContainer(android.support.v7.widget.ActionBarContainer) ViewGroup(android.view.ViewGroup) Intent(android.content.Intent) ActionBarOverlayLayout(android.support.v7.widget.ActionBarOverlayLayout) BroadcastReceiver(android.content.BroadcastReceiver) ViewPager(android.support.v4.view.ViewPager) URL(java.net.URL) LinearLayoutCompat(android.support.v7.widget.LinearLayoutCompat) RequestFactory(com.huetoyou.chatexchange.net.RequestFactory) FrameLayout(android.widget.FrameLayout) ScrollingTabContainerView(android.support.v7.widget.ScrollingTabContainerView) LinearLayout(android.widget.LinearLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with ActionBarContainer

use of android.support.v7.widget.ActionBarContainer in project HoloEverywhere by Prototik.

the class ActionBarImplBase method init.

private void init(ActionBarActivity activity) {
    mOverlayLayout = (ActionBarOverlayLayout) activity.findViewById(R.id.action_bar_overlay_layout);
    if (mOverlayLayout != null) {
        mOverlayLayout.setActionBar(this);
    }
    mActionView = (ActionBarView) activity.findViewById(R.id.action_bar);
    mContextView = (ActionBarContextView) activity.findViewById(R.id.action_context_bar);
    mContainerView = (ActionBarContainer) activity.findViewById(R.id.action_bar_container);
    mTopVisibilityView = (ViewGroup) activity.findViewById(R.id.top_action_bar);
    if (mTopVisibilityView == null) {
        mTopVisibilityView = mContainerView;
    }
    mSplitView = (ActionBarContainer) activity.findViewById(R.id.split_action_bar);
    if (mActionView == null || mContextView == null || mContainerView == null) {
        throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with a compatible window decor layout");
    }
    mActionView.setContextView(mContextView);
    mContextDisplayMode = mActionView.isSplitActionBar() ? CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;
    // This was initially read from the action bar style
    final int current = mActionView.getDisplayOptions();
    final boolean homeAsUp = (current & DISPLAY_HOME_AS_UP) != 0;
    if (homeAsUp) {
        mDisplayHomeAsUpSet = true;
    }
    ActionBarPolicy abp = ActionBarPolicy.get(mContext);
    setHomeButtonEnabled(abp.enableHomeButtonByDefault() || homeAsUp);
    setHasEmbeddedTabs(abp.hasEmbeddedTabs());
    setTitle(mActivity.getTitle());
}
Also used : ActionBarPolicy(android.support.v7.internal.view.ActionBarPolicy)

Aggregations

BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 TypedArray (android.content.res.TypedArray)1 ViewPager (android.support.v4.view.ViewPager)1 ActionBarPolicy (android.support.v7.internal.view.ActionBarPolicy)1 ActionBarContainer (android.support.v7.internal.widget.ActionBarContainer)1 ActionBarContextView (android.support.v7.internal.widget.ActionBarContextView)1 ActionBarContainer (android.support.v7.widget.ActionBarContainer)1 ActionBarOverlayLayout (android.support.v7.widget.ActionBarOverlayLayout)1 LinearLayoutCompat (android.support.v7.widget.LinearLayoutCompat)1 ScrollingTabContainerView (android.support.v7.widget.ScrollingTabContainerView)1 Toolbar (android.support.v7.widget.Toolbar)1 ViewGroup (android.view.ViewGroup)1 FrameLayout (android.widget.FrameLayout)1 LinearLayout (android.widget.LinearLayout)1 RequestFactory (com.huetoyou.chatexchange.net.RequestFactory)1 URL (java.net.URL)1