List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.customdatepicker.date.DatePickerDialog.java
/** * Set the text color of the OK button/*ww w. j av a2 s. c o m*/ * * @param color the color you want */ @SuppressWarnings("unused") public void setOkColor(String color) { mOkColor = Color.parseColor(color); }
From source file:com.spydiko.rotationmanager.MainActivity.java
@Override public void onClick(View view) { // Button temp = (Button) view; ImageView tmp;/*from w w w.j a va2 s . c om*/ vibe.vibrate(50);// Vibrate it's time you click something... switch (view.getId()) { case (R.id.button2):// Clear all button for (Model mdl : activities) { mdl.setSelectedPortrait(false); mdl.setSelectedLandscape(false); myapp.savePreferences(mdl.getPackageName(), false, true); myapp.savePreferences(mdl.getPackageName(), false, false); } lv.setAdapter(adapter); break; case (R.id.orientationButton):// Auto-Rotation button tmp = (ImageView) findViewById(view.getId()); //****************** //-----4state------- int state = AppSpecificOrientation.getCheck_button(); state = (state + 1) % 5; switch (state) { case 0: tmp.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_on)); autoRotate.setTextColor(Color.GREEN); autoRotate.setText(getResources().getText(R.string.orientationOn)); AppSpecificOrientation.setCheck_button(0); Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1); break; case 1: tmp.setImageDrawable(getResources().getDrawable(R.drawable.auto_rotate_off)); autoRotate.setTextColor(Color.RED); autoRotate.setText(getResources().getText(R.string.orientationOff)); AppSpecificOrientation.setCheck_button(1); Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0); break; case 2: tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_portrait)); autoRotate.setTextColor(Color.CYAN); autoRotate.setText(getResources().getText(R.string.forced_portrait)); AppSpecificOrientation.setCheck_button(2); break; case 3: tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_landscape)); autoRotate.setTextColor(Color.CYAN); autoRotate.setText(getResources().getText(R.string.forced_landscape)); AppSpecificOrientation.setCheck_button(3); break; case 4: tmp.setImageDrawable(getResources().getDrawable(R.drawable.forced_auto)); autoRotate.setTextColor(Color.parseColor("#FFFFFF")); autoRotate.setText(getResources().getText(R.string.forced_auto)); AppSpecificOrientation.setCheck_button(4); break; default: break; } break; } }
From source file:com.amaze.filemanager.utils.Futils.java
public void showProps(final HFile f, final Activity c, int theme1) { String date = null;// w w w . ja v a 2s .c om try { date = getdate(f.lastModified()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (SmbException e) { e.printStackTrace(); } String items = getString(c, R.string.calculating), size = getString(c, R.string.calculating), name, parent; name = f.getName(); parent = f.getReadablePath(f.getParent()); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c); String fabskin = PreferenceUtils.getAccentString(sp); MaterialDialog.Builder a = new MaterialDialog.Builder(c); a.title(getString(c, R.string.properties)); if (theme1 == 1) a.theme(Theme.DARK); View v = c.getLayoutInflater().inflate(R.layout.properties_dialog, null); v.findViewById(R.id.appX).setVisibility(View.GONE); a.customView(v, true); a.positiveText(R.string.copy_path); a.negativeText(getString(c, R.string.md5_2)); a.positiveColor(Color.parseColor(fabskin)); a.negativeColor(Color.parseColor(fabskin)); a.neutralText(R.string.cancel); a.neutralColor(Color.parseColor(fabskin)); a.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { copyToClipboard(c, f.getPath()); Toast.makeText(c, c.getResources().getString(R.string.pathcopied), Toast.LENGTH_SHORT).show(); } @Override public void onNegative(MaterialDialog materialDialog) { } }); MaterialDialog materialDialog = a.build(); materialDialog.show(); new GenerateMD5Task(materialDialog, (f), name, parent, size, items, date, c, v).execute(f.getPath()); }
From source file:com.customdatepicker.date.DatePickerDialog.java
/** * Set the text color of the Cancel button * * @param color the color you want// w w w. ja v a 2 s . c o m */ @SuppressWarnings("unused") public void setCancelColor(String color) { mCancelColor = Color.parseColor(color); }
From source file:com.example.search.car.pools.welcome.java
private void initMenu() { iv_search = (ImageView) findViewById(R.id.iv_search); iv_cities = (ImageView) findViewById(R.id.iv_cities); iv_dashboard = (ImageView) findViewById(R.id.iv_dashboard); // iv_edit_profile = (ImageView) findViewById(R.id.iv_edit_profile); iv_login = (ImageView) findViewById(R.id.iv_login); login = (TextView) findViewById(R.id.tv_login); profile_login = (TextView) findViewById(R.id.tv_profile_login); tv_profile_name = (TextView) findViewById(R.id.tv_profile_name); tv_profile_email = (TextView) findViewById(R.id.tv_profile_email); avatar = (MyCirclure) findViewById(R.id.avatar); svg_search = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.search1); svg_cities = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.city); svg_dashboard = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.dashboard); svg_edit_profile = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.edit); svg_login = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.login_side_menu); svg_logout = SVGParser.getSVGFromResource(welcome.this.getResources(), R.raw.logout_side_menu); iv_search.setImageDrawable(svg_search.createPictureDrawable()); iv_cities.setImageDrawable(svg_cities.createPictureDrawable()); iv_dashboard.setImageDrawable(svg_dashboard.createPictureDrawable()); // iv_edit_profile.setImageDrawable(svg_edit_profile.createPictureDrawable()); rlProfile = (LinearLayout) findViewById(R.id.rlProfile); rlProfile_login = (LinearLayout) findViewById(R.id.rlProfile_login); rlSearch = (RelativeLayout) findViewById(R.id.rlSearch); rlCities = (RelativeLayout) findViewById(R.id.rlCities); rlDashboard = (RelativeLayout) findViewById(R.id.rlDashboard); // rlEditProfile = (RelativeLayout) findViewById(R.id.rlEditProfile); rlLogin = (RelativeLayout) findViewById(R.id.rlLogin); l_search = (RelativeLayout) findViewById(R.id.l_search); l_cities = (RelativeLayout) findViewById(R.id.l_cities); l_dashboard = (RelativeLayout) findViewById(R.id.l_dashboard); // l_edit_profile = (RelativeLayout) findViewById(R.id.l_Edit_Profile); if (task.getString("user_id", null) != null) { iv_login.setImageDrawable(svg_logout.createPictureDrawable()); rlProfile.setVisibility(View.VISIBLE); rlProfile_login.setVisibility(View.GONE); rlDashboard.setVisibility(View.GONE); // rlEditProfile.setVisibility(View.GONE); set_data();/*from w w w. j a va2s . c o m*/ } else { iv_login.setImageDrawable(svg_login.createPictureDrawable()); rlProfile.setVisibility(View.GONE); rlProfile_login.setVisibility(View.VISIBLE); } rlLogin.setOnClickListener(this); rlProfile.setOnClickListener(this); rlProfile_login.setOnClickListener(this); rlSearch.setOnClickListener(this); rlCities.setOnClickListener(this); rlDashboard.setOnClickListener(this); login.setOnClickListener(this); profile_login.setOnClickListener(this); // rlEditProfile.setOnClickListener(this); rlSearch.setBackgroundColor(Color.parseColor("#00ca98")); l_search.setBackground(getResources().getDrawable(R.drawable.white_circle_side_menu)); }
From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java
public static int parseColor(View view, String text) { if (text.startsWith("@color/")) { Resources resources = view.getResources(); return resources.getColor(resources.getIdentifier(text.substring("@color/".length()), "color", view.getContext().getPackageName())); }//from www . ja v a 2s . c o m if (text.length() == 4 && text.startsWith("#")) { text = "#" + text.charAt(1) + text.charAt(1) + text.charAt(2) + text.charAt(2) + text.charAt(3) + text.charAt(3); } return Color.parseColor(text); }
From source file:com.coincide.alphafitness.ui.Fragment_Main.java
/** * Updates the bar graph to show the steps/distance of the last week. Should * be called when switching from step count to distance. */// w ww. jav a2 s .c o m private void updateBars() { SimpleDateFormat df = new SimpleDateFormat("E", Locale.getDefault()); BarChart barChart = (BarChart) getView().findViewById(R.id.bargraph); if (barChart.getData().size() > 0) barChart.clearChart(); int steps; float distance = 0, stepsize = Fragment_Settings.DEFAULT_STEP_SIZE; boolean stepsize_cm = true; if (!showSteps) { // load some more settings if distance is needed SharedPreferences prefs = getActivity().getSharedPreferences("pedometer", Context.MODE_PRIVATE); stepsize = prefs.getFloat("stepsize_value", Fragment_Settings.DEFAULT_STEP_SIZE); stepsize_cm = prefs.getString("stepsize_unit", Fragment_Settings.DEFAULT_STEP_UNIT).equals("cm"); } barChart.setShowDecimal(!showSteps); // show decimal in distance view only BarModel bm; Database db = Database.getInstance(getActivity()); // List<Pair<Long, Integer>> last = db.getLastEntries(8); List<Pair<Float, Integer>> last = db.getWorkouts(8); db.close(); for (int i = last.size() - 1; i > 0; i--) { // Pair<Long, Integer> current = last.get(i); Pair<Float, Integer> current = last.get(i); steps = current.second; if (steps > 0) { // bm = new BarModel(df.format(new Date(current.first)), 0, // steps > goal ? Color.parseColor("#99CC00") : Color.parseColor("#0099cc")); bm = new BarModel("Calories Burnt", 0, Color.parseColor("#0099cc")); /*if (showSteps) { bm.setValue(steps); } else { distance = steps * stepsize; if (stepsize_cm) { distance /= 100000; } else { distance /= 5280; } distance = Math.round(distance * 1000) / 1000f; // 3 decimals bm.setValue(distance); }*/ bm.setValue(current.first); barChart.addBar(bm); } } /* bm=new BarModel("Calories Burnt",0,Color.parseColor("#0099cc")); bm.setValue(2.5f); barChart.addBar(bm); bm=new BarModel("Calories Burnt",0,Color.parseColor("#0099cc")); bm.setValue(1.5f); barChart.addBar(bm); bm=new BarModel("Calories Burnt",0,Color.parseColor("#0099cc")); bm.setValue(1.0f); barChart.addBar(bm); */ if (barChart.getData().size() > 0) { barChart.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { // Dialog_Statistics.getDialog(getActivity(), since_boot).show(); } }); barChart.startAnimation(); } else { barChart.setVisibility(View.VISIBLE); } // Database db = Database.getInstance(getActivity()); try { long avgDistance = db.getAVGDistance(); long avgTime = db.getAVGTime(); long millis = avgTime * 100; // obtained from StopWatch long minutes = (millis / 1000) / 60; long avg = minutes / avgDistance; tv_avg.setText(TimeFormatUtil.toDisplayString((int) avg)); avgDistance = db.getMAXDistance(); avgTime = db.getMAXTime(); millis = avgTime * 100; // obtained from StopWatch minutes = (millis / 1000) / 60; avg = minutes / avgDistance; tv_max.setText(TimeFormatUtil.toDisplayString((int) avg)); avgDistance = db.getMINDistance(); avgTime = db.getMINTime(); millis = avgTime * 100; // obtained from StopWatch minutes = (millis / 1000) / 60; avg = minutes / avgDistance; tv_min.setText(TimeFormatUtil.toDisplayString((int) avg)); } catch (Exception e) { } }
From source file:com.esprit.lyricsplus.DAO.SongDAO.java
public void getSearchTracks(String track, final List<Song> songs, final SearchTrackRVAdapter adapter) { songs.clear();//from w ww. ja v a 2s .c om String url = replace("http://api.musixmatch.com/ws/1.1/track.search?q_track=" + track + "&s_track_rating=DESC&apikey=73ddf8ff707c806059b04faa88e4d483" + "&format=json&page_size=15"); final SweetAlertDialog pDialog = new SweetAlertDialog(SongSearchFragment.activity, SweetAlertDialog.PROGRESS_TYPE); pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86")); pDialog.setTitleText("Loading"); pDialog.setCancelable(false); pDialog.show(); Volley.newRequestQueue(SongSearchFragment.app.getApplicationContext()) .add(new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { if (response != null) { getSuggestedTracks(songs, response); adapter.notifyDataSetChanged(); if (adapter.getItemCount() == 0) { SongSearchFragment.rv.setVisibility(View.INVISIBLE); SongSearchFragment.nfound.setVisibility(View.VISIBLE); } } pDialog.dismiss(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { System.out.println("error setting note : " + error.getMessage()); if (error instanceof TimeoutError) { System.out.println(error.toString()); } pDialog.dismiss(); } })); }
From source file:io.lqd.sdk.Liquid.java
/** * Get a variable value./* w w w . ja va2s . c o m*/ * * @param variableKey * Variable Key of the Value. * @param fallbackValue * is the value returned if the value for variableKey doesn't * exist in Liquid instance. * @return The value in Liquid instance or fallbackValue if the variable * don't exist. */ public int getColorVariable(String variableKey, int fallbackValue) { if (isDevelopmentMode) { sendBundleVariable(LQVariable.buildJsonObject(variableKey, LiquidTools.colorToHex(fallbackValue), LQVariable.COLOR_TYPE)); } if (!mAppliedValues.containsKey(variableKey)) { return fallbackValue; } if (mAppliedValues.get(variableKey).getDataType().equals(LQVariable.COLOR_TYPE)) { try { return Color.parseColor(mAppliedValues.get(variableKey).getValue().toString()); } catch (IllegalArgumentException e) { LQLog.error("Error parsing Color with key: \"" + variableKey + "\""); } } invalidateVariables(variableKey); return fallbackValue; }
From source file:com.flipzu.flipzu.Player.java
private void setLiveVisible(boolean visible) { ImageView live_v = (ImageView) findViewById(R.id.livetag); ImageView live_vb = (ImageView) findViewById(R.id.livetag_bottom); TextView time_str = (TextView) findViewById(R.id.time_str); if (visible) { int color = Color.parseColor("#FFFFFF"); updateBanner("", color); live_v.setVisibility(View.VISIBLE); live_vb.setVisibility(View.VISIBLE); time_str.setVisibility(View.INVISIBLE); findViewById(R.id.seekbar).setVisibility(View.INVISIBLE); } else {// w w w. j a v a2s . co m live_v.setVisibility(View.INVISIBLE); live_vb.setVisibility(View.INVISIBLE); // time_str.setVisibility(View.VISIBLE); } }