@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (ActionBarUtil.hasSB()) { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { setInfoBottomMargin(0); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { setInfoBottomMargin( getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height)); } } }
@Override protected void onCreate(Bundle savedInstanceState) { ActionBarUtil.compatibleDeviceWithSB(this); requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); super.onCreate(savedInstanceState); ActionBarUtil.setXiaomiFilterDisplayOptions(getSupportActionBar(), false); getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans)); Bundle extras = getIntent().getExtras(); title = extras.getString("title"); getSupportActionBar().setTitle(title); aid = extras.getInt("aid"); mList = extras.getStringArrayList(EXTRA_IMAGES); int index = extras.getInt(EXTRA_INDEX, 0); MobclickAgent.onEvent(this, "view_big_pic"); setContentView(R.layout.activity_images); indexText = (TextView) findViewById(R.id.index); if (ActionBarUtil.hasSB() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) { setInfoBottomMargin( getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height)); } pager = (MyViewPager) findViewById(R.id.pager); pager.setAdapter(new ImageAdapter(getSupportFragmentManager(), mList)); pager.setOffscreenPageLimit(1); pager.setOnPageChangeListener(this); pager.setCurrentItem(index); onPageSelected(index); }