private void restoreComplexPreferences() { SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE); Gson gson = new Gson(); String json = sharedPreferences.getString(MAIN_ACTIVITY_SAVE, ""); MainActivitySave save = gson.fromJson(json, MainActivitySave.class); if (save != null) { Log.i(TAG, "drawer final state is ------ " + save.isDrawerOpen()); if (!save.isDrawerOpen()) mPagerTitleStrip.setBackgroundColor(Color.parseColor("#01579B")); else mPagerTitleStrip.setBackgroundColor(Color.parseColor("#039BE5")); } }
@Override public void setBackgroundColor(int color) { super.setBackgroundColor(color); if (!mDrawFullUnderlineSet) { mDrawFullUnderline = (color & 0xFF000000) == 0; } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTheme(android.R.style.Theme_Light); m_vp = (ViewPager) findViewById(R.id.viewpager); pagerTabStrip = (PagerTabStrip) findViewById(R.id.pagertab); // 设置下划线的颜色 pagerTabStrip.setTabIndicatorColor(getResources().getColor(android.R.color.holo_green_dark)); // 设置背景的颜色 pagerTabStrip.setBackgroundColor(getResources().getColor(android.R.color.holo_blue_dark)); pagerTitleStrip = (PagerTitleStrip) findViewById(R.id.pagertab); // 设置背景的颜色 pagerTitleStrip.setBackgroundColor(getResources().getColor(android.R.color.holo_blue_dark)); mfragment1 = new fragment1(); mfragment2 = new fragment2(); mfragment3 = new fragment3(); fragmentList = new ArrayList<Fragment>(); fragmentList.add(mfragment1); fragmentList.add(mfragment2); fragmentList.add(mfragment3); titleList.add("第一页 "); titleList.add("第二页"); titleList.add("第三页 "); m_vp.setAdapter(new MyViewPagerAdapter(getSupportFragmentManager())); m_vp.setOffscreenPageLimit(1); }
public void setBackgroundColor(int paramInt) { super.setBackgroundColor(paramInt); if (!mDrawFullUnderlineSet) { if ((0xFF000000 & paramInt) != 0) { break label27; } } label27: for (boolean bool = true; ; bool = false) { mDrawFullUnderline = bool; return; } }
@Override public void onMainFragmentInteraction(int task) { switch (task) { case FragmentActivityInterfaceConstants.START_LOCATION_UPDATES: startLocationUpdates(); break; case FragmentActivityInterfaceConstants.STOP_LOCATION_UPDATES_AND_DISCONNECT_GOOGLE_API: if (mGoogleApiClient.isConnected()) { // Just like we have to disconnect our client, we also need to explicitly // remove location updates after requesting them. We do this with the opposite method, // which we can call in onPause() when we disconnect our Google API client: LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this); mGoogleApiClient.disconnect(); } break; case FragmentActivityInterfaceConstants.DISABLE_PAGER_TITLESTRIP: mPagerTitleStrip.setBackgroundColor(Color.parseColor("#039BE5")); break; case FragmentActivityInterfaceConstants.ENABLE_PAGER_TITLESTRIP: mPagerTitleStrip.setBackgroundColor(Color.parseColor("#01579B")); break; } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); 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 } context = this; sharedPrefs = context.getSharedPreferences( "com.klinker.android.twitter_world_preferences", Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE); settings = AppSettings.getInstance(this); try { searchQuery = getIntent().getStringExtra(SearchManager.QUERY); } catch (Exception e) { searchQuery = ""; } if (searchQuery == null) { searchQuery = ""; } handleIntent(getIntent()); if (Build.VERSION.SDK_INT > 18 && settings.uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet))) { translucent = true; getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); try { int immersive = android.provider.Settings.System.getInt(getContentResolver(), "immersive_mode"); if (immersive == 1) { translucent = false; } } catch (Exception e) { } } else { translucent = false; } Utils.setUpTheme(context, settings); setContentView(R.layout.search_pager); actionBar = getActionBar(); actionBar.setTitle(getResources().getString(R.string.search)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); View statusBar = findViewById(R.id.activity_status_bar); mViewPager = (ViewPager) findViewById(R.id.pager); if (translucent) { statusBar.setVisibility(View.VISIBLE); int statusBarHeight = Utils.getStatusBarHeight(context); LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } else { mViewPager.setPadding(0, 0, 0, 0); } mSectionsPagerAdapter = new SearchPagerAdapter( getFragmentManager(), context, onlyStatus, onlyProfile, searchQuery, translucent); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(3); if (settings.addonTheme) { PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip); strip.setBackgroundColor(settings.pagerTitleInt); } mViewPager.setCurrentItem(1); Utils.setActionBar(context, true); if (onlyProfile) { mViewPager.setCurrentItem(2); } }