当前位置: 首页>>代码示例>>Java>>正文


Java PagerSlidingTabStrip.setOnPageChangeListener方法代码示例

本文整理汇总了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));
}
 
开发者ID:johan12345,项目名称:vertretungsplan,代码行数:64,代码来源:StartActivity.java

示例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);
	}
}
 
开发者ID:johan12345,项目名称:ls-vertretungsplan,代码行数:55,代码来源:StartActivity.java


注:本文中的com.astuetz.viewpager.extensions.PagerSlidingTabStrip.setOnPageChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。