Search in sources :

Example 1 with SearchPagerAdapter

use of com.klinker.android.twitter.adapters.SearchPagerAdapter 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);
    }
}
Also used : ViewConfiguration(android.view.ViewConfiguration) Field(java.lang.reflect.Field) ColorDrawable(android.graphics.drawable.ColorDrawable) PagerTitleStrip(android.support.v4.view.PagerTitleStrip) SearchPagerAdapter(com.klinker.android.twitter.adapters.SearchPagerAdapter) ImageView(android.widget.ImageView) View(android.view.View) SearchView(android.widget.SearchView) TwitterException(twitter4j.TwitterException) LinearLayout(android.widget.LinearLayout)

Aggregations

ColorDrawable (android.graphics.drawable.ColorDrawable)1 PagerTitleStrip (android.support.v4.view.PagerTitleStrip)1 View (android.view.View)1 ViewConfiguration (android.view.ViewConfiguration)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 SearchView (android.widget.SearchView)1 SearchPagerAdapter (com.klinker.android.twitter.adapters.SearchPagerAdapter)1 Field (java.lang.reflect.Field)1 TwitterException (twitter4j.TwitterException)1