List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.giovanniterlingen.windesheim.view.Adapters.ScheduleAdapter.java
@Override public void onBindViewHolder(final ViewHolder holder, int position) { final TextView lessonName = holder.lessonName; final TextView lessonTime = holder.lessonTime; final TextView lessonRoom = holder.lessonRoom; final TextView lessonComponent = holder.lessonComponent; final RelativeLayout menuButton = holder.menuButton; final ImageView menuButtonImage = holder.menuButtonImage; final View scheduleIdentifier = holder.scheduleIdentifier; Lesson lesson = this.lessons[position]; long databaseDateStart = Long .parseLong(lesson.getDate().replaceAll("-", "") + lesson.getStartTime().replaceAll(":", "")); long databaseDateEnd = Long .parseLong(lesson.getDate().replaceAll("-", "") + lesson.getEndTime().replaceAll(":", "")); SimpleDateFormat yearMonthDayDateFormat = CalendarController.getInstance().getYearMonthDayDateTimeFormat(); long currentDate = Long.parseLong(yearMonthDayDateFormat.format(new Date())); lessonName.setText(lesson.getSubject()); lessonRoom.setText(lesson.getRoom()); lessonComponent.setText(lesson.getScheduleType() == 2 ? lesson.getClassName() : lesson.getTeacher()); lessonComponent.setSelected(true);/*from w w w. j a va 2s . c om*/ if (databaseDateStart <= currentDate && databaseDateEnd >= currentDate) { lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorAccent)); lessonTime.setText( ApplicationLoader.applicationContext.getResources().getString(R.string.lesson_started)); holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Lesson lesson = ScheduleAdapter.this.lessons[holder.getAdapterPosition()]; if (!lessonTime.getText().toString().equals(ApplicationLoader.applicationContext.getResources() .getString(R.string.lesson_started))) { TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); lessonTime.setAnimation(animation); lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorAccent)); lessonTime.setText(ApplicationLoader.applicationContext.getResources() .getString(R.string.lesson_started)); } else { TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); lessonTime.setAnimation(animation); String lessonTimes = lesson.getStartTime() + " - " + lesson.getEndTime(); lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorSecondaryText)); lessonTime.setText(lessonTimes); } } }); } else if (databaseDateEnd < currentDate) { lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorAccent)); lessonTime.setText(ApplicationLoader.applicationContext.getResources().getString(R.string.finished)); holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Lesson lesson = ScheduleAdapter.this.lessons[holder.getAdapterPosition()]; if (!lessonTime.getText().toString().equals( ApplicationLoader.applicationContext.getResources().getString(R.string.finished))) { TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); lessonTime.setAnimation(animation); lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorAccent)); lessonTime.setText( ApplicationLoader.applicationContext.getResources().getString(R.string.finished)); } else { TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(100); lessonTime.setAnimation(animation); String lessonTimes = lesson.getStartTime() + " - " + lesson.getEndTime(); lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorSecondaryText)); lessonTime.setText(lessonTimes); } } }); } else { String lessonTimes = lesson.getStartTime() + " - " + lesson.getEndTime(); lessonTime.setTextColor(ContextCompat.getColor(activity, R.color.colorSecondaryText)); lessonTime.setText(lessonTimes); holder.cardView.setOnClickListener(null); } menuButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { menuButtonImage.setImageDrawable( ResourcesCompat.getDrawable(activity.getResources(), R.drawable.overflow_open, null)); PopupMenu popupMenu = new PopupMenu(activity, menuButton); popupMenu.inflate(R.menu.menu_schedule); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { Lesson lesson = ScheduleAdapter.this.lessons[holder.getAdapterPosition()]; if (item.getItemId() == R.id.hide_lesson) { showPromptDialog(lesson.getSubject()); return true; } if (item.getItemId() == R.id.save_lesson) { showCalendarDialog(lesson.getRowId()); } return true; } }); popupMenu.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { menuButtonImage.setImageDrawable(ResourcesCompat.getDrawable(activity.getResources(), R.drawable.overflow_normal, null)); } }); popupMenu.show(); } }); scheduleIdentifier.setBackgroundColor(ColorController.getInstance().getColorById(lesson.getScheduleId())); }
From source file:com.mdlive.sav.MDLiveProviderDetails.java
private void defaultNowTextPreferences(final TextView timeslotTxt, final String appointmentType) { selectedTimeslot = true;//from ww w .jav a 2s.c o m //saveConsultationType(appointmentType); saveProviderDetailsForConFirmAppmt(timeslotTxt.getText().toString(), ((TextView) findViewById(R.id.dateTxt)).getText().toString().trim(), str_ProfileImg, selectedTimestamp, str_phys_avail_id); //This is to select and Unselect the Timeslot if (previousSelectedTv == null) { previousSelectedTv = timeslotTxt; timeslotTxt.setBackgroundResource(R.drawable.timeslot_blue_rounded_corner); timeslotTxt.setTextColor(Color.WHITE); } else { previousSelectedTv.setBackgroundResource(R.drawable.timeslot_white_rounded_corner); previousSelectedTv.setTextColor(Color.GRAY); previousSelectedTv = timeslotTxt; timeslotTxt.setBackgroundResource(R.drawable.timeslot_blue_rounded_corner); timeslotTxt.setTextColor(Color.WHITE); } }
From source file:se.anyro.tagtider.TransferActivity.java
private void setupTransferData(final Bundle extras) { TextView trainView = (TextView) findViewById(R.id.train); ViewGroup originGroup = (ViewGroup) findViewById(R.id.origin_group); TextView originView = (TextView) findViewById(R.id.origin); TextView arrivalView = (TextView) findViewById(R.id.arrival); TextView stationTrackView = (TextView) findViewById(R.id.station_track); ViewGroup destinationGroup = (ViewGroup) findViewById(R.id.destination_group); TextView destinationView = (TextView) findViewById(R.id.destination); TextView departureView = (TextView) findViewById(R.id.departure); TextView commentView = (TextView) findViewById(R.id.comment); mEmptyView = (TextView) findViewById(android.R.id.empty); trainView.setText("Tg " + extras.getString("train") + " (" + extras.getString("type") + ")"); String origin = extras.getString("origin"); if (origin != null && origin.length() > 0) { originView.setText("Frn " + origin); originGroup.setVisibility(View.VISIBLE); } else {/*w ww . java 2s .co m*/ originGroup.setVisibility(View.GONE); } String track = extras.getString("track"); if (track == null || track.equalsIgnoreCase("x") || track.equalsIgnoreCase("null")) track = ""; String arrival = extras.getString("arrival"); if (arrival != null && !arrival.startsWith("0000")) { arrivalView.setText("Ankommer " + StringUtils.extractTime(arrival)); String newArrival = extras.getString("newArrival"); if (newArrival != null) { newArrival = StringUtils.extractTime(newArrival); SpannableString strike = new SpannableString(arrivalView.getText() + " " + newArrival); strike.setSpan(new StrikethroughSpan(), strike.length() - 11, strike.length() - 6, 0); arrivalView.setText(strike, TextView.BufferType.SPANNABLE); } if (track.length() == 0) { SpannableString strike = new SpannableString(arrivalView.getText()); strike.setSpan(new StrikethroughSpan(), strike.length() - 5, strike.length(), 0); arrivalView.setText(strike, TextView.BufferType.SPANNABLE); } } if (extras.getString("stationName") != null) { mStationName = extras.getString("stationName"); } if (track.length() > 0 && mStationName != null) stationTrackView.setText(mStationName + ", spr " + track); else if (mStationName != null) stationTrackView.setText(mStationName); else if (track.length() > 0) stationTrackView.setText("Spr " + track); else stationTrackView.setText(""); String destination = extras.getString("destination"); if (destination != null && destination.length() > 0) { destinationView.setText("Till " + destination); destinationGroup.setVisibility(View.VISIBLE); } else { destinationGroup.setVisibility(View.GONE); } String departure = extras.getString("departure"); if (departure != null && !departure.startsWith("0000")) { departureView.setText("Avgr " + StringUtils.extractTime(departure)); String newDeparture = extras.getString("newDeparture"); if (newDeparture != null) { newDeparture = StringUtils.extractTime(newDeparture); SpannableString strike = new SpannableString(departureView.getText() + " " + newDeparture); strike.setSpan(new StrikethroughSpan(), strike.length() - 11, strike.length() - 6, 0); departureView.setText(strike, TextView.BufferType.SPANNABLE); } if (track.length() == 0) { SpannableString strike = new SpannableString(departureView.getText()); strike.setSpan(new StrikethroughSpan(), strike.length() - 5, strike.length(), 0); departureView.setText(strike, TextView.BufferType.SPANNABLE); } } String comment = extras.getString("comment"); if ((comment == null || comment.length() == 0) && track.length() == 0) comment = "Instllt"; if (comment != null && comment.length() > 0) { commentView.setText(comment); commentView.setVisibility(View.VISIBLE); } else { commentView.setVisibility(View.GONE); } mTrain = extras.getString("train"); mStationId = extras.getString("stationId"); mTransferId = extras.getString("id"); }
From source file:reportsas.com.formulapp.Formulario.java
public int ObtenerRespuesta(LinearLayout contenedor, Pregunta Pregunta, ArrayList<PreguntaRespuesta> respuestaList) { PreguntaRespuesta result = new PreguntaRespuesta(); int numRespuesta = 0; result.setIdPregunta(Pregunta.getIdPregunta()); EditText resp;// w w w . ja va 2 s .co m TextView selectio; switch (Pregunta.getTipoPregunta()) { case 1: resp = (EditText) contenedor.findViewById(R.id.edtTexto); result.setItem(1); result.setRespuesta(resp.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 2: resp = (EditText) contenedor.findViewById(R.id.mtxtEdit); result.setItem(1); result.setRespuesta(resp.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 3: selectio = (TextView) contenedor.findViewById(R.id.respuestaGruop); result.setItem(1); result.setRespuesta(selectio.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 4: String resp_opcio = ""; for (int j = 0; j < contenedor.getChildCount(); j++) { View child = contenedor.getChildAt(j); if (child instanceof CheckBox) { CheckBox hijo = (CheckBox) child; if (hijo.isChecked()) { if (resp_opcio.length() == 0) { if (Pregunta.isOpcionEditble(hijo.getText().toString())) { EditText otrosR = (EditText) contenedor.findViewById(R.id.edtTexto); resp_opcio = otrosR.getText().toString(); } else { resp_opcio = hijo.getText().toString(); } } else { if (Pregunta.isOpcionEditble(hijo.getText().toString())) { EditText otrosR = (EditText) contenedor.findViewById(R.id.edtTexto); resp_opcio += " , " + otrosR.getText().toString() + " "; } else { resp_opcio = resp_opcio + " , " + hijo.getText() + " "; } } } } } result.setItem(1); result.setRespuesta(resp_opcio); respuestaList.add(result); numRespuesta = 1; break; case 5: selectio = (TextView) contenedor.findViewById(R.id.seleEscala); result.setItem(1); result.setRespuesta(selectio.getText().toString()); respuestaList.add(result); numRespuesta = 1; break; case 6: Spinner lista = (Spinner) contenedor.findViewById(R.id.opcionesListado); result.setItem(1); result.setRespuesta(lista.getSelectedItem().toString() + ""); respuestaList.add(result); numRespuesta = 1; break; case 7: TableLayout tabla = (TableLayout) contenedor.findViewById(R.id.tablaOpciones); for (int i = 0; i < tabla.getChildCount(); i++) { TableRow registro = (TableRow) tabla.getChildAt(i); TextView etiq = (TextView) registro.findViewById(R.id.textoRow); RadioGroup selector = (RadioGroup) registro.findViewById(R.id.valoresRow); PreguntaRespuesta itemA = new PreguntaRespuesta(); itemA.setIdPregunta(Pregunta.getIdPregunta()); itemA.setItem(i + 1); itemA.setRespuesta(etiq.getText().toString()); if (selector.getCheckedRadioButtonId() > 0) { RadioButton rb = (RadioButton) selector.findViewById(selector.getCheckedRadioButtonId()); itemA.setOpcion(rb.getText() + ""); } respuestaList.add(itemA); numRespuesta++; } break; case 8: DatePicker dp = (DatePicker) contenedor.findViewById(R.id.Fecha_resutl); result.setItem(1); result.setRespuesta(dp.getYear() + "-" + dp.getMonth() + "-" + dp.getDayOfMonth()); respuestaList.add(result); numRespuesta = 1; break; case 9: TimePicker tp = (TimePicker) contenedor.findViewById(R.id.hora_result); result.setItem(1); result.setRespuesta(tp.getCurrentHour() + ":" + tp.getCurrentMinute()); respuestaList.add(result); numRespuesta = 1; break; default: result.setItem(1); result.setRespuesta("Proceso"); break; } return numRespuesta; }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragment.java
/** * Get product fragment values and update local member vars *//* w w w.jav a2s. c o m*/ private void getProductFragmentValues() { if (mProductFragmentReady) { // get the product list for selected markt from the shared prefs SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext()); String producten = settings .getString(getContext().getString(R.string.sharedpreferences_key_markt_producten), null); if (producten != null) { // split comma-separated string into list with product strings List<String> productList = Arrays.asList(producten.split(",")); if (productList.size() > 0) { String[] productKeys = getResources().getStringArray(R.array.array_product_key); String[] productTypes = getResources().getStringArray(R.array.array_product_type); String[] productParams = getResources().getStringArray(R.array.array_product_param); // get the product fragment view, find the product count views, and get their values View fragmentView = mProductFragment.getView(); for (int i = 0; i < productList.size(); i++) { if (fragmentView != null) { View productView = fragmentView .findViewById(Utility.getResId("product_" + productList.get(i), R.id.class)); if (productView != null) { // get the corresponding product type and column based on the productlist item value String productType = ""; String productColumn = ""; for (int j = 0; j < productKeys.length; j++) { if (productKeys[j].equals(productList.get(i))) { productType = productTypes[j]; productColumn = productParams[j]; } } // get value depending on product type String productCount = "0"; if (productType.equals("integer")) { TextView productCountView = (TextView) productView .findViewById(R.id.product_count); productCount = productCountView.getText().toString(); } else if (productType.equals("boolean")) { Switch productCountView = (Switch) productView .findViewById(R.id.product_switch); if (productCountView.isChecked()) { productCount = "1"; } } // update the local product member var if (!productColumn.equals("") && !productCount.equals("")) { // only set the local member var if the view value not is 0, or if it is 0 and the existing member is not -1 if (!productCount.equals("0") || (productCount.equals("0") && mProducten.get(productColumn) != -1)) { mProducten.put(productColumn, Integer.valueOf(productCount)); } } } } } } } // get dagvergunning notitie value if (!mProductFragment.mNotitie.getText().toString().equals("")) { mNotitie = mProductFragment.mNotitie.getText().toString(); } else if (mNotitie != null && !mNotitie.equals("")) { mNotitie = null; } } }
From source file:gr.scify.newsum.ui.ViewActivity.java
private void initRatingBar() { final TextView tx = (TextView) findViewById(R.id.textView1); final RatingBar rb = (RatingBar) findViewById(R.id.ratingBar); rb.setVisibility(View.VISIBLE); final TextView rateLbl = (TextView) findViewById(R.id.rateLbl); rateLbl.setVisibility(View.VISIBLE); final Button btnSubmit = (Button) findViewById(R.id.submitRatingBtn); // Set rating bar reaction btnSubmit.setOnClickListener(new OnClickListener() { @Override/*from www .j a v a2s . c om*/ public void onClick(View v) { HttpParams params = new BasicHttpParams(); // Basic params HttpClient client = new DefaultHttpClient(params); String sURL = getApplicationContext().getResources().getString(R.string.urlRating); HttpPost post = new HttpPost(sURL); ArrayList<NameValuePair> alParams = new ArrayList<NameValuePair>(); NameValuePair nvSummary = new NameValuePair() { @Override public String getValue() { return tx.getText().toString(); } @Override public String getName() { return "summary"; } }; NameValuePair nvRating = new NameValuePair() { @Override public String getValue() { return String.valueOf(rb.getRating()); } @Override public String getName() { return "rating"; } }; // added User ID NameValuePair nvUserID = new NameValuePair() { @Override public String getValue() { SharedPreferences idSettings = getSharedPreferences(UID_PREFS_NAME, Context.MODE_PRIVATE); String sUID = idSettings.getString("UID", ""); return sUID; } @Override public String getName() { return "userID"; } }; alParams.add(nvSummary); alParams.add(nvRating); alParams.add(nvUserID); boolean bSuccess = false; try { post.setEntity(new UrlEncodedFormEntity(alParams, HTTP.UTF_8)); // with list of key-value pairs client.execute(post); bSuccess = true; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (bSuccess) { Toast.makeText(ViewActivity.this, R.string.thankyou_rate, Toast.LENGTH_SHORT).show(); rb.setVisibility(View.GONE); rateLbl.setVisibility(View.GONE); btnSubmit.setVisibility(View.GONE); } else Toast.makeText(ViewActivity.this, R.string.fail_rate, Toast.LENGTH_SHORT).show(); } }); rb.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() { @Override public void onRatingChanged(final RatingBar ratingBar, float rating, boolean fromUser) { // Ignore auto setting if (!fromUser) return; // Allow submit btnSubmit.setVisibility(View.VISIBLE); } }); rb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Allow submit btnSubmit.setVisibility(View.VISIBLE); } }); rb.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // Allow submit btnSubmit.setVisibility(View.VISIBLE); return false; } }); }
From source file:export.UploadManager.java
private void askUsernamePassword(final Uploader l, boolean showPassword) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(l.getName());/* w w w . j ava2s.com*/ // Get the layout inflater LayoutInflater inflater = activity.getLayoutInflater(); final View view = inflater.inflate(R.layout.userpass, null); final CheckBox cb = (CheckBox) view.findViewById(R.id.showpass); final TextView tv1 = (TextView) view.findViewById(R.id.username); final TextView tv2 = (TextView) view.findViewById(R.id.password_input); String authConfigStr = l.getAuthConfig(); final JSONObject authConfig = newObj(authConfigStr); String username = authConfig.optString("username", ""); String password = authConfig.optString("password", ""); tv1.setText(username); tv2.setText(password); cb.setChecked(showPassword); tv2.setInputType(InputType.TYPE_CLASS_TEXT | (showPassword ? 0 : InputType.TYPE_TEXT_VARIATION_PASSWORD)); cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { tv2.setInputType( InputType.TYPE_CLASS_TEXT | (isChecked ? 0 : InputType.TYPE_TEXT_VARIATION_PASSWORD)); } }); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout builder.setView(view); builder.setPositiveButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { authConfig.put("username", tv1.getText()); authConfig.put("password", tv2.getText()); } catch (JSONException e) { e.printStackTrace(); } testUserPass(l, authConfig, cb.isChecked()); } }); builder.setNeutralButton("Skip", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handleAuthComplete(l, Status.SKIP); } }); builder.setNegativeButton("Cancel", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handleAuthComplete(l, Status.SKIP); } }); final AlertDialog dialog = builder.create(); dialog.show(); }
From source file:com.hybris.mobile.lib.ui.view.Alert.java
/** * Show the alert/*from ww w. j ava 2 s. com*/ * * @param context application-specific resources * @param configuration describes all device configuration information * @param text message to be displayed * @param forceClearPreviousAlert true will clear previous alert else keep it */ @SuppressLint("NewApi") private static void showAlertOnScreen(final Activity context, final Configuration configuration, final String text, boolean forceClearPreviousAlert) { final ViewGroup mainView = ((ViewGroup) context.findViewById(android.R.id.content)); boolean currentlyDisplayed = false; int viewId = R.id.alert_view_top; final TextView textView; boolean alertAlreadyExists = false; if (configuration.getOrientation().equals(Configuration.Orientation.BOTTOM)) { viewId = R.id.alert_view_bottom; } // Retrieving the view RelativeLayout relativeLayout = (RelativeLayout) mainView.findViewById(viewId); if (forceClearPreviousAlert) { mainView.removeView(relativeLayout); relativeLayout = null; } // Creating the view if (relativeLayout == null) { // Main layout relativeLayout = new RelativeLayout(context); relativeLayout.setId(viewId); relativeLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, configuration.getHeight())); relativeLayout.setGravity(Gravity.CENTER); // Textview textView = new TextView(context); textView.setId(R.id.alert_view_text); textView.setGravity(Gravity.CENTER); textView.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); relativeLayout.addView(textView); setIcon(context, configuration, relativeLayout, textView); if (configuration.getOrientation().equals(Configuration.Orientation.TOP)) { relativeLayout.setY(-configuration.getHeight()); } else { relativeLayout.setY(mainView.getHeight()); } // Adding the view to the global layout mainView.addView(relativeLayout, 0); relativeLayout.bringToFront(); relativeLayout.requestLayout(); relativeLayout.invalidate(); } // View already exists else { alertAlreadyExists = true; textView = (TextView) relativeLayout.findViewById(R.id.alert_view_text); if (configuration.getOrientation().equals(Configuration.Orientation.TOP)) { if (relativeLayout.getY() == 0) { currentlyDisplayed = true; } } else { if (relativeLayout.getY() < mainView.getHeight()) { currentlyDisplayed = true; } } // The view is currently shown to the user if (currentlyDisplayed) { // If the message is not the same, we hide the current message and display the new one if (!StringUtils.equals(text, textView.getText())) { // Anim out the current message ViewPropertyAnimator viewPropertyAnimator = animOut(configuration, mainView, relativeLayout); final RelativeLayout relativeLayoutFinal = relativeLayout; if (viewPropertyAnimator != null) { // Anim in the new message after the animation out has finished if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { viewPropertyAnimator.setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setIcon(context, configuration, relativeLayoutFinal, textView); animIn(configuration, relativeLayoutFinal, textView, mainView, text); } }); } else { viewPropertyAnimator.withEndAction(new Runnable() { @Override public void run() { setIcon(context, configuration, relativeLayoutFinal, textView); animIn(configuration, relativeLayoutFinal, textView, mainView, text); } }); } } else { setIcon(context, configuration, relativeLayoutFinal, textView); animIn(configuration, relativeLayoutFinal, textView, mainView, text); } } } } final RelativeLayout relativeLayoutFinal = relativeLayout; // Close the alert by clicking the layout if (configuration.isCloseable()) { relativeLayout.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { animOut(configuration, mainView, relativeLayoutFinal); v.performClick(); return true; } }); } if (!currentlyDisplayed) { // Set the icon in case the alert already exists but it's not currently displayed if (alertAlreadyExists) { setIcon(context, configuration, relativeLayoutFinal, textView); } // We anim in the alert animIn(configuration, relativeLayoutFinal, textView, mainView, text); } }
From source file:com.bookkos.bircle.CaptureActivity.java
private void setMode(TextView textview) { arrayList.clear();//w ww . j a v a2 s. c om if (textview.getText().toString().equals("??")) { textview.setText("?"); textview.setTextColor(Color.rgb(62, 162, 229)); strokeColor = Color.rgb(62, 162, 229); registFlag = 1; } else { textview.setText("??"); textview.setTextColor(Color.rgb(56, 234, 123)); strokeColor = Color.rgb(56, 234, 123); registFlag = 0; } }
From source file:com.mdlive.sav.MDLiveSearchProvider.java
/** * Instantiating array adapter to populate the listView * The layout android.R.layout.simple_list_item_single_choice creates radio button for each listview item * * @param list : Dependent users array list *///w ww . java2 s . com private void showListViewDialog(final ArrayList<String> list, final TextView selectedText, final String key, final ArrayList<HashMap<String, String>> typeList) { /*We need to get the instance of the LayoutInflater*/ final AlertDialog.Builder alertDialog = new AlertDialog.Builder(MDLiveSearchProvider.this); LayoutInflater inflater = getLayoutInflater(); View convertView = inflater.inflate(R.layout.mdlive_screen_popup, null); alertDialog.setView(convertView); ListView lv = (ListView) convertView.findViewById(R.id.popupListview); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list); lv.setAdapter(adapter); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); final AlertDialog dialog = alertDialog.create(); dialog.show(); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String SelectedText = list.get(position); HashMap<String, String> localMap = typeList.get(position); for (Map.Entry entry : localMap.entrySet()) { if (SelectedText.equals(entry.getValue().toString())) { postParams.put(key, entry.getKey().toString()); break; //breaking because its one to one map } } specialityBasedOnProvider(SelectedText, key); String oldChoice = selectedText.getText().toString(); selectedText.setText(SelectedText); dialog.dismiss(); // if user selects a different Provider type, then reload this screen if (!oldChoice.equals(SelectedText)) { SharedPreferences sharedpreferences = getSharedPreferences( PreferenceConstants.MDLIVE_USER_PREFERENCES, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(PreferenceConstants.PROVIDER_MODE, SelectedText); int providerType = MDLiveConfig.PROVIDERTYPE_MAP.get(SelectedText) == null ? MDLiveConfig.UNMAPPED : MDLiveConfig.PROVIDERTYPE_MAP.get(SelectedText); if (providerType == MDLiveConfig.UNMAPPED) editor.putString(PreferenceConstants.PROVIDERTYPE_ID, ""); else editor.putString(PreferenceConstants.PROVIDERTYPE_ID, String.valueOf(providerType)); editor.commit(); // now reload the screen //recreate(); } } }); }