Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2012 The CyanogenMod project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- package com.android.settings.spirit.fragments;
- import android.app.ActionBar;
- import android.app.Activity;
- import android.app.Fragment;
- import android.app.FragmentManager;
- import android.app.FragmentTransaction;
- import android.content.res.Resources;
- import android.content.Context;
- import android.os.Bundle;
- import android.support.v13.app.FragmentPagerAdapter;
- import android.support.v4.view.PagerTabStrip;
- import android.support.v4.view.ViewPager;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import com.android.settings.R;
- import com.android.settings.SettingsPreferenceFragment;
- import com.android.settings.Utils;
- import com.android.settings.spirit.Pie;
- import com.android.settings.spirit.navbar.NavbarTabHostFragment;
- import com.android.settings.spirit.NavRingTargets;
- import java.lang.Exception;
- import java.util.ArrayList;
- public class NavbarSettings extends SettingsPreferenceFragment {
- private static final String TAG = "NavSettings";
- PagerTabStrip mPagerTabStrip;
- ViewPager mViewPager;
- String titleString[];
- ViewGroup mContainer;
- static Bundle mSavedState;
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- mContainer = container;
- View view = inflater.inflate(R.layout.settings_tab, container, false);
- mViewPager = (ViewPager) view.findViewById(R.id.viewPager);
- mPagerTabStrip = (PagerTabStrip) view.findViewById(R.id.pagerTabStrip);
- mPagerTabStrip.setTabIndicatorColorResource(android.R.color.white);
- StatusBarAdapter StatusBarAdapter = new StatusBarAdapter(getFragmentManager());
- mViewPager.setAdapter(StatusBarAdapter);
- return view;
- }
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- // After confirming PreferenceScreen is available, we call super.
- super.onActivityCreated(savedInstanceState);
- }
- @Override
- public void onResume() {
- super.onResume();
- if (!Utils.isTablet(getActivity())) {
- mContainer.setPadding(0, 0, 0, 0);
- }
- }
- class StatusBarAdapter extends FragmentPagerAdapter {
- String titles[] = getTitles();
- private Fragment frags[] = new Fragment[titles.length];
- public StatusBarAdapter(FragmentManager fm) {
- super(fm);
- frags[0] = new Pie();
- frags[1] = new NavRingTargets();
- frags[2] = new NavbarTabHostFragment();
- }
- @Override
- public CharSequence getPageTitle(int position) {
- return titles[position];
- }
- @Override
- public Fragment getItem(int position) {
- return frags[position];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement