List of usage examples for android.graphics Color parseColor
@ColorInt public static int parseColor(@Size(min = 1) String colorString)
From source file:com.nest5.businessClient.Initialactivity.java
private void makeTable(String name) { table.removeAllViews();/* ww w. j a va2s . co m*/ Iterator<Entry<Registrable, Integer>> it = currentOrder.entrySet().iterator(); int i = 0; while (it.hasNext()) { LinkedHashMap.Entry<Registrable, Integer> pairs = (LinkedHashMap.Entry<Registrable, Integer>) it.next(); // System.out.println(pairs.getKey() + " = " + pairs.getValue()); // it.remove(); // avoids a ConcurrentModificationException TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.table_row, null); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tQty = (TextView) tr.findViewById(R.id.cell_qty); TextView tPrice = (TextView) tr.findViewById(R.id.cell_price); ImageButton rmvBtn = (ImageButton) tr.findViewById(R.id.cell_remove_button); tItem.setText(pairs.getKey().name); tQty.setText(String.valueOf(pairs.getValue())); tPrice.setText(String.valueOf(pairs.getKey().price)); if (name == pairs.getKey().name) { tr.setBackgroundColor(Color.parseColor("#55222222")); } rmvBtn.setOnClickListener(removeClickListener); rmvBtn.setId(i); table.addView(tr); // Draw separator TextView tv = new TextView(mContext); tv.setBackgroundColor(Color.parseColor("#80808080")); tv.setHeight(2); table.addView(tv); inTableRegistrable.add(i, pairs.getKey()); i++; } }
From source file:com.nest5.businessClient.Initialactivity.java
private void makeDailyTable(int TABLE_TYPE) { dailyTable.removeAllViews();//from ww w .ja v a2 s .c o m Double total = 0.0; DecimalFormat dec = new DecimalFormat("$###,###,###"); TextView tv = new TextView(mContext); tv.setBackgroundColor(Color.parseColor("#80808080")); tv.setHeight(2); TableRow tr1 = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate1 = (TextView) tr1.findViewById(R.id.cell_date); TextView tItem1 = (TextView) tr1.findViewById(R.id.cell_item); TextView tAccount1 = (TextView) tr1.findViewById(R.id.cell_account); TextView tVal1 = (TextView) tr1.findViewById(R.id.cell_value); TextView tTot1 = (TextView) tr1.findViewById(R.id.cell_total); tDate1.setText("FECHA"); tAccount1.setText("CUENTA"); tItem1.setText("ITEM"); tVal1.setText("VALOR"); tTot1.setText("TOTAL"); tr1.setBackgroundColor(Color.CYAN); dailyTable.addView(tr1); dailyTable.addView(tv); //actualizar sales de hoy Calendar today = Calendar.getInstance(); Calendar tomorrow = Calendar.getInstance(); today.set(Calendar.HOUR, 0); today.set(Calendar.HOUR_OF_DAY, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.SECOND, 0); today.set(Calendar.MILLISECOND, 0); tomorrow.roll(Calendar.DATE, 1); tomorrow.set(Calendar.HOUR, 0); tomorrow.set(Calendar.HOUR_OF_DAY, 0); tomorrow.set(Calendar.MINUTE, 0); tomorrow.set(Calendar.SECOND, 0); tomorrow.set(Calendar.MILLISECOND, 0); init = today.getTimeInMillis(); end = tomorrow.getTimeInMillis(); Log.d("GUARDANDOVENTA", today.toString()); Log.d("GUARDANDOVENTA", tomorrow.toString()); Calendar now = Calendar.getInstance(); now.setTimeInMillis(System.currentTimeMillis()); Log.d(TAG, now.toString()); Log.d(TAG, "Diferencia entre tiempos: " + String.valueOf(end - init)); salesFromToday = saleDataSource.getAllSalesWithin(init, end); List<Sale> usingSales = salesFromToday; switch (TABLE_TYPE) { case TABLE_TYPE_TODAY: usingSales = salesFromToday; break; case TABLE_TYPE_ALL: usingSales = saleList; break; } for (Sale currentSale : usingSales) { double totalLocal = 0.0; LinkedHashMap<Combo, Double> combos = currentSale.getCombos(); LinkedHashMap<Product, Double> products = currentSale.getProducts(); LinkedHashMap<Ingredient, Double> ingredients = currentSale.getIngredients(); Log.w("DAYILETABLES", " " + combos.size() + " " + products.size() + " " + ingredients.size()); Iterator<Entry<Combo, Double>> it = combos.entrySet().iterator(); Calendar date = Calendar.getInstance(); date.setTimeInMillis(currentSale.getDate()); String fecha = date.get(Calendar.MONTH) + "/" + date.get(Calendar.DAY_OF_MONTH) + "/" + date.get(Calendar.YEAR) + "\n" + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND); String account = currentSale.getPaymentMethod(); while (it.hasNext()) { TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); Map.Entry<Combo, Double> pair = (Map.Entry<Combo, Double>) it.next(); Double value = pair.getValue() * pair.getKey().getPrice(); tDate.setText(fecha); tAccount.setText(account); tItem.setText(pair.getKey().getName() + " en Combo"); tVal.setText(dec.format(value)); tTot.setText("----"); total += value; totalLocal += value; dailyTable.addView(tr); // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue()); } Iterator<Entry<Product, Double>> it2 = products.entrySet().iterator(); while (it2.hasNext()) { Map.Entry<Product, Double> pair = (Map.Entry<Product, Double>) it2.next(); TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); Double value = pair.getValue() * pair.getKey().getPrice(); tDate.setText(fecha); tAccount.setText(account); tItem.setText(pair.getKey().getName()); tVal.setText(dec.format(value)); tTot.setText("----"); total += value; totalLocal += value; dailyTable.addView(tr); // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue()); } Iterator<Entry<Ingredient, Double>> it3 = ingredients.entrySet().iterator(); while (it3.hasNext()) { Map.Entry<Ingredient, Double> pair = (Map.Entry<Ingredient, Double>) it3.next(); TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); Double value = pair.getValue() * pair.getKey().getPrice(); tDate.setText(fecha); tAccount.setText(account); tItem.setText(pair.getKey().getName()); tVal.setText(dec.format(value)); tTot.setText("----"); total += value; totalLocal += value; dailyTable.addView(tr); // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue()); } TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); tDate.setText(fecha); tAccount.setText("-------"); tItem.setText("Ingreso por Ventas"); tVal.setText("----"); tTot.setText(dec.format(totalLocal)); tr.setBackgroundColor(Color.LTGRAY); dailyTable.addView(tr); TableRow tr2 = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate2 = (TextView) tr2.findViewById(R.id.cell_date); TextView tItem2 = (TextView) tr2.findViewById(R.id.cell_item); TextView tAccount2 = (TextView) tr2.findViewById(R.id.cell_account); TextView tVal2 = (TextView) tr2.findViewById(R.id.cell_value); TextView tTot2 = (TextView) tr2.findViewById(R.id.cell_total); tDate2.setText(fecha); tAccount2.setText("-------"); tItem2.setText("Acumulado por Ventas"); tVal2.setText("----"); tTot2.setText(dec.format(total)); tr2.setBackgroundColor(Color.GRAY); dailyTable.addView(tr2); } }
From source file:com.eveningoutpost.dexdrip.Home.java
private void displayCurrentInfoFromReading(BgReading lastBgReading, boolean predictive) { double estimate = 0; double estimated_delta = 0; String slope_arrow = lastBgReading.slopeArrow(); String extrastring = ""; if ((new Date().getTime()) - stale_data_millis() - lastBgReading.timestamp > 0) { notificationText.setText(R.string.signal_missed); if (!predictive) { estimate = lastBgReading.calculated_value; } else {/*w w w .j a v a 2 s . c o m*/ estimate = BgReading.estimated_bg(lastBgReading.timestamp + (6000 * 7)); } currentBgValueText.setText(bgGraphBuilder.unitized_string(estimate)); currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); dexbridgeBattery.setPaintFlags(dexbridgeBattery.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { if (notificationText.getText().length() == 0) { notificationText.setTextColor(Color.WHITE); } boolean bg_from_filtered = prefs.getBoolean("bg_from_filtered", false); if (!predictive) { estimate = lastBgReading.calculated_value; // normal currentBgValueText.setTypeface(null, Typeface.NORMAL); // if noise has settled down then switch off filtered mode if ((bg_from_filtered) && (BgGraphBuilder.last_noise < BgGraphBuilder.NOISE_FORGIVE) && (prefs.getBoolean("bg_compensate_noise", false))) { bg_from_filtered = false; prefs.edit().putBoolean("bg_from_filtered", false).apply(); } if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_TRIGGER) && (BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0) && (prefs.getBoolean("bg_compensate_noise", false))) { estimate = BgGraphBuilder.best_bg_estimate; // this maybe needs scaling based on noise intensity estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate; slope_arrow = BgReading .slopeToArrowSymbol(estimated_delta / (BgGraphBuilder.DEXCOM_PERIOD / 60000)); // delta by minute currentBgValueText.setTypeface(null, Typeface.ITALIC); extrastring = "\u26A0"; // warning symbol ! } if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_HIGH) && (DexCollectionType.hasFiltered())) { bg_from_filtered = true; // force filtered mode } if (bg_from_filtered) { currentBgValueText .setPaintFlags(currentBgValueText.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); estimate = lastBgReading.filtered_calculated_value; } else { currentBgValueText .setPaintFlags(currentBgValueText.getPaintFlags() & ~Paint.UNDERLINE_TEXT_FLAG); } String stringEstimate = bgGraphBuilder.unitized_string(estimate); if ((lastBgReading.hide_slope) || (bg_from_filtered)) { slope_arrow = ""; } currentBgValueText.setText(stringEstimate + " " + slope_arrow); } else { estimate = BgReading.activePrediction(); String stringEstimate = bgGraphBuilder.unitized_string(estimate); currentBgValueText.setText(stringEstimate + " " + BgReading.activeSlopeArrow()); } if (extrastring.length() > 0) currentBgValueText.setText(extrastring + currentBgValueText.getText()); } int minutes = (int) (System.currentTimeMillis() - lastBgReading.timestamp) / (60 * 1000); if ((!small_width) || (notificationText.length() > 0)) notificationText.append("\n"); if (!small_width) { notificationText.append(minutes + ((minutes == 1) ? getString(R.string.space_minute_ago) : getString(R.string.space_minutes_ago))); } else { // small screen notificationText.append(minutes + getString(R.string.space_mins)); currentBgValueText.setPadding(0, 0, 0, 0); } if (small_screen) { if (currentBgValueText.getText().length() > 4) currentBgValueText.setTextSize(25); } // do we actually need to do this query here if we again do it in unitizedDeltaString List<BgReading> bgReadingList = BgReading.latest(2, is_follower); if (bgReadingList != null && bgReadingList.size() == 2) { // same logic as in xDripWidget (refactor that to BGReadings to avoid redundancy / later inconsistencies)? display_delta = bgGraphBuilder.unitizedDeltaString(true, true, is_follower); // TODO reduce duplication of logic if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_TRIGGER) && (BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0) && (prefs.getBoolean("bg_compensate_noise", false))) { //final double estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate; display_delta = bgGraphBuilder.unitizedDeltaStringRaw(true, true, estimated_delta); addDisplayDelta(); if (!prefs.getBoolean("show_noise_workings", false)) { notificationText.append("\nNoise: " + bgGraphBuilder.noiseString(BgGraphBuilder.last_noise)); } } else { addDisplayDelta(); } } if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } }
From source file:com.nest5.businessClient.Initialactivity.java
private void makeInventoryTable(List<Ingredient> ingredients) { inventoryTable.removeAllViews();/* ww w . ja v a2 s .c o m*/ Double total = 0.0; DecimalFormat dec = new DecimalFormat("$###,###,###"); TextView tv = new TextView(mContext); tv.setBackgroundColor(Color.parseColor("#80808080")); tv.setHeight(2); TableRow tr1 = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null); TextView tDate1 = (TextView) tr1.findViewById(R.id.cell_date); TextView tItem1 = (TextView) tr1.findViewById(R.id.cell_type); TextView tAccount1 = (TextView) tr1.findViewById(R.id.cell_qty); TextView tVal1 = (TextView) tr1.findViewById(R.id.cell_unit_value); TextView tTot1 = (TextView) tr1.findViewById(R.id.cell_total_value); TextView tTotTot1 = (TextView) tr1.findViewById(R.id.cell_total_total); tDate1.setText("FECHA"); tAccount1.setText("CANTIDAD"); tItem1.setText("TIPO"); tVal1.setText("VALOR\nUNIDAD"); tTot1.setText("TOTAL\nITEM"); tTotTot1.setText("TOTAL"); tr1.setBackgroundColor(Color.CYAN); inventoryTable.addView(tr1); inventoryTable.addView(tv); for (Ingredient current : ingredients) { Calendar date = Calendar.getInstance(); date.setTimeInMillis(current.getDate()); String fecha = date.get(Calendar.MONTH) + "/" + date.get(Calendar.DAY_OF_MONTH) + "/" + date.get(Calendar.YEAR) + "\n" + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND); Double localVal = current.getQty() * current.getCostPerUnit(); total += localVal; TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tType = (TextView) tr.findViewById(R.id.cell_type); TextView tQty = (TextView) tr.findViewById(R.id.cell_qty); TextView tVal = (TextView) tr.findViewById(R.id.cell_unit_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total_value); TextView tTotTot = (TextView) tr.findViewById(R.id.cell_total_total); tDate.setText(fecha); tType.setText("E"); tQty.setText(String.valueOf(current.getQty())); tVal.setText(dec.format(current.getCostPerUnit())); tTot.setText(dec.format(localVal)); tTotTot.setText(" ----- "); inventoryTable.addView(tr); } TableRow tr2 = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null); TextView tDate2 = (TextView) tr2.findViewById(R.id.cell_date); TextView tType2 = (TextView) tr2.findViewById(R.id.cell_type); TextView tQty2 = (TextView) tr2.findViewById(R.id.cell_qty); TextView tVal2 = (TextView) tr2.findViewById(R.id.cell_unit_value); TextView tTot2 = (TextView) tr2.findViewById(R.id.cell_total_value); TextView tTotTot2 = (TextView) tr2.findViewById(R.id.cell_total_total); tDate2.setText("------"); tType2.setText("-----"); tQty2.setText("-----"); tVal2.setText("-----"); tTot2.setText("TOTAL GENERAL"); tTotTot2.setText(dec.format(total)); tr2.setBackgroundColor(Color.LTGRAY); inventoryTable.addView(tr2); }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
void initialiseFab() { String folder_skin = getColorPreference().getColorAsString(ColorUsage.ICON_SKIN); int fabSkinPressed = PreferenceUtils.getStatusColor(BaseActivity.accentSkin); int folderskin = Color.parseColor(folder_skin); int fabskinpressed = (PreferenceUtils.getStatusColor(folder_skin)); floatingActionButton = (FloatingActionMenu) findViewById(R.id.menu); floatingActionButton.setMenuButtonColorNormal(Color.parseColor(BaseActivity.accentSkin)); floatingActionButton.setMenuButtonColorPressed(fabSkinPressed); floatingActionButton.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() { @Override//from w ww . j a v a 2s . com public void onMenuToggle(boolean b) { if (b) utils.revealShow(fabBgView, true); else utils.revealShow(fabBgView, false); } }); FloatingActionButton fabNewFolder = (FloatingActionButton) findViewById(R.id.menu_new_folder); fabNewFolder.setColorNormal(folderskin); fabNewFolder.setColorPressed(fabskinpressed); fabNewFolder.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mainActivityHelper.add(MainActivityHelper.NEW_FOLDER); //utils.revealShow(fabBgView, false); floatingActionButton.close(true); } }); FloatingActionButton fabNewFile = (FloatingActionButton) findViewById(R.id.menu_new_file); fabNewFile.setColorNormal(folderskin); fabNewFile.setColorPressed(fabskinpressed); fabNewFile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mainActivityHelper.add(MainActivityHelper.NEW_FILE); //utils.revealShow(fabBgView, false); floatingActionButton.close(true); } }); final FloatingActionButton floatingActionButton3 = (FloatingActionButton) findViewById(R.id.menu_new_cloud); floatingActionButton3.setColorNormal(folderskin); floatingActionButton3.setColorPressed(fabskinpressed); floatingActionButton3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mainActivityHelper.add(MainActivityHelper.NEW_CLOUD); //utils.revealShow(fabBgView, false); floatingActionButton.close(true); } }); }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
/** * Hide menu items not appropriate for the current context. * //from w w w . ja va 2 s . com * <p> * <strong>Note:</strong> Please adjust the comments in * {@code res/menu/message_list_option.xml} if you change the visibility of * a menu item in this method. * </p> * * @param mMenu2 * The {@link Menu} instance that should be modified. May be * {@code null}; in that case the method does nothing and * immediately returns. */ private void configureMenu(android.view.Menu mMenu2) { if (mMenu2 == null) { return; } // Set visibility of account/folder settings menu items if (mMessageListFragment == null) { mMenu2.findItem(R.id.account_settings).setVisible(false); mMenu2.findItem(R.id.folder_settings).setVisible(false); } else { mMenu2.findItem(R.id.account_settings).setVisible(mMessageListFragment.isSingleAccountMode()); mMenu2.findItem(R.id.folder_settings).setVisible(mMessageListFragment.isSingleFolderMode()); } /* * Set visibility of menu items related to the message view */ if (mDisplayMode == DisplayMode.MESSAGE_LIST || mMessageViewFragment == null || !mMessageViewFragment.isInitialized()) { mMenu2.findItem(R.id.next_message).setVisible(false); mMenu2.findItem(R.id.previous_message).setVisible(false); mMenu2.findItem(R.id.single_message_options).setVisible(false); mMenu2.findItem(R.id.delete).setVisible(false); mMenu2.findItem(R.id.composeList).setVisible(false); mMenu2.findItem(R.id.composeView).setVisible(false); mMenu2.findItem(R.id.archive).setVisible(false); mMenu2.findItem(R.id.move).setVisible(false); mMenu2.findItem(R.id.copy).setVisible(false); mMenu2.findItem(R.id.spam).setVisible(false); mMenu2.findItem(R.id.refile).setVisible(false); mMenu2.findItem(R.id.toggle_unread).setVisible(false); mMenu2.findItem(R.id.select_text).setVisible(false); mMenu2.findItem(R.id.toggle_message_view_theme).setVisible(false); mMenu2.findItem(R.id.show_headers).setVisible(false); mMenu2.findItem(R.id.hide_headers).setVisible(false); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); SharedPreferences sharedpref = getSharedPreferences("actionbar_color", Context.MODE_PRIVATE); if (!sharedpref.contains("actionbar_color")) { if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); } } else { actionbar_colors = sharedpref.getString("actionbar_color", null); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors))); } } } else { // hide prev/next buttons in split mode if (mDisplayMode != DisplayMode.MESSAGE_VIEW) { mMenu2.findItem(R.id.next_message).setVisible(false); mMenu2.findItem(R.id.previous_message).setVisible(false); } else { MessageReference ref = mMessageViewFragment.getMessageReference(); boolean initialized = (mMessageListFragment != null && mMessageListFragment.isLoadFinished()); boolean canDoPrev = (initialized && !mMessageListFragment.isFirst(ref)); boolean canDoNext = (initialized && !mMessageListFragment.isLast(ref)); MenuItem prev = mMenu2.findItem(R.id.previous_message); prev.setEnabled(canDoPrev); // prev.getIcon().setAlpha(canDoPrev ? 255 : 127); // MenuItem next = menu.findItem(R.id.next_message); // next.setEnabled(canDoNext); // next.getIcon().setAlpha(canDoNext ? 255 : 127); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff"))); } } MenuItem toggleTheme = mMenu2.findItem(R.id.toggle_message_view_theme); if (K9.useFixedMessageViewTheme()) { toggleTheme.setVisible(false); } else { // Set title of menu item to switch to dark/light theme if (K9.getK9MessageViewTheme() == K9.Theme.DARK) { toggleTheme.setTitle(R.string.message_view_theme_action_light); } else { toggleTheme.setTitle(R.string.message_view_theme_action_dark); } toggleTheme.setVisible(true); } // Set title of menu item to toggle the read state of the currently // displayed message if (mMessageViewFragment.isMessageRead()) { mMenu2.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_unread_action); } else { mMenu2.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_read_action); } // Jellybean has built-in long press selection support mMenu2.findItem(R.id.select_text).setVisible(Build.VERSION.SDK_INT < 16); mMenu2.findItem(R.id.delete).setVisible(K9.isMessageViewDeleteActionVisible()); /* * Set visibility of copy, move, archive, spam in action bar and * refile submenu */ if (mMessageViewFragment.isCopyCapable()) { mMenu2.findItem(R.id.copy).setVisible(K9.isMessageViewCopyActionVisible()); mMenu2.findItem(R.id.refile_copy).setVisible(true); } else { mMenu2.findItem(R.id.copy).setVisible(false); mMenu2.findItem(R.id.refile_copy).setVisible(false); } if (mMessageViewFragment.isMoveCapable()) { boolean canMessageBeArchived = mMessageViewFragment.canMessageBeArchived(); boolean canMessageBeMovedToSpam = mMessageViewFragment.canMessageBeMovedToSpam(); mMenu2.findItem(R.id.move).setVisible(K9.isMessageViewMoveActionVisible()); mMenu2.findItem(R.id.archive) .setVisible(canMessageBeArchived && K9.isMessageViewArchiveActionVisible()); mMenu2.findItem(R.id.spam) .setVisible(canMessageBeMovedToSpam && K9.isMessageViewSpamActionVisible()); mMenu2.findItem(R.id.refile_move).setVisible(true); mMenu2.findItem(R.id.refile_archive).setVisible(canMessageBeArchived); mMenu2.findItem(R.id.refile_spam).setVisible(canMessageBeMovedToSpam); } else { mMenu2.findItem(R.id.move).setVisible(false); mMenu2.findItem(R.id.archive).setVisible(false); mMenu2.findItem(R.id.spam).setVisible(false); mMenu2.findItem(R.id.refile).setVisible(false); } if (mMessageViewFragment.allHeadersVisible()) { mMenu2.findItem(R.id.show_headers).setVisible(false); } else { mMenu2.findItem(R.id.hide_headers).setVisible(false); } } /* * Set visibility of menu items related to the message list */ // Hide both search menu items by default and enable one when // appropriate mMenu2.findItem(R.id.search).setVisible(false); mMenu2.findItem(R.id.search_remote).setVisible(false); if (mDisplayMode == DisplayMode.MESSAGE_VIEW || mMessageListFragment == null || !mMessageListFragment.isInitialized()) { mMenu2.findItem(R.id.check_mail).setVisible(false); mMenu2.findItem(R.id.set_sort).setVisible(false); mMenu2.findItem(R.id.select_all).setVisible(false); mMenu2.findItem(R.id.send_messages).setVisible(false); mMenu2.findItem(R.id.expunge).setVisible(false); mMenu2.findItem(R.id.mark_all_as_read).setVisible(false); mMenu2.findItem(R.id.show_folder_list).setVisible(false); } else { mMenu2.findItem(R.id.set_sort).setVisible(true); mMenu2.findItem(R.id.select_all).setVisible(true); mMenu2.findItem(R.id.composeList).setVisible(true); mMenu2.findItem(R.id.mark_all_as_read).setVisible(mMessageListFragment.isMarkAllAsReadSupported()); if (!mMessageListFragment.isSingleAccountMode()) { mMenu2.findItem(R.id.expunge).setVisible(false); mMenu2.findItem(R.id.send_messages).setVisible(false); mMenu2.findItem(R.id.show_folder_list).setVisible(false); } else { mMenu2.findItem(R.id.send_messages).setVisible(mMessageListFragment.isOutbox()); mMenu2.findItem(R.id.expunge).setVisible( mMessageListFragment.isRemoteFolder() && mMessageListFragment.isAccountExpungeCapable()); mMenu2.findItem(R.id.show_folder_list).setVisible(true); } mMenu2.findItem(R.id.check_mail).setVisible(mMessageListFragment.isCheckMailSupported()); // If this is an explicit local search, show the option to search on // the server if (!mMessageListFragment.isRemoteSearch() && mMessageListFragment.isRemoteSearchAllowed()) { mMenu2.findItem(R.id.search_remote).setVisible(true); } else if (!mMessageListFragment.isManualSearch()) { mMenu2.findItem(R.id.search).setVisible(true); } } }
From source file:com.guardtrax.ui.screens.HomeScreen.java
private void displaytourInfo() { String message = ""; int i = 0;/* w w w.java 2 s . com*/ int tagCount = 0; boolean singleDisplay = false; //indicates that only 1 item is to be displayed in the tour list List<Boolean> tourtagsIncluded = new ArrayList<Boolean>(); List<Boolean> tourtagsScanned = new ArrayList<Boolean>(); List<Integer> tourOrder = new ArrayList<Integer>(); List<String> messageList = new ArrayList<String>(); //check if this is a single display (second last character of tour name is a space) singleDisplay = isSingleRandomTour(); tourDB.open(); Cursor c = tourDB.getRecordByTour(GTConstants.tourName); if (c != null && c.moveToFirst()) { tourtagsScanned = refreshtourtagList(c.getCount(), false, true, false, false); tourtagsIncluded = refreshtourtagList(c.getCount(), false, false, true, false); tourOrder = gettourOrder(c.getCount()); //initialize the message array which wil be used to display the messages in the random order while (messageList.size() < c.getCount()) messageList.add(""); for (i = 0; i < c.getCount(); i++) { if (tourtagsScanned.get(i) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#00FF00'>" + c.getString(2) + "</font><br/>"); else if (!tourtagsScanned.get(i) && !Utility.istourOntime(tourEnd) && Utility.getcurrentState().equals(GTConstants.onShift) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#FF0000'>" + c.getString(2) + "</font><br/>"); else if (!tourtagsScanned.get(i) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#FFFFFF'>" + c.getString(2) + "</font><br/>"); else if (singleDisplay && i == touritemNumber) messageList.add(tourOrder.get(i), "<br><font color='#FFFFFF'>" + c.getString(2) + "</font><br/>"); //get the number of tags included if (tourtagsIncluded.get(i)) tagCount++; c.moveToNext(); } } tourDB.close(); //create the message string for (i = 0; i < messageList.size(); i++) if (messageList.get(i).length() > 1) message = message + messageList.get(i); LayoutInflater inflater = LayoutInflater.from(HomeScreen.this); View view = inflater.inflate(R.layout.scroll_dialog, null); TextView textview = (TextView) view.findViewById(R.id.dialogtext); textview.setText(Html.fromHtml(message)); AlertDialog.Builder alertDialog = new AlertDialog.Builder(HomeScreen.this); //create custom title TextView title = new TextView(HomeScreen.this); //if this is a single display tour then do not indicate how many tags are in the tour if (isSingleRandomTour()) //this is a single display tour title.setText(GTConstants.tourName + CRLF + tourTime + CRLF); else title.setText(GTConstants.tourName + CRLF + tourTime + CRLF + String.valueOf(tagCount) + " Tags"); title.setPadding(10, 10, 10, 10); title.setGravity(Gravity.CENTER); title.setTextColor(Color.parseColor("#79ABFF")); title.setTextSize(20); alertDialog.setCustomTitle(title); //alertDialog.setTitle(tourName + CRLF + String.valueOf(i-1) + " Tags"); alertDialog.setView(view); alertDialog.setPositiveButton("OK", null); AlertDialog alert = alertDialog.create(); alert.show(); }
From source file:com.android.vending.billing.InAppBillingService.LACK.listAppsFragment.java
public void contextcreateapk() { ArrayList localArrayList = new ArrayList(); if (pli.custom) { localArrayList.add(Integer.valueOf(2131165385)); }//ww w . j ava 2 s. co m localArrayList.add(Integer.valueOf(2131165386)); localArrayList.add(Integer.valueOf(2131165384)); localArrayList.add(Integer.valueOf(2131165389)); localArrayList.add(Integer.valueOf(2131165263)); menu_adapt = new ArrayAdapter(getContext(), 2130968623, localArrayList) { public View getView(int paramAnonymousInt, View paramAnonymousView, ViewGroup paramAnonymousViewGroup) { Object localObject = paramAnonymousView; paramAnonymousView = (View) localObject; if (localObject == null) { paramAnonymousView = ((LayoutInflater) listAppsFragment.getInstance() .getSystemService("layout_inflater")).inflate(2130968623, paramAnonymousViewGroup, false); } paramAnonymousViewGroup = (TextView) paramAnonymousView.findViewById(2131558462); localObject = (ImageView) paramAnonymousView.findViewById(2131558461); ((ImageView) localObject).setImageDrawable(null); paramAnonymousViewGroup.setTextAppearance(getContext(), listAppsFragment.getSizeText()); paramAnonymousViewGroup.setTextColor(-1); for (;;) { try { int i = ((Integer) getItem(paramAnonymousInt)).intValue(); switch (i) { } } catch (OutOfMemoryError localOutOfMemoryError) { localOutOfMemoryError.printStackTrace(); System.gc(); continue; localOutOfMemoryError.setImageDrawable(listAppsFragment.getRes().getDrawable(2130837536)); localOutOfMemoryError.setColorFilter(Color.parseColor("#66cc66"), PorterDuff.Mode.MULTIPLY); paramAnonymousViewGroup.setTextColor(Color.parseColor("#66cc66")); continue; } catch (Exception localException) { localException.printStackTrace(); continue; localException.setImageDrawable(listAppsFragment.getRes().getDrawable(2130837530)); localException.setColorFilter(Color.parseColor("#99cccc"), PorterDuff.Mode.MULTIPLY); paramAnonymousViewGroup.setTextColor(Color.parseColor("#99cccc")); continue; localException.setImageDrawable(listAppsFragment.getRes().getDrawable(2130837536)); localException.setColorFilter(Color.parseColor("#66cc66"), PorterDuff.Mode.MULTIPLY); paramAnonymousViewGroup.setTextColor(Color.parseColor("#66cc66")); continue; localException.setImageDrawable(listAppsFragment.getRes().getDrawable(2130837540)); localException.setColorFilter(Color.parseColor("#cc99cc"), PorterDuff.Mode.MULTIPLY); paramAnonymousViewGroup.setTextColor(Color.parseColor("#cc99cc")); continue; } paramAnonymousViewGroup.setCompoundDrawablePadding( (int) (5.0F * listAppsFragment.getRes().getDisplayMetrics().density + 0.5F)); paramAnonymousViewGroup .setText(Utils.getText(((Integer) getItem(paramAnonymousInt)).intValue())); paramAnonymousViewGroup.setTypeface(null, 1); return paramAnonymousView; ((ImageView) localObject).setImageDrawable(listAppsFragment.getRes().getDrawable(2130837534)); ((ImageView) localObject).setColorFilter(Color.parseColor("#ffff99"), PorterDuff.Mode.MULTIPLY); paramAnonymousViewGroup.setTextColor(Color.parseColor("#ffff99")); } } }; }
From source file:com.android.vending.billing.InAppBillingService.LACK.listAppsFragment.java
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) { System.out.println("View created"); if (su) {//from ww w . jav a2s .c o m } for (paramLayoutInflater = paramLayoutInflater.inflate(2130968629, paramViewGroup);; paramLayoutInflater = paramLayoutInflater.inflate(2130968630, paramViewGroup)) { lv = (ExpandableListView) paramLayoutInflater.findViewById(2131558620); menu_lv = (ExpandableListView) paramLayoutInflater.findViewById(2131558613); paramViewGroup = (HorizontalScrollView) paramLayoutInflater.findViewById(2131558621); paramBundle = (Button) paramViewGroup.findViewById(2131558622); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558623); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558479); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558624); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramBundle = (Button) paramViewGroup.findViewById(2131558625); if (paramBundle != null) { paramBundle.setTextAppearance(getContext(), getSizeText()); paramBundle.setTextColor(Color.parseColor("#999999")); } paramViewGroup = (Button) paramViewGroup.findViewById(2131558626); if (paramViewGroup != null) { paramViewGroup.setTextAppearance(getContext(), getSizeText()); paramViewGroup.setTextColor(Color.parseColor("#999999")); } if (getOldPackageName() == null) { if (data != null) { break; } sqlScan = true; paramViewGroup = new Thread(new AppScanning()); paramViewGroup.setPriority(10); paramViewGroup.start(); } return paramLayoutInflater; } populateAdapter(data, getSortPref()); return paramLayoutInflater; }