Search in sources :

Example 46 with ActionBar

use of android.support.v7.app.ActionBar in project simple-stack by Zhuinden.

the class MainActivity method handleStateChange.

@Override
public void handleStateChange(StateChange traversal, final StateChanger.Callback callback) {
    Path path = traversal.topNewState();
    setTitle(path.getTitle());
    ActionBar actionBar = getSupportActionBar();
    boolean canGoBack = traversal.getNewState().size() > 1;
    actionBar.setDisplayHomeAsUpEnabled(canGoBack);
    actionBar.setHomeButtonEnabled(canGoBack);
    containerAsStateChanger.handleStateChange(traversal, new StateChanger.Callback() {

        @Override
        public void stateChangeComplete() {
            invalidateOptionsMenu();
            callback.stateChangeComplete();
        }
    });
}
Also used : ConversationListPath(com.example.stackmasterdetail.paths.conversation.conversationlist.ConversationListPath) FriendListPath(com.example.stackmasterdetail.paths.friend.friendlist.FriendListPath) StateChanger(com.zhuinden.simplestack.StateChanger) ActionBar(android.support.v7.app.ActionBar)

Example 47 with ActionBar

use of android.support.v7.app.ActionBar in project simple-stack by Zhuinden.

the class MainActivity method onCreate.

/**
     * Pay attention to the {@link #setContentView} call here. It's creating a responsive layout
     * for us.
     * <p>
     * Notice that the app has two root_layout files. The main one, in {@code res/layout} is used by
     * mobile devices and by tablets in portrait orientation. It holds a generic {@link
     * com.example.stackmasterdetail.util.pathview.FramePathContainerView}.
     * <p>
     * The interesting one, loaded by tablets in landscape mode, is {@code res/layout-sw600dp-land}.
     * It loads a {@link TabletMasterDetailRoot}, with a master list on the
     * left and a detail view on the right.
     * <p>
     * But this master activity knows nothing about those two view types. It only requires that
     * the view loaded by {@code root_layout.xml} implements the {@link com.example.stackmasterdetail.util.Container} interface,
     * to render whatever is appropriate for the screens received from {@link com.zhuinden.simplestack.Backstack} via
     * {@link #handleStateChange}.
     */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(false);
    setContentView(R.layout.root_layout);
    container = (ViewGroup) findViewById(R.id.container);
    containerAsStateChanger = (StateChanger) container;
    containerAsBackTarget = (HandlesBack) containerAsStateChanger;
    Navigator.configure().setStateChanger(this).setStateClearStrategy(new MasterDetailStateClearStrategy()).setShouldPersistContainerChild(false).install(this, container, HistoryBuilder.single(ConversationListPath.create()));
}
Also used : MasterDetailStateClearStrategy(com.example.stackmasterdetail.util.MasterDetailStateClearStrategy) ActionBar(android.support.v7.app.ActionBar)

Example 48 with ActionBar

use of android.support.v7.app.ActionBar in project Atom_Android by Rogrand-Dev.

the class ImageResultActivity method initEventAndData.

@Override
protected void initEventAndData() {
    setSupportActionBar(mToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
    GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3, GridLayoutManager.VERTICAL, false);
    mRecyclerView.setLayoutManager(gridLayoutManager);
    mAdapter = new ShowImageAdapter(this, mAllDatas, onItemControlListener);
    mAdapter.setMaxShow(9);
    mRecyclerView.setAdapter(mAdapter);
    mAdapter.setOnItemClickListener(new ShowImageAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View v, int position) {
            PictureConfig.getInstance().externalPicturePreview(mContext, position, mAllDatas);
        }
    });
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Example 49 with ActionBar

use of android.support.v7.app.ActionBar in project GSYVideoPlayer by CarGuo.

the class CommonUtil method hideSupportActionBar.

public static void hideSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
    if (actionBar) {
        AppCompatActivity appCompatActivity = CommonUtil.getAppCompActivity(context);
        if (appCompatActivity != null) {
            ActionBar ab = appCompatActivity.getSupportActionBar();
            if (ab != null) {
                ab.setShowHideAnimationEnabled(false);
                ab.hide();
            }
        }
    }
    if (statusBar) {
        if (context instanceof FragmentActivity) {
            FragmentActivity fragmentActivity = (FragmentActivity) context;
            fragmentActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else {
            CommonUtil.getAppCompActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Example 50 with ActionBar

use of android.support.v7.app.ActionBar in project GSYVideoPlayer by CarGuo.

the class CommonUtil method showSupportActionBar.

public static void showSupportActionBar(Context context, boolean actionBar, boolean statusBar) {
    if (actionBar) {
        AppCompatActivity appCompatActivity = CommonUtil.getAppCompActivity(context);
        if (appCompatActivity != null) {
            ActionBar ab = appCompatActivity.getSupportActionBar();
            if (ab != null) {
                ab.setShowHideAnimationEnabled(false);
                ab.show();
            }
        }
    }
    if (statusBar) {
        if (context instanceof FragmentActivity) {
            FragmentActivity fragmentActivity = (FragmentActivity) context;
            fragmentActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else {
            CommonUtil.getAppCompActivity(context).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)784 View (android.view.View)248 Toolbar (android.support.v7.widget.Toolbar)214 TextView (android.widget.TextView)160 Intent (android.content.Intent)118 ImageView (android.widget.ImageView)76 AppCompatActivity (android.support.v7.app.AppCompatActivity)66 RecyclerView (android.support.v7.widget.RecyclerView)57 AdapterView (android.widget.AdapterView)52 Bundle (android.os.Bundle)49 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)49 ListView (android.widget.ListView)44 ColorDrawable (android.graphics.drawable.ColorDrawable)33 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)32 ViewPager (android.support.v4.view.ViewPager)29 ArrayList (java.util.ArrayList)29 SharedPreferences (android.content.SharedPreferences)28 Fragment (android.support.v4.app.Fragment)28 MenuItem (android.view.MenuItem)28 BindView (butterknife.BindView)28