List of usage examples for android.graphics Color BLACK
int BLACK
To view the source code for android.graphics Color BLACK.
Click Source Link
From source file:com.eng.arab.translator.androidtranslator.translate.TranslateViewActivity.java
@Override public void onClick(View view) { if (view == translateButton) { trgText.setTextColor(Color.BLACK);// Set Default Color trgText.setText(srcText.getText()); hideSoftKeyboard();//from w w w.ja v a 2 s .co m if (!srcText.getText().toString().equals("")) { // TEST Blank TranslatorClass tc = new TranslatorClass(); tc.setContext(getApplicationContext()); String translatedSentence = tc .searchWord3(new TranslatorClass().arabicNumberFormatter2(srcText.getText().toString())); trgText.setText(String.valueOf(Html.fromHtml(translatedSentence))); } } else if (view == srcToolbar && !editing) { trgCard.setVisibility(trgCard.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); // updateSrcToolbar(); } else if (view == trgToolbar) { srcCard.setVisibility(srcCard.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); // updateTrgToolbar(); } }
From source file:edu.pitt.gis.uniapp.UniApp.java
/** * Load the url into the webview.//from w ww .j a v a 2s . c o m * * @param url */ public void loadUrl(String url) { // Init web view if not already done if (this.appView == null) { this.init(); } // Set backgroundColor this.backgroundColor = this.getIntegerProperty("backgroundColor", Color.BLACK); this.root.setBackgroundColor(this.backgroundColor); // If keepRunning this.keepRunning = this.getBooleanProperty("keepRunning", true); // Then load the spinner this.loadSpinner(); this.appView.loadUrl(url); }
From source file:com.manning.androidhacks.hack017.CreateAccountAdapter.java
private TextView createTitle(String text) { TextView ret = new TextView(mContext); LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); ret.setLayoutParams(params);//from ww w .j a v a 2 s .c om ret.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17); ret.setTextColor(Color.BLACK); ret.setText(text); return ret; }
From source file:eu.operando.operandoapp.OperandoProxyStatus.java
@Override protected void onCreate(Bundle savedInstanceState) { MainUtil.initializeMainContext(getApplicationContext()); Settings settings = mainContext.getSettings(); settings.initializeDefaultValues();//from w w w.j a v a 2 s. c o m setCurrentThemeStyle(settings.getThemeStyle()); setTheme(getCurrentThemeStyle().themeAppCompatStyle()); super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); settings.registerOnSharedPreferenceChangeListener(this); webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); //region Floating Action Button fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (MainUtil.isServiceRunning(mainContext.getContext(), ProxyService.class) && !MainUtil.isProxyPaused(mainContext)) { //Update Preferences to BypassProxy MainUtil.setProxyPaused(mainContext, true); fab.setImageResource(android.R.drawable.ic_media_play); //Toast.makeText(mainContext.getContext(), "-- bypass (disable) proxy --", Toast.LENGTH_SHORT).show(); } else if (MainUtil.isServiceRunning(mainContext.getContext(), ProxyService.class) && MainUtil.isProxyPaused(mainContext)) { MainUtil.setProxyPaused(mainContext, false); fab.setImageResource(android.R.drawable.ic_media_pause); //Toast.makeText(mainContext.getContext(), "-- re-enable proxy --", Toast.LENGTH_SHORT).show(); } else if (!mainContext.getAuthority() .aliasFile(BouncyCastleSslEngineSource.KEY_STORE_FILE_EXTENSION).exists()) { try { installCert(); } catch (RootCertificateException | GeneralSecurityException | OperatorCreationException | IOException ex) { Logger.error(this, ex.getMessage(), ex.getCause()); } } } }); //endregion //region TabHost final TabHost tabHost = (TabHost) findViewById(R.id.tabHost2); tabHost.setup(); TabHost.TabSpec tabSpec = tabHost.newTabSpec("wifi_ap"); tabSpec.setContent(R.id.WifiAndAccessPointsScrollView); tabSpec.setIndicator("", getResources().getDrawable(R.drawable.ic_home)); tabHost.addTab(tabSpec); tabSpec = tabHost.newTabSpec("response_domain_filters"); tabSpec.setContent(R.id.ResponseAndDomainFiltersScrollView); tabSpec.setIndicator("", getResources().getDrawable(R.drawable.ic_filter)); tabHost.addTab(tabSpec); tabSpec = tabHost.newTabSpec("pending_notifications"); tabSpec.setContent(R.id.PendingNotificationsScrollView); tabSpec.setIndicator("", getResources().getDrawable(R.drawable.ic_pending_notification)); tabHost.addTab(tabSpec); tabSpec = tabHost.newTabSpec("logs"); tabSpec.setContent(R.id.LogsScrollView); tabSpec.setIndicator("", getResources().getDrawable(R.drawable.ic_report)); tabHost.addTab(tabSpec); tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String tabId) { switch (tabId) { case "pending_notifications": //region Load Tab3 ((TableLayout) ((LinearLayout) ((ScrollView) findViewById(R.id.PendingNotificationsScrollView)) .getChildAt(0)).getChildAt(1)).removeAllViews(); LoadPendingNotificationsTab(); //endregion break; case "logs": //region Load Tab 4 //because it is a heavy task it is being loaded asynchronously ((TableLayout) ((LinearLayout) ((ScrollView) findViewById(R.id.LogsScrollView)).getChildAt(0)) .getChildAt(1)).removeAllViews(); new AsyncTask() { private ProgressDialog mProgress; private List<String[]> apps; @Override protected void onPreExecute() { super.onPreExecute(); mProgress = new ProgressDialog(MainActivity.this); mProgress.setCancelable(false); mProgress.setCanceledOnTouchOutside(false); mProgress.setTitle("Fetching Application Data Logs"); mProgress.show(); } @Override protected Object doInBackground(Object[] params) { apps = new ArrayList(); for (String[] app : getInstalledApps(false)) { apps.add(new String[] { app[0], GetDataForApp(Integer.parseInt(app[1])) }); } return null; } @Override protected void onPostExecute(Object o) { super.onPostExecute(o); mProgress.dismiss(); for (String[] app : apps) { if (app[0].contains(".")) { continue; } TextView tv = new TextView(MainActivity.this); tv.setTextSize(18); tv.setText(app[0] + " || " + app[1]); ((TableLayout) ((LinearLayout) ((ScrollView) findViewById(R.id.LogsScrollView)) .getChildAt(0)).getChildAt(1)).addView(tv); View separator = new View(MainActivity.this); separator.setBackgroundColor(Color.BLACK); separator.setLayoutParams( new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 5)); ((TableLayout) ((LinearLayout) ((ScrollView) findViewById(R.id.LogsScrollView)) .getChildAt(0)).getChildAt(1)).addView(separator); } } }.execute(); //endregion break; } } }); //endregion //region Buttons WiFiAPButton = (Button) findViewById(R.id.WiFiAPButton); WiFiAPButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(mainContext.getContext(), AccessPointsActivity.class); startActivity(i); } }); responseFiltersButton = (Button) findViewById(R.id.responseFiltersButton); responseFiltersButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mainContext.getContext(), ResponseFiltersActivity.class); startActivity(i); } }); domainFiltersButton = (Button) findViewById(R.id.domainFiltersButton); domainFiltersButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mainContext.getContext(), DomainFiltersActivity.class); startActivity(i); } }); domainManagerButton = (Button) findViewById(R.id.domainManagerButton); domainManagerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mainContext.getContext(), DomainManagerActivity.class); startActivity(i); } }); permissionsPerDomainButton = (Button) findViewById(R.id.permissionsPerDomainButton); permissionsPerDomainButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mainContext.getContext(), PermissionsPerDomainActivity.class); startActivity(i); } }); trustedAccessPointsButton = (Button) findViewById(R.id.trustedAccessPointsButton); trustedAccessPointsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mainContext.getContext(), TrustedAccessPointsActivity.class); startActivity(i); } }); updateButton = (Button) findViewById(R.id.updateButton); updateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // mark first time has not runned and update like it's initial . final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("firstTime", true); editor.commit(); DownloadInitialSettings(); } }); statisticsButton = (Button) findViewById(R.id.statisticsButton); statisticsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mainContext.getContext(), StatisticsActivity.class); startActivity(i); } }); //endregion //region Action Bar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { setTitle(R.string.app_name); } //endregion //region Send Cached Settings //send cached settings if exist... BufferedReader br = null; try { File file = new File(MainContext.INSTANCE.getContext().getFilesDir(), "resend.inf"); StringBuilder content = new StringBuilder(); br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { content.append(line); } if (content.toString().equals("1")) { File f = new File(file.getCanonicalPath()); f.delete(); new DatabaseHelper(MainActivity.this) .sendSettingsToServer(new RequestFilterUtil(MainActivity.this).getIMEI()); } } catch (Exception ex) { ex.getMessage(); } finally { try { br.close(); } catch (Exception ex) { ex.getMessage(); } } //endregion initializeProxyService(); }
From source file:com.amaze.filemanager.fragments.ProcessViewer.java
public void processResults(final DataPackage b) { if (!running) return;//w w w. j ava 2s . c o m if (getResources() == null) return; if (b != null) { int id = b.getId(); final Integer id1 = new Integer(id); if (!CancelledCopyIds.contains(id1)) { if (CopyIds.contains(id1)) { boolean completed = b.isCompleted(); View process = rootView.findViewWithTag("copy" + id); if (completed) { try { rootView.removeViewInLayout(process); CopyIds.remove(CopyIds.indexOf(id1)); } catch (Exception e) { e.printStackTrace(); } } else { String name = b.getName(); int p1 = b.getP1(); int p2 = b.getP2(); long total = b.getTotal(); long done = b.getDone(); boolean move = b.isMove(); String text = utils.getString(getActivity(), R.string.copying) + "\n" + name + "\n" + utils.readableFileSize(done) + "/" + utils.readableFileSize(total) + "\n" + p1 + "%"; if (move) { text = utils.getString(getActivity(), R.string.moving) + "\n" + name + "\n" + utils.readableFileSize(done) + "/" + utils.readableFileSize(total) + "\n" + p1 + "%"; } ((TextView) process.findViewById(R.id.progressText)).setText(text); ProgressBar p = (ProgressBar) process.findViewById(R.id.progressBar1); p.setProgress(p1); p.setSecondaryProgress(p2); } } else { CardView root = (android.support.v7.widget.CardView) getActivity().getLayoutInflater() .inflate(R.layout.processrow, null); root.setTag("copy" + id); ImageButton cancel = (ImageButton) root.findViewById(R.id.delete_button); TextView progressText = (TextView) root.findViewById(R.id.progressText); Drawable icon = icons.getCopyDrawable(); boolean move = b.isMove(); if (move) { icon = icons.getCutDrawable(); } if (mainActivity.theme1 == 1) { cancel.setImageResource(R.drawable.ic_action_cancel); root.setCardBackgroundColor(R.color.cardView_foreground); root.setCardElevation(0f); progressText.setTextColor(Color.WHITE); } else { icon.setColorFilter(Color.parseColor("#666666"), PorterDuff.Mode.SRC_ATOP); progressText.setTextColor(Color.BLACK); } ((ImageView) root.findViewById(R.id.progressImage)).setImageDrawable(icon); cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View p1) { Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.stopping), Toast.LENGTH_LONG).show(); Intent i = new Intent("copycancel"); i.putExtra("id", id1); getActivity().sendBroadcast(i); rootView.removeView(rootView.findViewWithTag("copy" + id1)); CopyIds.remove(CopyIds.indexOf(id1)); CancelledCopyIds.add(id1); // TODO: Implement this method } }); String name = b.getName(); int p1 = b.getP1(); int p2 = b.getP2(); String text = utils.getString(getActivity(), R.string.copying) + "\n" + name; if (move) { text = utils.getString(getActivity(), R.string.moving) + "\n" + name; } progressText.setText(text); ProgressBar p = (ProgressBar) root.findViewById(R.id.progressBar1); p.setProgress(p1); p.setSecondaryProgress(p2); CopyIds.add(id1); rootView.addView(root); } } } }
From source file:com.example.administrator.mywebviewdrawsign.SysWebView.java
public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) { // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0 LogUtils.d("showing Custom View"); // if a view already exists then immediately terminate the new one if (mCustomView != null) { callback.onCustomViewHidden();/*w w w . j a v a 2 s .com*/ return; } // Store the view and its callback for later (to kill it properly) mCustomView = view; mCustomViewCallback = callback; // Add the custom view to its container. ViewGroup parent = (ViewGroup) this.getParent(); background = parent.getBackground(); parent.setBackground(new ColorDrawable(Color.BLACK)); parent.addView(view, COVER_SCREEN_GRAVITY_CENTER); // Hide the content view. this.setVisibility(View.GONE); // Finally show the custom view container. parent.setVisibility(View.VISIBLE); parent.bringToFront(); if (objects != null && objects.length > 0) { for (Object obj : objects) { if (obj instanceof View) { ((View) obj).setVisibility(View.GONE); } else if (obj instanceof Fragment) { ((Fragment) obj).getView().setVisibility(View.GONE); } } } ((Activity) mContext).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); ((Activity) mContext).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); }
From source file:com.esri.arcgisruntime.sample.featurelayerupdateattributes.MainActivity.java
/** * Displays Callout// w ww .java2s .com * @param title the text to show in the Callout */ private void showCallout(String title) { // create a text view for the callout RelativeLayout calloutLayout = new RelativeLayout(getApplicationContext()); TextView calloutContent = new TextView(getApplicationContext()); calloutContent.setId(R.id.textview); calloutContent.setTextColor(Color.BLACK); calloutContent.setTextSize(18); calloutContent.setPadding(0, 10, 10, 0); calloutContent.setText(title); RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); relativeParams.addRule(RelativeLayout.RIGHT_OF, calloutContent.getId()); // create image view for the callout ImageView imageView = new ImageView(getApplicationContext()); imageView.setImageDrawable( ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_info_outline_black_18dp)); imageView.setLayoutParams(relativeParams); imageView.setOnClickListener(new ImageViewOnclickListener()); calloutLayout.addView(calloutContent); calloutLayout.addView(imageView); mCallout.setLocation(mMapView.screenToLocation(mClickPoint)); mCallout.setContent(calloutLayout); mCallout.show(); }
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 w w . j a v a 2 s . co 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:ca.appvelopers.mcgillmobile.ui.ScheduleActivity.java
/** * Renders the landscape view// w w w . j av a2 s . c o m */ private void renderLandscapeView() { //Make sure that the necessary views are present in the layout Assert.assertNotNull(timetableContainer); Assert.assertNotNull(scheduleContainer); //Leave space at the top for the day names View dayView = View.inflate(this, R.layout.fragment_day_name, null); //Black line to separate the timetable from the schedule View dayViewLine = dayView.findViewById(R.id.day_line); dayViewLine.setVisibility(View.VISIBLE); //Add the day view to the top of the timetable timetableContainer.addView(dayView); //Find the index of the given date int currentDayIndex = date.getDayOfWeek().getValue(); //Go through the 7 days of the week for (int i = 1; i < 8; i++) { DayOfWeek day = DayOfWeek.of(i); //Set up the day name dayView = View.inflate(this, R.layout.fragment_day_name, null); TextView dayViewTitle = (TextView) dayView.findViewById(R.id.day_name); dayViewTitle.setText(DayUtils.getString(this, day)); scheduleContainer.addView(dayView); //Set up the schedule container for that one day LinearLayout scheduleContainer = new LinearLayout(this); scheduleContainer.setOrientation(LinearLayout.VERTICAL); scheduleContainer.setLayoutParams(new LinearLayout.LayoutParams( getResources().getDimensionPixelSize(R.dimen.cell_landscape_width), ViewGroup.LayoutParams.WRAP_CONTENT)); //Fill the schedule for the current day fillSchedule(this.timetableContainer, scheduleContainer, date.plusDays(i - currentDayIndex), false); //Add the current day to the schedule container this.scheduleContainer.addView(scheduleContainer); //Line View line = new View(this); line.setBackgroundColor(Color.BLACK); line.setLayoutParams( new ViewGroup.LayoutParams(getResources().getDimensionPixelSize(R.dimen.schedule_line), ViewGroup.LayoutParams.MATCH_PARENT)); this.scheduleContainer.addView(line); } }
From source file:com.nononsenseapps.feeder.ui.BaseActivity.java
private void updateStatusBarForNavDrawerSlide(float slideOffset) { if (mStatusBarColorAnimator != null) { mStatusBarColorAnimator.cancel(); }/*from w w w .ja va 2s . c o m*/ if (!mActionBarShown) { mLPreviewUtils.setStatusBarColor(Color.BLACK); return; } mLPreviewUtils.setStatusBarColor( (Integer) ARGB_EVALUATOR.evaluate(slideOffset, mThemedStatusBarColor, Color.BLACK)); }