Search in sources :

Example 1 with ProfilePagerAdapter

use of com.klinker.android.twitter.adapters.ProfilePagerAdapter in project Talon-for-Twitter by klinker24.

the class ProfilePager method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);
    mCache = App.getInstance(this).getBitmapCache();
    context = this;
    sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
    settings = AppSettings.getInstance(this);
    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
    }
    if (getIntent().getBooleanExtra("from_widget", false) || ((settings.advanceWindowed && !getIntent().getBooleanExtra("long_click", false)) || !settings.advanceWindowed && getIntent().getBooleanExtra("long_click", false))) {
        setUpWindow();
    }
    setUpTheme();
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }
    getFromIntent();
    setContentView(R.layout.tweet_pager);
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    ProfilePagerAdapter mPagerAdapter = new ProfilePagerAdapter(getFragmentManager(), context, name, screenName, proPic, tweetId, isRetweet, isMyProfile);
    pager.setAdapter(mPagerAdapter);
    pager.setOffscreenPageLimit(3);
    if (settings.addonTheme) {
        PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
        strip.setBackgroundColor(settings.pagerTitleInt);
        if (!settings.showTitleStrip) {
            strip.setVisibility(View.GONE);
        }
    }
    Utils.setActionBar(context, !settings.advanceWindowed);
    // set it to the profile
    pager.setCurrentItem(1);
}
Also used : ViewConfiguration(android.view.ViewConfiguration) Field(java.lang.reflect.Field) PagerTitleStrip(android.support.v4.view.PagerTitleStrip) ProfilePagerAdapter(com.klinker.android.twitter.adapters.ProfilePagerAdapter) ViewPager(android.support.v4.view.ViewPager) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) Point(android.graphics.Point)

Aggregations

Point (android.graphics.Point)1 PagerTitleStrip (android.support.v4.view.PagerTitleStrip)1 ViewPager (android.support.v4.view.ViewPager)1 ViewConfiguration (android.view.ViewConfiguration)1 ProfilePagerAdapter (com.klinker.android.twitter.adapters.ProfilePagerAdapter)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1