List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:gov.sfmta.sfpark.DetailViewActivity.java
private void hr() { View ruler = new View(mContext); ruler.setBackgroundColor(Color.WHITE); listLayout.addView(ruler, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 2)); }
From source file:ca.qc.bdeb.info.horus.DetailFragment.java
private void changerTexteCouleur() { mDateView.setTextColor(Color.WHITE); mFriendlyDateView.setTextColor(Color.WHITE); mDescriptionView.setTextColor(Color.WHITE); mHighTempView.setTextColor(Color.WHITE); mLowTempView.setTextColor(Color.WHITE); mHumidityView.setTextColor(Color.WHITE); mWindView.setTextColor(Color.WHITE); mPressureView.setTextColor(Color.WHITE); }
From source file:com.coinblesk.client.utils.UIUtils.java
public static SpannableString toLargeSpannable(Context context, String amount, String currency) { final int amountLength = amount.length(); SpannableString result = new SpannableString(new StringBuffer(amount + " " + currency)); result.setSpan(new RelativeSizeSpan(2), 0, amountLength, 0); result.setSpan(new ForegroundColorSpan(Color.WHITE), 0, amountLength, 0); result.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.colorAccent)), amountLength, result.length(), 0);/*from w ww . j av a 2 s . c om*/ return result; }
From source file:com.FluksoViz.FluksoVizActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); Display display = getWindowManager().getDefaultDisplay(); screen_width = display.getWidth();// w ww . java2 s . c o m if (screen_width == 320) { setContentView(R.layout.main_lowres); } else setContentView(R.layout.main); context = getApplicationContext(); SharedPreferences my_app_prefs = PreferenceManager.getDefaultSharedPreferences(this); try { versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } sensor_number = Integer.parseInt(my_app_prefs.getString("sensor_number", "1")); api_server_ip = my_app_prefs.getString("api_server", "178.79.177.6"); skip_initial_sensor_checks = (Boolean) my_app_prefs.getBoolean("skip_initial_sensor_checks", false); ip_addr = (String) my_app_prefs.getString("flukso_ip_addr", "10.10.10.10"); api_key_1 = (String) my_app_prefs.getString("sensor_1_api_key", "0.0.0.0"); api_key_2 = (String) my_app_prefs.getString("sensor_2_api_key", "0.0.0.0"); api_key_3 = (String) my_app_prefs.getString("sensor_3_api_key", "0.0.0.0"); api_token_1 = (String) my_app_prefs.getString("sensor_1_token", "0.0.0.0"); api_token_2 = (String) my_app_prefs.getString("sensor_2_token", "0.0.0.0"); api_token_3 = (String) my_app_prefs.getString("sensor_3_token", "0.0.0.0"); cost_fixedpart = Double.parseDouble(my_app_prefs.getString("cost_perkwh", "0")); cost_perkwh = Double.parseDouble(my_app_prefs.getString("cost_perkwh", "0")); cost_currencycode = (String) my_app_prefs.getString("cost_currencycode", "PLN"); Napis = (TextView) findViewById(R.id.textView1); Napis2 = (TextView) findViewById(R.id.textView2); Napis01 = (TextView) findViewById(R.id.textView01); Napis3 = (TextView) findViewById(R.id.textView_r1); Napis4 = (TextView) findViewById(R.id.textView_rd1); tv_p1 = (TextView) findViewById(R.id.textView_p1); tv_p1.setTextColor(Color.WHITE); tv_p1.setVisibility(TextView.INVISIBLE); tv_p2 = (TextView) findViewById(R.id.textView_p2); tv_p2.setTextColor(Color.WHITE); tv_p2.setVisibility(TextView.INVISIBLE); tv_p3 = (TextView) findViewById(R.id.textView_p3); tv_p3.setTextColor(Color.WHITE); tv_p3.setVisibility(TextView.INVISIBLE); tv_today_kwh = (TextView) findViewById(R.id.TextView_r2); tv_today_cost = (TextView) findViewById(R.id.TextView_r4); tv_today_percent = (TextView) findViewById(R.id.TextView_r6); tv_today_avg = (TextView) findViewById(R.id.TextView_r22); tv_week_kwh = (TextView) findViewById(R.id.TextView_rd2); tv_week_avg = (TextView) findViewById(R.id.TextView_rd22); tv_week_cost = (TextView) findViewById(R.id.TextView_rd4); tv_week_percent = (TextView) findViewById(R.id.TextView_rd6); tv_month_kwh = (TextView) findViewById(R.id.TextView_rt2); tv_month_avg = (TextView) findViewById(R.id.TextView_rt22); tv_month_cost = (TextView) findViewById(R.id.TextView_rt4); tv_month_percent = (TextView) findViewById(R.id.TextView_rt6); tv_curr1 = (TextView) findViewById(R.id.TextView_r5); tv_curr2 = (TextView) findViewById(R.id.TextView_rd5); tv_curr3 = (TextView) findViewById(R.id.TextView_rt5); tv_curr1.setText(cost_currencycode); tv_curr2.setText(cost_currencycode); tv_curr3.setText(cost_currencycode); Napis01.setText("" + sensor_number); iv1 = (ImageView) findViewById(R.id.arrow_image1); iv2 = (ImageView) findViewById(R.id.arrow_image2); iv3 = (ImageView) findViewById(R.id.arrow_image3); W = (TextView) findViewById(R.id.textView4); napis_delta = (TextView) findViewById(R.id.textView_delta); napis_delta.setText("" + (char) 0x0394); napis_delta.setTextColor(Color.WHITE); napis_delta.setVisibility(TextView.INVISIBLE); Plot1 = (XYPlot) findViewById(R.id.Plot1); Plot2 = (XYPlot) findViewById(R.id.Plot2); series1m = new SimpleXYSeries("seria 1m"); series2m = new SimpleXYSeries("seria 2m"); series3m = new SimpleXYSeries("seria 3m"); series_p2_1 = new SimpleXYSeries("plot 2 - 1"); series1mFormat = new LineAndPointFormatter(Color.rgb(0, 180, 0), // line Color.rgb(50, 100, 0), // point color null); line1mFill = new Paint(); line1mFill.setAlpha(100); line1mFill.setShader( new LinearGradient(0, 0, 0, 200, Color.rgb(0, 100, 0), Color.BLACK, Shader.TileMode.MIRROR)); series1mFormat.getLinePaint().setStrokeWidth(3); series1mFormat.getVertexPaint().setStrokeWidth(0); series1mFormat.setFillPaint(line1mFill); series2mFormat = new LineAndPointFormatter( // FAZA 2 formater Color.rgb(0, 200, 0), // line color Color.rgb(0, 100, 50), // point color null); line2mFill = new Paint(); line2mFill.setAlpha(100); line2mFill.setShader( new LinearGradient(0, 0, 0, 200, Color.rgb(0, 100, 0), Color.BLACK, Shader.TileMode.MIRROR)); series2mFormat.getLinePaint().setStrokeWidth(3); series2mFormat.getVertexPaint().setStrokeWidth(0); series2mFormat.setFillPaint(line2mFill); series3mFormat = new LineAndPointFormatter( // FAZA 3 formater Color.rgb(0, 220, 0), // line color Color.rgb(0, 150, 0), // point color null); line3mFill = new Paint(); line3mFill.setAlpha(100); line3mFill.setShader( new LinearGradient(0, 0, 0, 200, Color.rgb(0, 200, 0), Color.BLACK, Shader.TileMode.MIRROR)); series3mFormat.getLinePaint().setStrokeWidth(3); // series3mFormat.getVertexPaint().setStrokeWidth(0); series3mFormat.setFillPaint(line3mFill); series4mFormat = new LineAndPointFormatter(Color.rgb(0, 140, 220), // line Color.rgb(0, 120, 190), // point color null); line4mFill = new Paint(); line4mFill.setAlpha(190); line4mFill.setShader( new LinearGradient(0, 0, 0, 200, Color.rgb(0, 140, 220), Color.BLACK, Shader.TileMode.MIRROR)); series4mFormat.getLinePaint().setStrokeWidth(5); series4mFormat.setFillPaint(line4mFill); make_graph_pretty(Plot1); // All formating of the graph goes into // seperate method make_graph_pretty(Plot2); Napis.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (delta_mode) { napis_delta.setVisibility(TextView.INVISIBLE); delta_mode = false; delta_value = 0; // Plot1.removeMarker(marker1); } else { napis_delta.setVisibility(TextView.VISIBLE); delta_mode = true; try { delta_value = seriesSUM123linkedlist.getLast().intValue(); // marker1 = new YValueMarker(delta_value, "" + (char) // 0x0394, new // XPositionMetric(3,XLayoutStyle.ABSOLUTE_FROM_LEFT), // Color.GREEN, Color.WHITE); // Plot1.addMarker(marker1); } catch (NullPointerException e) { delta_value = 0; } } ; } }); W.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Napis01.setText("restarted"); thread1_running = true; thread2_running = true; } }); Plot1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /* * Change the switch block to an increment and one * if statement. Also, avoid magic numbers */ plot1_mode++; if (plot1_mode > MAX_PLOT1_CLICK) plot1_mode = 0; switch (sensor_number) { case 1: case 2: case 3: { switch (plot1_mode) { case 0: { Plot1.setTitle("Power (W) - last minute - stacked"); Plot1.removeSeries(series1m); Plot1.addSeries(series2m, series2mFormat); Plot1.addSeries(series3m, series3mFormat); Plot1.addSeries(series1m, series1mFormat); Plot1.redraw(); break; } case 1: { Plot1.setTitle("Power (W) - last minute - with details"); Plot1.redraw(); // update title even if series are not updating (like in set prefs) setDetailsVisibility(true); // show details break; } case 2: { Plot1.setTitle("Power (W) - last minute - Total only"); Plot1.removeSeries(series2m); Plot1.removeSeries(series1m); Plot1.redraw(); setDetailsVisibility(false); // hide details break; } } break; } case 4: { switch (plot1_mode) { case 0: { Plot1.setTitle("Power (W) - last minute - stacked"); Plot1.redraw(); break; } case 1: { Plot1.setTitle("Power (W) - last minute - with details"); Plot1.redraw(); // This update plot title even if the series update is stoped setDetailsVisibility(true); // show details break; } case 2: { Plot1.setTitle("Power (W) - last minute "); // Plot1.removeSeries(series2m); // Plot1.removeSeries(series1m); Plot1.redraw(); setDetailsVisibility(false); // hide details break; } } break; } } } }); series1m.setModel(series1linkedlist, SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED); series2m.setModel(series2linkedlist, SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED); series3m.setModel(series3linkedlist, SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED); Plot1.addSeries(series2m, series2mFormat); Plot1.addSeries(series3m, series3mFormat); Plot1.addSeries(series1m, series1mFormat); series_p2_1.setModel(series_day1_linkedlist, SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED); Plot2.addSeries(series_p2_1, series4mFormat); if (skip_initial_sensor_checks) { thread_updater1s.start(); thread_updater2.start(); } else { run_network_token_test(); // Alert dialog when application starts new AlertDialog.Builder(this).setTitle(R.string.nw_chk_results).setMessage(network_checks_results) .setIcon(android.R.drawable.ic_menu_agenda) .setPositiveButton(R.string.run_both_th_local_remote, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { thread_updater1s.start(); thread_updater2.start(); } }).setNeutralButton(R.string.run_just_local_th, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { thread_updater1s.start(); Plot2.setTitle(getString(R.string.disabled)); tv_today_kwh.setVisibility(TextView.INVISIBLE); tv_today_cost.setVisibility(TextView.INVISIBLE); tv_today_percent.setVisibility(TextView.INVISIBLE); tv_today_avg.setVisibility(TextView.INVISIBLE); tv_week_kwh.setVisibility(TextView.INVISIBLE); tv_week_avg.setVisibility(TextView.INVISIBLE); tv_week_cost.setVisibility(TextView.INVISIBLE); tv_week_percent.setVisibility(TextView.INVISIBLE); tv_month_kwh.setVisibility(TextView.INVISIBLE); tv_month_avg.setVisibility(TextView.INVISIBLE); tv_month_cost.setVisibility(TextView.INVISIBLE); tv_month_percent.setVisibility(TextView.INVISIBLE); } }) .setNegativeButton(R.string.let_me_fix_the_prefs_first, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); } // end of if for skip initial tests }
From source file:com.appdevper.mediaplayer.activity.ActionBarCastActivity.java
private void populateDrawerItems() { mDrawerMenuContents = new DrawerMenuContents(this); final int selectedPosition = mDrawerMenuContents.getPosition(this.getClass()); final int unselectedColor = Color.WHITE; final int selectedColor = getResources().getColor(R.color.drawer_item_selected_background); SimpleAdapter adapter = new SimpleAdapter(this, mDrawerMenuContents.getItems(), R.layout.drawer_list_item, new String[] { DrawerMenuContents.FIELD_TITLE, DrawerMenuContents.FIELD_ICON }, new int[] { R.id.drawer_item_title, R.id.drawer_item_icon }) { @Override/*www .j ava2 s . c o m*/ public View getView(int position, View convertView, ViewGroup parent) { View view = super.getView(position, convertView, parent); int color = unselectedColor; if (position == selectedPosition) { color = selectedColor; } view.setBackgroundColor(color); return view; } }; mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position != selectedPosition) { //view.setBackgroundColor(getResources().getColor(R.color.drawer_item_selected_background)); mItemToOpenWhenDrawerCloses = position; } mDrawerLayout.closeDrawers(); } }); mDrawerList.setAdapter(adapter); }
From source file:com.desno365.mods.DesnoUtils.java
public static Snackbar getDefaultSnackbar(View parent, int text, int duration) { Snackbar snack = Snackbar.make(parent, text, duration); // make text white View view = snack.getView();/*from w w w . j av a 2s. co m*/ @SuppressLint("PrivateResource") TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text); tv.setTextColor(Color.WHITE); // set background and action colors TypedArray a = parent.getContext().getTheme() .obtainStyledAttributes(new int[] { R.attr.color_primary_dark, R.attr.color_accent }); int color1 = a.getColor(0, 0); int color2 = a.getColor(1, 0); a.recycle(); view.setBackgroundColor(color1); snack.setActionTextColor(color2); return snack; }
From source file:com.ibuildapp.romanblack.WebPlugin.WebPlugin.java
@Override public void create() { try {//from ww w .j a v a 2 s .com setContentView(R.layout.romanblack_html_main); root = (FrameLayout) findViewById(R.id.romanblack_root_layout); webView = new ObservableWebView(this); webView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); root.addView(webView); webView.setHorizontalScrollBarEnabled(false); setTitle("HTML"); Intent currentIntent = getIntent(); Bundle store = currentIntent.getExtras(); widget = (Widget) store.getSerializable("Widget"); if (widget == null) { handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100); return; } appName = widget.getAppName(); if (widget.getPluginXmlData().length() == 0) { if (currentIntent.getStringExtra("WidgetFile").length() == 0) { handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100); return; } } if (widget.getTitle() != null && widget.getTitle().length() > 0) { setTopBarTitle(widget.getTitle()); } else { setTopBarTitle(getResources().getString(R.string.romanblack_html_web)); } currentUrl = (String) getSession(); if (currentUrl == null) { currentUrl = ""; } ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni != null && ni.isConnectedOrConnecting()) { isOnline = true; } // topbar initialization setTopBarLeftButtonText(getString(R.string.common_home_upper), true, new View.OnClickListener() { @Override public void onClick(View view) { onBackPressed(); } }); if (isOnline) { webView.getSettings().setJavaScriptEnabled(true); } webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.getSettings().setGeolocationEnabled(true); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setAppCacheEnabled(true); webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setUseWideViewPort(false); webView.getSettings().setSavePassword(false); webView.clearHistory(); webView.invalidate(); if (Build.VERSION.SDK_INT >= 19) { } webView.getSettings().setUserAgentString( "Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"); webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.invalidate(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { } break; case MotionEvent.ACTION_UP: { if (!v.hasFocus()) { v.requestFocus(); } } break; case MotionEvent.ACTION_MOVE: { } break; } return false; } }); webView.setBackgroundColor(Color.WHITE); try { if (widget.getBackgroundColor() != Color.TRANSPARENT) { webView.setBackgroundColor(widget.getBackgroundColor()); } } catch (IllegalArgumentException e) { } webView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent); } }); webView.setWebChromeClient(new WebChromeClient() { FrameLayout.LayoutParams LayoutParameters = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); @Override public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) { AlertDialog.Builder builder = new AlertDialog.Builder(WebPlugin.this); builder.setTitle(R.string.location_dialog_title); builder.setMessage(R.string.location_dialog_description); builder.setCancelable(true); builder.setPositiveButton(R.string.location_dialog_allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.invoke(origin, true, false); } }); builder.setNegativeButton(R.string.location_dialog_not_allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.invoke(origin, false, false); } }); AlertDialog alert = builder.create(); alert.show(); } @Override public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { if (customView != null) { customViewCallback.onCustomViewHidden(); return; } view.setBackgroundColor(Color.BLACK); view.setLayoutParams(LayoutParameters); root.addView(view); customView = view; customViewCallback = callback; webView.setVisibility(View.GONE); } @Override public void onHideCustomView() { if (customView == null) { return; } else { closeFullScreenVideo(); } } public void openFileChooser(ValueCallback<Uri> uploadMsg) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT);//Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); isMedia = true; startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } // For Android 3.0+ public void openFileChooser(ValueCallback uploadMsg, String acceptType) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE); } //For Android 4.1 public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); isMedia = true; i.setType("image/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } @Override public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) { isV21 = true; mUploadMessageV21 = filePathCallback; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); return true; } @Override public void onReceivedTouchIconUrl(WebView view, String url, boolean precomposed) { super.onReceivedTouchIconUrl(view, url, precomposed); } }); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); if (state == states.EMPTY) { currentUrl = url; setSession(currentUrl); state = states.LOAD_START; handler.sendEmptyMessage(SHOW_PROGRESS); } } @Override public void onLoadResource(WebView view, String url) { if (!alreadyLoaded && (url.startsWith("http://www.youtube.com/get_video_info?") || url.startsWith("https://www.youtube.com/get_video_info?")) && Build.VERSION.SDK_INT < 11) { try { String path = url.contains("https://www.youtube.com/get_video_info?") ? url.replace("https://www.youtube.com/get_video_info?", "") : url.replace("http://www.youtube.com/get_video_info?", ""); String[] parqamValuePairs = path.split("&"); String videoId = null; for (String pair : parqamValuePairs) { if (pair.startsWith("video_id")) { videoId = pair.split("=")[1]; break; } } if (videoId != null) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com")) .setData(Uri.parse("http://www.youtube.com/watch?v=" + videoId))); needRefresh = true; alreadyLoaded = !alreadyLoaded; return; } } catch (Exception ex) { } } else { super.onLoadResource(view, url); } } @Override public void onPageFinished(WebView view, String url) { if (hideProgress) { if (TextUtils.isEmpty(WebPlugin.this.url)) { state = states.LOAD_COMPLETE; handler.sendEmptyMessage(HIDE_PROGRESS); super.onPageFinished(view, url); } else { view.loadUrl("javascript:(function(){" + "l=document.getElementById('link');" + "e=document.createEvent('HTMLEvents');" + "e.initEvent('click',true,true);" + "l.dispatchEvent(e);" + "})()"); hideProgress = false; } } else { state = states.LOAD_COMPLETE; handler.sendEmptyMessage(HIDE_PROGRESS); super.onPageFinished(view, url); } } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { if (errorCode == WebViewClient.ERROR_BAD_URL) { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(url)), DOWNLOAD_REQUEST_CODE); } } @Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { final AlertDialog.Builder builder = new AlertDialog.Builder(WebPlugin.this); builder.setMessage(R.string.notification_error_ssl_cert_invalid); builder.setPositiveButton(WebPlugin.this.getResources().getString(R.string.wp_continue), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.proceed(); } }); builder.setNegativeButton(WebPlugin.this.getResources().getString(R.string.wp_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.cancel(); } }); final AlertDialog dialog = builder.create(); dialog.show(); } @Override public void onFormResubmission(WebView view, Message dontResend, Message resend) { super.onFormResubmission(view, dontResend, resend); } @Override public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { return super.shouldInterceptRequest(view, request); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { try { if (url.contains("youtube.com/watch")) { if (Build.VERSION.SDK_INT < 11) { try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com")) .setData(Uri.parse(url))); return true; } catch (Exception ex) { return false; } } else { return false; } } else if (url.contains("paypal.com")) { if (url.contains("&bn=ibuildapp_SP")) { return false; } else { url = url + "&bn=ibuildapp_SP"; webView.loadUrl(url); return true; } } else if (url.contains("sms:")) { try { Intent smsIntent = new Intent(Intent.ACTION_VIEW); smsIntent.setData(Uri.parse(url)); startActivity(smsIntent); return true; } catch (Exception ex) { Log.e("", ex.getMessage()); return false; } } else if (url.contains("tel:")) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(url)); startActivity(callIntent); return true; } else if (url.contains("mailto:")) { MailTo mailTo = MailTo.parse(url); Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { mailTo.getTo() }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mailTo.getSubject()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, mailTo.getBody()); WebPlugin.this.startActivity(Intent.createChooser(emailIntent, getString(R.string.romanblack_html_send_email))); return true; } else if (url.contains("rtsp:")) { Uri address = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, address); final PackageManager pm = getPackageManager(); final List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0); if (matches.size() > 0) { startActivity(intent); } else { Toast.makeText(WebPlugin.this, getString(R.string.romanblack_html_no_video_player), Toast.LENGTH_SHORT).show(); } return true; } else if (url.startsWith("intent:") || url.startsWith("market:") || url.startsWith("col-g2m-2:")) { Intent it = new Intent(); it.setData(Uri.parse(url)); startActivity(it); return true; } else if (url.contains("//play.google.com/")) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } else { if (url.contains("ibuildapp.com-1915109")) { String param = Uri.parse(url).getQueryParameter("widget"); finish(); if (param != null && param.equals("1001")) com.appbuilder.sdk.android.Statics.launchMain(); else if (param != null && !"".equals(param)) { View.OnClickListener widget = Statics.linkWidgets.get(Integer.valueOf(param)); if (widget != null) widget.onClick(view); } return false; } currentUrl = url; setSession(currentUrl); if (!isOnline) { handler.sendEmptyMessage(HIDE_PROGRESS); handler.sendEmptyMessage(STOP_LOADING); } else { String pageType = "application/html"; if (!url.contains("vk.com")) { getPageType(url); } if (pageType.contains("application") && !pageType.contains("html") && !pageType.contains("xml")) { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(url)), DOWNLOAD_REQUEST_CODE); return super.shouldOverrideUrlLoading(view, url); } else { view.getSettings().setLoadWithOverviewMode(true); view.getSettings().setUseWideViewPort(true); view.setBackgroundColor(Color.WHITE); } } return false; } } catch (Exception ex) { // Error Logging return false; } } }); handler.sendEmptyMessage(SHOW_PROGRESS); new Thread() { @Override public void run() { EntityParser parser; if (widget.getPluginXmlData() != null) { if (widget.getPluginXmlData().length() > 0) { parser = new EntityParser(widget.getPluginXmlData()); } else { String xmlData = readXmlFromFile(getIntent().getStringExtra("WidgetFile")); parser = new EntityParser(xmlData); } } else { String xmlData = readXmlFromFile(getIntent().getStringExtra("WidgetFile")); parser = new EntityParser(xmlData); } parser.parse(); url = parser.getUrl(); html = parser.getHtml(); if (url.length() > 0 && !isOnline) { handler.sendEmptyMessage(NEED_INTERNET_CONNECTION); } else { if (isOnline) { } else { if (html.length() == 0) { } } if (html.length() > 0 || url.length() > 0) { handler.sendEmptyMessageDelayed(SHOW_HTML, 700); } else { handler.sendEmptyMessage(HIDE_PROGRESS); handler.sendEmptyMessage(INITIALIZATION_FAILED); } } } }.start(); } catch (Exception ex) { } }
From source file:com.artemchep.horario.ui.fragments.master.LessonsFragment.java
@Override protected void setupToolbar() { super.setupToolbar(); CustomAppBar appBar = getMainActivity().mAppBar; appBar.setTitle(getString(R.string.nav_lessons)); Toolbar toolbar = appBar.getToolbarSpecific(); toolbar.inflateMenu(R.menu.master_lessons_week); toolbar.setOnMenuItemClickListener(this); // Load week icon TypedArray a = getActivity().getTheme() .obtainStyledAttributes(new int[] { R.attr.icon_calendar_empty_grey, R.attr.is_dark_theme }); int iconDrawableRes = a.getResourceId(0, 0); boolean isDarkTheme = a.getBoolean(1, false); a.recycle();/* w ww . jav a 2 s . c o m*/ float density = getResources().getDisplayMetrics().density; mWeekDrawable = new TextDrawable(); mWeekDrawable.setTranslationY(density * 2); mWeekDrawable.setTextSize(density * 10); mWeekDrawable.setColor(isDarkTheme ? Color.WHITE : Color.GRAY); mWeekCompositeDrawable = new LayerDrawable( new Drawable[] { ContextCompat.getDrawable(getContext(), iconDrawableRes), mWeekDrawable }); Menu menu = toolbar.getMenu(); mWeekMenuItem = menu.findItem(R.id.action_switch_week); mWeekMenuItem.setIcon(mWeekCompositeDrawable); mWeekMenuItem.setVisible(mWeekCycle > 1); updateWeekNumberMenuItemText(); }
From source file:com.spoiledmilk.cykelsuperstier.navigation.SMRouteNavigationActivity.java
public void onLocalTrainContainerClick(View v) { v.setBackgroundColor(isLocalTrainSelected ? Color.rgb(255, 255, 255) : Color.rgb(236, 104, 0)); ((ImageView) findViewById(R.id.imgCheckbox5)) .setImageResource(isLocalTrainSelected ? R.drawable.check_field : R.drawable.check_in_orange); ((ImageView) findViewById(R.id.imgLocalTrain)).setImageResource( isLocalTrainSelected ? R.drawable.local_train_icon_gray : R.drawable.local_train_icon_white); textLocalTrain.setTextColor(isLocalTrainSelected ? getResources().getColor(R.color.DarkGrey) : Color.WHITE); if (isLocalTrainSelected) getMapFragment().overlaysManager.removelocalTrainStations(); else//from ww w.ja v a2 s.com getMapFragment().overlaysManager.drawlocalTrainStations(this); isLocalTrainSelected = !isLocalTrainSelected; }
From source file:com.artemchep.horario.ui.fragments.details.TeacherDetailsFragment.java
@Override protected void updateAll() { super.updateAll(); Teacher model = getModel();/*from ww w . java 2s .co m*/ // Make color a little bit lighter on dark backgrounds // and darker on light ones. int textAccentColor = model != null ? model.color : Palette.GREY; if (ColorUtil.isColorDark(textAccentColor) == mIsDarkTheme) { int filter = mIsDarkTheme ? Color.WHITE : Color.BLACK; textAccentColor = ColorUtils.blendARGB(textAccentColor, filter, 0.5f); } mEmailButton.setTextColor(textAccentColor); mPhoneButton.setTextColor(textAccentColor); }