List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.flipzu.flipzu.Recorder.java
@Override public void onCommentsReceived(Hashtable<String, String>[] comments) { debug.logV(TAG, "onCommentsReceived"); final LinearLayout cc = (LinearLayout) findViewById(R.id.comments_container); /* cleanup comments first */ cc.removeAllViews();// ww w .j a va 2 s . c o m /* get pixel values for various DIPs */ final float scale = getResources().getDisplayMetrics().density; // final int pixel_10 = 10 / (int) (scale + 0.5f); final int pixel_5 = 5 / (int) (scale + 0.5f); // final int pixel_30 = 30 / (int) (scale + 0.5f); final LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); if (comments != null && comments.length > 0) { for (int i = 0; i < comments.length; i++) { LinearLayout cl = new LinearLayout(Recorder.this); cl.setOrientation(LinearLayout.HORIZONTAL); cl.setPadding(0, 0, 0, pixel_5); debug.logD(TAG, "Refresher comment " + comments[i]); /* comment */ TextView comment_tv = new TextView(Recorder.this); comment_tv.setLayoutParams(params); comment_tv.setText(comments[i].get("username") + ": " + comments[i].get("comment"), TextView.BufferType.SPANNABLE); comment_tv.setTextColor(Color.parseColor("#656565")); Spannable comment_span = (Spannable) comment_tv.getText(); comment_span.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, comment_tv.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); comment_span.setSpan(new ForegroundColorSpan(Color.parseColor("#182e5b")), 0, comments[i].get("username").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); comment_tv.setText(comment_span); cl.addView(comment_tv); cc.addView(cl); } } else { if (mState == recorderState.RECORDING) { String msg = "You're LIVE! Your broadcast can be heard at http://flipzu.com/" + mUser.getUsername(); showFlipzuTipsOffline(cc, params, msg); } else { String msg = "Pick a good and descriptive broadcast title. A great title will attract more listeners!"; showFlipzuTipsOffline(cc, params, msg); msg = "You can disable sharing in Twitter and Facebook by clicking the logo buttons. This is great for testing."; showFlipzuTipsOffline(cc, params, msg); msg = "Press the \"Start Broadcast\" button and let them hear you!"; showFlipzuTipsOffline(cc, params, msg); } } }
From source file:com.bw.luzz.monkeyapplication.View.DateTimePicker.date.DatePickerDialog.java
/** * Set the accent color of this dialog// w w w .j a va 2s .c o m * @param color the accent color you want */ public void setAccentColor(String color) { try { mAccentColor = Color.parseColor(color); } catch (IllegalArgumentException e) { throw e; } }
From source file:com.flipzu.flipzu.Player.java
private void displayComment(Hashtable<String, String> comment) { if (comment == null) return;/*from w ww .ja v a 2s .c o m*/ final LinearLayout com_layout = (LinearLayout) findViewById(R.id.comments_layout); TextView comment_tv = new TextView(Player.this); comment_tv.setText(comment.get("username") + ": " + comment.get("comment"), TextView.BufferType.SPANNABLE); comment_tv.setTextColor(Color.parseColor("#656565")); Spannable comment_span = (Spannable) comment_tv.getText(); comment_span.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, comment_tv.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); comment_span.setSpan(new ForegroundColorSpan(Color.parseColor("#597490")), 0, comment.get("username").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); comment_tv.setText(comment_span); com_layout.addView(comment_tv); }
From source file:com.filemanager.free.adapters.Recycleradapter.java
@Override public void onBindViewHolder(RecyclerView.ViewHolder vholder, @SuppressLint("RecyclerView") final int p) { final Recycleradapter.ViewHolder holder = ((Recycleradapter.ViewHolder) vholder); if (main.IS_LIST) { if (p == getItemCount() - 1) { holder.rl.setMinimumHeight(rowHeight); if (items.size() == (main.GO_BACK_ITEM ? 1 : 0)) holder.txtTitle.setText(R.string.nofiles); else { holder.txtTitle.setText(R.string.footer); }/*w w w. j av a2 s .c o m*/ return; } } if (holder.imageView == null) return; if (!this.stoppedAnimation && !myanim.get(p)) { animate(holder); myanim.put(p, true); } final Layoutelements rowItem = items.get(p); if (main.IS_LIST) { holder.rl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.onListItemClicked(p, v); } }); holder.rl.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View p1) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } return true; } }); filetype = -1; if (Icons.isPicture((rowItem.getDesc().toLowerCase()))) filetype = 0; else if (Icons.isApk((rowItem.getDesc()))) filetype = 1; else if (Icons.isVideo(rowItem.getDesc())) filetype = 2; holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageDrawable(rowItem.getImageId()); holder.ext.setText(""); if (holder.about != null) { if (main.theme1 == 0) holder.about.setColorFilter(grey_color); showPopup(holder.about, rowItem); } holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.viewmageV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.apk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.imageView.setVisibility(View.VISIBLE); holder.viewmageV.setVisibility(View.INVISIBLE); if (filetype == 0) { if (main.SHOW_THUMBS) { if (main.CIRCULAR_IMAGES) { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.VISIBLE); holder.viewmageV.setImageDrawable(main.DARK_IMAGE); main.ic.cancelLoad(holder.viewmageV); main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null); } else { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.DARK_IMAGE); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } } else if (filetype == 1) { if (main.SHOW_THUMBS) { holder.viewmageV.setVisibility(View.GONE); holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.apk); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } else if (filetype == 2) { if (main.SHOW_THUMBS) { if (main.CIRCULAR_IMAGES) { holder.imageView.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.VISIBLE); holder.viewmageV.setImageDrawable(main.DARK_VIDEO); main.ic.cancelLoad(holder.viewmageV); main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null); } else { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.DARK_VIDEO); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } } else { holder.viewmageV.setVisibility(View.GONE); holder.apk.setVisibility(View.GONE); holder.imageView.setVisibility(View.VISIBLE); } Boolean checked = myChecked.get(p); if (checked != null) { if (main.theme1 == 0) { holder.rl.setBackgroundResource(R.drawable.safr_ripple_white); } else { holder.rl.setBackgroundResource(R.drawable.safr_ripple_black); } holder.rl.setSelected(false); if (checked) { holder.apk.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.GONE); holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageDrawable( ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark)); GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); gradientDrawable.setColor(c1); holder.rl.setSelected(true); holder.ext.setText(""); } else { GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); if (main.COLORISE_ICONS) { if (rowItem.isDirectory()) gradientDrawable.setColor(main.icon_skin_color); else if (Icons.isVideo(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc())) gradientDrawable.setColor(c2); else if (Icons.isAudio(rowItem.getDesc())) gradientDrawable.setColor(c3); else if (Icons.isPdf(rowItem.getDesc())) gradientDrawable.setColor(c4); else if (Icons.isCode(rowItem.getDesc())) gradientDrawable.setColor(c5); else if (Icons.isText(rowItem.getDesc())) gradientDrawable.setColor(c6); else if (Icons.isArchive(rowItem.getDesc())) gradientDrawable.setColor(c7); else if (Icons.isApk(rowItem.getDesc())) gradientDrawable.setColor(c8); else if (Icons.isgeneric(rowItem.getDesc())) { gradientDrawable.setColor(c9); String ext = MimeTypes.getExtension(new File(rowItem.getDesc()).getName()); if (ext != null && ext.trim().length() != 0) { holder.ext.setText(ext); holder.imageView.setImageDrawable(null); } } else { gradientDrawable.setColor(main.icon_skin_color); } } else gradientDrawable.setColor((main.icon_skin_color)); if (rowItem.getSize().equals(main.goback)) gradientDrawable.setColor(c1); } } if (main.SHOW_PERMISSIONS) holder.perm.setText(rowItem.getPermissions()); if (main.SHOW_LAST_MODIFIED) holder.date.setText(rowItem.getDate()); String size = rowItem.getSize(); if (size.equals(main.goback)) { holder.date.setText(size); holder.txtDesc.setText(""); } else if (main.SHOW_SIZE) holder.txtDesc.setText(rowItem.getSize()); } else { Boolean checked = myChecked.get(p); holder.rl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.onListItemClicked(p, v); } }); holder.rl.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View p1) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } return true; } }); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView1.setVisibility(View.INVISIBLE); holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageDrawable(rowItem.getImageId()); if (Icons.isPicture((rowItem.getDesc().toLowerCase())) || Icons.isVideo(rowItem.getDesc().toLowerCase())) { holder.imageView.setColorFilter(null); holder.imageView1.setVisibility(View.VISIBLE); holder.imageView1.setImageDrawable(null); if (main.theme == 1) holder.imageView1.setBackgroundColor(Color.BLACK); main.ic.cancelLoad(holder.imageView1); main.ic.loadDrawable(holder.imageView1, (rowItem.getDesc()), null); } else if (Icons.isApk((rowItem.getDesc()))) { holder.imageView.setColorFilter(null); main.ic.cancelLoad(holder.imageView); main.ic.loadDrawable(holder.imageView, (rowItem.getDesc()), null); } if (rowItem.isDirectory()) holder.imageView.setColorFilter(main.icon_skin_color); else if (Icons.isVideo(rowItem.getDesc())) holder.imageView.setColorFilter(c2); else if (Icons.isAudio(rowItem.getDesc())) holder.imageView.setColorFilter(c3); else if (Icons.isPdf(rowItem.getDesc())) holder.imageView.setColorFilter(c4); else if (Icons.isCode(rowItem.getDesc())) holder.imageView.setColorFilter(c5); else if (Icons.isText(rowItem.getDesc())) holder.imageView.setColorFilter(c6); else if (Icons.isArchive(rowItem.getDesc())) holder.imageView.setColorFilter(c7); else if (Icons.isgeneric(rowItem.getDesc())) holder.imageView.setColorFilter(c9); else if (Icons.isApk(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc())) holder.imageView.setColorFilter(null); else holder.imageView.setColorFilter(main.icon_skin_color); if (rowItem.getSize().equals(main.goback)) holder.imageView.setColorFilter(c1); if (checked != null) { if (checked) { holder.imageView.setColorFilter(main.icon_skin_color); holder.imageView.setImageDrawable( ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark)); holder.rl.setBackgroundColor(Color.parseColor("#9f757575")); } else { if (main.theme1 == 0) holder.rl.setBackgroundResource(R.drawable.item_doc_grid); else { holder.rl.setBackgroundResource(R.drawable.ic_grid_card_background_dark); holder.rl.findViewById(R.id.icon_frame).setBackgroundColor(Color.parseColor("#303030")); } } } if (holder.about != null) { if (main.theme1 == 0) holder.about.setColorFilter(grey_color); showPopup(holder.about, rowItem); } if (main.SHOW_LAST_MODIFIED) holder.date.setText(rowItem.getDate()); if (rowItem.getSize().equals(main.goback)) { holder.date.setText(rowItem.getSize()); holder.txtDesc.setText(""); } /*else if(main.SHOW_SIZE) holder.txtDesc.setText(rowItem.getSize()); */ if (main.SHOW_PERMISSIONS) holder.perm.setText(rowItem.getPermissions()); } }
From source file:com.openerp.MainActivity.java
private void loadFragment(DrawerItem item) { Fragment fragment = (Fragment) item.getFragmentInstace(); ;/*ww w . ja v a2 s . c o m*/ if (item.getTagColor() != null && !fragment.getArguments().containsKey("tag_color")) { Bundle tagcolor = fragment.getArguments(); tagcolor.putInt("tag_color", Color.parseColor(item.getTagColor())); fragment.setArguments(tagcolor); } loadFragment(fragment); }
From source file:com.mdlive.sav.MDLiveProviderDetails.java
public void handleDateResponse(JSONObject response) { horizontalscrollview.setVisibility(View.GONE); //Fetch Data From the Services JsonParser parser = new JsonParser(); JsonObject responObj = (JsonObject) parser.parse(response.toString()); JsonObject profileobj = responObj.get("doctor_profile").getAsJsonObject(); JsonObject appointment_slot = profileobj.get("appointment_slot").getAsJsonObject(); JsonArray available_hour = appointment_slot.get("available_hour").getAsJsonArray(); LinearLayout layout = (LinearLayout) findViewById(R.id.panelMessageFiles); String str_timeslot = "", str_phys_avail_id = ""; if (layout.getChildCount() > 0) { layout.removeAllViews();/* ww w . j a va 2s. c o m*/ } timeSlotListMap.clear(); for (int i = 0; i < available_hour.size(); i++) { JsonObject availabilityStatus = available_hour.get(i).getAsJsonObject(); String str_availabilityStatus = ""; if (MdliveUtils.checkJSONResponseHasString(availabilityStatus, "status")) { str_availabilityStatus = availabilityStatus.get("status").getAsString(); if (str_availabilityStatus.equals("Available")) { //This visibility is for future timeslots response for the corresponding date selection. //if the future date has timeslots then make an appointment req layout nd textview visibility will be gone findViewById(R.id.noappmtsTxtLayout).setVisibility(View.GONE); reqfutureapptBtnLayout.setVisibility(View.GONE); JsonArray timeSlotArray = availabilityStatus.get("time_slot").getAsJsonArray(); for (int j = 0; j < timeSlotArray.size(); j++) { JsonObject timeSlotObj = timeSlotArray.get(j).getAsJsonObject(); if (MdliveUtils.checkJSONResponseHasString(timeSlotObj, "appointment_type") && MdliveUtils.checkJSONResponseHasString(timeSlotObj, "timeslot")) { str_appointmenttype = timeSlotObj.get("appointment_type").getAsString(); str_timeslot = timeSlotObj.get("timeslot").getAsString(); selectedTimestamp = timeSlotObj.get("timeslot").getAsString(); if (MdliveUtils.checkJSONResponseHasString(timeSlotObj, "phys_availability_id")) { str_phys_avail_id = timeSlotObj.get("phys_availability_id").getAsString(); } else { str_phys_avail_id = null; } HashMap<String, String> datemap = new HashMap<String, String>(); datemap.put("timeslot", str_timeslot); datemap.put("phys_id", str_phys_avail_id); datemap.put("appointment_type", str_appointmenttype); videophoneparentLl.setVisibility(View.VISIBLE); timeSlotListMap.add(datemap); final Button myText = new Button(MDLiveProviderDetails.this); if (str_timeslot.equals("0")) { final int density = (int) getBaseContext().getResources() .getDisplayMetrics().density; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { myText.setElevation(0f); } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.setMargins(4 * density, 4 * density, 4 * density, 4 * density); myText.setLayoutParams(params); myText.setGravity(Gravity.CENTER); myText.setTextColor(Color.WHITE); myText.setTextSize(16); myText.setPadding(8 * density, 4 * density, 8 * density, 4 * density); myText.setBackgroundResource(R.drawable.timeslot_white_rounded_corner); myText.setText("Now"); myText.setBackgroundResource(R.drawable.timeslot_blue_rounded_corner); myText.setClickable(true); previousSelectedTv = myText; if (str_appointmenttype.toLowerCase().contains("video") || str_appointmenttype.toLowerCase().contains("video or phone")) { videoList.add(myText); } if (str_appointmenttype.toLowerCase().contains("phone")) { phoneList.add(myText); } LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(4 * density, 4 * density, 4 * density, 4 * density); myText.setLayoutParams(lp); myText.setTag("Now"); defaultNowTextPreferences(myText, str_appointmenttype); selectedTimeslot = true; clickEventForHorizontalText(myText, str_timeslot, str_phys_avail_id); layout.addView(myText); } else { setHorizontalScrollviewTimeslots(layout, str_timeslot, j, str_phys_avail_id); } } } } else { if (layout.getChildCount() == 0) { selectedTimeslot = false; findViewById(R.id.noappmtsTxtLayout).setVisibility(View.VISIBLE); ((TextView) findViewById(R.id.noAppmtsTxt)) .setText(getString(R.string.mdl_notimeslots_txt)); reqfutureapptBtnLayout.setVisibility(viewsVisibility); ((TextView) findViewById(R.id.reqfutureapptBtn)).setText("Make an appointment request"); ((TextView) findViewById(R.id.reqfutureapptBtn)).setTextColor(Color.parseColor("#0079FD")); videophoneparentLl.setVisibility(View.GONE); tapReqFutureBtnAction(); findViewById(R.id.reqApmtBtm).setVisibility(View.GONE); } } } } }
From source file:at.alladin.rmbt.android.views.ResultGraphView.java
/** * //from w w w . j a va2 s . com * @param graphArray * @param graphView * @param color * @throws JSONException */ public void addStaticMarker(JSONArray graphArray, CustomizableGraphView graphView, String color, double absoluteMarkerMs, double maxTimeMs) throws JSONException { StaticGraph markerGraph = StaticGraph.addGraph(graphView, Color.parseColor(color), false); final double startTime = (absoluteMarkerMs / maxTimeMs); markerGraph.addValue(1, startTime); markerGraph.addValue(0, startTime); }
From source file:com.amaze.filemanager.fragments.ZipViewer.java
void createViews(String dir) { stopAnims = true;//from ww w.j a va2s . c o m if (!addheader) { listView.removeItemDecoration(dividerItemDecoration); listView.removeItemDecoration(headersDecor); addheader = true; } if (addheader) { dividerItemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, true, showDividers); listView.addItemDecoration(dividerItemDecoration); headersDecor = new StickyRecyclerHeadersDecoration(rarAdapter); listView.addItemDecoration(headersDecor); addheader = false; } final FastScroller fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroll); fastScroller.setRecyclerView(listView, 1); fastScroller.setPressedHandleColor(Color.parseColor(PreferenceUtils.getAccentString(Sp))); ((AppBarLayout) mToolbarContainer).addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { fastScroller.updateHandlePosition(verticalOffset, 112); } }); listView.stopScroll(); zipViewer.current = dir; zipViewer.bbar(); swipeRefreshLayout.setRefreshing(false); }
From source file:com.connectsdk.service.CastService.java
private void playMedia(final com.google.android.gms.cast.MediaInfo mediaInformation, final String mediaAppId, final LaunchListener listener) { final ApplicationConnectionResultCallback webAppLaunchCallback = new ApplicationConnectionResultCallback( new LaunchWebAppListener() { @Override/*from w w w . j a va 2 s. c o m*/ public void onSuccess(final WebAppSession webAppSession) { ConnectionListener connectionListener = new ConnectionListener() { @Override public void onConnected() { try { mMediaPlayer.load(mApiClient, mediaInformation, true).setResultCallback( new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() { @Override public void onResult(MediaChannelResult result) { Status status = result.getStatus(); if (status.isSuccess()) { webAppSession.launchSession .setSessionType(LaunchSessionType.Media); // White text, black outline, no background TextTrackStyle textTrackStyle = new TextTrackStyle(); textTrackStyle .setForegroundColor(Color.parseColor("#FFFFFFFF")); textTrackStyle .setBackgroundColor(Color.parseColor("#01000000")); textTrackStyle .setWindowType(TextTrackStyle.WINDOW_TYPE_NONE); textTrackStyle .setEdgeType(TextTrackStyle.EDGE_TYPE_OUTLINE); textTrackStyle.setEdgeColor(Color.BLACK); textTrackStyle.setFontGenericFamily( TextTrackStyle.FONT_FAMILY_SANS_SERIF); mMediaPlayer.setTextTrackStyle(mApiClient, textTrackStyle); mMediaPlayer.setActiveMediaTracks(mApiClient, new long[] { 1 }); Util.postSuccess(listener, new MediaLaunchObject( webAppSession.launchSession, CastService.this)); } else { Util.postError(listener, new ServiceCommandError(status.getStatusCode(), status.getStatusMessage(), status)); } } }); } catch (Exception e) { Util.postError(listener, new ServiceCommandError(0, "Unable to load", null)); } } }; runCommand(connectionListener); } @Override public void onFailure(ServiceCommandError error) { Util.postError(listener, error); } }); launchingAppId = mediaAppId; ConnectionListener connectionListener = new ConnectionListener() { @Override public void onConnected() { boolean relaunchIfRunning = false; try { if (Cast.CastApi.getApplicationStatus(mApiClient) == null || (!mediaAppId.equals(currentAppId))) { relaunchIfRunning = true; } LaunchOptions options = new LaunchOptions(); options.setRelaunchIfRunning(relaunchIfRunning); Cast.CastApi.launchApplication(mApiClient, mediaAppId, options) .setResultCallback(webAppLaunchCallback); } catch (Exception e) { Util.postError(listener, new ServiceCommandError(0, "Unable to launch", null)); } } }; runCommand(connectionListener); }
From source file:at.alladin.rmbt.android.views.ResultGraphView.java
/** * // w ww . j a v a 2 s. c o m * @param graphArray * @param graphView * @param color * @param alpha * @param absoluteMarkerStartMs * @param absoluteMarkerEndMs * @param maxTimeMs * @throws JSONException */ public void addStaticMarker(JSONArray graphArray, CustomizableGraphView graphView, String color, int alpha, double absoluteMarkerStartMs, double absoluteMarkerEndMs, double maxTimeMs) throws JSONException { StaticGraph markerGraph = StaticGraph.addGraph(graphView, Color.parseColor(color), false); StaticGraph markerGraphStartLine = StaticGraph.addGraph(graphView, Color.parseColor(color), false); StaticGraph markerGraphEndLine = StaticGraph.addGraph(graphView, Color.parseColor(color), false); markerGraph.setFillAlpha(alpha / 2); markerGraph.setPaintAlpha(alpha / 2); markerGraphStartLine.setPaintAlpha(alpha); markerGraphEndLine.setPaintAlpha(alpha); final double startTime = (absoluteMarkerStartMs / maxTimeMs); final double endTime = (absoluteMarkerEndMs / maxTimeMs); markerGraph.addValue(1, startTime); markerGraph.addValue(1, endTime); markerGraphStartLine.addValue(1, startTime); markerGraphStartLine.addValue(0, startTime); markerGraphEndLine.addValue(1, endTime); markerGraphEndLine.addValue(0, endTime); }