List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.fowlcorp.homebank4android.gui.AccountRecyclerAdapter.java
@Override public void onBindViewHolder(final OperationViewHolder holder, final int position) { final Operation operation = listOperation.get(position); final Calendar myDate = Calendar.getInstance(); myDate.clear();//from www.j ava2s.co m myDate.setTime(operation.getDate().getTime()); final SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE); holder.getRootLayout().setOnClickListener(new OnClickListener() { @SuppressWarnings("unchecked") @Override public void onClick(View v) { Intent intent = new Intent(activity.getApplicationContext(), DetailedCardActivity.class); Bundle bdl = new Bundle(); try { bdl.putString("Date", df.format(myDate.getTime())); } catch (Exception e) { } try { bdl.putString("Category", (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } try { bdl.putString("Payee", operation.getPayee().getName()); } catch (Exception e) { } try { bdl.putString("Wording", operation.getWording()); } catch (Exception e) { } try { bdl.putString("Amount", String.valueOf(Round.roundAmount(operation.getAmount()))); } catch (Exception e) { } try { bdl.putInt("Type", operation.getPayMode()); } catch (Exception e) { } // try { // intent.putExtra("Info", operation.getInfo()); // } catch (Exception e) { // } try { bdl.putBoolean("Reconciled", operation.isReconciled()); } catch (Exception e) { } try { bdl.putBoolean("Remind", operation.isRemind()); } catch (Exception e) { } try { Log.d("Debug", String.valueOf(operation.isSplit())); bdl.putBoolean("Split", operation.isSplit()); } catch (Exception e) { } try { bdl.putSerializable("Couple", operation.getSplits()); } catch (Exception e) { e.printStackTrace(); } intent.putExtras(bdl); // Pair datePair = Pair.create(holder.getDate(), "date"); // Pair categoryPair = Pair.create(holder.getCategory(), "category"); // Pair wordingPair = Pair.create(holder.getWording(), "wording"); // Pair payeePair = Pair.create(holder.getPayee(), "payee"); // Pair amountPair = Pair.create(holder.getAmount(), "amount"); Pair<View, String> cardPair = Pair.create((View) holder.getCard(), "card"); // Pair iconPair = Pair.create(holder.getMode(), "icon"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, cardPair); ActivityCompat.startActivity(activity, intent, options.toBundle()); //activity.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(activity).toBundle()); //activity.startActivity(intent); } }); try { holder.getDate().setText(activity.getString(R.string.Date) + " : " + df.format(myDate.getTime())); } catch (Exception e) { } try { holder.getPayee().setText(activity.getString(R.string.Payee) + " : " + operation.getPayee().getName()); } catch (Exception e) { } try { holder.getWording().setText(activity.getString(R.string.Wording) + " : " + operation.getWording()); } catch (Exception e) { } if (!operation.isSplit()) { holder.getSplitLinear().removeAllViews(); holder.getUnSplitLinear().setVisibility(LinearLayout.VISIBLE); try { holder.getCategory() .setText(activity.getString(R.string.Wording) + " : " + (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } } else { holder.getUnSplitLinear().setVisibility(LinearLayout.GONE); LinearLayout splitLayout = holder.getSplitLinear(); splitLayout.removeAllViews(); LayoutInflater inflater = activity.getLayoutInflater(); for (Triplet subOp : operation.getSplits()) { View view = inflater.inflate(R.layout.split_layout, null); TextView category = (TextView) view.findViewById(R.id.splitLayout_category); TextView memo = (TextView) view.findViewById(R.id.splitLayout_memo); TextView amount = (TextView) view.findViewById(R.id.splitLayout_amount); //System.out.println(activity.getString(R.string.cardLayout_category) + " " + (subOp.getCategory().getParent() == null ? "" :subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); category.setText(activity.getString(R.string.Category) + " : " + (subOp.getCategory().getParent() == null ? "" : subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); amount.setText(colorText(activity.getString(R.string.Amount) + " : ", "" + Round.roundAmount(subOp.getAmount()))); memo.setText(activity.getString(R.string.Category) + " : " + operation.getWording()); splitLayout.addView(view); } } try { holder.getAmount().setText(colorText(activity.getString(R.string.Amount) + " : ", String.valueOf(Round.roundAmount(operation.getAmount())))); } catch (Exception e) { } try { holder.getBalance().setText(colorText(activity.getString(R.string.Balance) + " : ", String.valueOf(Round.roundAmount(operation.getBalanceAccount())))); } catch (Exception e) { } if (operation.isSplit()) { holder.getOption().setImageResource(R.drawable.split); } else if (operation.isRemind()) { holder.getOption().setImageResource(R.drawable.remind); holder.getCard().setCardBackgroundColor(Color.parseColor("#ffebee")); } else { holder.getOption().setImageDrawable(null); } if (!operation.isReconciled() && !operation.isRemind()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#fff3e0")); } else if (operation.isReconciled()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#ffffff")); } try { switch (operation.getPayMode()) { case PayMode.CREDIT_CARD: holder.getMode().setImageResource(R.drawable.mastercard); break; case PayMode.DEBIT_CARD: holder.getMode().setImageResource(R.drawable.card); break; case PayMode.CASH: holder.getMode().setImageResource(R.drawable.cash); break; case PayMode.TRANSFERT: holder.getMode().setImageResource(R.drawable.transfert); break; case PayMode.ELECTRONIC_PAYMENT: holder.getMode().setImageResource(R.drawable.nfc); break; case PayMode.CHEQUE: holder.getMode().setImageResource(R.drawable.cheque); break; default: holder.getMode().setImageDrawable(null); break; } } catch (Exception e) { } }
From source file:com.musenkishi.atelier.Atelier.java
private static void applyColorToView(final FloatingActionButton floatingActionButton, int color, boolean fromCache, boolean shouldMask) { if (fromCache) { if (shouldMask) { if (floatingActionButton.getDrawable() != null) { floatingActionButton.getDrawable().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY); } else if (floatingActionButton.getBackground() != null) { floatingActionButton.getBackground().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY); }// ww w. j a va2s. c om } else { ColorStateList colorStateList = ColorStateList.valueOf(color); floatingActionButton.setBackgroundTintList(colorStateList); } } else { if (shouldMask) { Integer colorFrom; ValueAnimator.AnimatorUpdateListener imageAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { if (floatingActionButton.getDrawable() != null) { floatingActionButton.getDrawable().mutate().setColorFilter( (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY); } else if (floatingActionButton.getBackground() != null) { floatingActionButton.getBackground().mutate().setColorFilter( (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY); } } }; ValueAnimator.AnimatorUpdateListener animatorUpdateListener; PaletteTag paletteTag = (PaletteTag) floatingActionButton.getTag(viewTagKey); animatorUpdateListener = imageAnimatorUpdateListener; colorFrom = paletteTag.getColor(); floatingActionButton.setTag(viewTagKey, new PaletteTag(paletteTag.getId(), color)); Integer colorTo = color; ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.addUpdateListener(animatorUpdateListener); colorAnimation.setDuration(300); colorAnimation.start(); } else { Integer colorFrom = Color.parseColor("#FFFAFAFA"); ColorStateList colorStateList = floatingActionButton.getBackgroundTintList(); if (colorStateList != null) { colorFrom = colorStateList.getDefaultColor(); } Integer colorTo = color; ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { int color = (Integer) animator.getAnimatedValue(); floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(color)); } }); colorAnimation.setDuration(300); colorAnimation.start(); } } }
From source file:com.ezartech.ezar.videooverlay.ezAR.java
private void init(JSONArray args, final CallbackContext callbackContext) { this.callbackContext = callbackContext; supportSnapshot = getSnapshotPlugin() != null; if (args != null) { String rgb = DEFAULT_RGB; try {//from w w w . j av a 2s . co m rgb = args.getString(0); } catch (JSONException e) { //do nothing; resort to DEFAULT_RGB } setBackgroundColor(Color.parseColor(rgb)); cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { webViewView.setBackgroundColor(getBackgroundColor()); } }); } if (!PermissionHelper.hasPermission(this, permissions[0])) { PermissionHelper.requestPermission(this, CAMERA_SEC, Manifest.permission.CAMERA); return; } JSONObject jsonObject = new JSONObject(); try { Display display = activity.getWindowManager().getDefaultDisplay(); DisplayMetrics m = new DisplayMetrics(); display.getMetrics(m); jsonObject.put("displayWidth", m.widthPixels); jsonObject.put("displayHeight", m.heightPixels); int mNumberOfCameras = Camera.getNumberOfCameras(); Log.d(TAG, "Cameras:" + mNumberOfCameras); // Find the ID of the back-facing ("default") camera Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); for (int i = 0; i < mNumberOfCameras; i++) { Camera.getCameraInfo(i, cameraInfo); Parameters parameters; Camera open = null; try { open = Camera.open(i); parameters = open.getParameters(); } finally { if (open != null) { open.release(); } } Log.d(TAG, "Camera facing:" + cameraInfo.facing); CameraDirection type = null; for (CameraDirection f : CameraDirection.values()) { if (f.getDirection() == cameraInfo.facing) { type = f; } } if (type != null) { double zoom = 0; double maxZoom = 0; if (parameters.isZoomSupported()) { maxZoom = (parameters.getMaxZoom() + 1) / 10.0; zoom = Math.min(parameters.getZoom() / 10.0 + 1, maxZoom); } JSONObject jsonCamera = new JSONObject(); jsonCamera.put("id", i); jsonCamera.put("position", type.toString()); jsonCamera.put("zoom", zoom); jsonCamera.put("maxZoom", maxZoom); jsonObject.put(type.toString(), jsonCamera); } } } catch (JSONException e) { Log.e(TAG, "Can't set exception", e); } callbackContext.success(jsonObject); }
From source file:com.filemanager.free.activities.TextReader.java
private void checkUnsavedChanges() { if (mOriginal != null && mInput.isShown() && !mOriginal.equals(mInput.getText().toString())) { new MaterialDialog.Builder(this).title(R.string.unsavedchanges).content(R.string.unsavedchangesdesc) .positiveText(R.string.yes).negativeText(R.string.no).positiveColor(Color.parseColor(fabskin)) .negativeColor(Color.parseColor(fabskin)).onPositive(new MaterialDialog.SingleButtonCallback() { @Override// w ww .j ava2s . co m public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { writeTextFile(mFile.getPath(), mInput.getText().toString()); finish(); } }).onNeutral(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { finish(); } }).build().show(); } else { finish(); } }
From source file:cn.com.pplo.sicauhelper.widget.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); //tab if (i == 0) { tab.setTextColor(Color.parseColor("#ffffff")); } else { tab.setTextColor(tabTextColor); }/*from w w w. ja v a 2s . com*/ // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.amaze.filemanager.fragments.Main.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.main_frag, container, false); setRetainInstance(true);/*from ww w . j a v a2s. c o m*/ listView = (android.support.v7.widget.RecyclerView) rootView.findViewById(R.id.listView); mToolbarContainer = (AppBarLayout) getActivity().findViewById(R.id.lin); fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroll); fastScroller.setPressedHandleColor(Color.parseColor(fabSkin)); listView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (adapter != null && stopAnims) { stopAnimation(); stopAnims = false; } return false; } }); mToolbarContainer.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (adapter != null && stopAnims) { stopAnimation(); stopAnims = false; } return false; } }); mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.activity_main_swipe_refresh_layout); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadlist((CURRENT_PATH), false, openMode); } }); buttons = (LinearLayout) getActivity().findViewById(R.id.buttons); pathbar = (LinearLayout) getActivity().findViewById(R.id.pathbar); SHOW_THUMBS = Sp.getBoolean("showThumbs", true); res = getResources(); pathname = (TextView) getActivity().findViewById(R.id.pathname); mFullPath = (TextView) getActivity().findViewById(R.id.fullpath); goback = res.getString(R.string.goback); itemsstring = res.getString(R.string.items); apk = res.getDrawable(R.drawable.ic_doc_apk_grid); mToolbarContainer.setBackgroundColor(skin_color); // listView.setPadding(listView.getPaddingLeft(), paddingTop, listView.getPaddingRight(), listView.getPaddingBottom()); return rootView; }
From source file:com.eeshana.icstories.activities.UploadVideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // this will copy the license file and the demo video file. // to the videokit work folder location. // without the license file the library will not work. //copyLicenseAndDemoFilesFromAssetsToSDIfNeeded(); setContentView(R.layout.upload_video_activity); height = SignInActivity.getScreenHeight(UploadVideoActivity.this); width = SignInActivity.getScreenWidth(UploadVideoActivity.this); mProgressDialog = new ProgressDialog(UploadVideoActivity.this); pDialog = new ProgressDialog(UploadVideoActivity.this); showCustomToast = new ShowCustomToast(); connectionDetector = new ConnectionDetector(UploadVideoActivity.this); // mProgressDialog=new ProgressDialog(UploadVideoActivity.this,AlertDialog.THEME_HOLO_LIGHT); // mProgressDialog.setFeatureDrawableResource(height,R.drawable.rounded_toast); prefs = getSharedPreferences("PREF", MODE_PRIVATE); regId = prefs.getString("regid", "NA"); SharedPreferences pref = getSharedPreferences("DB", 0); userid = pref.getString("userid", "1"); SharedPreferences assign_prefs = getSharedPreferences("ASSIGN", 0); assignment_id = assign_prefs.getString("ASSIGN_ID", ""); videoPath = getIntent().getStringExtra("VIDEOPATH"); // iCTextView=(TextView) findViewById(R.id.tvIC); // iCTextView.setTypeface(CaptureVideoActivity.ic_typeface,Typeface.BOLD); // storiesTextView=(TextView) findViewById(R.id.tvStories); // storiesTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.BOLD); // watsStoryTextView=(TextView) findViewById(R.id.tvWhatsStory); // watsStoryTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.ITALIC); // logoImageView=(ImageView) findViewById(R.id.ivLogo); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams((int) (width/1.9), (int) (height/9.5)); // lp.addRule(RelativeLayout.CENTER_HORIZONTAL); // lp.setMargins(0, 0, 0, 0); // logoImageView.setLayoutParams(lp); uploadtTextView = (TextView) findViewById(R.id.tvUpload); uploadtTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); // extension=getIntent().getStringExtra("EXTENSION"); // folderPath = Environment.getExternalStorageDirectory().getPath()+"/ICStoriesFolder"; // if (!FileUtils.checkIfFolderExists(folderPath)) { // boolean isFolderCreated = FileUtils.createFolder(folderPath); // Log.i(Prefs.TAG, folderPath + " created? " + isFolderCreated); // if (isFolderCreated) { ////from w ww . java2s . c o m // } // } //command for rotating video 90 degree //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=1 -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k "+folderPath+"/out."+extension; //Change Video Resolution: //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=3 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/res."+extension; //command for compressing video // String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/test."+extension; // setCommand(commandStr); // runTranscoing(); thumb = ThumbnailUtils.createVideoThumbnail(videoPath, MediaStore.Images.Thumbnails.MINI_KIND); System.out.println("THUMB IMG in uplaod== " + thumb); titleEditText = (EditText) findViewById(R.id.etTitle); titleEditText.setTypeface(CaptureVideoActivity.stories_typeface); descriptionEditText = (EditText) findViewById(R.id.etDescripton); descriptionEditText.setTypeface(CaptureVideoActivity.stories_typeface); locationEditText = (EditText) findViewById(R.id.etLocation); locationEditText.setTypeface(CaptureVideoActivity.stories_typeface); isAssignmentButton = (Button) findViewById(R.id.buttonCheck); isAssignmentButton.setTypeface(CaptureVideoActivity.stories_typeface); isAssignmentButton.setOnClickListener(this); dailyAssignTextView = (TextView) findViewById(R.id.tvDailyAssignment); dailyAssignTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); uploadButton = (Button) findViewById(R.id.buttonUpload); uploadButton.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout uploadRelativeLayout = (RelativeLayout) findViewById(R.id.rlUpload); RelativeLayout.LayoutParams lp9 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, height / 17); lp9.addRule(RelativeLayout.BELOW, R.id.rlDailyAssignment); lp9.setMargins(width / 7, 30, width / 7, 0); uploadRelativeLayout.setLayoutParams(lp9); uploadButton.setOnClickListener(this); //bottom bar homeRelativeLayout = (RelativeLayout) findViewById(R.id.rlHome); homeRelativeLayout.setBackgroundResource(R.drawable.press_border); homeRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); homeTextView = (TextView) homeRelativeLayout.findViewById(R.id.tvHome); homeTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); homeTextView.setTextColor(Color.parseColor("#fffffe")); RelativeLayout.LayoutParams lp4 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp4.addRule(RelativeLayout.ALIGN_LEFT); homeRelativeLayout.setLayoutParams(lp4); homeRelativeLayout.setOnClickListener(this); wallRelativeLayout = (RelativeLayout) findViewById(R.id.rlWall); wallRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); wallTextView = (TextView) wallRelativeLayout.findViewById(R.id.tvWall); wallTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout.LayoutParams lp5 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp5.addRule(RelativeLayout.RIGHT_OF, R.id.rlHome); wallRelativeLayout.setLayoutParams(lp5); wallRelativeLayout.setOnClickListener(this); settingsRelativeLayout = (RelativeLayout) findViewById(R.id.rlSettings); settingsRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); settingsTextView = (TextView) settingsRelativeLayout.findViewById(R.id.tvSettings); settingsTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout.LayoutParams lp6 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp6.addRule(RelativeLayout.RIGHT_OF, R.id.rlWall); settingsRelativeLayout.setLayoutParams(lp6); settingsRelativeLayout.setOnClickListener(this); // current location locationDialog = new Dialog(UploadVideoActivity.this); locationDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); locationDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); locationDialog.setContentView(R.layout.location_dialog); locationDialog.setCancelable(true); LinearLayout dialogLayout = (LinearLayout) locationDialog.findViewById(R.id.ll1); okButton = (Button) dialogLayout.findViewById(R.id.OkBtn); okButton.setOnClickListener(this); cancelButton = (Button) dialogLayout.findViewById(R.id.cancelBtn); cancelButton.setOnClickListener(this); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); boolean network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (network_enabled) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); } else { showCustomToast.showToast(UploadVideoActivity.this, "Could not find current location. Please enable location services of your device."); } // else if(gps_enabled == false){ // locationDialog.show(); // } }
From source file:com.fa.mastodon.activity.LoginActivity.java
private static boolean openInCustomTab(Uri uri, Context context) { boolean lightTheme = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("lightTheme", false); int toolbarColorRes; if (lightTheme) { toolbarColorRes = R.color.custom_tab_toolbar_light; } else {/*from w w w .j a va2 s. co m*/ toolbarColorRes = R.color.custom_tab_toolbar_dark; } int toolbarColor = ContextCompat.getColor(context, toolbarColorRes); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); builder.setToolbarColor(Color.parseColor("#FFFFFF")); CustomTabsIntent customTabsIntent = builder.build(); try { String packageName = CustomTabsHelper.getPackageNameToUse(context); /* If we cant find a package name, it means theres no browser that supports * Chrome Custom Tabs installed. So, we fallback to the webview */ if (packageName == null) { return false; } else { customTabsIntent.intent.setPackage(packageName); customTabsIntent.launchUrl(context, uri); } } catch (ActivityNotFoundException e) { Log.w("URLSpan", "Activity was not found for intent, " + customTabsIntent.toString()); return false; } return true; }
From source file:com.amaze.carbonfilemanager.fragments.MainFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MAIN_ACTIVITY = (MainActivity) getActivity(); utilsProvider = MAIN_ACTIVITY;// w w w . ja v a 2 s .c o m utils = utilsProvider.getFutils(); setRetainInstance(true); no = getArguments().getInt("no", 1); home = getArguments().getString("home"); CURRENT_PATH = getArguments().getString("lastpath"); sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); //int hidemode = sharedPref.getInt("hidemode", 0);// TODO: 23/5/2017 use or delete fabSkin = MAIN_ACTIVITY.getColorPreference().getColorAsString(ColorUsage.ACCENT); iconskin = MAIN_ACTIVITY.getColorPreference().getColorAsString(ColorUsage.ICON_SKIN); skin_color = MAIN_ACTIVITY.getColorPreference().getColor(ColorUsage.PRIMARY); skinTwoColor = MAIN_ACTIVITY.getColorPreference().getColor(ColorUsage.PRIMARY_TWO); icon_skin_color = Color.parseColor(iconskin); SHOW_PERMISSIONS = sharedPref.getBoolean("showPermissions", false); SHOW_SIZE = sharedPref.getBoolean("showFileSize", false); SHOW_DIVIDERS = sharedPref.getBoolean("showDividers", true); SHOW_HEADERS = sharedPref.getBoolean("showHeaders", true); GO_BACK_ITEM = sharedPref.getBoolean("goBack_checkbox", false); CIRCULAR_IMAGES = sharedPref.getBoolean("circularimages", true); SHOW_LAST_MODIFIED = sharedPref.getBoolean("showLastModified", true); //IconUtils icons = new IconUtils(sharedPref, getActivity());// TODO: 23/5/2017 use this or delete it }
From source file:com.androguide.honamicontrol.MainActivity.java
@Override public void onPageSelected(int pos) { //We could set a different color for each tab here if needed changeColor(Color.parseColor(flatColors[pos])); switch (pos) { case 2:/*from ww w. ja v a 2 s .c o m*/ getSupportActionBar().setIcon(getResources().getDrawable(R.drawable.ic_tools_sound_control)); break; case 3: getSupportActionBar().setIcon(getResources().getDrawable(R.drawable.ic_tools_touchscreen)); break; default: getSupportActionBar().setIcon(getResources().getDrawable(R.drawable.ic_launcher)); break; } }