List of usage examples for android.graphics Paint STRIKE_THRU_TEXT_FLAG
int STRIKE_THRU_TEXT_FLAG
To view the source code for android.graphics Paint STRIKE_THRU_TEXT_FLAG.
Click Source Link
From source file:nodomain.freeyourgadget.gadgetbridge.activities.CalBlacklistActivity.java
private void toggleEntry(View view) { TextView name = (TextView) view.findViewById(R.id.calendar_name); CheckBox checked = (CheckBox) view.findViewById(R.id.item_checkbox); name.setPaintFlags(name.getPaintFlags() ^ Paint.STRIKE_THRU_TEXT_FLAG); checked.toggle();// ww w . j av a 2s .com }
From source file:se.frikod.payday.DailyBudgetFragment.java
private void updateBudgetItems() { TableLayout itemsTable = (TableLayout) V.findViewById(R.id.budgetItems); itemsTable.removeAllViews();//from w w w .j a v a 2 s .co m for (int i = 0; i < budget.budgetItems.size(); i++) { BudgetItem bi = budget.budgetItems.get(i); final int currentIndex = i; LayoutInflater inflater = activity.getLayoutInflater(); TableRow budgetItemView = (TableRow) inflater.inflate(R.layout.daily_budget_budget_item, itemsTable, false); TextView amount = (TextView) budgetItemView.findViewById(R.id.budgetItemAmount); TextView title = (TextView) budgetItemView.findViewById(R.id.budgetItemLabel); amount.setText(budget.formatter.format(bi.amount)); title.setText(bi.title); if (bi.exclude) { amount.setTextColor(0xffCCCCCC); amount.setPaintFlags(amount.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); title.setTextColor(0xffCCCCCC); title.setPaintFlags(title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } budgetItemView.setClickable(true); budgetItemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(10); BudgetItem bi = budget.budgetItems.get(currentIndex); bi.exclude = !bi.exclude; budget.saveBudgetItems(); updateBudgetItems(); } }); budgetItemView.setLongClickable(true); budgetItemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { editBudgetItem(v, currentIndex); return true; } }); itemsTable.addView(budgetItemView); } FontUtils.setRobotoFont(activity, itemsTable); updateBudget(); }
From source file:com.meiste.greg.ptw.tab.QuestionsAnswers.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { Util.log("QuestionsAnswers: onCreateView"); final String qjson = getArguments().getString(RACE_QUESTIONS); if (qjson == null) { return null; }// ww w. j a v a2 s.co m final String ajson = getArguments().getString(RACE_ANSWERS); if (ajson == null) { return null; } final RaceQuestions rq = RaceQuestions.fromJson(qjson); final RaceAnswers ra = RaceAnswers.fromJson(ajson); final Resources res = getActivity().getResources(); final View v = inflater.inflate(R.layout.questions_answered, container, false); final TextView q2 = (TextView) v.findViewById(R.id.question2); q2.setText(getActivity().getString(R.string.questions_2, rq.q2)); final TextView q3 = (TextView) v.findViewById(R.id.question3); q3.setText(getActivity().getString(R.string.questions_3, rq.q3)); final TextView a1 = (TextView) v.findViewById(R.id.answer1); a1.setText(Driver.find(rq.drivers, res, ra.a1).getName()); final TextView a2 = (TextView) v.findViewById(R.id.answer2); a2.setText(rq.a2[ra.a2]); final TextView a3 = (TextView) v.findViewById(R.id.answer3); a3.setText(rq.a3[ra.a3]); final TextView a4 = (TextView) v.findViewById(R.id.answer4); a4.setText(Driver.find(rq.drivers, res, ra.a4).getName()); final TextView a5 = (TextView) v.findViewById(R.id.answer5); a5.setText(res.getStringArray(R.array.num_leaders)[ra.a5]); final String cajson = getArguments().getString(RACE_CORRECT_ANSWERS); if (cajson != null) { Util.log("QuestionsAnswers: Correct answers available"); final RaceAnswers rca = RaceAnswers.fromJson(cajson); // Have to check for null in case there is no correct answer if ((rca.a1 != null) && (rca.a1 >= 0)) { if (rca.a1 == ra.a1) { a1.setTextColor(res.getColor(R.color.answer_right)); } else { a1.setPaintFlags(a1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); a1.setTextColor(res.getColor(R.color.answer_wrong)); final TextView c1 = (TextView) v.findViewById(R.id.correct1); c1.setText(Driver.find(rq.drivers, res, rca.a1).getName()); c1.setVisibility(View.VISIBLE); } } if ((rca.a2 != null) && (rca.a2 >= 0)) { if (rca.a2 == ra.a2) { a2.setTextColor(res.getColor(R.color.answer_right)); } else { a2.setPaintFlags(a2.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); a2.setTextColor(res.getColor(R.color.answer_wrong)); final TextView c2 = (TextView) v.findViewById(R.id.correct2); c2.setText(rq.a2[rca.a2]); c2.setVisibility(View.VISIBLE); } } if ((rca.a3 != null) && (rca.a3 >= 0)) { if (rca.a3 == ra.a3) { a3.setTextColor(res.getColor(R.color.answer_right)); } else { a3.setPaintFlags(a3.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); a3.setTextColor(res.getColor(R.color.answer_wrong)); final TextView c3 = (TextView) v.findViewById(R.id.correct3); c3.setText(rq.a3[rca.a3]); c3.setVisibility(View.VISIBLE); } } if ((rca.a4 != null) && (rca.a4 >= 0)) { if (rca.a4 == ra.a4) { a4.setTextColor(res.getColor(R.color.answer_right)); } else { a4.setPaintFlags(a4.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); a4.setTextColor(res.getColor(R.color.answer_wrong)); final TextView c4 = (TextView) v.findViewById(R.id.correct4); c4.setText(Driver.find(rq.drivers, res, rca.a4).getName()); c4.setVisibility(View.VISIBLE); } } if ((rca.a5 != null) && (rca.a5 >= 0)) { if (rca.a5 == ra.a5) { a5.setTextColor(res.getColor(R.color.answer_right)); } else { a5.setPaintFlags(a5.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); a5.setTextColor(res.getColor(R.color.answer_wrong)); final TextView c5 = (TextView) v.findViewById(R.id.correct5); c5.setText(res.getStringArray(R.array.num_leaders)[rca.a5]); c5.setVisibility(View.VISIBLE); } } } return v; }
From source file:io.realm.realmtasks.list.ItemViewHolder.java
public void setCompleted(boolean completed) { if (completed == this.completed && !shouldChangeTextColor) { return;/*from ww w. ja va2 s . co m*/ } this.completed = completed; int paintFlags = text.getPaintFlags(); if (completed) { text.setTextColor(cellCompletedColor); text.setPaintFlags(paintFlags | Paint.STRIKE_THRU_TEXT_FLAG); metadata.setTextColor(cellCompletedColor); metadata.setPaintFlags(paintFlags | Paint.STRIKE_THRU_TEXT_FLAG); row.setBackgroundColor(cellCompletedBackgroundColor); } else { if (badge.getVisibility() == View.VISIBLE && badge.getText().equals("0")) { text.setTextColor(cellCompletedColor); metadata.setTextColor(cellCompletedColor); } else { text.setTextColor(cellDefaultColor); metadata.setTextColor(metadataCellCompletedColor); } text.setPaintFlags(paintFlags & ~Paint.STRIKE_THRU_TEXT_FLAG); metadata.setPaintFlags(paintFlags & ~Paint.STRIKE_THRU_TEXT_FLAG); row.setBackgroundColor(generateBackgroundColor()); } shouldChangeTextColor = false; }
From source file:net.grappendorf.doitlater.TaskEditorActivity.java
private void updateTitleView() { title.setText(task.getTitle());/*from w w w. j a v a2 s. co m*/ title.setPaintFlags(completed.isChecked() ? title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG : title.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); }
From source file:org.dash.wallet.common.ui.CurrencyAmountView.java
public void setStrikeThru(final boolean strikeThru) { if (strikeThru) textView.setPaintFlags(textView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); else/*from ww w .ja v a 2s. c om*/ textView.setPaintFlags(textView.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); }
From source file:com.xxxifan.devbox.core.util.ViewUtils.java
public static void addTextDelLine(TextView textView) { textView.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG); }
From source file:com.justplay1.shoppist.features.lists.items.ListItemAdapter.java
@Override public void onBindChildViewHolder(BaseSwipeableItemViewHolder viewHolder, int groupPosition, int childPosition, int viewType) { ListItemViewHolder holder = (ListItemViewHolder) viewHolder; holder.childPosition = childPosition; holder.groupPosition = groupPosition; final ListItemViewModel item = getChildItem(groupPosition, childPosition); if (!item.isChecked()) { item.setChecked(isItemChecked(item.getId())); }/* w ww. ja v a2 s .c o m*/ holder.name.setText(item.getName()); if (item.getStatus()) { holder.note.setVisibility(View.GONE); holder.info2.setVisibility(View.INVISIBLE); } else { holder.info2.setVisibility(View.VISIBLE); if (!item.getNote().isEmpty()) { View.OnClickListener listener = v -> { if (noteClickListener != null) { noteClickListener.onNoteClick(item.getNote()); } }; holder.note.setVisibility(View.VISIBLE); holder.note.setOnClickListener(listener); ViewUtils.setPaddingRight(holder.info2, 0); } else { ViewUtils.setPaddingRight(holder.info2, context.getResources().getDimensionPixelSize(R.dimen.content2x)); holder.note.setVisibility(View.GONE); } } if (preferences.getSortForShoppingListItems() == SortType.SORT_BY_CATEGORIES) { holder.categoryName.setVisibility(View.GONE); } else { holder.categoryName.setVisibility(View.VISIBLE); holder.categoryName.setText(item.getCategory().getName()); } if (item.getPrice() == 0 || item.getCurrency().getId().equals(CurrencyViewModel.NO_CURRENCY_ID)) { holder.priceAndCurrency.setVisibility(View.GONE); } else { holder.priceAndCurrency.setVisibility(View.VISIBLE); holder.priceAndCurrency.setText( String.format("%s %s", ShoppistUtils.roundDouble(item.getPrice() * item.getQuantity(), 2), item.getCurrency().getName())); } if (item.getQuantity() == 0 || item.getUnit().getId().equals(UnitViewModel.NO_UNIT_ID)) { holder.quantityAndUnit.setVisibility(View.GONE); } else { holder.quantityAndUnit.setVisibility(View.VISIBLE); holder.quantityAndUnit .setText(String.format("%s %s", item.getQuantity(), item.getUnit().getShortName())); } setPriorityBackgroundColor(item.getPriority(), holder.priorityIndicator); int normalStateColor = item.getCategory().getColor(); if (item.getStatus()) { holder.name.setPaintFlags(holder.name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); holder.categoryName.setPaintFlags(holder.categoryName.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); holder.name.setTextColor(ContextCompat.getColor(context, R.color.disable_text_color_black)); normalStateColor = ContextCompat.getColor(context, R.color.grey_300); holder.selectBox.setInnerTextColor(ContextCompat.getColor(context, R.color.disable_text_color_black)); } else { holder.name.setPaintFlags(holder.name.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); holder.categoryName.setPaintFlags(holder.categoryName.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); holder.name.setTextColor(ContextCompat.getColor(context, R.color.text_color_black)); holder.selectBox.setInnerTextColor(ContextCompat.getColor(context, R.color.white)); } holder.selectBox.setNormalStateColor(normalStateColor); holder.selectBox .setInnerText(ShoppistUtils.getFirstCharacter(item.getName()).toUpperCase(Locale.getDefault())); holder.selectBox.setEventListener(isChecked -> { onCheckItem(item, isChecked); holder.setActivated(isChecked); }); holder.selectBox.setChecked(item.isChecked()); holder.setActivated(item.isChecked()); if (item.isPinned()) { if (holder.getSwipeResult() == SwipeableItemConstants.RESULT_SWIPED_RIGHT) { holder.setSwipeItemHorizontalSlideAmount(SwipeableItemConstants.OUTSIDE_OF_THE_WINDOW_RIGHT); } else { holder.setSwipeItemHorizontalSlideAmount(SwipeableItemConstants.OUTSIDE_OF_THE_WINDOW_LEFT); } } else { holder.setSwipeItemHorizontalSlideAmount(0); } }
From source file:com.bhb27.isu.Main.java
protected void UpdateMain(boolean CMSU) { if (CMSU) {/*from w w w. j a va2 s .co m*/ suSwitch.setChecked(Tools.SuBinary(xbin_su)); SuStatus.setText( (suSwitch.isChecked() ? getString(R.string.activated) : getString(R.string.deactivated))); suSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { iSuSwitch(isChecked); } }); SuSwitchSummary.setText(getString(R.string.su_state)); // Selinux switch SelinuxSwitch.setChecked(Tools.isSELinuxActive()); SelinuxSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { SelinuxSwitch(isChecked); } }); per_app.setOnClickListener(new View.OnClickListener() { Intent myIntent = new Intent(getApplicationContext(), PerAppActivity.class); @Override public void onClick(View v) { startActivity(myIntent); } }); iSuNotification.setChecked(Tools.getBoolean("isu_notification", false, MainContext)); iSuNotification.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Tools.saveBoolean("isu_notification", isChecked, MainContext); } }); SuSelinuxSwitch.setChecked(Tools.getBoolean("main_restart_selinux", false, MainContext)); SuSelinuxSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Tools.saveBoolean("main_restart_selinux", isChecked, MainContext); } }); if (Tools.getBoolean("isu_notification", false, MainContext)) { try { MainContext.registerReceiver(updateMainReceiver, new IntentFilter("updateMainReceiver")); } catch (NullPointerException ignored) { } } upMain = true; } else { suSwitch.setEnabled(false); suSwitch.setTextColor(getColorWrapper(MainContext, R.color.text_gray)); suSwitch.setPaintFlags(suSwitch.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); SuSwitchSummary.setText(getString(R.string.su_not_cm)); su_version.setVisibility(View.GONE); SelinuxSwitch.setEnabled(false); SelinuxSwitch.setTextColor(getColorWrapper(MainContext, R.color.text_gray)); SelinuxSwitch.setPaintFlags(suSwitch.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); SuSelinuxSwitch.setEnabled(false); SuSelinuxSwitch.setTextColor(getColorWrapper(MainContext, R.color.text_gray)); SuSelinuxSwitch.setPaintFlags(suSwitch.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); iSuNotification.setEnabled(false); iSuNotification.setTextColor(getColorWrapper(MainContext, R.color.text_gray)); iSuNotification.setPaintFlags(suSwitch.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); SuSelinuxSwitchSummary.setVisibility(View.GONE); per_app.setEnabled(false); per_app_summary.setText(getString(R.string.not_available)); SuStatus.setVisibility(View.GONE); kernel_check.setTextColor(getColorWrapper(MainContext, R.color.colorAccent)); kernel_check.setText(getString(R.string.isu_kernel_no_su)); upMain = false; } }
From source file:com.example.android.todolist.AddTaskActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { // Update the data that the adapter uses to create ViewHolders // mAdapter.swapCursor(data); String title, description;//from w ww.java 2s .c o m int titleIndex = 0, descriptionIndex = 0, idIndex, timeIndex = 0; if (cursor.moveToFirst()) { // in case of new task not from archive if (isTaskUri) { idIndex = cursor.getColumnIndex(TaskContract.TaskEntry._ID); titleIndex = cursor.getColumnIndex(TaskContract.TaskEntry.COLUMN_TITLE); descriptionIndex = cursor.getColumnIndex(TaskContract.TaskEntry.COLUMN_DESCRIPTION); timeIndex = cursor.getColumnIndex(TaskContract.TaskEntry.COLUMN_TIME); colorPositionIndex = cursor.getColumnIndex(TaskContract.TaskEntry.COLUMN_COLOR_POSITION); //from archive } else { idIndex = cursor.getColumnIndex(TaskContract.TaskArchiveEntry._ID); titleIndex = cursor.getColumnIndex(TaskContract.TaskArchiveEntry.COLUMN_TITLE_ARCHIVE); descriptionIndex = cursor.getColumnIndex(TaskContract.TaskArchiveEntry.COLUMN_DESCRIPTION_ARCHIVE); } // Determine the values of the wanted data id = cursor.getInt(idIndex); title = cursor.getString(titleIndex); description = cursor.getString(descriptionIndex); long picked_hour = cursor.getLong(timeIndex); int color_pos = cursor.getInt(colorPositionIndex); selectColor(color_pos); edt_title.setText(title); edt_description.setText(description); if (isTaskUri) { if (picked_hour != 0) { SimpleDateFormat format1 = new SimpleDateFormat("E h:mm a"); choosenTime.setText(format1.format(picked_hour)); if (picked_hour < System.currentTimeMillis()) { choosenTime.setPaintFlags(choosenTime.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } } } // Toast.makeText(AddTaskActivity.this, "" + title + description, Toast.LENGTH_LONG).show(); } }