List of usage examples for android.graphics Color GRAY
int GRAY
To view the source code for android.graphics Color GRAY.
Click Source Link
From source file:com.javielinux.fragments.MyActivityFragment.java
public void showDialogSamples() { final boolean[] samplesChecked = new boolean[] { false, false, false, false, false, false, false, false, false, false, false, false }; final CheckBox cb = new CheckBox(getActivity()); cb.setText(R.string.samples_search_lang); cb.setTextColor(Color.GRAY); AlertDialog builder = new AlertDialog.Builder(getActivity()).setTitle(R.string.samples_search).setView(cb) .setMultiChoiceItems(/*from ww w .j ava2 s. c o m*/ R.array.actions_samples_search, new boolean[] { false, false, false, false, false, false, false, false, false, false, false, false }, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { samplesChecked[whichButton] = isChecked; } }) .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String[] names = getResources().getStringArray(R.array.actions_samples_search); String lang = ""; if (cb.isChecked()) { String[] langs = getResources().getStringArray(R.array.languages_values); for (int l = 0; l < langs.length; l++) { if (langs[l].equals(Locale.getDefault().getLanguage())) { lang = Locale.getDefault().getLanguage(); } } } for (int i = 0; i < samplesChecked.length; i++) { if (samplesChecked[i]) { Entity ent = new Entity("search"); ent.setValue("name", names[i]); ent.setValue("date_create", Utils.now()); ent.setValue("last_modified", Utils.now()); ent.setValue("use_count", 0); if (i == 0) { ent.setValue("lang", lang); ent.setValue("words_and", "android"); ent.setValue("icon_id", 2); ent.setValue("icon_big", "drawable/icon_android"); ent.setValue("icon_small", "drawable/icon_android_small"); } else if (i == 1) { ent.setValue("lang", lang); ent.setValue("words_and", "android"); ent.setValue("words_or", "juego juegos videojuegos videjuego game games"); ent.setValue("icon_id", 2); ent.setValue("icon_big", "drawable/icon_android"); ent.setValue("icon_small", "drawable/icon_android_small"); } else if (i == 2) { ent.setValue("lang", lang); ent.setValue("words_and", "android"); ent.setValue("words_or", "app aplicacion aplication"); ent.setValue("icon_id", 2); ent.setValue("icon_big", "drawable/icon_android"); ent.setValue("icon_small", "drawable/icon_android_small"); } else if (i == 3) { ent.setValue("words_and", "tilt shift"); ent.setValue("filter", 2); ent.setValue("icon_id", 17); ent.setValue("icon_big", "drawable/icon_photo"); ent.setValue("icon_small", "drawable/icon_photo_small"); } else if (i == 4) { ent.setValue("words_and", "hdr"); ent.setValue("filter", 2); ent.setValue("icon_id", 18); ent.setValue("icon_big", "drawable/icon_photo2"); ent.setValue("icon_small", "drawable/icon_photo2_small"); } else if (i == 5) { ent.setValue("lang", lang); ent.setValue("words_and", "true blood"); ent.setValue("icon_id", 1); ent.setValue("icon_big", "drawable/letter_t"); ent.setValue("icon_small", "drawable/letter_t_small"); } else if (i == 6) { ent.setValue("lang", lang); ent.setValue("words_and", "walking dead"); ent.setValue("icon_id", 1); ent.setValue("icon_big", "drawable/letter_w"); ent.setValue("icon_small", "drawable/letter_w_small"); } else if (i == 7) { ent.setValue("words_and", "4 8 15 16 23 42"); ent.setValue("icon_id", 1); ent.setValue("icon_big", "drawable/letter_n"); ent.setValue("icon_small", "drawable/letter_n_small"); } else if (i == 8) { ent.setValue("lang", lang); ent.setValue("words_or", "geek \"humor geek\""); ent.setValue("filter", 5); ent.setValue("icon_id", 14); ent.setValue("icon_big", "drawable/icon_news"); ent.setValue("icon_small", "drawable/icon_news_small"); } else if (i == 9) { ent.setValue("lang", lang); ent.setValue("words_or", "receta recipe"); ent.setValue("filter", 5); ent.setValue("icon_id", 14); ent.setValue("icon_big", "drawable/icon_news"); ent.setValue("icon_small", "drawable/icon_news_small"); } else if (i == 10) { ent.setValue("words_and", "slow motion"); ent.setValue("filter", 3); ent.setValue("icon_id", 3); ent.setValue("icon_big", "drawable/icon_cinema"); ent.setValue("icon_small", "drawable/icon_cinema_small"); } else if (i == 11) { ent.setValue("words_and", "stop motion"); ent.setValue("filter", 3); ent.setValue("icon_id", 4); ent.setValue("icon_big", "drawable/icon_cinema2"); ent.setValue("icon_small", "drawable/icon_cinema2_small"); } ent.save(); } } fillData(); } }).setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).create(); builder.show(); }
From source file:com.battlelancer.seriesguide.ui.OverviewFragment.java
private void onPopulateShowData(Cursor show) { if (show == null || !show.moveToFirst()) { return;//from w ww.ja v a 2s . c o m } mShowCursor = show; // set show title in action bar mShowTitle = show.getString(ShowQuery.SHOW_TITLE); ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); actionBar.setTitle(mShowTitle); // status final TextView statusText = (TextView) getView().findViewById(R.id.showStatus); int status = show.getInt(ShowQuery.SHOW_STATUS); if (status == 1) { statusText.setTextColor(getResources().getColor( Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.textColorSgGreen))); statusText.setText(getString(R.string.show_isalive)); } else if (status == 0) { statusText.setTextColor(Color.GRAY); statusText.setText(getString(R.string.show_isnotalive)); } // favorite final ImageView favorited = (ImageView) getView().findViewById(R.id.imageViewFavorite); boolean isFavorited = show.getInt(ShowQuery.SHOW_FAVORITE) == 1; if (isFavorited) { favorited.setImageResource( Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.drawableStar)); } else { favorited.setImageResource( Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.drawableStar0)); } CheatSheet.setup(favorited, isFavorited ? R.string.context_unfavorite : R.string.context_favorite); favorited.setTag(isFavorited); // poster background Utils.loadPosterBackground(getActivity(), mBackgroundImage, show.getString(ShowQuery.SHOW_POSTER)); // air time and network final StringBuilder timeAndNetwork = new StringBuilder(); final long releaseTime = show.getLong(ShowQuery.SHOW_RELEASE_TIME); final String releaseCountry = show.getString(ShowQuery.SHOW_RELEASE_COUNTRY); final String releaseDay = show.getString(ShowQuery.SHOW_RELEASE_DAY); if (!TextUtils.isEmpty(releaseDay) && releaseTime != -1) { String[] values = TimeTools.formatToShowReleaseTimeAndDay(getActivity(), releaseTime, releaseCountry, releaseDay); timeAndNetwork.append(values[1]).append(" ").append(values[0]).append(" "); } final String network = show.getString(ShowQuery.SHOW_NETWORK); if (!TextUtils.isEmpty(network)) { timeAndNetwork.append(getString(R.string.show_on_network, network)); } ((TextView) getActivity().findViewById(R.id.showmeta)).setText(timeAndNetwork.toString()); }
From source file:rta.ae.sharekni.RegisterNewTest.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try {/*from w ww . java 2 s . c om*/ if (TakeATour.getInstance() != null) { TakeATour.getInstance().finish(); } } catch (NullPointerException e) { e.printStackTrace(); } getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); registerNewTestActivity = this; mContext = this; // cal.add(Calendar.YEAR, -18); year_x = cal.get(Calendar.YEAR); month_x = cal.get(Calendar.MONTH); day_x = cal.get(Calendar.DAY_OF_MONTH); setContentView(R.layout.activity_register_new_test); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); // txt_year = (TextView) findViewById(R.id.txt_year); // txt_year.setText("0"); txt_beforeCal = (TextView) findViewById(R.id.txt_beforeCal); txt_dayOfWeek = (TextView) findViewById(R.id.txt_dayOfWeek); showDialogOnButtonClick(); driver_toggle = (ImageView) findViewById(R.id.driver_toggle); passenger_toogle = (ImageView) findViewById(R.id.passenger_toggle); both_toggle = (ImageView) findViewById(R.id.both_toggle); both_toggle_active = (ImageView) findViewById(R.id.both_toggle_active); driver_toggle_active = (ImageView) findViewById(R.id.driver_toggle_active); passenger_toggle_active = (ImageView) findViewById(R.id.passenger_toggle_active); btn_save = (Button) findViewById(R.id.btn_register_id); btn_upload_image = (Button) findViewById(R.id.btnUploadPhotoReg); edit_fname = (EditText) findViewById(R.id.edit_reg_fname); edit_lname = (EditText) findViewById(R.id.edit_reg_lname); edit_phone = (EditText) findViewById(R.id.edit_reg_phone); edit_pass = (EditText) findViewById(R.id.edit_reg_pass); edit_user = (EditText) findViewById(R.id.edit_reg_username); txt_comma = (TextView) findViewById(R.id.Register_comma_cal); malefemale_txt = (TextView) findViewById(R.id.malefemale_txt); femalemale_txt = (TextView) findViewById(R.id.femalemale_txt); malefemale = (ImageView) findViewById(R.id.malefemale); femalemale = (ImageView) findViewById(R.id.femalemale); //Terms_And_Cond_txt = (TextView) findViewById(R.id.Terms_And_Cond_txt); txt_lang = (TextView) findViewById(R.id.autocomplete_lang_id); txt_country = (AutoCompleteTextView) findViewById(R.id.autocompletecountry_id); Terms_And_Cond_txt_2 = (TextView) findViewById(R.id.Terms_And_Cond_txt_2); Terms_And_Cond_txt_2 .setText(Html.fromHtml("<u><font color=#e72433>" + getString(R.string.reg_terms) + "</font></u>")); txt_terms = (RelativeLayout) findViewById(R.id.terms_relative); Privacy_and_poolicy = (TextView) findViewById(R.id.Privacy_and_poolicy); Privacy_and_poolicy .setText(Html.fromHtml("<u><font color=#e72433>" + getString(R.string.reg_policy) + "</font></u>")); FirstName_Linear = (LinearLayout) findViewById(R.id.FirstName_Linear); LastName_Linear = (LinearLayout) findViewById(R.id.LastName_Linear); MobileNumber_Linear = (LinearLayout) findViewById(R.id.MobileNumber_Linear); UserName_Linear = (LinearLayout) findViewById(R.id.UserName_Linear); Password_Linear = (LinearLayout) findViewById(R.id.Password_Linear); // Nat_Linear = (LinearLayout) findViewById(R.id.Nat_Linear); Language_Linear = (LinearLayout) findViewById(R.id.Language_Linear); Date_Relative = (RelativeLayout) findViewById(R.id.datepicker_id); AgeCheckBox = (CheckBox) findViewById(R.id.AgeCheckBox); initToolbar(); txt_terms.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getBaseContext(), TermsAndCond.class); startActivity(intent); } }); Privacy_and_poolicy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getBaseContext(), Privacy_Policy.class); startActivity(intent); } }); btn_upload_image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final CharSequence[] items = { getString(R.string.take_photo), getString(R.string.choose_from_library), getString(R.string.cancel) }; android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder( RegisterNewTest.this); builder.setTitle(getString(R.string.add_photo)); builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (items[item].equals(getString(R.string.take_photo))) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 0); } else if (items[item].equals(getString(R.string.choose_from_library))) { Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, getString(R.string.select_file)), 1337); } else if (items[item].equals(getString(R.string.cancel))) { dialog.dismiss(); } } }); builder.show(); } }); edit_fname.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { edit_fname.setHint(getString(R.string.Reg_FirstN)); if (edit_fname.getText().length() == 0) { FirstName_Linear.setBackgroundResource(R.drawable.user_register_border_error); } else { FirstName_Linear.setBackgroundResource(R.drawable.user_register_border); } } } }); edit_lname.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { edit_lname.setHint(getString(R.string.Reg_LastN)); if (edit_lname.getText().length() == 0) { LastName_Linear.setBackgroundResource(R.drawable.user_register_border_error); } else { LastName_Linear.setBackgroundResource(R.drawable.user_register_border); } } } }); edit_phone.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { edit_phone.setHint(getString(R.string.REg_Mobile)); if (edit_phone != null) { if (edit_phone.length() < 9) { Toast.makeText(RegisterNewTest.this, getString(R.string.short_mobile), Toast.LENGTH_SHORT).show(); MobileNumber_Linear.setBackgroundResource(R.drawable.user_register_border_error); } else { MobileNumber_Linear.setBackgroundResource(R.drawable.user_register_border); } } else { MobileNumber_Linear.setBackgroundResource(R.drawable.user_register_border); } } if (hasFocus) { edit_phone.setHint(""); } } }); edit_user.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { edit_user.setHint(getString(R.string.Reg_Email)); if (!isEmailValid(edit_user.getText().toString())) { vailedEmail = false; UserName_Linear.setBackgroundResource(R.drawable.user_register_border_error); Toast.makeText(RegisterNewTest.this, getString(R.string.email_valid_form), Toast.LENGTH_SHORT).show(); } } else { vailedEmail = true; UserName_Linear.setBackgroundResource(R.drawable.user_register_border); } if (hasFocus) { edit_user.setHint(""); } } }); edit_pass.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { edit_pass.setHint(R.string.password); if (edit_pass != null) { if (edit_pass.length() <= 4) { Password_Linear.setBackgroundResource(R.drawable.user_register_border_error); Toast.makeText(RegisterNewTest.this, getString(R.string.short_pass), Toast.LENGTH_SHORT) .show(); } } } else { Password_Linear.setBackgroundResource(R.drawable.user_register_border); } if (hasFocus) { edit_pass.setHint(""); } } }); // txt_country.setOnFocusChangeListener(new View.OnFocusChangeListener() { // public void onFocusChange(View v, boolean hasFocus) { // Boolean result = false; // if (!hasFocus) { // txt_country.setHint(getString(R.string.nationality)); // if (Country_List.size() != 0 && txt_country.getText() != null && !txt_country.getText().toString().equals(getString(R.string.nationality))) { // for (int i = 0; i <= 193; i++) { // String a = Country_List.get(i).get("NationalityEnName"); // String b = txt_country.getText().toString(); // if (a.equals(b)) { // result = true; // } // } // } // if (!result) { // txt_country.setBackgroundResource(R.drawable.user_register_border_error); // Toast.makeText(RegisterNewTest.this, R.string.unknown_country, Toast.LENGTH_SHORT).show(); // } else { // txt_country.setBackgroundResource(R.drawable.user_register_border); // } // } // if (hasFocus) { // txt_country.setHint(""); // } // } // }); txt_lang.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { Boolean result = false; if (!hasFocus) { txt_lang.setHint(getString(R.string.language)); if (Lang_List.size() != 0 && txt_lang.getText() != null && !txt_lang.getText().toString().equals(getString(R.string.Reg_PrefLang))) { for (int i = 0; i <= Lang_List.size(); i++) { String a = Lang_List.get(i).get("NationalityEnName"); String b = txt_lang.getText().toString(); if (a.equals(b)) { result = true; } } } else { Nat_Linear.setBackgroundResource(R.drawable.user_register_border); } if (!result) { Nat_Linear.setBackgroundResource(R.drawable.user_register_border_error); // Toast.makeText(RegisterNewTest.this, R.string.unknown_language, Toast.LENGTH_SHORT).show(); } } if (hasFocus) { txt_lang.setHint(""); } } }); both_toggle.setOnClickListener(this); driver_toggle.setOnClickListener(this); passenger_toogle.setOnClickListener(this); both_toggle_active.setOnClickListener(this); passenger_toggle_active.setOnClickListener(this); driver_toggle_active.setOnClickListener(this); // get Languages new lang().execute(); // get nationals // new nat().execute(); btn_save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!vailedEmail) { UserName_Linear.setBackgroundResource(R.drawable.user_register_border_error); } else { UserName_Linear.setBackgroundResource(R.drawable.user_register_border); } if (edit_fname.getText().length() == 0) { FirstName_Linear.setBackgroundResource(R.drawable.user_register_border_error); } else { FirstName_Linear.setBackgroundResource(R.drawable.user_register_border); } if (edit_lname.getText().length() != 0) { LastName_Linear.setBackgroundResource(R.drawable.user_register_border); } else { LastName_Linear.setBackgroundResource(R.drawable.user_register_border_error); } if (edit_phone.getText().length() != 0) { MobileNumber_Linear.setBackgroundResource(R.drawable.user_register_border); } else { MobileNumber_Linear.setBackgroundResource(R.drawable.user_register_border_error); } if (edit_pass.getText().length() != 0) { Password_Linear.setBackgroundResource(R.drawable.user_register_border); } else { Password_Linear.setBackgroundResource(R.drawable.user_register_border_error); } // if (txt_country.getText().length() != 0) { // Nat_Linear.setBackgroundResource(R.drawable.user_register_border); // } else { // Nat_Linear.setBackgroundResource(R.drawable.user_register_border_error); // } if (txt_lang.getText().length() != 0) { Language_Linear.setBackgroundResource(R.drawable.user_register_border); } else { Language_Linear.setBackgroundResource(R.drawable.user_register_border_error); } if (AgeCheckBox.isChecked()) { Date_Relative.setBackgroundResource(R.drawable.user_register_border); } if (!AgeCheckBox.isChecked()) { Toast.makeText(RegisterNewTest.this, R.string.fill_all_error, Toast.LENGTH_SHORT).show(); Date_Relative.setBackgroundResource(R.drawable.user_register_border_error); } else { if (edit_fname.getText() != null && !edit_fname.getText().toString().equals(getString(R.string.Reg_FirstN)) && edit_lname.getText() != null && !edit_lname.getText().toString().equals(getString(R.string.Reg_LastN)) && edit_phone.getText() != null && !edit_phone.getText().toString().equals(getString(R.string.REg_Mobile)) && edit_pass.getText() != null && !edit_pass.getText().toString().equals(getString(R.string.Reg_pass)) && edit_user.getText() != null && !edit_user.getText().toString().equals(getString(R.string.Reg_Email)) && !edit_lname.getText().toString().equals(getString(R.string.Reg_Nat)) && Language_ID != -1 && vailedEmail == true) { ArrayList codes = new ArrayList(); codes.add("50"); codes.add("52"); codes.add("55"); codes.add("56"); String code = edit_phone.getText().toString().substring(0, 2); if (edit_pass.getText().length() < 5) { Toast.makeText(RegisterNewTest.this, R.string.Password_sould_be_more_than_five_chars, Toast.LENGTH_SHORT).show(); } else { if (!codes.contains(code)) { Toast.makeText(RegisterNewTest.this, getString(R.string.short_mobile), Toast.LENGTH_SHORT).show(); } else { String Fname = edit_fname.getText().toString(); String Lname = edit_lname.getText().toString(); String phone = edit_phone.getText().toString(); String pass = edit_pass.getText().toString(); String user = edit_user.getText().toString(); // String country = txt_country.getText().toString(); String country = "0"; // String lang = txt_lang.getText().toString(); char gender = i; // String birthdate = full_date; int x = Language_ID; // int y = Nationality_ID; RegisterJsonParse registerJsonParse = new RegisterJsonParse(); switch (usertype) { case "Passenger": registerJsonParse.stringRequest(GetData.DOMAIN + "RegisterPassenger?firstName=" + URLEncoder.encode(Fname) + "&lastName=" + URLEncoder.encode(Lname) + "&mobile=" + phone + "&username=" + URLEncoder.encode(user) + "&password=" + URLEncoder.encode(pass) + "&gender=" + gender + "&BirthDate=" + "&NationalityId=0" + "&PreferredLanguageId=" + x + "&photoName=" + uploadedImage, RegisterNewTest.this, country, "P"); Log.d("Registration :", GetData.DOMAIN + "RegisterPassenger?firstName=" + URLEncoder.encode(Fname) + "&lastName=" + URLEncoder.encode(Lname) + "&mobile=" + phone + "&username=" + URLEncoder.encode(user) + "&password=" + URLEncoder.encode(pass) + "&gender=" + gender + "&BirthDate=" + "&NationalityId=0" + "&PreferredLanguageId=" + x + "&photoName=" + uploadedImage); break; case "1": Toast.makeText(RegisterNewTest.this, R.string.select_type_first_error, Toast.LENGTH_SHORT).show(); break; case "Driver": registerJsonParse.stringRequest( GetData.DOMAIN + "RegisterDriver?firstName=" + URLEncoder.encode(Fname) + "&lastName=" + URLEncoder.encode(Lname) + "&mobile=" + phone + "&username=" + URLEncoder.encode(user) + "&password=" + URLEncoder.encode(pass) + "&gender=" + gender + "&BirthDate=" + "&licenseScannedFileName=nofile.jpg" + "&TrafficFileNo=nofile.jpg" + "&photoName=" + uploadedImage + "&NationalityId=0" + "&PreferredLanguageId=" + x, RegisterNewTest.this, country, "D"); Log.d("Reg Driver", GetData.DOMAIN + "RegisterDriver?firstName=" + URLEncoder.encode(Fname) + "&lastName=" + URLEncoder.encode(Lname) + "&mobile=" + phone + "&username=" + URLEncoder.encode(user) + "&password=" + URLEncoder.encode(pass) + "&gender=" + gender + "&BirthDate=" + "&licenseScannedFileName=nofile.jpg" + "&TrafficFileNo=nofile.jpg" + "&photoName=" + uploadedImage + "&NationalityId=0" + "&PreferredLanguageId=" + x); break; case "Both": registerJsonParse.stringRequest( GetData.DOMAIN + "RegisterDriver?firstName=" + URLEncoder.encode(Fname) + "&lastName=" + URLEncoder.encode(Lname) + "&mobile=" + phone + "&username=" + URLEncoder.encode(user) + "&password=" + URLEncoder.encode(pass) + "&gender=" + gender + "&BirthDate=" + "&licenseScannedFileName=nofile.jpg" + "&TrafficFileNo=nofile.jpg" + "&photoName=" + uploadedImage + "&NationalityId=0" + "&PreferredLanguageId=" + x, RegisterNewTest.this, country, "D"); break; } } } } else { Toast.makeText(RegisterNewTest.this, R.string.fill_all_error, Toast.LENGTH_SHORT).show(); } } } // else { // Toast.makeText(RegisterNewTest.this, R.string.fill_all_error, Toast.LENGTH_SHORT).show(); // } // }); malefemale.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { malefemale.setVisibility(View.INVISIBLE); femalemale.setVisibility(View.VISIBLE); malefemale_txt.setTextColor(Color.GRAY); femalemale_txt.setTextColor(Color.RED); i = 'F'; } }); femalemale.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { femalemale.setVisibility(View.INVISIBLE); malefemale.setVisibility(View.VISIBLE); malefemale_txt.setTextColor(Color.RED); femalemale_txt.setTextColor(Color.GRAY); i = 'M'; } }); femalemale_txt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { malefemale_txt.setTextColor(Color.GRAY); femalemale_txt.setTextColor(Color.RED); malefemale.setVisibility(View.INVISIBLE); femalemale.setVisibility(View.VISIBLE); i = 'M'; } }); malefemale_txt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { i = 'F'; malefemale_txt.setTextColor(Color.RED); femalemale_txt.setTextColor(Color.GRAY); malefemale.setVisibility(View.VISIBLE); femalemale.setVisibility(View.INVISIBLE); } }); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
From source file:com.msopentech.applicationgateway.EnterpriseBrowserActivity.java
public void showSettingsPopup(View v) { try {//from w ww .j a va 2 s .c om PopupMenu popup = new PopupMenu(this, v); MenuInflater inflater = popup.getMenuInflater(); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_connection: { showAgentsList(); return true; } case R.id.menu_sign_in_or_out: { if (mIsSigninRequired) { // Menu item in sign in mode. //TODO: showSignIn(null, true); return true; } // Clean up the session. mTraits.sessionID = null; mTraits.token = null; mTraits.agent = null; // Indicate the condition. mIsSigninRequired = true; //Remove all tabs except one. mCustomTabHost.resetTabs(); mUrlEditTextView.setText(""); mProgressBarView.setProgress(0); // Disable the reload button and set the right image for it. mReloadButtonView.setEnabled(false); mReloadButtonView.setImageResource(R.drawable.reload_button); mStatusButtonView.setImageResource(R.drawable.connection_red); // Since it's the user's intention to sign out, his // history must be dropped. PersistenceManager.dropContent(PersistenceManager.ContentType.HISTORY); return true; } // Removed from RELEASE version. Should be active for development ONLY. // case R.id.menu_advanced_router_settings: { // showAdvancedRouterSettings(null); // } default: { return false; } } } }); inflater.inflate(R.menu.settings_menu, popup.getMenu()); if (mIsSigninRequired) { MenuItem signItem = popup.getMenu().findItem(R.id.menu_sign_in_or_out); signItem.setTitle(getResources().getString(R.string.browser_menu_item_sign_in)); } // Assumes that agent always has a display name. If display name is not present agent is considered to be not connected. MenuItem agentItem = popup.getMenu().findItem(R.id.menu_connection); String status = getResources().getString(R.string.browser_menu_item_choose_connection_not_connected); if (mTraits != null && mTraits.agent != null && !TextUtils.isEmpty(mTraits.agent.getDisplayName())) { status = mTraits.agent.getDisplayName(); } Spannable span = new SpannableString( getResources().getString(R.string.browser_menu_item_choose_connection, status)); span.setSpan(new RelativeSizeSpan(0.8f), 18, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); span.setSpan(new ForegroundColorSpan(Color.GRAY), 18, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); agentItem.setTitle(span); popup.show(); } catch (final Exception e) { Utility.showAlertDialog(EnterpriseBrowserActivity.class.getSimpleName() + ".showSettingsPopup(): Failed. " + e.toString(), EnterpriseBrowserActivity.this); } }
From source file:cz.tsystems.portablecheckin.MainActivity.java
private void setEnableButton(ButtonFloat buttonFloat, boolean enable) { buttonFloat.setEnabled(enable);//from w w w. j av a 2s . com int color = (enable) ? getResources().getColor(R.color.mainColor) : Color.GRAY; buttonFloat.setBackgroundColor(color); }
From source file:edu.princeton.jrpalmer.asmlibrary.Settings.java
private void toggleParticipationViews(boolean isActive) { if (isActive) { participationLabel.setTextColor(Color.WHITE); pendingUploadsLabel.setTextColor(Color.WHITE); participationTimeText.setTextColor(Color.WHITE); nUploadsText.setTextColor(Color.WHITE); deletePendingUploadsButton.setVisibility(View.VISIBLE); uploadButton.setVisibility(View.VISIBLE); mStorageSizePendingUploadsText.setVisibility(View.VISIBLE); } else {// w w w .j av a 2s .c om participationLabel.setTextColor(Color.GRAY); pendingUploadsLabel.setTextColor(Color.GRAY); participationTimeText.setTextColor(Color.GRAY); nUploadsText.setTextColor(Color.GRAY); deletePendingUploadsButton.setVisibility(View.INVISIBLE); uploadButton.setVisibility(View.INVISIBLE); mStorageSizePendingUploadsText.setVisibility(View.INVISIBLE); } }
From source file:com.master.metehan.filtereagle.ActivityMain.java
private void menu_about() { // Create view LayoutInflater inflater = LayoutInflater.from(this); View view = inflater.inflate(R.layout.about, null, false); TextView tvVersionName = (TextView) view.findViewById(R.id.tvVersionName); TextView tvVersionCode = (TextView) view.findViewById(R.id.tvVersionCode); Button btnRate = (Button) view.findViewById(R.id.btnRate); TextView tvLicense = (TextView) view.findViewById(R.id.tvLicense); // Show version tvVersionName.setText(Util.getSelfVersionName(this)); if (!Util.hasValidFingerprint(this)) tvVersionName.setTextColor(Color.GRAY); tvVersionCode.setText(Integer.toString(Util.getSelfVersionCode(this))); // Handle license tvLicense.setMovementMethod(LinkMovementMethod.getInstance()); // Handle logcat view.setOnClickListener(new View.OnClickListener() { private short tap = 0; private Toast toast = Toast.makeText(ActivityMain.this, "", Toast.LENGTH_SHORT); @Override// w w w. j a va2 s. co m public void onClick(View view) { tap++; if (tap == 7) { tap = 0; toast.cancel(); Intent intent = getIntentLogcat(); if (intent.resolveActivity(getPackageManager()) != null) startActivityForResult(intent, REQUEST_LOGCAT); } else if (tap > 3) { toast.setText(Integer.toString(7 - tap)); toast.show(); } } }); // Handle rate btnRate.setVisibility( getIntentRate(this).resolveActivity(getPackageManager()) == null ? View.GONE : View.VISIBLE); btnRate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(getIntentRate(ActivityMain.this)); } }); // Show dialog dialogAbout = new AlertDialog.Builder(this).setView(view).setCancelable(true) .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { dialogAbout = null; } }).create(); dialogAbout.show(); }
From source file:org.croudtrip.fragments.join.JoinDrivingFragment.java
private List<LatLng> getPolylinePoints(List<RouteLocation> route, boolean dashed) { List<LatLng> polylinePoints = new ArrayList<LatLng>(); LatLng first = null;/* w ww .j ava 2s. c o m*/ LatLng last = null; for (RouteLocation loc : route) { last = new LatLng(loc.getLat(), loc.getLng()); if (first == null) { first = last; } else if (dashed) { createDashedLine(first, last, Color.GRAY); } polylinePoints.add(last); } return polylinePoints; }
From source file:com.amaze.filemanager.utils.Futils.java
public void showHiddenDialog(final Main m) { final MaterialDialog.Builder a = new MaterialDialog.Builder(m.getActivity()); a.positiveText(R.string.cancel);//from ww w . j a v a 2 s . c o m a.positiveColor(Color.parseColor(m.fabSkin)); a.title(R.string.hiddenfiles); if (m.theme1 == 1) a.theme(Theme.DARK); a.autoDismiss(true); HiddenAdapter adapter = new HiddenAdapter(m.getActivity(), m, R.layout.bookmarkrow, toHFileArray(DataUtils.getHiddenfiles()), null, false); a.adapter(adapter, new MaterialDialog.ListCallback() { @Override public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence charSequence) { } }); a.dividerColor(Color.GRAY); MaterialDialog x = a.build(); adapter.updateDialog(x); x.show(); }
From source file:com.dwdesign.tweetings.util.Utils.java
public static Bitmap getColorPreviewBitmap(final Context context, final int color) { if (context == null) return null; final float density = context.getResources().getDisplayMetrics().density; final int width = (int) (32 * density), height = (int) (32 * density); final Bitmap bm = Bitmap.createBitmap(width, height, Config.ARGB_8888); final Canvas canvas = new Canvas(bm); final int rectrangle_size = (int) (density * 5); final int numRectanglesHorizontal = (int) Math.ceil(width / rectrangle_size); final int numRectanglesVertical = (int) Math.ceil(height / rectrangle_size); final Rect r = new Rect(); boolean verticalStartWhite = true; for (int i = 0; i <= numRectanglesVertical; i++) { boolean isWhite = verticalStartWhite; for (int j = 0; j <= numRectanglesHorizontal; j++) { r.top = i * rectrangle_size; r.left = j * rectrangle_size; r.bottom = r.top + rectrangle_size; r.right = r.left + rectrangle_size; final Paint paint = new Paint(); paint.setColor(isWhite ? Color.WHITE : Color.GRAY); canvas.drawRect(r, paint);/* ww w.j av a2 s . co m*/ isWhite = !isWhite; } verticalStartWhite = !verticalStartWhite; } canvas.drawColor(color); final Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStrokeWidth(2.0f); final float[] points = new float[] { 0, 0, width, 0, 0, 0, 0, height, width, 0, width, height, 0, height, width, height }; canvas.drawLines(points, paint); return bm; }