use of android.support.v4.view.PagerTitleStrip in project Talon-for-Twitter by klinker24.
the class SearchPager method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit);
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception ex) {
// Ignore
}
context = this;
sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
settings = AppSettings.getInstance(this);
try {
searchQuery = getIntent().getStringExtra(SearchManager.QUERY);
} catch (Exception e) {
searchQuery = "";
}
if (searchQuery == null) {
searchQuery = "";
}
handleIntent(getIntent());
if (Build.VERSION.SDK_INT > 18 && settings.uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet))) {
translucent = true;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
try {
int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode");
if (immersive == 1) {
translucent = false;
}
} catch (Exception e) {
}
} else {
translucent = false;
}
Utils.setUpTheme(context, settings);
setContentView(R.layout.search_pager);
actionBar = getActionBar();
actionBar.setTitle(getResources().getString(R.string.search));
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
View statusBar = findViewById(R.id.activity_status_bar);
mViewPager = (ViewPager) findViewById(R.id.pager);
if (translucent) {
statusBar.setVisibility(View.VISIBLE);
int statusBarHeight = Utils.getStatusBarHeight(context);
LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams();
statusParams.height = statusBarHeight;
statusBar.setLayoutParams(statusParams);
} else {
mViewPager.setPadding(0, 0, 0, 0);
}
mSectionsPagerAdapter = new SearchPagerAdapter(getFragmentManager(), context, onlyStatus, onlyProfile, searchQuery, translucent);
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setOffscreenPageLimit(3);
if (settings.addonTheme) {
PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
strip.setBackgroundColor(settings.pagerTitleInt);
}
mViewPager.setCurrentItem(1);
Utils.setActionBar(context, true);
if (onlyProfile) {
mViewPager.setCurrentItem(2);
}
}
Aggregations