本文整理汇总了Java中com.astuetz.viewpager.extensions.PagerSlidingTabStrip.setOnPageChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java PagerSlidingTabStrip.setOnPageChangeListener方法的具体用法?Java PagerSlidingTabStrip.setOnPageChangeListener怎么用?Java PagerSlidingTabStrip.setOnPageChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.astuetz.viewpager.extensions.PagerSlidingTabStrip
的用法示例。
在下文中一共展示了PagerSlidingTabStrip.setOnPageChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.astuetz.viewpager.extensions.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
appContext = getApplicationContext();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
try {
setSupportActionBar(toolbar);
} catch (Throwable e) {
// Bug auf Samsung- und Wiko-Geräten
// https://code.google.com/p/android/issues/detail?id=78377
}
settings = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
if (!settings.contains("selected_school")) {
if (BuildConfig.FIXED_SCHOOL == null) {
Intent intent = new Intent(this, SelectSchoolActivity.class);
startActivity(intent);
finish();
} else {
settings.edit().putString("selected_school", BuildConfig.FIXED_SCHOOL).commit();
}
}
if (!isTablet()) {
vertretungFragment = new VertretungFragment();
nachrichtenFragment = new NachrichtenFragment();
addTab("Vertretungsplan", vertretungFragment);
addTab("Nachrichten", nachrichtenFragment);
tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
tabs.setViewPager(mViewPager);
tabs.setOnPageChangeListener(adapter);
} else {
vertretungFragment = (VertretungFragment) getSupportFragmentManager()
.findFragmentById(R.id.vertretung_fragment);
nachrichtenFragment = (NachrichtenFragment) getSupportFragmentManager()
.findFragmentById(R.id.nachrichten_fragment);
}
content = findViewById(R.id.content);
pBar = (ProgressBar) findViewById(R.id.progressBar);
// Launch license dialog
showDialogs();
if (savedInstanceState == null) {
if (gcmRegistered) {
new GetVertretungsplanTask().execute();
}
created = true;
} else {
Log.d("vertretungsplan", "load");
vertretungsplan = new Gson().fromJson(
savedInstanceState.getString("vertretungsplan"),
Vertretungsplan.class);
if (vertretungsplan != null)
setVertretungsplan(vertretungsplan);
}
FontUtils.setRobotoFont(this, findViewById(android.R.id.content));
}
示例2: onCreate
import com.astuetz.viewpager.extensions.PagerSlidingTabStrip; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
appContext = getApplicationContext();
settings = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
if (!settings.contains("selected_school")) {
settings.edit().putString("selected_school", "Schleswig_Lornsenschule").commit();
}
vertretungFragment = new VertretungFragment();
nachrichtenFragment = new NachrichtenFragment();
addTab("Vertretungsplan", vertretungFragment);
addTab("Nachrichten", nachrichtenFragment);
tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
tabs.setViewPager(mViewPager);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
getResources().getConfiguration();
if (metrics.widthPixels / (metrics.densityDpi / 160f) >= 800
&& getResources().getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE) {
tabs.setVisibility(View.GONE);
}
tabs.setOnPageChangeListener(adapter);
tabs.setIndicatorColor(Color.rgb(51, 139, 255));
// Launch license dialog
showDialogs();
if (savedInstanceState == null) {
if (settings.getString("regId", null) != null)
new GetVertretungsplanTask().execute();
else {
setProgress(true);
// wait for GCM registration
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
unregisterReceiver(this);
new GetVertretungsplanTask().execute();
}
}, new IntentFilter("com.johan.vertretungsplan.registered"));
}
} else {
Log.d("vertretungsplan", "load");
vertretungsplan = new Gson().fromJson(
savedInstanceState.getString("vertretungsplan"),
Vertretungsplan.class);
}
}