List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.artitk.licensefragment.example.MainActivity.java
@Override public void onNavigationDrawerItemSelected(int position) { // if (true) return; FragmentManager fragmentManager = getFragmentManager(); Fragment fragment;/*from www.j a v a 2 s . c o m*/ ArrayList<Integer> licenseIds = new ArrayList<>(); licenseIds.add(LicenseID.GSON); licenseIds.add(LicenseID.RETROFIT); switch (position) { case 0: if (fragmentManager.findFragmentById(R.id.container) instanceof ScrollViewLicenseFragment) return; fragment = ScrollViewLicenseFragment.newInstance(licenseIds); // Call newInstance() using parameter ArrayList<Integer> break; case 1: if (fragmentManager.findFragmentById(R.id.container) instanceof ListViewLicenseFragment) return; fragment = ListViewLicenseFragment.newInstance(new int[] { LicenseID.PICASSO }) // Call newInstance() using parameter array .withLicenseChain(false); // Disable license chain break; case 2: if (fragmentManager.findFragmentById(R.id.container) instanceof RecyclerViewLicenseFragment) return; ArrayList<License> licenses = new ArrayList<>(); licenses.add(new License(this, "Test Library 1", LicenseType.MIT_LICENSE, "2000-2001", "Test Owner 1")); licenses.add(new License(this, "Test Library 2", LicenseType.GPL_30, "2002", "Test Owner 2")); licenses.add(new License(this, "Test Library 3", LicenseType.EPL_10, "2003", "Test Owner 3")); licenses.add(new License(this, "Custom License 1", R.raw.wtfpl, "2004", "Test Owner 3")); licenses.add(new License(this, "Custom License 2", R.raw.x11, "2005", "Test Owner 4")); fragment = RecyclerViewLicenseFragment.newInstance() // Call newInstance() using without parameter .setLog(true) // Enable Log .withLicenseChain(true) // Enable license chain (default) .addLicense(new int[] { LicenseID.PICASSO }) // Add array (same call newInstance) .addLicense(licenseIds) // Add ArrayList<Integer> (same call newInstance) .addCustomLicense(licenses) // Add Custom License .setCustomUI(new CustomUI() // Set Custom UI .setTitleBackgroundColor(Color.parseColor("#7fff7f")) .setTitleTextColor(getResources().getColor(android.R.color.holo_green_dark)) .setLicenseBackgroundColor(Color.rgb(127, 223, 127)).setLicenseTextColor(Color.DKGRAY)); break; default: return; } // ((LicenseFragmentBase) fragment).setLog(true); // update the main content by replacing fragments fragmentManager.beginTransaction().replace(R.id.container, fragment).commit(); fragmentId = position + 1; }
From source file:com.example.SmartBoard.MyActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.clear: AlertDialog.Builder clearAlert = new AlertDialog.Builder(this); clearAlert.setTitle("Clear"); clearAlert.setMessage("Are you sure you wanna clear everything on the screen?"); clearAlert.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //save drawing clearScreen();//from www .ja v a 2 s. c o m } }); clearAlert.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); clearAlert.show(); return true; case R.id.deleteObject: mode = "Object Delete Mode"; notifyMode("Object Delete Mode"); drawer.removeObjectMode(true); return true; case R.id.blue: drawer.changeColor(Color.BLUE); return true; case R.id.black: drawer.changeColor(Color.BLACK); return true; case R.id.red: drawer.changeColor(Color.RED); return true; case R.id.green: drawer.changeColor(Color.parseColor("#228B22")); return true; case R.id.save: AlertDialog.Builder saveAlert = new AlertDialog.Builder(this); saveAlert.setTitle("Save"); saveAlert.setMessage("Save work to device Gallery?"); saveAlert.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //save drawing drawer.setDrawingCacheEnabled(true); String imgSaved = MediaStore.Images.Media.insertImage(getContentResolver(), drawer.getDrawingCache(), UUID.randomUUID().toString() + ".png", "room ID:" + Login.roomId); if (imgSaved != null) { Toast savedToast = Toast.makeText(getApplicationContext(), "Drawing saved to Gallery!", Toast.LENGTH_SHORT); savedToast.show(); } else { Toast unsavedToast = Toast.makeText(getApplicationContext(), "Oops! Image could not be saved.", Toast.LENGTH_SHORT); unsavedToast.show(); } drawer.destroyDrawingCache(); } }); saveAlert.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //do nothing } }); saveAlert.show(); return true; case R.id.print: drawer.setDrawingCacheEnabled(true); doPhotoPrint(drawer.getDrawingCache()); drawer.destroyDrawingCache(); return true; case R.id.small: mode = "Pencil Mode"; notifyMode("Pencil Mode"); drawer.changeBrushSize(2); return true; case R.id.medium: mode = "Pencil Mode"; notifyMode("Pencil Mode"); drawer.changeBrushSize(5); return true; case R.id.large: mode = "Pencil Mode"; notifyMode("Pencil Mode"); drawer.changeBrushSize(10); return true; case R.id.smallE: mode = "Erase Mode"; notifyMode("Erase Mode"); drawer.changeEraseSize(30); return true; case R.id.mediumE: mode = "Erase Mode"; notifyMode("Erase Mode"); drawer.changeEraseSize(40); return true; case R.id.largeE: mode = "Erase Mode"; notifyMode("Erase Mode"); drawer.changeEraseSize(50); return true; case R.id.circle: mode = "Circle Mode"; drawer.circleMode(true); notifyMode("Circle Object Mode"); return true; case R.id.rectangle: mode = "Rectangle Object Mode"; drawer.rectMode(true); notifyMode("Rectangle Object Mode"); return true; case R.id.line: mode = "Line Object Mode"; drawer.lineMode(true); notifyMode("Line Object Mode"); return true; case R.id.drag: mode = "Drag Mode"; drawer.dragMode(true); notifyMode("Drag Mode"); return true; case R.id.text: mode = "Text Mode"; notifyMode("Text Mode"); DrawingView.placed = false; Intent intent2 = new Intent(this, TextBoxAlert.class); startActivityForResult(intent2, TEXT_BOX_INPUT); return true; case R.id.blackDropper: mode = "Color Dropper"; drawer.colorDropperMode(true, Color.BLACK); return true; case R.id.blueDroppper: mode = "Color Dropper"; drawer.colorDropperMode(true, Color.BLUE); return true; case R.id.redDropper: mode = "Color Dropper"; drawer.colorDropperMode(true, Color.RED); return true; case R.id.greenDropper: mode = "Color Dropper"; drawer.colorDropperMode(true, Color.parseColor("#228B22")); return true; case R.id.smallText: mode = "Touch to Resize"; notifyMode(mode); drawer.textSizeMode(true, 10); return true; case R.id.mediumText: mode = "Touch to Resize"; notifyMode(mode); drawer.textSizeMode(true, 15); return true; case R.id.largeText: mode = "Touch to Resize"; notifyMode(mode); drawer.textSizeMode(true, 20); return true; case R.id.exit: finish(); return true; case R.id.chat: if (StatusListener.connectFlag) { Intent intent = new Intent(this, Chat.class); startActivity(intent); } else { Toast.makeText(this, "No active connection. Check your internet connection and enter room", Toast.LENGTH_SHORT).show(); finish(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.cryart.sabbathschool.view.SSQuarterliesActivity.java
@Override public void onQuarterliesChanged(List<SSQuarterly> ssQuarterlies) { if (ssQuarterlies.size() > 0) { SSColorTheme.getInstance().setColorPrimary(ssQuarterlies.get(0).color_primary); SSColorTheme.getInstance().setColorPrimaryDark(ssQuarterlies.get(0).color_primary_dark); updateColorScheme();/*from w ww .j a va 2s . com*/ } SSQuarterliesAdapter adapter = (SSQuarterliesAdapter) binding.ssQuarterliesList.getAdapter(); adapter.setQuarterlies(ssQuarterlies); adapter.notifyDataSetChanged(); boolean languageFilterPromptSeen = prefs.getBoolean(SSConstants.SS_LANGUAGE_FILTER_PROMPT_SEEN, false); if (!languageFilterPromptSeen) { new MaterialTapTargetPrompt.Builder(this).setTarget(R.id.ss_quarterlies_menu_filter) .setPrimaryText(getString(R.string.ss_quarterlies_filter_languages_prompt_title)) .setCaptureTouchEventOutsidePrompt(true) .setIconDrawableColourFilter(Color.parseColor(SSColorTheme.getInstance().getColorPrimary())) .setIconDrawable(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_translate) .color(Color.parseColor(SSColorTheme.getInstance().getColorPrimary())).sizeDp(18)) .setBackgroundColour(Color.parseColor(SSColorTheme.getInstance().getColorPrimary())) .setSecondaryText(R.string.ss_quarterlies_filter_languages_prompt_description) .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) { if (state == MaterialTapTargetPrompt.STATE_DISMISSED) { SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(SSConstants.SS_LANGUAGE_FILTER_PROMPT_SEEN, true); editor.commit(); } } }).show(); } }
From source file:samples.piggate.com.piggateCompleteExample.Activity_Logged.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _piggate = new Piggate(this, null); //Initialize the Piggate object setContentView(R.layout.activity_logged); getSupportActionBar().setTitle(PiggateUser.getEmail()); startService(new Intent(getApplicationContext(), Service_Notify.class)); //Start the service //Initialize and set all the left navigation drawer fields mDrawer = new Drawer().withActivity(this).withTranslucentStatusBar(false).withHeader(R.layout.drawerheader) .addDrawerItems( /* Add drawer items with this method */) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override/*from w ww . ja va2 s. co m*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { // Open the exchange activity for the selected item Intent slideactivity = new Intent(Activity_Logged.this, Activity_Exchange.class); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); //Send the current offer information to the exchange activity slideactivity.putExtra("offerName", exchangeOfferList.get(position).getName().toString()); slideactivity.putExtra("offerDescription", exchangeOfferList.get(position).getDescription().toString()); slideactivity.putExtra("offerImgURL", exchangeOfferList.get(position).getImgURL().toString()); slideactivity.putExtra("exchangeID", exchangeOfferList.get(position).getExchangeID().toString()); Bundle bndlanimation = ActivityOptions.makeCustomAnimation(Activity_Logged.this, R.anim.slidefromright, R.anim.slidetoleft).toBundle(); startActivity(slideactivity, bndlanimation); } }).withSliderBackgroundColor(Color.parseColor("#FFFFFF")).withSelectedItem(-1).build(); //Initialize recycler view mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new LinearLayoutManager(Activity_Logged.this)); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); newBeaconsLayout = (LinearLayout) findViewById(R.id.newBeaconsLayout); //Initialize swipe layout mSwipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container); mSwipeLayout.setOnRefreshListener(this); errorDialog = new AlertDialog.Builder(this).create(); errorDialog.setTitle("Logout error"); errorDialog.setMessage("There is an error with the logout"); errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); successPaymentDialog = new AlertDialog.Builder(this).create(); successPaymentDialog.setTitle("Successful payment"); successPaymentDialog.setMessage("Now you can exchange your purchased product"); successPaymentDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); errorBuyDialog = new AlertDialog.Builder(this).create(); errorBuyDialog.setTitle("Payment failed"); errorBuyDialog.setMessage("There is an error with your payment"); errorBuyDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); successExchangeDialog = new AlertDialog.Builder(this).create(); successExchangeDialog.setTitle("Offer successfully exchanged"); successExchangeDialog.setMessage("The offer has been purchased and exchanged"); successExchangeDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); errorExchangeDialog = new AlertDialog.Builder(this).create(); errorExchangeDialog.setTitle("Exchange error"); errorExchangeDialog.setMessage("There is an error with the exchange"); errorExchangeDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); networkErrorDialog = new AlertDialog.Builder(this).create(); networkErrorDialog.setTitle("Network error"); networkErrorDialog.setMessage("There is an error with the network connection"); networkErrorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); fadeIn = AnimationUtils.loadAnimation(Activity_Logged.this, R.anim.fadein); fadeOut = AnimationUtils.loadAnimation(Activity_Logged.this, R.anim.fadeout); //Check if the bluetooth is switched on BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); } if (getIntent().hasExtra("payment")) { if (getIntent().getExtras().getBoolean("payment") == true) { successPaymentDialog.show(); //Show success payment dialog mDrawer.openDrawer(); //Open the left panel } else { errorBuyDialog.show(); //Show payment error dialog } } else if (getIntent().hasExtra("exchanged")) { if (getIntent().getExtras().getBoolean("exchanged") == true) { successExchangeDialog.show(); //Show exchange success dialog } else { errorExchangeDialog.show(); //Show exchange error dialog } } }
From source file:com.example.slidingTabBasic.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from w w w. jav a 2 s. c om */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTextColor(Color.parseColor("#FFFFFF")); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:net.evecom.androidecssp.activity.event.ContinueInfoActivity.java
/** * //from w ww . ja v a2 s .co m * * * @author Stark Zhou * @created 2015-12-30 3:03:36 */ private void initGallery() { mGallery = (GalleryFlow) findViewById(R.id.continue_gallery_flow); mGallery.setBackgroundColor(Color.parseColor("#ffffff")); // mGallery.setSpacing(90);// mGallery.setMaxRotationAngle(20);// mGallery.setFadingEdgeLength(10); // mGallery.setGravity(Gravity.CENTER_VERTICAL); // mGallery.setAdapter(new GalleryAdapter()); mGallery.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(getApplicationContext(), AfnailPictureActivity.class); BaseActivity.pushObjData("filebean", filebeans.get(position), intent); startActivityForResult(intent, R.layout.afnail_picture_activity); } }); }
From source file:com.detroitteatime.autocarfinder.Main.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainLayout = (LinearLayout) this.getLayoutInflater().inflate(R.layout.main, null); setContentView(mainLayout);//from w ww . j a va 2 s .co m // Possible work around for market launches. See // http://code.google.com/p/android/issues/detail?id=2373 // for more details. Essentially, the market launches the main activity // on top of other activities. // we never want this to happen. Instead, we check if we are the root // and if not, we finish. if (!isTaskRoot()) { final Intent intent = getIntent(); final String intentAction = intent.getAction(); if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intentAction != null && intentAction.equals(Intent.ACTION_MAIN)) { // Log.w("My Code", // "Main Activity is not the root. Finishing Main Activity instead of launching."); finish(); return; } } // set up buttons start = (Button) findViewById(R.id.start); manual = (Button) findViewById(R.id.manual); // progress = (ProgressBar) findViewById(R.id.progressBar1); start.setOnClickListener(this); start.getBackground().setColorFilter(Color.parseColor(COLOR), PorterDuff.Mode.MULTIPLY); manual.setOnClickListener(this); manual.getBackground().setColorFilter(Color.parseColor(COLOR), PorterDuff.Mode.MULTIPLY); monitor = (FrameLayout) findViewById(R.id.frameLayout1); data1 = this.getSharedPreferences("storage", 0); editor1 = data1.edit(); // firstTime = data1.getBoolean("first_time", true); editor1.putBoolean("first_time", false); editor1.commit(); pi = PendingIntent.getActivity(this, 0, new Intent(this, Main.class), 0); data1 = getSharedPreferences("storage", 0); editor1 = data1.edit(); // set a global layout listener which will be called when the layout // pass is completed and the view is drawn FragmentManager myFragmentManager = getSupportFragmentManager(); mySupportMapFragment = (SupportMapFragment) myFragmentManager.findFragmentById(R.id.map); if (MapsInitializer.initialize(this) != ConnectionResult.SUCCESS) { Toast.makeText(this, "Map failed to initialize.", Toast.LENGTH_SHORT).show(); } map = mySupportMapFragment.getMap(); manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the locatioin provider -> use // default criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); provider = manager.getBestProvider(criteria, false); manager.requestLocationUpdates(provider, 1000, 1, this); navigate = (Button) findViewById(R.id.navigate); navigate.setOnClickListener(this); type = (Button) findViewById(R.id.satellite); type.setOnClickListener(this); }
From source file:com.ashoksm.pinfinder.common.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./*from www .j ava 2 s .c o m*/ */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.parseColor("#99ffffff")); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.cw.litenote.tabs.TabsHost.java
@Nullable @Override//from w w w . ja va 2s . com public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { System.out.println("TabsHost / _onCreateView"); View rootView; // set layout by orientation if (Util.isLandscapeOrientation(MainAct.mAct)) { if (Define.ENABLE_ADMOB) { if (Define.CODE_MODE == Define.DEBUG_MODE) rootView = inflater.inflate(R.layout.tabs_host_landscape_test, container, false); else rootView = inflater.inflate(R.layout.tabs_host_landscape, container, false); } else rootView = inflater.inflate(R.layout.tabs_host_landscape, container, false); } else { if (Define.ENABLE_ADMOB) { if (Define.CODE_MODE == Define.DEBUG_MODE) rootView = inflater.inflate(R.layout.tabs_host_portrait_test, container, false); else rootView = inflater.inflate(R.layout.tabs_host_portrait, container, false); } else rootView = inflater.inflate(R.layout.tabs_host_portrait, container, false); } // view pager mViewPager = (ViewPager) rootView.findViewById(R.id.tabs_pager); // mTabsPagerAdapter mTabsPagerAdapter = new TabsPagerAdapter(MainAct.mAct, MainAct.mAct.getSupportFragmentManager()); // mTabsPagerAdapter = new TabsPagerAdapter(MainAct.mAct,getChildFragmentManager()); // add pages to mTabsPagerAdapter int pageCount = 0; if (Drawer.getFolderCount() > 0) { pageCount = addPages(mTabsPagerAdapter); } // show blank folder if no page exists if (pageCount == 0) { rootView.findViewById(R.id.blankFolder).setVisibility(View.VISIBLE); mViewPager.setVisibility(View.GONE); } else { rootView.findViewById(R.id.blankFolder).setVisibility(View.GONE); mViewPager.setVisibility(View.VISIBLE); } // set mTabsPagerAdapter of view pager mViewPager.setAdapter(mTabsPagerAdapter); // set tab layout mTabLayout = (TabLayout) rootView.findViewById(R.id.tabs); mTabLayout.setupWithViewPager(mViewPager); mTabLayout.setOnTabSelectedListener(this); mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL); // mTabLayout.setTabMode(TabLayout.MODE_FIXED); mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); // mTabLayout.setBackgroundColor(ColorSet.getBarColor(MainAct.mAct)); mTabLayout.setBackgroundColor(ColorSet.getButtonColor(MainAct.mAct)); // mTabLayout.setBackgroundColor(Color.parseColor("#FF303030")); // tab indicator mTabLayout.setSelectedTabIndicatorHeight(15); mTabLayout.setSelectedTabIndicatorColor(Color.parseColor("#FFFF7F00")); // mTabLayout.setSelectedTabIndicatorHeight((int) (5 * getResources().getDisplayMetrics().density)); mTabLayout.setTabTextColors(ContextCompat.getColor(MainAct.mAct, R.color.colorGray), //normal ContextCompat.getColor(MainAct.mAct, R.color.colorWhite) //selected ); mFooterMessage = (TextView) rootView.findViewById(R.id.footerText); mFooterMessage.setBackgroundColor(Color.BLUE); mFooterMessage.setVisibility(View.VISIBLE); // AdMob support // if ENABLE_ADMOB = true, enable the following // test app id if (Define.ENABLE_ADMOB) { if (Define.CODE_MODE == Define.DEBUG_MODE) MobileAds.initialize(getActivity(), getActivity().getResources().getString(R.string.ad_mob_app_id_test)); else // real app id MobileAds.initialize(getActivity(), getActivity().getResources().getString(R.string.ad_mob_app_id)); // Load an ad into the AdMob banner view. AdView adView = (AdView) rootView.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } return rootView; }
From source file:com.autogermany.opel360.Utils.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//www. j a v a 2 s .c o m */ @SuppressLint("NewApi") protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.parseColor("#FFFFFF")); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }