List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.insthub.O2OMobile.Activity.D1_OrderActivity.java
private void showOrderDialog(boolean isSucceed, orderacceptResponse response) { LayoutInflater inflater = LayoutInflater.from(D1_OrderActivity.this); View view = inflater.inflate(R.layout.d1_order_dialog, null); mOrderDialog = new Dialog(D1_OrderActivity.this, R.style.dialog); mOrderDialog.setContentView(view);//from w ww .j av a 2 s. c om mOrderDialog.setCanceledOnTouchOutside(false); mOrderDialog.show(); Button order_dialog_button = (Button) view.findViewById(R.id.order_dialog_button); ImageView order_dialog_icon = (ImageView) view.findViewById(R.id.order_dialog_icon); TextView order_dialog_text = (TextView) view.findViewById(R.id.order_dialog_text); TextView order_dialog_error_text = (TextView) view.findViewById(R.id.order_dialog_error_text); if (isSucceed) { order_dialog_icon.setImageResource(R.drawable.b2_selected_icon); order_dialog_text.setText(getString(R.string.receive_order_success)); order_dialog_text.setTextColor(Color.parseColor("#39BCED")); } else { order_dialog_icon.setImageResource(R.drawable.d3_failed); order_dialog_text.setText(getString(R.string.receive_order_fail)); order_dialog_text.setTextColor(Color.parseColor("#f65858")); order_dialog_error_text.setText(response.error_desc); } order_dialog_button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mOrderDialog.dismiss(); } }); }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void showMapHideLoadingScreen() { ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar); View loadingTV = (View) findViewById(R.id.loading_tv); progressBar.getIndeterminateDrawable().setColorFilter(Color.parseColor("#FF00BEED"), PorterDuff.Mode.MULTIPLY);/*from ww w . j av a2 s .com*/ progressBar.setVisibility(View.GONE); loadingTV.setVisibility(View.GONE); }
From source file:com.amaze.filemanager.utils.Futils.java
public void deleteFiles(ArrayList<Layoutelements> a, final Main b, List<Integer> pos) { final MaterialDialog.Builder c = new MaterialDialog.Builder(b.getActivity()); c.title(getString(b.getActivity(), R.string.confirm)); String names = ""; final ArrayList<BaseFile> todelete = new ArrayList<>(); for (int i = 0; i < pos.size(); i++) { todelete.add(a.get(pos.get(i)).generateBaseFile()); names = names + "\n" + (i + 1) + ". " + a.get(pos.get(i)).getTitle(); }/*from w w w. j a v a2 s . c o m*/ c.content(getString(b.getActivity(), R.string.questiondelete) + names); if (b.theme1 == 1) c.theme(Theme.DARK); c.negativeText(getString(b.getActivity(), R.string.no)); c.positiveText(getString(b.getActivity(), R.string.yes)); c.positiveColor(Color.parseColor(b.fabSkin)); c.negativeColor(Color.parseColor(b.fabSkin)); c.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { Toast.makeText(b.getActivity(), getString(b.getActivity(), R.string.deleting), Toast.LENGTH_SHORT) .show(); b.MAIN_ACTIVITY.mainActivityHelper.deleteFiles(todelete); } @Override public void onNegative(MaterialDialog materialDialog) { //materialDialog.cancel(); } }); c.build().show(); }
From source file:com.example.carsharing.ShortWayActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { photouri = Uri/*from w w w. j a v a2s. c o m*/ .fromFile(new File(this.getExternalFilesDir(Environment.DIRECTORY_PICTURES), IMAGE_FILE_NAME2)); super.onCreate(savedInstanceState); setContentView(R.layout.activity_short_way); activity_drawer = new Drawer(this, R.id.short_way_layout); mDrawerToggle = activity_drawer.newdrawer(); mDrawerLayout = activity_drawer.setDrawerLayout(); bdriver = true; // SharedPreferences sharedPref = this.getSharedPreferences(getString(R.string.PreferenceDefaultName), Context.MODE_PRIVATE); UserPhoneNumber = sharedPref.getString(getString(R.string.PreferenceUserPhoneNumber), "0"); // standard_date = new SimpleDateFormat("yyyy-MM-dd", Locale.SIMPLIFIED_CHINESE); primary_date = new SimpleDateFormat("yyyyMMdd", Locale.SIMPLIFIED_CHINESE); standard_time = new SimpleDateFormat("HH:mm:ss", Locale.SIMPLIFIED_CHINESE); primary_time = new SimpleDateFormat("HHmmss", Locale.SIMPLIFIED_CHINESE); queue = Volley.newRequestQueue(this); exchange = (ImageView) findViewById(R.id.shortway_exchange); exchange.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String temp = startplace.getText().toString(); if (!temp.equals("") && !endplace.getText().toString().equals("")) { startplace.setText(endplace.getText().toString()); endplace.setText(temp); float a, b; a = startplace_longitude; b = startplace_latitude; startplace_longitude = destination_longitude; startplace_latitude = destination_latitude; destination_longitude = a; destination_latitude = b; } } }); datebutton = (Button) findViewById(R.id.shortway_dates); earlystarttime = (Button) findViewById(R.id.shortway_earliest_start_time); latestarttime = (Button) findViewById(R.id.shortway_latest_start_time); increase = (Button) findViewById(R.id.shortway_increase); decrease = (Button) findViewById(R.id.shortway_decrease); s2 = (TextView) findViewById(R.id.shortway_count); startplace = (Button) findViewById(R.id.shortway_startplace); endplace = (Button) findViewById(R.id.shortway_endplace); sure = (Button) findViewById(R.id.shortway_sure); commute = findViewById(R.id.drawer_commute); shortway = findViewById(R.id.drawer_shortway); longway = findViewById(R.id.drawer_longway); setting = findViewById(R.id.drawer_setting); personalcenter = findViewById(R.id.drawer_personalcenter); about = findViewById(R.id.drawer_respond); taxi = findViewById(R.id.drawer_taxi); drawericon = (ImageView) findViewById(R.id.drawer_icon); drawername = (TextView) findViewById(R.id.drawer_name); drawernum = (TextView) findViewById(R.id.drawer_phone); carbrand = (EditText) findViewById(R.id.shortway_CarBrand); model = (EditText) findViewById(R.id.shortway_CarModel); color = (EditText) findViewById(R.id.shortway_color); licensenum = (EditText) findViewById(R.id.shortway_Num); licensenum.addTextChangedListener(numTextWatcher); carbrand.addTextChangedListener(detTextWatcher); color.addTextChangedListener(coTextWatcher); model.addTextChangedListener(moTextWatcher); next = (Button) findViewById(R.id.shortway_sure); next.setEnabled(false); db = new DatabaseHelper(ShortWayActivity.this, "test", null, 1); db1 = db.getWritableDatabase(); final TextView content = (TextView) findViewById(R.id.shortway_content); mRadio1 = (RadioButton) findViewById(R.id.shortway_radioButton1); mRadio2 = (RadioButton) findViewById(R.id.shortway_radioButton2); shortway_group = (RadioGroup) findViewById(R.id.shortway_radiobutton01); star1 = (ImageView) findViewById(R.id.shortway_star); star2 = (ImageView) findViewById(R.id.shortway_star01); // judge the value of "pre_page" Bundle bundle = this.getIntent().getExtras(); String PRE_PAGE = bundle.getString("pre_page"); if (PRE_PAGE.compareTo("ReOrder") == 0) { // startplace.setText(bundle.getString("stpusername") + "," + bundle.getString("stpmapname")); bstart = true; endplace.setText(bundle.getString("epusername") + "," + bundle.getString("epmapname")); bend = true; startplace_longitude = bundle.getFloat("stpx"); Log.e("startplace_longitude", String.valueOf(startplace_longitude)); startplace_latitude = bundle.getFloat("stpy"); Log.e("startplace_latitude", String.valueOf(startplace_latitude)); destination_longitude = bundle.getFloat("epx"); Log.e("destination_longitude", String.valueOf(destination_longitude)); destination_latitude = bundle.getFloat("epy"); Log.e("destination_latitude", String.valueOf(destination_latitude)); datebutton.setText(bundle.getString("re_short_startdate")); bdate = true; earlystarttime.setText(bundle.getString("re_short_starttime")); best = true; latestarttime.setText(bundle.getString("re_short_endtime")); blst = true; } // judge the value of "pre_page" about.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent about = new Intent(ShortWayActivity.this, AboutActivity.class); startActivity(about); } }); setting.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent setting = new Intent(ShortWayActivity.this, SettingActivity.class); startActivity(setting); } }); // database db = new DatabaseHelper(getApplicationContext(), UserPhoneNumber, null, 1); db1 = db.getWritableDatabase(); // database end star1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (bstart) { if (Pointisliked(StartPointMapName)) { // Define 'where' part of query. String selection = getString(R.string.dbstring_PlaceMapName) + " LIKE ?"; // Specify arguments in placeholder order. String[] selelectionArgs = { StartPointMapName }; // Issue SQL statement. db1.delete(getString(R.string.dbtable_placeliked), selection, selelectionArgs); star1.setImageResource(R.drawable.ic_action_not_important); } else { ContentValues content = new ContentValues(); content.put(getString(R.string.dbstring_PlaceUserName), StartPointUserName); content.put(getString(R.string.dbstring_PlaceMapName), StartPointMapName); content.put(getString(R.string.dbstring_longitude), startplace_longitude); content.put(getString(R.string.dbstring_latitude), startplace_latitude); db1.insert(getString(R.string.dbtable_placeliked), null, content); // Define 'where' part of query. String selection = getString(R.string.dbstring_PlaceMapName) + " LIKE ?"; // Specify arguments in placeholder order. String[] selelectionArgs = { StartPointMapName }; // Issue SQL statement. db1.delete(getString(R.string.dbtable_placehistory), selection, selelectionArgs); star1.setImageResource(R.drawable.ic_action_important); } } } }); star2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (bend) { if (Pointisliked(EndPointMapName)) { // Define 'where' part of query. String selection = getString(R.string.dbstring_PlaceMapName) + " LIKE ?"; // Specify arguments in placeholder order. String[] selelectionArgs = { EndPointMapName }; // Issue SQL statement. db1.delete(getString(R.string.dbtable_placeliked), selection, selelectionArgs); star2.setImageResource(R.drawable.ic_action_not_important); } else { ContentValues content = new ContentValues(); content.put(getString(R.string.dbstring_PlaceUserName), EndPointUserName); content.put(getString(R.string.dbstring_PlaceMapName), EndPointMapName); content.put(getString(R.string.dbstring_longitude), destination_longitude); content.put(getString(R.string.dbstring_latitude), destination_latitude); db1.insert(getString(R.string.dbtable_placeliked), null, content); // Define 'where' part of query. String selection = getString(R.string.dbstring_PlaceMapName) + " LIKE ?"; // Specify arguments in placeholder order. String[] selelectionArgs = { EndPointMapName }; // Issue SQL statement. db1.delete(getString(R.string.dbtable_placehistory), selection, selelectionArgs); star2.setImageResource(R.drawable.ic_action_important); } } } }); taxi.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); } }); personalcenter.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent personalcenter = new Intent(ShortWayActivity.this, PersonalCenterActivity.class); startActivity(personalcenter); } }); shortway.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); } }); longway.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent longway = new Intent(ShortWayActivity.this, MainActivity.class); startActivity(longway); } }); commute.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent commute = new Intent(ShortWayActivity.this, CommuteActivity.class); commute.putExtra("pre_page", "Drawer"); startActivity(commute); } }); // RadioGroup shortway_group.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int checkedId) { // TODO Auto-generated method stub18 // ID // """"textView if (checkedId == mRadio2.getId()) { bpassenager = true; bdriver = false; licensenum.setEnabled(false); carbrand.setEnabled(false); color.setEnabled(false); model.setEnabled(false); licensenum.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); carbrand.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); color.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); model.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); content.setText(getString(R.string.warningInfo_seatNeed)); licensenum.setHintTextColor(Color.parseColor("#cccccc")); carbrand.setHintTextColor(Color.parseColor("#cccccc")); color.setHintTextColor(Color.parseColor("#cccccc")); model.setHintTextColor(Color.parseColor("#cccccc")); licensenum.setInputType(InputType.TYPE_NULL); carbrand.setInputType(InputType.TYPE_NULL); color.setInputType(InputType.TYPE_NULL); model.setInputType(InputType.TYPE_NULL); } else { bpassenager = false; bdriver = true; licensenum.setEnabled(true); carbrand.setEnabled(true); color.setEnabled(true); model.setEnabled(true); licensenum.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); carbrand.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); color.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); model.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); content.setText(getString(R.string.warningInfo_seatOffer)); licensenum.setHintTextColor(Color.parseColor("#9F35FF")); carbrand.setHintTextColor(Color.parseColor("#9F35FF")); color.setHintTextColor(Color.parseColor("#9F35FF")); model.setHintTextColor(Color.parseColor("#9F35FF")); // licensenum.setText(""); // carbrand.setText(""); // color.setText(""); // model.setText(""); licensenum.setInputType(InputType.TYPE_CLASS_TEXT); carbrand.setInputType(InputType.TYPE_CLASS_TEXT); color.setInputType(InputType.TYPE_CLASS_TEXT); model.setInputType(InputType.TYPE_CLASS_TEXT); // start! selectcarinfo(UserPhoneNumber); // end! } confirm(); } }); sure.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if (shortway_group.getCheckedRadioButtonId() == mRadio1.getId()) userrole = "d"; else userrole = "p"; // start! shortway_request(UserPhoneNumber, datebutton.getText().toString(), earlystarttime.getText().toString(), latestarttime.getText().toString()); // end! } private void shortway_request(final String shortway_phonenum, final String shortway_date, final String shortway_starttime, final String shortway_endtime) { // TODO Auto-generated method stub // start try { test_date = primary_date.parse(shortway_date); standard_shortway_startdate = standard_date.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { test_date = primary_time.parse(shortway_starttime); standard_shortway_starttime = standard_time.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { test_date = primary_time.parse(shortway_endtime); standard_shortway_endtime = standard_time.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } // end! String shortway_baseurl = getString(R.string.uri_base) + getString(R.string.uri_ShortwayRequest) + getString(R.string.uri_addrequest_action); // "http://192.168.1.111:8080/CarsharingServer/ShortwayRequest!addrequest.action?"; Log.w("URL", shortway_baseurl); StringRequest stringRequest = new StringRequest(Request.Method.POST, shortway_baseurl, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.d("shortway_result", response); JSONObject json1 = null; try { json1 = new JSONObject(response); requestok = json1.getBoolean("result"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (requestok == true) { if (carinfochoosing_type == 1) { // add // start! carinfo(shortway_phonenum, licensenum.getText().toString(), carbrand.getText().toString(), model.getText().toString(), color.getText().toString(), String.valueOf(sum), 1); // end! } else { // update // start! carinfo(shortway_phonenum, licensenum.getText().toString(), carbrand.getText().toString(), model.getText().toString(), color.getText().toString(), String.valueOf(sum), 2); // end! } Intent sure = new Intent(ShortWayActivity.this, OrderResponseActivity.class); sure.putExtra(getString(R.string.request_response), "true"); sure.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(sure); } else { // Toast errorinfo = // Toast.makeText(getApplicationContext(), // "", Toast.LENGTH_LONG); // errorinfo.show(); Intent sure = new Intent(ShortWayActivity.this, OrderResponseActivity.class); sure.putExtra(getString(R.string.request_response), "false"); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("shortway_result", error.getMessage(), error); // Toast errorinfo = Toast.makeText(null, // "", Toast.LENGTH_LONG); // errorinfo.show(); Intent sure = new Intent(ShortWayActivity.this, OrderResponseActivity.class); sure.putExtra(getString(R.string.request_response), "false"); sure.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(sure); } }) { protected Map<String, String> getParams() { // POSTgetParams // start try { test_date = primary_date.parse(shortway_date); standard_shortway_startdate = standard_date.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { test_date = primary_time.parse(shortway_starttime); standard_shortway_starttime = standard_time.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { test_date = primary_time.parse(shortway_endtime); standard_shortway_endtime = standard_time.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } // end! Map<String, String> params = new HashMap<String, String>(); params.put("phonenum", shortway_phonenum); params.put("userrole", userrole); params.put("startplacex", String.valueOf(startplace_longitude)); params.put("startplacey", String.valueOf(startplace_latitude)); params.put(getString(R.string.uri_startplace), startplace.getText().toString()); params.put("destinationx", String.valueOf(destination_longitude)); params.put("destinationy", String.valueOf(destination_latitude)); params.put(getString(R.string.uri_destination), endplace.getText().toString()); params.put("startdate", standard_shortway_startdate); params.put("starttime", standard_shortway_starttime); params.put("endtime", standard_shortway_endtime); return params; } }; queue.add(stringRequest); } }); startplace.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub startActivityForResult(new Intent(ShortWayActivity.this, ChooseAddressActivity.class), 1); } }); endplace.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub startActivityForResult(new Intent(ShortWayActivity.this, ChooseArrivalActivity.class), 2); } }); increase.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub sum++; s2.setText("" + sum); confirm(); } }); decrease.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub sum--; if (sum < 0) { sum = 0; } s2.setText("" + sum); confirm(); } }); datebutton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(DATE_DIALOG); } }); earlystarttime.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(TIME_DIALOG); } }); latestarttime.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(TIME_DIALOG1); } }); }
From source file:com.allwinner.theatreplayer.launcher.activity.LaunchActivity.java
@SuppressWarnings("unchecked") private void setCellDate() { if (mCellInfoList == null || mCellViews == null) { return;/*w ww. j ava 2 s . c o m*/ } int listCount = mCellInfoList.size(); if (Constants.CELL_COUNT >= listCount) { CellInfo cellInfo = null; CellViews cellViews = null; ArrayList<CellInfo> cloneList = (ArrayList<CellInfo>) mCellInfoList.clone(); // Log.i("jim", "cloneList.size() = "+cloneList.size()); for (int i = 0; i < listCount; i++) { cellInfo = cloneList.get(i); cellViews = mCellViews.get(i); if (cellInfo != null) { if (cellViews != null && cellViews.iLayout != null) { if (cellInfo.type == 4) { cellViews.iLayout.setVisibility(View.INVISIBLE); } else if (cellInfo.type == 3) { cellViews.iLayout.setVisibility(View.GONE); } } if (cellInfo.type == 4 && !LoadApplicationInfo.isInstalled(this, cellInfo.packageName)) { mCellInfoList.remove(cellInfo); } } } cloneList.clear(); cloneList = null; listCount = mCellInfoList.size(); } for (int i = 0; i < listCount; i++) { CellInfo cellInfo = mCellInfoList.get(i); CellViews cellViews = mCellViews.get(i); if (cellViews != null && cellViews.iLayout != null) { cellViews.iLayout.setTag(cellInfo); cellViews.iLayout.setVisibility(View.VISIBLE); if (!mIsFiveLayout && cellInfo.type == 3 && !LoadApplicationInfo.isInstalled(this, cellInfo.packageName)) { cellViews.iLayout.setVisibility(View.GONE); } if (cellInfo.backgroundPic != null && !cellInfo.backgroundPic.equals("")) { BitmapDrawable bitmapDrawable = (BitmapDrawable) ImageUtils.getShortcutIconFromSys(this, cellInfo.backgroundPic); if (bitmapDrawable != null) { Bitmap bitmap = bitmapDrawable.getBitmap(); cellViews.iLayout.setImageBitmap(bitmap); } } else if (cellInfo.backgroundColour != null && !cellInfo.backgroundColour.equals("")) { cellViews.iLayout.setBackgroundColor(Color.parseColor(cellInfo.backgroundColour)); } // if (i != 0) { // if(cellInfo.packageName.equals("com.vst.live.allwinner")){ // Log.i("jim", "55555555555======"+cellInfo.packageName); // // } Drawable iconDrawable = null; if (cellInfo.icon != null && !cellInfo.icon.equals("")) { iconDrawable = ImageUtils.getShortcutIconFromSys(this, cellInfo.icon); } if (iconDrawable == null && cellInfo.type == 4) { iconDrawable = ImageUtils.getAppIcon(cellInfo.packageName, this); } if (iconDrawable != null && cellViews.iconView != null) { cellViews.iconView.setImageDrawable(iconDrawable); } if (cellViews.textView != null) { cellViews.textView.setText(cellInfo.title); } // } if (cellViews.imgView != null) { Bitmap bitmap = ImageUtils.loadImageFromLocat(this, cellInfo.className); if (bitmap == null) { bitmap = ImageUtils.getBitmapByPicName(this, "img_" + cellInfo.className); } if (bitmap != null) { cellViews.imgView.setImageBitmap(bitmap); } } } } }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
private void deselectRow(int index) { if (index >= 0) { TableRow tr = (TableRow) tl.findViewWithTag(index); if (tr != null) { tr.setBackgroundColor(Color.parseColor("#F2F7F2")); }/*from ww w . j a v a 2 s . c om*/ } }
From source file:com.ofalvai.bpinfo.api.bkkinfo.BkkInfoClient.java
/** * Returns the background and foreground colors of the route, because the alert list API * doesn't return them in the response.//from www . j a v a2s.c o m * Note that the alert detail response contains color values, so the alert detail parsing * doesn't need to call this. * @param type Parsed type of the route. Most of the time this is enough to match the colors * @param shortName Parsed short name (line number) of the route. This is needed because some * route types have different colors for each route (eg. subway, ferry). * @return Array of color-ints: background, foreground */ @ColorInt private int[] parseRouteColors(RouteType type, String shortName) { // Color values based on this list of routes: // http://online.winmenetrend.hu/budapest/latest/lines String defaultBackground = "EEEEEE"; String defaultText = "BBBBBB"; String background; String text; switch (type) { case BUS: if (shortName.matches("^9[0-9][0-9][A-Z]?$")) { // Night bus numbers start from 900, and might contain one extra letter after // the 3 digits. background = "1E1E1E"; text = "FFFFFF"; } else if (shortName.equals("I")) { // Nostalgia bus background = "FFA417"; text = "FFFFFF"; } else { // Regular bus background = "009FE3"; text = "FFFFFF"; } break; case FERRY: if (shortName.equals("D12")) { background = "9A1915"; text = "FFFFFF"; } else { background = "E50475"; text = "FFFFFF"; } break; case RAIL: switch (shortName) { case "H5": background = "821066"; text = "FFFFFF"; break; case "H6": background = "884200"; text = "FFFFFF"; break; case "H7": background = "EE7203"; text = "FFFFFF"; break; case "H8": background = "FF6677"; text = "FFFFFF"; break; case "H9": background = "FF6677"; text = "FFFFFF"; break; default: background = defaultBackground; text = defaultText; } break; case TRAM: background = "FFD800"; text = "000000"; break; case TROLLEYBUS: background = "FF1609"; text = "FFFFFF"; break; case SUBWAY: switch (shortName) { case "M1": background = "FFD800"; text = "000000"; break; case "M2": background = "FF1609"; text = "FFFFFF"; break; case "M3": background = "005CA5"; text = "FFFFFF"; break; case "M4": background = "19A949"; text = "FFFFFF"; break; default: background = defaultBackground; text = defaultText; } break; case CHAIRLIFT: background = "009155"; text = "000000"; break; case FUNICULAR: background = "884200"; text = "000000"; break; case _OTHER_: background = defaultBackground; text = defaultText; break; default: background = defaultBackground; text = defaultText; break; } int backgroundColor; int textColor; try { backgroundColor = Color.parseColor("#" + background); textColor = Color.parseColor("#" + text); } catch (IllegalArgumentException ex) { backgroundColor = Color.parseColor("#" + defaultBackground); textColor = Color.parseColor("#" + defaultText); } return new int[] { backgroundColor, textColor }; }
From source file:au.com.wallaceit.reddinator.Rservice.java
private void getThemeColors() { switch (Integer.valueOf(mSharedPreferences.getString("widgetthemepref", "1"))) { // set colors array: healine text, load more text, divider, domain text, vote & comments case 1:/*from w w w.j a v a 2s . com*/ themeColors = new int[] { Color.BLACK, Color.BLACK, Color.parseColor("#D7D7D7"), Color.parseColor("#336699"), Color.parseColor("#FF4500") }; break; case 2: themeColors = new int[] { Color.WHITE, Color.WHITE, Color.parseColor("#646464"), Color.parseColor("#5F99CF"), Color.parseColor("#FF8B60") }; break; case 3: case 4: case 5: themeColors = new int[] { Color.WHITE, Color.WHITE, Color.parseColor("#646464"), Color.parseColor("#CEE3F8"), Color.parseColor("#FF8B60") }; break; } // user title color override if (!mSharedPreferences.getString("titlecolorpref", "0").equals("0")) { themeColors[0] = Color.parseColor(mSharedPreferences.getString("titlecolorpref", "#000")); } }
From source file:com.hypodiabetic.happ.MainActivity.java
public void displayCurrentInfo() { final TextView currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime); final TextView notificationText = (TextView) findViewById(R.id.notices); final TextView deltaText = (TextView) findViewById(R.id.bgDelta); if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) { currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); }//from w w w . j ava 2s.c o m Bg lastBgreading = Bg.last(); if (lastBgreading != null) { notificationText.setText(lastBgreading.readingAge()); String bgDelta = tools.unitizedBG(lastBgreading.bgdelta, MainApp.instance().getApplicationContext()); if (lastBgreading.bgdelta >= 0) bgDelta = "+" + bgDelta; deltaText.setText(bgDelta); currentBgValueText.setText(extendedGraphBuilder.unitized_string(lastBgreading.sgv_double()) + " " + lastBgreading.slopeArrow()); if ((new Date().getTime()) - (60000 * 16) - lastBgreading.datetime > 0) { notificationText.setTextColor(Color.parseColor("#C30909")); currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { notificationText.setTextColor(Color.WHITE); } double estimate = lastBgreading.sgv_double(); if (extendedGraphBuilder.unitized(estimate) <= extendedGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (extendedGraphBuilder.unitized(estimate) >= extendedGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } } //Stats UI update updateStats(null); //OpenAPS UI update updateOpenAPSDetails(null); //Temp Basal running update updateRunningTemp(); }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void hideNoInternetScreen() { hideLoadingScreen();/*from w ww .j a v a 2s . c om*/ TextView ConnectionTV = (TextView) findViewById(R.id.loading_tv); ConnectionTV.setText("Loading smog data"); ConnectionTV.setTextColor(Color.parseColor("#FF00BEED")); ConnectionTV.setPadding(0, 30, 0, 30); }