List of usage examples for android.graphics Color GRAY
int GRAY
To view the source code for android.graphics Color GRAY.
Click Source Link
From source file:com.igniva.filemanager.utils.Futils.java
public void showHiddenDialog(final Main m) { final MaterialDialog.Builder a = new MaterialDialog.Builder(m.getActivity()); a.positiveText(R.string.cancel);// w ww . j av a 2s . c o m a.positiveColor(Color.parseColor(BaseActivity.accentSkin)); a.title(R.string.hiddenfiles); if (m.theme1 == 1) a.theme(Theme.DARK); a.autoDismiss(true); HiddenAdapter adapter = new HiddenAdapter(m.getActivity(), m, R.layout.bookmarkrow, toHFileArray(DataUtils.getHiddenfiles()), null, false); a.adapter(adapter, new MaterialDialog.ListCallback() { @Override public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence charSequence) { } }); a.dividerColor(Color.GRAY); MaterialDialog x = a.build(); adapter.updateDialog(x); x.show(); }
From source file:com.seatgeek.placesautocompletedemo.MainFragment.java
/** * chooses a random color from array.xml *///w w w .java 2s.com private int getRandomMaterialColor(String typeColor) { int returnColor = Color.GRAY; int arrayId = getResources().getIdentifier("mdcolor_" + typeColor, "array", getContext().getPackageName()); if (arrayId != 0) { TypedArray colors = getResources().obtainTypedArray(arrayId); int index = (int) (Math.random() * colors.length()); returnColor = colors.getColor(index, Color.GRAY); colors.recycle(); } return returnColor; }
From source file:com.bookkos.bircle.CaptureActivity.java
@Override public void amazonAPIAsyncTaskCallback(String result, String request_url) { String response = result;/*from w w w.j av a 2 s. c o m*/ JSONArray json_array = amazonAPIResultJSONArray; String isbn = ""; if (lastResult != null) { isbn = lastResult.toString(); } // ????? if (response == null) { requestCount++; if (requestCount < 5) { HttpConnectAmazonAPI connect_amazon_api = new HttpConnectAmazonAPI(_activity, _context, request_url, this); connect_amazon_api.execute(); } else { Toast.makeText(_context, "????????. ????????????.", Toast.LENGTH_LONG).show(); restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS); requestCount = 0; } } // ????? else if (response != null) { requestCount = 0; // AmazonAPI???????????, ??? if (response.equals("0")) { titleInputDialog(isbn, json_array); } // ?????? else if (response.equals("1")) { // ????????, json_array?????????? if (json_array != null) { parseShelfData(isbn, json_array); } // ??ISBN?????????????else??(????) else { // ????????????? arrayList.add("&book_code[]=" + lastResult); if (bookListViewAdapter.isEmpty()) { animateTranslationY(bookRegistRelativeLayout, displayHeight, displayHeight - displayHeight / 4 - titleBarHeight); borrowReturnButton.setEnabled(false); registButton.setEnabled(false); borrowReturnButton.setTextColor(Color.GRAY); registButton.setTextColor(Color.GRAY); } // ????? bookListViewAdapter.add(new BookListViewItem(lastResult.toString())); // for(int i=0; i < arrayList.size(); i++){ // text += arrayList.get(i) + "\n"; // } bircleBeepManager.playBeepSoundAndVibrate(2); Toast.makeText(_context, "ISBN = " + lastResult + " ?????.", Toast.LENGTH_SHORT).show(); restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS); } } else { } } }
From source file:com.mdlive.sav.MDLiveProviderDetails.java
private void clickForVideoOrPhoneTapReqFutureAction() { findViewById(R.id.dateTxtLayout).setVisibility(View.VISIBLE); tapSeetheDoctorTxtLayout.setVisibility(View.GONE); reqfutureapptBtnLayout.setVisibility(View.GONE); videophoneparentLl.setVisibility(View.VISIBLE); horizontalscrollview.setVisibility(View.GONE); //This condition is only for PHS Users final UserBasicInfo userBasicInfo = UserBasicInfo.readFromSharedPreference(getBaseContext()); //PHS user/* w w w . j av a2s . com*/ if (userBasicInfo.getPersonalInfo().getConsultMethod().equalsIgnoreCase("video")) { byphoneBtnLayout.setVisibility(View.INVISIBLE); byphoneBtnLayout.setBackgroundResource(R.drawable.disable_round_rect_grey_border); byphoneBtn.setTextColor(getResources().getColor(R.color.disableBtn)); ((ImageView) findViewById(R.id.phoneicon)).setImageResource(R.drawable.phone_icon_gray); byphoneBtnLayout.setClickable(false); saveAppmtType("video"); byvideoBtnLayout.setBackgroundResource(R.drawable.searchpvr_white_rounded_corner); byvideoBtn.setTextColor(Color.GRAY); byvideoBtn.setTextColor(Color.GRAY); byvideoBtnLayout.setVisibility(View.VISIBLE); byvideoBtnLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { horizontalscrollview.smoothScrollTo(layout.getChildAt(0).getLeft(), 0); byvideoBtnLayout.setBackgroundResource(R.drawable.searchpvr_blue_rounded_corner); byvideoBtn.setTextColor(Color.WHITE); ((ImageView) findViewById(R.id.videoicon)).setImageResource(R.drawable.video_icon_white); ((ImageView) findViewById(R.id.phoneicon)).setImageResource(R.drawable.phone_icon_gray); byphoneBtnLayout.setBackgroundResource(R.drawable.disable_round_rect_grey_border); byphoneBtn.setTextColor(getResources().getColor(R.color.disableBtn)); byphoneBtnLayout.setVisibility(View.INVISIBLE); byphoneBtnLayout.setClickable(false); horizontalscrollview.setVisibility(View.VISIBLE); final LinearLayout layout = (LinearLayout) findViewById(R.id.panelMessageFiles); if (layout.getChildCount() > 0) { layout.removeAllViews(); } for (TextView tv : videoList) { layout.addView(tv); } saveConsultationType("Video", MDLiveProviderDetails.this); //Enable Request Appointment Button enableReqAppmtBtn(); ((ImageView) findViewById(R.id.videoicon)).setImageResource(R.drawable.video_icon_white); //horizontalscrollview.smoothScrollTo(0,0); horizontalscrollview.smoothScrollTo(layout.getChildAt(0).getLeft(), 0); horizontalscrollview.postDelayed(new Runnable() { public void run() { horizontalscrollview.fullScroll(HorizontalScrollView.FOCUS_LEFT); } }, 100L); //horizontalscrollview.fullScroll(HorizontalScrollView.FOCUS_LEFT); selectedTimeslot = false; enableReqAppmtBtn(); clearTimeSlotViews(); horizontalscrollview.startAnimation(AnimationUtils.loadAnimation(MDLiveProviderDetails.this, R.anim.mdlive_trans_left_in)); } catch (Exception e) { e.printStackTrace(); } } }); } else if (userBasicInfo.getPersonalInfo().getConsultMethod().equalsIgnoreCase("phone")) { phsOnlyForPhone(); } //Only For idaho else if (longLocation.equalsIgnoreCase("idaho")) { onlyForIdaho(); } //Only For Texas else if (longLocation.equalsIgnoreCase("texas")) { phsOnlyForPhone(); } //Vido or Phone Button on Click listener for Blue color else { //Disabling the Video or Phone Based on the Phone list and video list //if the phone list is empty we should not shown the Phone Layout //if the video list is empty then we should not show the Video Layout. byvideoBtnLayout.setBackgroundResource(R.drawable.searchpvr_white_rounded_corner); ((ImageView) findViewById(R.id.videoicon)).setImageResource(R.drawable.video_icon); ((ImageView) findViewById(R.id.phoneicon)).setImageResource(R.drawable.phone_icon); byvideoBtn.setTextColor(Color.GRAY); byphoneBtnLayout.setBackgroundResource(R.drawable.searchpvr_white_rounded_corner); byphoneBtn.setTextColor(Color.GRAY); if (videoList.size() == 0) { saveAppmtType("phone"); byvideoBtnLayout.setVisibility(View.VISIBLE); byvideoBtnLayout.setBackgroundResource(R.drawable.disable_round_rect_grey_border); byvideoBtn.setTextColor(getResources().getColor(R.color.disableBtn)); ((ImageView) findViewById(R.id.videoicon)).setImageResource(R.drawable.video_icon_gray); byvideoBtnLayout.setClickable(false); } else { byvideoBtnLayout.setVisibility(View.VISIBLE); byvideoBtnLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { horizontalscrollview.smoothScrollTo(layout.getChildAt(0).getLeft(), 0); byvideoBtnLayout.setBackgroundResource(R.drawable.searchpvr_blue_rounded_corner); byvideoBtn.setTextColor(Color.WHITE); ((ImageView) findViewById(R.id.videoicon)) .setImageResource(R.drawable.video_icon_white); byphoneBtnLayout.setVisibility(View.VISIBLE); byphoneBtnLayout.setBackgroundResource(R.drawable.searchpvr_white_rounded_corner); byphoneBtn.setTextColor(Color.GRAY); ((ImageView) findViewById(R.id.phoneicon)).setImageResource(R.drawable.phone_icon); horizontalscrollview.setVisibility(View.VISIBLE); LinearLayout layout = (LinearLayout) findViewById(R.id.panelMessageFiles); if (layout.getChildCount() > 0) { layout.removeAllViews(); } for (TextView tv : videoList) { layout.addView(tv); } saveConsultationType("Video", MDLiveProviderDetails.this); //Enable Request Appointment Button horizontalscrollview.smoothScrollTo(layout.getChildAt(0).getLeft(), 0); ((ImageView) findViewById(R.id.videoicon)) .setImageResource(R.drawable.video_icon_white); ((ImageView) findViewById(R.id.phoneicon)).setImageResource(R.drawable.phone_icon); selectedTimeslot = false; enableReqAppmtBtn(); clearTimeSlotViews(); horizontalscrollview.startAnimation(AnimationUtils .loadAnimation(MDLiveProviderDetails.this, R.anim.mdlive_trans_left_in)); } catch (Exception e) { e.printStackTrace(); } } }); } if (phoneList.size() == 0) { saveAppmtType("video"); byphoneBtnLayout.setVisibility(View.VISIBLE); byphoneBtnLayout.setBackgroundResource(R.drawable.disable_round_rect_grey_border); byphoneBtn.setTextColor(getResources().getColor(R.color.disableBtn)); ((ImageView) findViewById(R.id.phoneicon)).setImageResource(R.drawable.phone_icon_gray); byphoneBtnLayout.setClickable(false); } else { byphoneBtnLayout.setVisibility(View.VISIBLE); byphoneBtnLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { horizontalscrollview.smoothScrollTo(layout.getChildAt(0).getLeft(), 0); byphoneBtnLayout.setBackgroundResource(R.drawable.searchpvr_blue_rounded_corner); byphoneBtn.setTextColor(Color.WHITE); ((ImageView) findViewById(R.id.phoneicon)) .setImageResource(R.drawable.phone_icon_white); byvideoBtnLayout.setVisibility(View.VISIBLE); byvideoBtnLayout.setBackgroundResource(R.drawable.searchpvr_white_rounded_corner); byvideoBtn.setTextColor(Color.GRAY); ((ImageView) findViewById(R.id.videoicon)).setImageResource(R.drawable.video_icon_gray); horizontalscrollview.setVisibility(View.VISIBLE); LinearLayout layout = (LinearLayout) findViewById(R.id.panelMessageFiles); if (layout.getChildCount() > 0) { layout.removeAllViews(); } for (TextView tv : phoneList) { layout.addView(tv); } saveConsultationType("Phone", MDLiveProviderDetails.this); //Enable Request Appointment Button horizontalscrollview.smoothScrollTo(layout.getChildAt(0).getLeft(), 0); ((ImageView) findViewById(R.id.phoneicon)) .setImageResource(R.drawable.phone_icon_white); ((ImageView) findViewById(R.id.videoicon)).setImageResource(R.drawable.video_icon); selectedTimeslot = false; enableReqAppmtBtn(); clearTimeSlotViews(); horizontalscrollview.startAnimation(AnimationUtils .loadAnimation(MDLiveProviderDetails.this, R.anim.mdlive_trans_left_in)); } catch (Exception e) { e.printStackTrace(); } } }); } } }
From source file:org.kiwix.kiwixmobile.KiwixMobileActivity.java
public void toggleImageViewGrayFilter(ImageView image, boolean state) { Drawable originalIcon = image.getDrawable(); Drawable res = originalIcon.mutate(); if (state) {//w ww. j a va 2s. c o m res.clearColorFilter(); } else { res.setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN); } image.setImageDrawable(res); }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
@SuppressWarnings("unused") public void updatePagerTitle(int page) { TextView tvLeft = null; // (TextView)findViewById(R.id.title_left); TextView tvRight = null; //(TextView)findViewById(R.id.title_right); String left = ""; SpannableStringBuilder ssb = new SpannableStringBuilder(); for (int i = 0; i < page; i++) { OpenFragment f = mViewPagerAdapter.getItem(i); if (f instanceof ContentFragment) { OpenPath p = ((ContentFragment) f).getPath(); left += p.getName();// www . java2s. c o m if (p.isDirectory() && !left.endsWith("/")) left += "/"; } } SpannableString srLeft = new SpannableString(left); srLeft.setSpan(new ForegroundColorSpan(Color.GRAY), 0, left.length(), Spanned.SPAN_COMPOSING); ssb.append(srLeft); //ssb.setSpan(new ForegroundColorSpan(Color.GRAY), 0, left.length(), Spanned.SPAN_COMPOSING); OpenFragment curr = mViewPagerAdapter.getItem(page); if (curr instanceof ContentFragment) { OpenPath pCurr = ((ContentFragment) curr).getPath(); ssb.append(pCurr.getName()); if (pCurr.isDirectory()) ssb.append("/"); } String right = ""; for (int i = page + 1; i < mViewPagerAdapter.getCount(); i++) { OpenFragment f = mViewPagerAdapter.getItem(i); if (f instanceof ContentFragment) { OpenPath p = ((ContentFragment) f).getPath(); right += p.getName(); if (p.isDirectory() && !right.endsWith("/")) right += "/"; } } SpannableString srRight = new SpannableString(right); srRight.setSpan(new ForegroundColorSpan(Color.GRAY), 0, right.length(), Spanned.SPAN_COMPOSING); ssb.append(srRight); updateTitle(ssb); }
From source file:com.lifehackinnovations.siteaudit.FloorPlanActivity.java
public static AlertDialog getaddtextdialog(String title, final int itemnumber, Context ctx) { AlertDialog.Builder getaddtext = new AlertDialog.Builder(ctx); final LinearLayout linearlayout = new LinearLayout(ctx); linearlayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); linearlayout.setOrientation(LinearLayout.VERTICAL); final EditText nameet = new EditText(ctx); nameet.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); final TextView fontname = new TextView(ctx); fontname.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); final TextView colorname = new TextView(ctx); colorname.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); final Spinner fontsizespinner = new Spinner(ctx); fontsizespinner.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); final Spinner colorspinner = new Spinner(ctx); fontsizespinner.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); List<String> fontsizelist = new ArrayList<String>(); for (int t = 1; t < 200; t++) { fontsizelist.add(u.s(t));/*from w ww . ja v a 2 s . c o m*/ } ArrayAdapter<String> fontsizearrayadapter = new ArrayAdapter<String>(ctx, R.layout.spinnertextview, fontsizelist); fontsizearrayadapter.setDropDownViewResource(R.layout.spinnertextview); List<String> colorlist = new ArrayList<String>(); { colorlist.add("RED"); colorlist.add("BLACK"); colorlist.add("BLUE"); colorlist.add("GREEN"); colorlist.add("WHITE"); colorlist.add("GRAY"); } ArrayAdapter<String> colorlistarrayadapter = new ArrayAdapter<String>(ctx, R.layout.spinnertextview, colorlist); fontsizearrayadapter.setDropDownViewResource(R.layout.spinnertextview); colorspinner.setAdapter(colorlistarrayadapter); fontsizespinner.setAdapter(fontsizearrayadapter); fontsizespinner.setSelection(getIndexofSpinner(fontsizespinner, "25")); fontname.setText("Select Font Size"); fontname.setTextSize(20f); colorname.setText("Select Color"); colorname.setTextSize(20f); linearlayout.addView(nameet); linearlayout.addView(fontname); linearlayout.addView(fontsizespinner); linearlayout.addView(colorname); linearlayout.addView(colorspinner); if (!(itemnumber == view.i)) { nameet.setText(view.ITEMstring[itemnumber]); fontsizespinner.setSelection(getIndexofSpinner(fontsizespinner, u.s(view.ITEMfontsize[itemnumber]))); colorspinner.setSelection(getIndexofSpinner(colorspinner, u.s(view.ITEMfontcolor[itemnumber]))); } getaddtext.setView(linearlayout); getaddtext.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); getaddtext.setTitle(title); getaddtext.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub String string = nameet.getText().toString(); float fontsize = fontsizespinner.getSelectedItemPosition() + 1; //ITEMelcnumber[itemselectednumber]=u.i(string); int colpos = colorspinner.getSelectedItemPosition(); int[] col = new int[] { Color.RED, Color.BLACK, Color.BLUE, Color.GREEN, Color.WHITE, Color.GRAY }; int color = col[colpos]; Log.d("addtext", u.s((int) fontsize) + colpos + color); view.ITEMstring[itemnumber] = string; view.ITEMfontsize[itemnumber] = (int) fontsize; view.ITEMfontcolor[itemnumber] = color; view.itemname = string; view.fontsize = (int) fontsize; view.color = color; view.invalidate(); dialog.dismiss(); FloorPlanActivity.writeonedbitem(itemnumber); } }); return getaddtext.create(); }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
private void setupLoggingDb() { FTP.setCommunicationListener(new OnFTPCommunicationListener() { @Override/*from w ww.ja v a 2s . c o m*/ public void onDisconnect(FTP file) { sendToLogView("FTP Disconnect " + getFTPString(file), Color.GRAY); } @Override public void onConnectFailure(FTP file) { sendToLogView("FTP Failure " + getFTPString(file), Color.RED); } @Override public void onConnect(FTP file) { sendToLogView("FTP Connect " + getFTPString(file), Color.GREEN); } @Override public void onBeforeConnect(FTP file) { //sendToLogView("FTP Before Connect " + getFTPString(file)); } @Override public void onSendCommand(FTP file, String message) { if (message.startsWith("PASS ")) message = "PASS " + message.substring(6).replaceAll(".", "*"); sendToLogView("Command: " + message.replace("\n", ""), Color.BLACK); // + getFTPString(file), Color.BLACK); } private String getFTPString(FTP file) { if (file != null && file.getSocket() != null && file.getRemoteAddress() != null) return " @ " + file.getRemoteAddress().getHostName(); return ""; } @Override public void onReply(String line) { sendToLogView("Reply: " + line, Color.BLUE); } }); JSch.setLogger(new com.jcraft.jsch.Logger() { @Override public void log(int level, String message) { switch (level) { case com.jcraft.jsch.Logger.DEBUG: sendToLogView("SFTP - " + message, Color.GREEN); break; case com.jcraft.jsch.Logger.INFO: sendToLogView("SFTP - " + message, Color.BLUE); break; case com.jcraft.jsch.Logger.WARN: sendToLogView("SFTP - " + message, Color.YELLOW); break; case com.jcraft.jsch.Logger.ERROR: sendToLogView("SFTP - " + message, Color.RED); break; case com.jcraft.jsch.Logger.FATAL: sendToLogView("SFTP - " + message, Color.MAGENTA); break; default: sendToLogView("SFTP (" + level + ") - " + message, Color.BLACK); break; } } @Override public boolean isEnabled(int level) { return true; } }); if (Logger.isLoggingEnabled()) { if (getPreferences().getBoolean("global", "pref_stats", true)) { if (!Logger.hasDb()) Logger.setDb(new LoggerDbAdapter(getApplicationContext())); } else if (!IS_DEBUG_BUILD) Logger.setLoggingEnabled(false); } SmbFile.setSMBCommunicationListener(new OnSMBCommunicationListener() { @Override public void onBeforeConnect(SmbFile file) { sendToLogView("SMB Connecting: " + file.getPath(), Color.GREEN); } @Override public void onConnect(SmbFile file) { //sendToLogView("SMB Connected: " + file.getPath(), Color.GREEN); } @Override public void onConnectFailure(SmbFile file) { sendToLogView("SMB Connect Failure: " + file.getPath(), Color.RED); } @Override public void onDisconnect(SmbFile file) { sendToLogView("SMB Disconnect: " + file.getPath(), Color.DKGRAY); } @Override public void onSendCommand(SmbFile file, Object... commands) { URL url = file.getURL(); String s = "Command: smb://" + url.getHost() + url.getPath(); for (Object o : commands) { if (o instanceof ServerMessageBlock) { ServerMessageBlock blk = (ServerMessageBlock) o; String tmp = blk.toString(); if (tmp.indexOf("[") > -1) s += " -> " + tmp.substring(0, tmp.indexOf("[")); else s += " -> " + tmp; } else s += " -> " + o.toString(); } sendToLogView(s, Color.BLACK); } }); }
From source file:plugin.google.maps.GoogleMaps.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @Override/*from ww w . j a v a 2 s . c o m*/ public View getInfoContents(Marker marker) { String title = marker.getTitle(); String snippet = marker.getSnippet(); if ((title == null) && (snippet == null)) { return null; } JSONObject properties = null; JSONObject styles = null; String propertyId = "marker_property_" + marker.getId(); PluginEntry pluginEntry = this.plugins.get("Marker"); PluginMarker pluginMarker = (PluginMarker) pluginEntry.plugin; if (pluginMarker.objects.containsKey(propertyId)) { properties = (JSONObject) pluginMarker.objects.get(propertyId); if (properties.has("styles")) { try { styles = (JSONObject) properties.getJSONObject("styles"); } catch (JSONException e) { } } } // Linear layout LinearLayout windowLayer = new LinearLayout(activity); windowLayer.setPadding(3, 3, 3, 3); windowLayer.setOrientation(LinearLayout.VERTICAL); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.BOTTOM | Gravity.CENTER; windowLayer.setLayoutParams(layoutParams); //---------------------------------------- // text-align = left | center | right //---------------------------------------- int gravity = Gravity.LEFT; int textAlignment = View.TEXT_ALIGNMENT_GRAVITY; if (styles != null) { try { String textAlignValue = styles.getString("text-align"); switch (TEXT_STYLE_ALIGNMENTS.valueOf(textAlignValue)) { case left: gravity = Gravity.LEFT; textAlignment = View.TEXT_ALIGNMENT_GRAVITY; break; case center: gravity = Gravity.CENTER; textAlignment = View.TEXT_ALIGNMENT_CENTER; break; case right: gravity = Gravity.RIGHT; textAlignment = View.TEXT_ALIGNMENT_VIEW_END; break; } } catch (Exception e) { } } if (title != null) { if (title.indexOf("data:image/") > -1 && title.indexOf(";base64,") > -1) { String[] tmp = title.split(","); Bitmap image = PluginUtil.getBitmapFromBase64encodedImage(tmp[1]); image = PluginUtil.scaleBitmapForDevice(image); ImageView imageView = new ImageView(this.cordova.getActivity()); imageView.setImageBitmap(image); windowLayer.addView(imageView); } else { TextView textView = new TextView(this.cordova.getActivity()); textView.setText(title); textView.setSingleLine(false); int titleColor = Color.BLACK; if (styles != null && styles.has("color")) { try { titleColor = PluginUtil.parsePluginColor(styles.getJSONArray("color")); } catch (JSONException e) { } } textView.setTextColor(titleColor); textView.setGravity(gravity); if (VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { textView.setTextAlignment(textAlignment); } //---------------------------------------- // font-style = normal | italic // font-weight = normal | bold //---------------------------------------- int fontStyle = Typeface.NORMAL; if (styles != null) { try { if ("italic".equals(styles.getString("font-style"))) { fontStyle = Typeface.ITALIC; } } catch (JSONException e) { } try { if ("bold".equals(styles.getString("font-weight"))) { fontStyle = fontStyle | Typeface.BOLD; } } catch (JSONException e) { } } textView.setTypeface(Typeface.DEFAULT, fontStyle); windowLayer.addView(textView); } } if (snippet != null) { //snippet = snippet.replaceAll("\n", ""); TextView textView2 = new TextView(this.cordova.getActivity()); textView2.setText(snippet); textView2.setTextColor(Color.GRAY); textView2.setTextSize((textView2.getTextSize() / 6 * 5) / density); textView2.setGravity(gravity); if (VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { textView2.setTextAlignment(textAlignment); } windowLayer.addView(textView2); } return windowLayer; }
From source file:com.mdlive.sav.MDLiveProviderDetails.java
private void clearTimeSlotViews() { if (previousSelectedTv != null) { previousSelectedTv.setBackgroundResource(R.drawable.searchpvr_white_rounded_corner); previousSelectedTv.setTextColor(Color.GRAY); previousSelectedTv = null;/*from w w w. j a va 2 s . c o m*/ } }