List of usage examples for android.graphics Color rgb
@ColorInt public static int rgb(float red, float green, float blue)
From source file:com.bookkos.bircle.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); _context = getApplicationContext();/*from w w w . j a v a2 s.c o m*/ _activity = this; currentTime = new Time("Asia/Tokyo"); // exceptionHandler = new ExceptionHandler(_context); // Thread.setDefaultUncaughtExceptionHandler(exceptionHandler); // sharedPreference???, user_id?group_id?registration_id?? getUserData(); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // ?? WindowManager window_manager = getWindowManager(); Display display = window_manager.getDefaultDisplay(); Point point = new Point(); display.getSize(point); displayWidth = point.x; displayHeight = point.y; displayInch = getInch(); // ??4??????? textSize = 17 * (displayInch / 4); actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_USE_LOGO); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); String title_text = ""; subGroupText = ""; groupText = groupName; if (displayInch < 4.7) { title_text = "<small><small><small>??: </small></small></small>"; resizeTitleSizeTooSmall(); } else if (displayInch >= 4.7 && displayInch < 5.5) { title_text = "<small><small>??: </small></small>"; resizeTitleSizeSmall(); } else if (displayInch >= 5.5 && displayInch < 6.5) { title_text = "<small>??: </small>"; resizeTitleSizeMiddle(); } else if (displayInch >= 6.5 && displayInch < 8) { title_text = "<small>??: </small>"; resizeTitleSizeLarge(); } else { title_text = "??: "; } String modify_group_text = title_text + "<font color=#FF0000>" + groupName + "</font>"; actionBar.setTitle(Html.fromHtml(modify_group_text)); Resources resources = _context.getResources(); int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); titleBarHeight = resources.getDimensionPixelSize(resourceId); setContentView(R.layout.capture); returnBorrowHelpView = (ImageView) findViewById(R.id.return_borrow_help_view); returnBorrowHelpView.setImageResource(R.drawable.return_borrow_help); returnBorrowHelpView.setTranslationY(displayHeight / 5 + titleBarHeight); returnBorrowHelpView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight / 5 + titleBarHeight, Gravity.BOTTOM | Gravity.CENTER)); registHelpView = (ImageView) findViewById(R.id.regist_help_view); registHelpView.setImageResource(R.drawable.regist_help); registHelpView.setTranslationY(displayHeight / 5 + titleBarHeight); registHelpView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight / 5 + titleBarHeight, Gravity.BOTTOM | Gravity.CENTER)); registHelpView.setVisibility(View.GONE); leftDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); leftDrawer = (ListView) findViewById(R.id.left_drawer); textView = (TextView) findViewById(R.id.textView); modeText = (TextView) findViewById(R.id.mode_text); modeText.setTextColor(Color.rgb(56, 234, 123)); modeText.setTextSize(textSize); modeText.setTypeface(Typeface.SERIF.MONOSPACE, Typeface.BOLD); strokeColor = Color.rgb(56, 234, 123); borrowReturnButton = (Button) findViewById(R.id.borrowReturnButton); registButton = (Button) findViewById(R.id.registButton); returnHistoryButton = (Button) findViewById(R.id.return_history_button); helpViewButton = (Button) findViewById(R.id.help_view_button); registSelectShelfRelativeLayout = (RelativeLayout) findViewById(R.id.regist_select_shelf_relative_layout); textViewLinearLayout = (LinearLayout) findViewById(R.id.text_view_linear_layout); buttonLinearLayout = (LinearLayout) findViewById(R.id.button_linear_layout); listViewLinearLayout = (LinearLayout) findViewById(R.id.list_view_linear_layout); decisionButton = (Button) findViewById(R.id.decision_button); cancelButton = (Button) findViewById(R.id.cancel_button); shelfListView = (ListView) findViewById(R.id.shelf_list_view); tempTextView = (TextView) findViewById(R.id.temp_text_view); // bookListViewAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); bookListViewAdapter = new BookListViewAdapter(_context, R.layout.book_list_row, this); bookRegistRelativeLayout = (RelativeLayout) findViewById(R.id.book_regist_relative_layout); bookRegistLinearLayout = (LinearLayout) findViewById(R.id.book_regist_linear_layout); bookRegistListViewLinearLayout = (LinearLayout) findViewById(R.id.book_regist_list_view_linear_layout); bookRegistListView = (ListView) findViewById(R.id.book_regist_list_view); bookRegistTextView = (TextView) findViewById(R.id.book_regist_text_view); bookRegistCancelButton = (Button) findViewById(R.id.book_regist_cancel_button); registFlag = 0; int borrowReturnButton_width = displayWidth / 5 * 2; int borrowReturnButton_height = displayHeight / 10; int borrowReturnButton_x = ((displayWidth / 2) - borrowReturnButton_width) / 2; int borrowReturnButton_y = displayHeight / 2 + titleBarHeight; borrowReturnButton.setTranslationX(borrowReturnButton_x); borrowReturnButton.setTranslationY(borrowReturnButton_y); borrowReturnButton .setLayoutParams(new FrameLayout.LayoutParams(borrowReturnButton_width, borrowReturnButton_height)); borrowReturnButton.setBackgroundColor(Color.rgb(56, 234, 123)); borrowReturnButton.setText("??\n"); borrowReturnButton.setTextSize(textSize * 7 / 10); borrowReturnButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { arrayList.clear(); registFlag = 0; borrowReturnButton.setText("??\n"); borrowReturnButton.setEnabled(false); borrowReturnButton.setTextColor(Color.WHITE); borrowReturnButton.setBackgroundColor(Color.rgb(56, 234, 123)); registButton.setText("?\n??"); registButton.setEnabled(true); registButton.setTextColor(Color.GRAY); registButton.setBackgroundColor(Color.argb(170, 21, 38, 45)); modeText.setText("??"); modeText.setTextColor(Color.rgb(56, 234, 123)); returnBorrowHelpView.setVisibility(View.VISIBLE); registHelpView.setVisibility(View.GONE); strokeColor = Color.rgb(56, 234, 123); } }); int registButton_width = displayWidth / 5 * 2; int registButton_height = displayHeight / 10; int registButton_x = (displayWidth / 2) + ((displayWidth / 2) - registButton_width) / 2; int registButton_y = displayHeight / 2 + titleBarHeight; registButton.setTranslationX(registButton_x); registButton.setTranslationY(registButton_y); registButton.setLayoutParams(new FrameLayout.LayoutParams(registButton_width, registButton_height)); registButton.setBackgroundColor(Color.argb(170, 21, 38, 45)); registButton.setTextColor(Color.GRAY); registButton.setTextSize(textSize * 7 / 10); registButton.setText("?\n??"); registButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { arrayList.clear(); registFlag = 1; borrowReturnButton.setText("??\n??"); borrowReturnButton.setEnabled(true); borrowReturnButton.setTextColor(Color.GRAY); borrowReturnButton.setBackgroundColor(Color.argb(170, 9, 54, 16)); registButton.setText("?\n"); registButton.setEnabled(false); registButton.setTextColor(Color.WHITE); registButton.setBackgroundColor(Color.rgb(62, 162, 229)); modeText.setText("?"); modeText.setTextColor(Color.rgb(62, 162, 229)); returnBorrowHelpView.setVisibility(View.GONE); registHelpView.setVisibility(View.VISIBLE); strokeColor = Color.rgb(62, 162, 229); } }); returnHistoryButton.setText("????"); returnHistoryButton.setTextSize(textSize * 7 / 10); returnHistoryButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { leftDrawerLayout.openDrawer(Gravity.RIGHT); // animateTranslationY(bookRegistRelativeLayout, displayHeight, displayHeight - displayHeight / 4 - titleBarHeight); } }); getReturnHistory(); getCurrentTime(); setHelpView(); setScanUnregisterBookView(); setBookRegistView(); arrayList = new ArrayList<String>(); tempRegistIsbn = ""; initBookRegistUrl = book_register_url + "?user_id=" + userId + "&group_id=" + groupId; initLendRegistUrl = lend_register_url + "?user_id=" + userId + "&group_id=" + groupId; initTemporaryLendRegistUrl = temporary_lend_register_url + "?user_id=" + userId + "&group_id=" + groupId; initCatalogRegistUrl = catalog_register_url + "?group_id=" + groupId + "&book_code="; initManuallyCatalogRegistUrl = manually_catalog_register_url + "?group_id=" + groupId + "&book_code="; getStatusUrl = get_status_url + "?group_id=" + groupId + "&user_id=" + userId; hasSurface = false; inactivityTimer = new InactivityTimer(this); bircleBeepManager = new BircleBeepManager(this); ambientLightManager = new AmbientLightManager(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); toastText = ""; }
From source file:com.astir_trotter.atcustom.ui.iconics.core.IconicsDrawable.java
/** * Set contour color for the./*from w ww. j ava 2 s.c om*/ * * @param contourColor * @return The current IconExtDrawable for chaining. */ public IconicsDrawable contourColor(@ColorInt int contourColor) { int red = Color.red(contourColor); int green = Color.green(contourColor); int blue = Color.blue(contourColor); mContourPaint.setColor(Color.rgb(red, green, blue)); mContourPaint.setAlpha(Color.alpha(contourColor)); mContourColor = contourColor; invalidateSelf(); return this; }
From source file:org.otempo.view.StationActivity.java
/** * Devuelve un TextView con el nombre de un da para poner sobre las predicciones *//* w ww . ja v a 2 s . c o m*/ private TextView getDayName(Calendar date) { TextView dayName = new TextView(this); if (date != null) { dayName.setText(DateUtils.weekDayFormat.format(date.getTime())); } else { dayName.setText("???"); } dayName.setGravity(Gravity.CENTER_HORIZONTAL); if (_background.equals("black")) { dayName.setTextColor(Color.rgb(255, 255, 255)); } else { dayName.setTextColor(Color.rgb(0, 0, 0)); } return dayName; }
From source file:android.support.v7.graphics.ColorCutQuantizer.java
/** * Quantized RGB888 values to have a word width of {@value #QUANTIZE_WORD_WIDTH}. *///from w ww . j ava 2s .c o m private static int approximateToRgb888(int r, int g, int b) { return Color.rgb(modifyWordWidth(r, QUANTIZE_WORD_WIDTH, 8), modifyWordWidth(g, QUANTIZE_WORD_WIDTH, 8), modifyWordWidth(b, QUANTIZE_WORD_WIDTH, 8)); }
From source file:com.spoiledmilk.ibikecph.LeftMenu.java
@SuppressWarnings("deprecation") public void updateControls() { LOG.d("LeftMenu updateControls"); if (!IbikeApplication.isUserLogedIn()) { favoritesContainer.setBackgroundDrawable(null); textFavoriteHint.setTextColor(getHintDisabledTextColor()); textNewFavorite.setTextColor(Color.rgb(60, 60, 60)); imgAdd.setImageResource(R.drawable.fav_plus_none); favoritesList.setAdapter(null);//from ww w . j a va2 s .c om RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, Util.dp2px(150)); favoritesContainerHeight = Util.dp2px(150); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.BELOW, favoritesHeaderContainer.getId()); favoritesContainer.setLayoutParams(params); addContainer.setPadding((int) (Util.getScreenWidth() / 7 + Util.dp2px(7)), (int) Util.dp2px(5), 0, (int) Util.dp2px(34)); // getView().findViewById(R.id.imgRightArrow).setVisibility(View.INVISIBLE); textFavoriteHint.setVisibility(View.VISIBLE); btnEditFavorites.setVisibility(View.INVISIBLE); btnEditFavorites.setEnabled(false); lastListDivider.setVisibility(View.GONE); params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.topMargin = Util.dp2px(3); // imgAdd.setLayoutParams(params); textNewFavorite.setPadding(Util.dp2px(0), 0, 0, Util.dp2px(0)); params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.bottomMargin = Util.getDensity() >= 2 ? Util.dp2px(40) : Util.dp2px(20); addContainer.setLayoutParams(params); addContainer.setPadding(Util.getDensity() >= 2 ? Util.dp2px(60) : Util.dp2px(40), Util.dp2px(7), 0, Util.dp2px(7)); addContainer.setBackgroundColor(Color.TRANSPARENT); addContainer.setClickable(false); } else if (favorites == null || favorites.size() == 0) { favoritesContainer.setBackgroundResource(R.drawable.add_fav_background_selector); addContainer.setBackgroundColor(Color.TRANSPARENT);// addContainer.setBackgroundResource(R.drawable.add_fav_background_selector); lastListDivider.setVisibility(View.GONE); favoritesList.setVisibility(View.GONE); textFavoriteHint.setVisibility(View.VISIBLE); // getView().findViewById(R.id.imgRightArrow).setVisibility(View.VISIBLE); favoritesContainer.setClickable(true); imgAdd.setImageResource(R.drawable.fav_add); textFavoriteHint.setTextColor(getHintEnabledTextColor()); textNewFavorite.setTextColor(getAddFavoriteTextColor()); btnEditFavorites.setVisibility(View.INVISIBLE); btnEditFavorites.setEnabled(false); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, Util.dp2px(150)); favoritesContainerHeight = Util.dp2px(150); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.BELOW, getView().findViewById(R.id.favoritesHeaderContainer).getId()); favoritesContainer.setLayoutParams(params); addContainer.setPadding((int) (Util.getScreenWidth() / 7 + Util.dp2px(7)), (int) Util.dp2px(5), 0, (int) Util.dp2px(34)); params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); params.topMargin = Util.dp2px(3); // imgAdd.setLayoutParams(params); textNewFavorite.setPadding(0, 0, 0, 0); params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.bottomMargin = Util.getDensity() >= 2 ? Util.dp2px(40) : Util.dp2px(20); addContainer.setLayoutParams(params); addContainer.setPadding(Util.getDensity() >= 2 ? Util.dp2px(0) : Util.dp2px(10), Util.dp2px(7), 0, Util.dp2px(7)); addContainer.setClickable(false); } else { // Loged in, and there is a list of favorites favoritesList.clearAnimations(); favoritesList.setVisibility(View.VISIBLE); if (listAdapter != null) { ((FavoritesAdapter) listAdapter).setIsEditMode(isEditMode); btnEditFavorites.setVisibility(isEditMode ? View.INVISIBLE : View.VISIBLE); btnEditFavorites.setEnabled(!isEditMode); btnDone.setVisibility(isEditMode ? View.VISIBLE : View.INVISIBLE); btnDone.setEnabled(isEditMode); } textFavoriteHint.setVisibility(View.GONE); if (getView() != null) { addContainer.setVisibility(isEditMode ? View.GONE : View.VISIBLE); // getView().findViewById(R.id.imgRightArrow).setVisibility(View.GONE); getView().findViewById(R.id.favoritesContainer).setClickable(false); int count = favorites.size(); int listHeight = count * (menuItemHeight) + Util.dp2px(1) * count; int viewHeight = (int) (Util.getScreenHeight() - Util.dp2px(26)); // // screen height without the // notifications bar int avaliableHeight = viewHeight - (menuItemHeight * (getMenuItemsCount() + (isEditMode ? 0 : 1))) - (getMenuItemsCount() * dividerHeight); LOG.d("available height = " + avaliableHeight); LOG.d("list height = " + listHeight); if (listHeight > avaliableHeight) { listHeight = avaliableHeight; } RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, (isEditMode ? listHeight : (listHeight + menuItemHeight))); favoritesContainerHeight = (isEditMode ? listHeight : (listHeight + menuItemHeight)); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.BELOW, getView().findViewById(R.id.horizontalDivider1).getId()); favoritesContainer.setLayoutParams(params); params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, listHeight); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); getView().findViewById(R.id.favoritesListContainer).setLayoutParams(params); imgAdd.setImageResource(R.drawable.fav_add); textFavoriteHint.setTextColor(Color.WHITE); textNewFavorite.setTextColor(getAddFavoriteTextColor()); lastListDivider.setVisibility( (isEditMode || favorites.size() <= getFavoritesVisibleItemCount()) ? View.GONE : View.VISIBLE); updateFavoritesContainer(); addContainer.setPadding((int) Util.dp2px(30), (int) Util.dp2px(0), 0, (int) Util.dp2px(0)); params = new RelativeLayout.LayoutParams(Util.dp2px(14), Util.dp2px(14)); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.CENTER_VERTICAL); params.bottomMargin = Util.dp2px(0); // imgAdd.setLayoutParams(params); params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, menuItemHeight); params.addRule(RelativeLayout.BELOW, getView().findViewById(R.id.favoritesListContainer).getId()); if (!isEditMode) { addContainer.setLayoutParams(params); } addContainer.setBackgroundResource(R.drawable.add_fav_background_selector); addContainer.setClickable(true); textNewFavorite.setPadding(Util.dp2px(4), 0, 0, 0); ((FavoritesAdapter) listAdapter).notifyDataSetChanged(); } } }
From source file:com.ksharkapps.musicnow.ui.activities.AudioPlayerActivity.java
private int getBackgroundColor(Bitmap imagen) { long reds = 0L; long greens = 0L; long blues = 0L; int[] pixeles = new int[imagen.getWidth() * imagen.getHeight()]; imagen.getPixels(pixeles, 0, imagen.getWidth(), 0, 0, imagen.getWidth(), imagen.getHeight()); for (int cursor = 0; cursor < pixeles.length; cursor++) { reds += Color.red(pixeles[cursor]); greens += Color.green(pixeles[cursor]); blues += Color.blue(pixeles[cursor]); }/* ww w . ja va 2 s . com*/ long numPixels = imagen.getWidth() * imagen.getHeight(); reds /= numPixels; greens /= numPixels; blues /= numPixels; Punto3D[] pixelesRef = { new Punto3D(255, 0, 0), new Punto3D(0, 255, 0), new Punto3D(0, 0, 255), new Punto3D(255, 255, 0), new Punto3D(0, 255, 255), new Punto3D(255, 0, 255), new Punto3D(0, 0, 0), new Punto3D(255, 255, 255) }; Punto3D pixelActual = new Punto3D(reds, greens, blues); double[] distancias = { pixelActual.distancia(pixelesRef[0]), pixelActual.distancia(pixelesRef[1]), pixelActual.distancia(pixelesRef[2]), pixelActual.distancia(pixelesRef[3]), pixelActual.distancia(pixelesRef[4]), pixelActual.distancia(pixelesRef[5]), pixelActual.distancia(pixelesRef[6]), pixelActual.distancia(pixelesRef[7]) }; String[] colors = { "Red", "Green", "Blue", "Yellow", "Cyan ", "Magenta", " Black ", "White" }; double dist_minima = 255; int indice_minima = 0; for (int index = 0; index < distancias.length; index++) { if (distancias[index] <= dist_minima) { indice_minima = index; dist_minima = distancias[index]; } Log.i("Distancias", "Distancias en pos " + index + ": " + distancias[index]); } return Color.rgb((int) pixelesRef[indice_minima].getX(), (int) pixelesRef[indice_minima].getY(), (int) pixelesRef[indice_minima].getZ()); }
From source file:com.example.amand.mobileprogrammingfitnessapp.LoggedActivity.java
public void loadpreferences(String currentuser) { // this involves to see whenever the user's preference file exista File f = new File("/data/data/" + getPackageName() + "/shared_prefs/" + currentuser + ".xml"); //if the preference file exists, the preferences will be recieved. if (f.exists()) { Toast.makeText(getApplicationContext(), "Loaded user's current preference", Toast.LENGTH_LONG).show(); //the preferences are loaded, the preference will be loaded, is essentially the name of the // users username SharedPreferences preferences = getSharedPreferences(currentuser, Context.MODE_PRIVATE); // Colours are obtained from the preferences, if it is unable to be obtained, a default value // of zero is given int red = preferences.getInt("Red", 0); int green = preferences.getInt("Green", 0); int blue = preferences.getInt("Blue", 0); // the naviagtion background is also obtained. String backgroundd = preferences.getString("background", "background"); int header = getApplicationContext().getResources().getIdentifier(backgroundd, "drawable", getPackageName());//from ww w . j a va 2s. c o m frame.setBackgroundColor(Color.rgb(red, green, blue)); window = this.getWindow(); window.setStatusBarColor(Color.rgb(red, green, blue)); toolbar.setBackgroundColor(Color.rgb(red, green, blue)); naviagtionbackground.setBackgroundResource(header); // sets the users details bassed on preferences } // this method is not being used and involves decoding objects that are stored in the users database // byte[] perference = new byte[100]; // objectDdecode = database.loadPreferenes(currentuser); // ByteArrayInputStream inputStream = new ByteArrayInputStream(objectDdecode); // Toast.makeText(getApplicationContext(),objectDdecode.toString(),Toast.LENGTH_LONG).show(); ////perference = database.loadPreferenes(currentuser); // SharedPreferences preference = getSharedPreferences("userdesign",Context.MODE_PRIVATE); // // // String aman = preference.getString("red",""); // Toast.makeText(getApplicationContext(),aman,Toast.LENGTH_LONG).show(); // // ObjectInputStream inputStream1 = null; // try { // inputStream1 = new ObjectInputStream(inputStream); // o = inputStream1.readObject(); // // } catch (IOException e) { // e.printStackTrace(); // } catch (ClassNotFoundException e) { // e.printStackTrace(); // } // SharedPreferences demo = (SharedPreferences) o ; // demo = getPreferences(Context.MODE_PRIVATE); // // Toast.makeText(getApplicationContext(),demo.toString(),Toast.LENGTH_LONG).show(); // // Toast.makeText(getApplicationContext(),"got your preference" ,Toast.LENGTH_LONG).show(); }
From source file:es.upv.riromu.arbre.main.MainActivity.java
private void rangeSeekBarChanged(int minValue, int maxValue) { {//from w w w .jav a 2s . com TextView imc = (TextView) findViewById(R.id.textView); imc.setVisibility(View.VISIBLE); ImageButton cropButton = (ImageButton) findViewById(R.id.button_crop); cropButton.setVisibility(View.GONE); ImageButton sendButton = (ImageButton) findViewById(R.id.button_send); sendButton.setVisibility(View.VISIBLE); ImageButton histButton = (ImageButton) findViewById(R.id.button_histogram); histButton.setVisibility(View.VISIBLE); ImageButton revertButton = (ImageButton) findViewById(R.id.button_revert); revertButton.setVisibility(View.VISIBLE); ImageView imagePalette = (ImageView) findViewById(R.id.palette); imagePalette.setVisibility(View.GONE); ImageWrapper imw = new ImageWrapper(); if (image_uri == null) image = Util.decodeSampledBitmapFromResource(getResources(), R.drawable.platanus_hispanica, MAX_SIZE, MAX_SIZE); if (image_uri != null) image = Util.decodeSampledBitmapFromUri(image_uri, MAX_SIZE, MAX_SIZE, this); // handle changed range values try { Log.i(TAG, "User selected new range values: MIN=" + minValue + ", MAX=" + maxValue); ImageView imv = (ImageView) findViewById(R.id.image_intro); if (state[CROP_IMAGE]) imw.setBitmap(croppedimage); else imw.setBitmap(image); imw.setMinV(minValue); imw.setMaxV(maxValue); ProcessImageTask pit = new ProcessImageTask(); imw = (ImageWrapper) pit.execute(imw).get(); treatedimage = imw.getBitmap(); imv.setImageBitmap(treatedimage); histogram = imw.getHistogram(); histograma = imw.getHist(); mascara = imw.getMask(); imc.setBackgroundColor( Color.rgb(imw.getR().intValue(), imw.getG().intValue(), imw.getB().intValue())); state[TREAT_IMAGE] = true; } catch (Exception e) { Log.e(TAG, "Error " + e.getMessage()); } } }
From source file:com.initiativaromania.hartabanilorpublici.IRUserInterface.activities.MainActivity.java
/** * Manipulates the map once available.//from w ww . j a v a 2s . c om * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { System.out.println("Map ready"); mMap = googleMap; // Add a marker in Bucharest and move the camera LatLng bucharest = new LatLng(44.435503, 26.102513); circle = mMap.addCircle(new CircleOptions().center(bucharest).radius(CIRCLE_DEFAULT_RADIUS) .fillColor(Color.argb(CIRCLE_ALPHA, DEFAULT_COLOR_RED, DEFAULT_COLOR_GREEN, DEFAULT_COLOR_BLUE)) .strokeColor(Color.rgb(DEFAULT_COLOR_RED, DEFAULT_COLOR_GREEN, DEFAULT_COLOR_BLUE)) .strokeWidth(CIRCLE_MARGIN)); seekBarListener.setCircle(circle); currentPos = mMap.addMarker(new MarkerOptions().position(bucharest).title("Locatia ta")); mMap.moveCamera(CameraUpdateFactory.newLatLng(bucharest)); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(bucharest, MAP_DEFAULT_ZOOM)); /* Initialize GPS location */ this.locationListener = IRLocationListener.getLocationManager(this); /* Init data from server */ initData(); }
From source file:com.coderdojo.libretalk.MainActivity.java
private final void printMsg(final LibretalkMessageData message) { ArrayAdapter<SpannableString> adapter = new ArrayAdapter<SpannableString>(this, android.R.layout.simple_list_item_1, mMessageListArray); ListView listView = (ListView) findViewById(R.id.message_list); listView.setAdapter(adapter);/*from www . j av a 2 s .c o m*/ listView.setStackFromBottom(true); final String sourceMessage = message.getSenderTag() + ": " + message.getData(); final SpannableString formattedText = new SpannableString(sourceMessage); if (message.getData().startsWith(">")) { formattedText.setSpan( new ForegroundColorSpan(LibretalkMessageData.getColorFromString(message.getSenderTag())), sourceMessage.indexOf(message.getSenderTag()), sourceMessage.indexOf(message.getSenderTag()) + message.getSenderTag().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); formattedText.setSpan(new ForegroundColorSpan(Color.rgb(120, 153, 34)), sourceMessage.indexOf(message.getData()), sourceMessage.indexOf(message.getData()) + message.getData().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } else { formattedText.setSpan( new ForegroundColorSpan(LibretalkMessageData.getColorFromString(message.getSenderTag())), sourceMessage.indexOf(message.getSenderTag()), sourceMessage.indexOf(message.getSenderTag()) + message.getSenderTag().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } mMessageListArray.add(formattedText); adapter.notifyDataSetChanged(); }