use of android.support.v4.view.PagerTitleStrip 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);
}
use of android.support.v4.view.PagerTitleStrip in project UltimateAndroid by cymcsg.
the class PagerTitleStrip method onAttachedToWindow.
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
final ViewParent parent = getParent();
if (!(parent instanceof ViewPager)) {
throw new IllegalStateException("PagerTitleStrip must be a direct child of a ViewPager.");
}
final ViewPager pager = (ViewPager) parent;
final PagerAdapter adapter = pager.getAdapter();
pager.setInternalPageChangeListener(mPageListener);
pager.setOnAdapterChangeListener(mPageListener);
mPager = pager;
updateAdapter(mWatchingAdapter != null ? mWatchingAdapter.get() : null, adapter);
}
use of android.support.v4.view.PagerTitleStrip in project Talon-for-Twitter by klinker24.
the class DiscoverPager method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
settings = AppSettings.getInstance(this);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
setUpTheme();
setContentView(R.layout.trends_activity);
setUpDrawer(0, getResources().getString(R.string.trends));
actionBar = getActionBar();
actionBar.setTitle(getResources().getString(R.string.trends));
if (!settings.isTwitterLoggedIn) {
Intent login = new Intent(context, LoginActivity.class);
startActivity(login);
finish();
}
mSectionsPagerAdapter = new TrendsPagerAdapter(getFragmentManager(), context);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setOverScrollMode(ViewPager.OVER_SCROLL_NEVER);
mViewPager.setOffscreenPageLimit(3);
if (settings.addonTheme) {
PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
strip.setBackgroundColor(settings.pagerTitleInt);
}
}
use of android.support.v4.view.PagerTitleStrip in project Talon-for-Twitter by klinker24.
the class TweetPager method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);
try {
getWindow().requestFeature(Window.FEATURE_PROGRESS);
} catch (Exception e) {
}
context = this;
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
}
getFromIntent();
mSectionsPagerAdapter = new TweetPagerAdapter(getFragmentManager(), context, name, screenName, tweet, time, retweeter, webpage, proPic, tweetId, picture, users, hashtags, otherLinks, isMyTweet, isMyRetweet, secondAcc, animatedGif);
// methods for advancing windowed
boolean settingsVal = settings.advanceWindowed;
boolean fromWidget = getIntent().getBooleanExtra("from_widget", false);
final boolean youtube;
youtube = mSectionsPagerAdapter.getHasYoutube() || mSectionsPagerAdapter.getHasGif() || mSectionsPagerAdapter.hasVine();
if (fromWidget || settingsVal) {
setUpWindow(youtube);
}
setUpTheme();
int currentOrientation = getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
}
if (getIntent().getBooleanExtra("clicked_youtube", false)) {
IntentFilter i = new IntentFilter("com.klinker.android.twitter.YOUTUBE_READY");
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
TweetYouTubeFragment.resume();
context.unregisterReceiver(this);
}
}, i);
}
setContentView(R.layout.tweet_pager);
pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(mSectionsPagerAdapter);
pager.setOffscreenPageLimit(5);
final int numberOfPages = mSectionsPagerAdapter.getCount();
pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i2) {
}
@Override
public void onPageSelected(int i) {
if (youtube) {
try {
switch(numberOfPages) {
case 3:
case 4:
if (i != 0) {
TweetYouTubeFragment.pause();
} else {
TweetYouTubeFragment.resume();
}
break;
case 5:
if (i != 1) {
TweetYouTubeFragment.pause();
} else {
TweetYouTubeFragment.resume();
}
break;
}
} catch (Exception e) {
}
}
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
switch(numberOfPages) {
case 2:
if (settings.pageToOpen == AppSettings.PAGE_CONVO) {
pager.setCurrentItem(1);
} else {
pager.setCurrentItem(0);
}
break;
case 3:
if (mSectionsPagerAdapter.getHasWebpage()) {
switch(settings.pageToOpen) {
case AppSettings.PAGE_CONVO:
pager.setCurrentItem(2);
break;
case AppSettings.PAGE_WEB:
pager.setCurrentItem(0);
break;
default:
pager.setCurrentItem(1);
break;
}
} else {
// no web page
switch(settings.pageToOpen) {
case AppSettings.PAGE_CONVO:
pager.setCurrentItem(2);
break;
default:
pager.setCurrentItem(1);
break;
}
}
break;
case // webpage and youtube
4:
switch(settings.pageToOpen) {
case AppSettings.PAGE_CONVO:
pager.setCurrentItem(3);
break;
case AppSettings.PAGE_WEB:
pager.setCurrentItem(1);
break;
default:
pager.setCurrentItem(0);
break;
}
break;
}
if (getIntent().getBooleanExtra("clicked_youtube", false)) {
pager.setCurrentItem(0);
}
if (settings.addonTheme) {
PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
strip.setBackgroundColor(settings.pagerTitleInt);
if (!settings.showTitleStrip) {
strip.setVisibility(View.GONE);
}
}
}
use of android.support.v4.view.PagerTitleStrip in project Talon-for-Twitter by klinker24.
the class ViewUsersPopup method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.activity_slide_up, R.anim.activity_slide_down);
Utils.setUpPopupTheme(this, AppSettings.getInstance(this));
setUpWindow();
setContentView(R.layout.search_pager);
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setPadding(0, 0, 0, 0);
UserListPagerAdapter adapter = new UserListPagerAdapter(getFragmentManager(), this, getIntent().getLongExtra("id", 0l));
mViewPager.setAdapter(adapter);
mViewPager.setOffscreenPageLimit(2);
AppSettings settings = AppSettings.getInstance(this);
if (settings.addonTheme) {
PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
strip.setBackgroundColor(settings.pagerTitleInt);
}
}
Aggregations