android.support.v7.widget.AppCompatTextView Java Examples
The following examples show how to use
android.support.v7.widget.AppCompatTextView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From appauth-android-codelab with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMainApplication = (MainApplication) getApplication(); mAuthorize = (AppCompatButton) findViewById(R.id.authorize); mMakeApiCall = (AppCompatButton) findViewById(R.id.makeApiCall); mSignOut = (AppCompatButton) findViewById(R.id.signOut); mGivenName = (AppCompatTextView) findViewById(R.id.givenName); mFamilyName = (AppCompatTextView) findViewById(R.id.familyName); mFullName = (AppCompatTextView) findViewById(R.id.fullName); mProfileView = (ImageView) findViewById(R.id.profileImage); enablePostAuthorizationFlows(); // wire click listeners mAuthorize.setOnClickListener(new AuthorizeListener()); }
Example #2
Source File: DotLayout.java From nono-android with GNU General Public License v3.0 | 6 votes |
@Override protected void initUI() { LinearLayout linearLayout=new LinearLayout(getContext()); linearLayout.setOrientation(LinearLayout.HORIZONTAL); textView=new AppCompatTextView(getContext()); int size=(int)(getResources().getDisplayMetrics().density*32); LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(size,size); //lp.gravity=Gravity.CENTER_VERTICAL; textView.setLayoutParams(lp); textView.setText("·"); textView.setTextColor(0xff000000); textView.setTextAppearance(getContext(),R.style.DotTextAppearance); textView.setGravity(Gravity.CENTER); editText=new BaseRichEditText(getContext()); editText.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT,1.0f)); linearLayout.addView(textView); linearLayout.addView(editText); this.addView(linearLayout); }
Example #3
Source File: SpringSettingsBottomDialog.java From CircularReveal with MIT License | 6 votes |
private SeekBar createConfigurationView(CharSequence label, int defaultVal, SeekBar.OnSeekBarChangeListener changeListener) { final TextView labelView = new AppCompatTextView(getContext(), null, R.style.TextAppearance_AppCompat_Caption); labelView.setText(label); labelView.setLayoutParams(createMarginLayoutParams(MATCH_PARENT, WRAP_CONTENT, 0, 0, 0, dp(8))); final SeekBar seekBar = new SeekBar(getContext()); seekBar.setProgress(defaultVal); seekBar.setMax(100); seekBar.setOnSeekBarChangeListener(changeListener); seekBar.setLayoutParams(createMarginLayoutParams(MATCH_PARENT, WRAP_CONTENT, 0, 0, 0, dp(16))); addView(labelView); addView(seekBar); return seekBar; }
Example #4
Source File: PhotoLayout.java From nono-android with GNU General Public License v3.0 | 6 votes |
private void initPreContainer(){ preContainer=new LinearLayout(getContext()); preContainer.setOrientation(LinearLayout.HORIZONTAL); LayoutParams lp=new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.gravity=Gravity.CENTER_VERTICAL; preContainer.setLayoutParams(lp); preContainer.setOnClickListener(this); AppCompatImageView tmpImageView=new AppCompatImageView(getContext()); tmpImageView.setBackgroundResource(R.mipmap.ic_image_black_24dp); AppCompatTextView tmpTextView=new AppCompatTextView(getContext()); LinearLayout.LayoutParams lp1=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.gravity=Gravity.CENTER_VERTICAL; tmpImageView.setLayoutParams(lp1); tmpTextView.setLayoutParams(lp1); tmpTextView.setText(getContext().getString(R.string.select_photo)); preContainer.addView(tmpImageView); preContainer.addView(tmpTextView); this.addView(preContainer); }
Example #5
Source File: IndexableLayout.java From IndexableRecyclerView with Apache License 2.0 | 6 votes |
private void initMDOverlay(int color) { mMDOverlay = new AppCompatTextView(mContext); mMDOverlay.setBackgroundResource(R.drawable.indexable_bg_md_overlay); ((AppCompatTextView) mMDOverlay).setSupportBackgroundTintList(ColorStateList.valueOf(color)); mMDOverlay.setSingleLine(); mMDOverlay.setTextColor(Color.WHITE); mMDOverlay.setTextSize(38); mMDOverlay.setGravity(Gravity.CENTER); int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 72, getResources().getDisplayMetrics()); LayoutParams params = new LayoutParams(size, size); params.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 33, getResources().getDisplayMetrics()); params.gravity = Gravity.END; mMDOverlay.setLayoutParams(params); mMDOverlay.setVisibility(INVISIBLE); addView(mMDOverlay); }
Example #6
Source File: ShopCartDelegate.java From FastWaiMai with MIT License | 6 votes |
@Override public void checkItemCount() { final int totalCount = mAdapter.getItemCount(); if (totalCount == 0) { //购物车中没有商品 @SuppressLint("RestrictedApi") //去购物 UI显示 final View stubView = mStubNoItem.inflate(); final AppCompatTextView stubToBuy = (AppCompatTextView) stubView.findViewById(R.id.tv_stub_to_buy); stubToBuy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getSupportDelegate().start(new IndexDelegate()); } }); mRecyclerView.setVisibility(View.GONE); } else { mRecyclerView.setVisibility(View.VISIBLE); } }
Example #7
Source File: DetailActivity.java From Puff-Android with MIT License | 6 votes |
private void wireUpViews(){ tvAccount = (AppCompatTextView) findViewById(R.id.account); tvPasswd = (AppCompatTextView) findViewById(R.id.password); tvAdditional = (AppCompatTextView) findViewById(R.id.additional); tvTitle = (AppCompatTextView) findViewById(R.id.id_name); image = (AppCompatImageView) findViewById(R.id.account_image); tvWebSite = (AppCompatTextView) findViewById(R.id.id_website_link); tvWebSiteTitle = (AppCompatTextView) findViewById(R.id.website_title); webSiteContainer = (LinearLayout) findViewById(R.id.website_container); tvLastAccess = (AppCompatTextView) findViewById(R.id.last_accessed); webSiteContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url = account.getWebsite(); if (!url.startsWith("http://") && !url.startsWith("https://")) url = "http://" + url; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); }
Example #8
Source File: BaseActivity.java From africastalking-android with MIT License | 6 votes |
protected void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) { hideKeyboard(); AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header); AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc); AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img); if (error) { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close"); } else { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok"); } infoHeader.setText(header); infoDesc.setText(desc); if (drawable != null) infoImg.setImageDrawable(drawable); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); }
Example #9
Source File: Luhn.java From Luhn with MIT License | 6 votes |
private void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) { hideKeyboard(); AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header); AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc); AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img); if (error) { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close"); } else { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok"); } infoHeader.setText(header); infoDesc.setText(desc); if (drawable != null) infoImg.setImageDrawable(drawable); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); }
Example #10
Source File: AddRouteActivity.java From kute with Apache License 2.0 | 6 votes |
/********** Overrides ***********/ @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_route); days=null; //Initialise the views name=(AppCompatEditText)findViewById(R.id.routeName); source=(AppCompatTextView) findViewById(R.id.startPlace); destination=(AppCompatTextView) findViewById(R.id.destination); destination.setOnClickListener(this); source.setOnClickListener(this); time=(TextView)findViewById(R.id.startTime); seats=(AppCompatEditText)findViewById(R.id.seatsAvailable); backnav=(ImageButton)findViewById(R.id.backNav); backnav.setOnClickListener(this); add_button=(ImageButton)findViewById(R.id.addButton); add_button.setOnClickListener(this); set_days=(ImageButton)findViewById(R.id.setDaysButton); set_days.setOnClickListener(this); time_layout=(RelativeLayout)findViewById(R.id.timeLayout); time_layout.setOnClickListener(this); }
Example #11
Source File: SelfRouteDetailActivity.java From kute with Apache License 2.0 | 6 votes |
public void connectViews(){ editButton=(ImageButton)findViewById(R.id.editButton); backNav=(ImageButton)findViewById(R.id.backNav); route_name=(TextView)findViewById(R.id.routeNameText); no_seats=(TextView)findViewById(R.id.noSeats); to=(AppCompatTextView) findViewById(R.id.destination); from=(AppCompatTextView)findViewById(R.id.startPlace); time=(TextView)findViewById(R.id.startTime); days_button=(ImageButton)findViewById(R.id.daysSelect); days_button.setOnClickListener(this); delete_route=(Button)findViewById(R.id.deleteRoute); start_trip=(Button)findViewById(R.id.startTrip); delete_route.setOnClickListener(this); start_trip.setOnClickListener(this); no_of_seats_edit=(AppCompatEditText)findViewById(R.id.noSeatEdit); route_name_edit=(AppCompatEditText)findViewById(R.id.routeNameEdit); to.setOnClickListener(this); from.setOnClickListener(this); backNav.setOnClickListener(this); editButton.setOnClickListener(this); }
Example #12
Source File: PlaceSearchDialog.java From place-search-dialog with Apache License 2.0 | 6 votes |
public void init() { locationET = (AppCompatAutoCompleteTextView) findViewById(R.id.place_search_dialog_location_ET); locationTIL = (TextInputLayout) findViewById(R.id.place_search_dialog_location_TIL); cancelTV = (AppCompatTextView) findViewById(R.id.place_search_dialog_cancel_TV); okTV = (AppCompatTextView) findViewById(R.id.place_search_dialog_ok_TV); headerImageIV = (ImageView) findViewById(R.id.place_search_dialog_header_image_IV); okTV.setOnClickListener(this); cancelTV.setOnClickListener(this); buildDialog(); locationET.setOnItemClickListener(mAutocompleteClickListener); mAdapter = new PlaceAutocompleteAdapter(context, mGoogleApiClient, BOUNDS_WORLD, null); locationET.setThreshold(3); locationET.setAdapter(mAdapter); }
Example #13
Source File: SetFragment.java From LLApp with Apache License 2.0 | 6 votes |
@OnClick(R.id.rl_about) void about() { View dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_about, null); About_dialog = new AlertDialog.Builder(getActivity()) .setView(dialogView) .create(); TextView autho = (AppCompatTextView) dialogView.findViewById(R.id.tv_author_github); TextView blog = (AppCompatTextView) dialogView.findViewById(R.id.tv_author_blog); TextView address = (AppCompatTextView) dialogView.findViewById(R.id.tv_open_address); TextView sure = (AppCompatTextView) dialogView.findViewById(R.id.tv_affirm); autho.setTextColor(StaticValue.color); blog.setTextColor(StaticValue.color); address.setTextColor(StaticValue.color); sure.setTextColor(StaticValue.color); setUnderline(autho); setUnderline(blog); setUnderline(address); autho.setOnClickListener(this); blog.setOnClickListener(this); address.setOnClickListener(this); sure.setOnClickListener(this); About_dialog.show(); }
Example #14
Source File: ActivityUtils.java From memetastic with GNU General Public License v3.0 | 6 votes |
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) { ScrollView scroll = new ScrollView(_context); AppCompatTextView textView = new AppCompatTextView(_context); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics()); scroll.setPadding(padding, 0, padding, 0); scroll.addView(textView); textView.setMovementMethod(new LinkMovementMethod()); textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17); AlertDialog.Builder dialog = new AlertDialog.Builder(_context) .setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener) .setView(scroll); if (resTitleId != 0) { dialog.setTitle(resTitleId); } dialogFullWidth(dialog.show(), true, false); }
Example #15
Source File: DownloadManagerResolver.java From FaceSlim with GNU General Public License v2.0 | 6 votes |
private static AlertDialog createDialog(final Context context) { AppCompatTextView messageTextView = new AppCompatTextView(context); messageTextView.setTextSize(16f); messageTextView.setText(context.getString(R.string.download_manager_disabled)); messageTextView.setPadding(50, 50, 50, 0); messageTextView.setTextColor(ContextCompat.getColor(context, R.color.black)); return new AlertDialog.Builder(context) .setView(messageTextView) .setPositiveButton("ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { enableDownloadManager(context); } }) .setCancelable(false) .create(); }
Example #16
Source File: MainActivity.java From appauth-android-codelab with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMainApplication = (MainApplication) getApplication(); mAuthorize = (AppCompatButton) findViewById(R.id.authorize); mMakeApiCall = (AppCompatButton) findViewById(R.id.makeApiCall); mSignOut = (AppCompatButton) findViewById(R.id.signOut); mGivenName = (AppCompatTextView) findViewById(R.id.givenName); mFamilyName = (AppCompatTextView) findViewById(R.id.familyName); mFullName = (AppCompatTextView) findViewById(R.id.fullName); mProfileView = (ImageView) findViewById(R.id.profileImage); enablePostAuthorizationFlows(); // wire click listeners mAuthorize.setOnClickListener(new AuthorizeListener()); }
Example #17
Source File: MainActivity.java From appauth-android-codelab with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMainApplication = (MainApplication) getApplication(); mAuthorize = (AppCompatButton) findViewById(R.id.authorize); mMakeApiCall = (AppCompatButton) findViewById(R.id.makeApiCall); mSignOut = (AppCompatButton) findViewById(R.id.signOut); mGivenName = (AppCompatTextView) findViewById(R.id.givenName); mFamilyName = (AppCompatTextView) findViewById(R.id.familyName); mFullName = (AppCompatTextView) findViewById(R.id.fullName); mProfileView = (ImageView) findViewById(R.id.profileImage); enablePostAuthorizationFlows(); // wire click listeners mAuthorize.setOnClickListener(new AuthorizeListener(this)); // Retrieve app restrictions and take appropriate action getAppRestrictions(); }
Example #18
Source File: CPUFragment.java From kernel_adiutor with Apache License 2.0 | 5 votes |
private void coreInit() { LinearLayout layout = new LinearLayout(getActivity()); layout.setOrientation(LinearLayout.VERTICAL); mCoreCheckBox = new AppCompatCheckBox[CPU.getBigCoreRange().size()]; mCoreProgressBar = new ProgressBar[mCoreCheckBox.length]; mCoreUsageText = new AppCompatTextView[mCoreCheckBox.length]; mCoreFreqText = new AppCompatTextView[mCoreCheckBox.length]; for (int i = 0; i < mCoreCheckBox.length; i++) { View view = inflater.inflate(R.layout.coreview, container, false); mCoreCheckBox[i] = (AppCompatCheckBox) view.findViewById(R.id.core_checkbox); mCoreCheckBox[i].setText(String.format(getString(R.string.core), i + 1)); mCoreCheckBox[i].setOnClickListener(this); mCoreProgressBar[i] = (ProgressBar) view.findViewById(R.id.progressbar); mCoreProgressBar[i].setMax(CPU.getFreqs().size()); mCoreUsageText[i] = (AppCompatTextView) view.findViewById(R.id.usage); mCoreFreqText[i] = (AppCompatTextView) view.findViewById(R.id.freq); layout.addView(view); } CardViewItem.DCardView coreCard = new CardViewItem.DCardView(); coreCard.setTitle(getString(R.string.current_freq)); coreCard.setView(layout); addView(coreCard); }
Example #19
Source File: SimpleListViewHolder.java From Puff-Android with MIT License | 5 votes |
public void configureWithAccount(Account account, int index) { this.type = SimpleListViewType.SimpleListViewTypeAccount; ((AppCompatTextView) itemView.findViewById(R.id.account_name)).setText(account.getName()); Picasso.with(itemView.getContext()).load(ResUtil.getInstance(itemView.getContext().getApplicationContext()).getBmpUri(account.getIcon())) .fit() .config(Bitmap.Config.RGB_565) .into((ImageView) itemView.findViewById(R.id.account_image)); this.index = index; }
Example #20
Source File: BottomSheetDialogView.java From ESeal with Apache License 2.0 | 5 votes |
public ViewHolder(View itemView) { super(itemView); securityLevelImageView = (ImageView) itemView.findViewById(R.id.securityLevel); timeTextView = (AppCompatTextView) itemView.findViewById(R.id.createDatetime); actionTypeTextView = (AppCompatTextView) itemView.findViewById(R.id.actionType); itemContent = itemView.findViewById(R.id.item_content); }
Example #21
Source File: CallRecyclerViewAdapter.java From PowerSwitch_Android with GNU General Public License v3.0 | 5 votes |
@Override public void onBindViewHolder(final CallRecyclerViewAdapter.ViewHolder holder, int position) { final CallEvent callEvent = callEvents.get(holder.getAdapterPosition()); String phoneNumbers = ""; Iterator<String> iterator = callEvent.getPhoneNumbers(PhoneConstants.Type.INCOMING).iterator(); while (iterator.hasNext()) { phoneNumbers += iterator.next(); if (iterator.hasNext()) { phoneNumbers += "\n"; } } holder.phoneNumbers.setText(phoneNumbers); for (Action action : callEvent.getActions(PhoneConstants.Type.INCOMING)) { AppCompatTextView textViewActionDescription = new AppCompatTextView(context); textViewActionDescription.setText(action.toString()); textViewActionDescription.setPadding(0, 0, 0, 4); holder.linearLayoutActions.addView(textViewActionDescription); } if (holder.getAdapterPosition() == getItemCount() - 1) { holder.footer.setVisibility(View.VISIBLE); } else { holder.footer.setVisibility(View.GONE); } }
Example #22
Source File: ComprehensionTest.java From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void saveAPK() { onView(withId(R.id.action_save)).perform(click()); onView(withText("Save APK")).perform(click()); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String finalApk = getText(allOf(withResourceName("content"), is(instanceOf(AppCompatTextView.class)))); finalApk = finalApk.substring(18, finalApk.length()); File file = new File(finalApk); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); mActivityRule.getActivity().startActivity(intent); }
Example #23
Source File: BottomSheetDialogView.java From ESeal with Apache License 2.0 | 5 votes |
public ViewHolder(View itemView) { super(itemView); securityLevelImageView = (ImageView) itemView.findViewById(R.id.securityLevel); timeTextView = (AppCompatTextView) itemView.findViewById(R.id.createDatetime); actionTypeTextView = (AppCompatTextView) itemView.findViewById(R.id.actionType); itemContent = itemView.findViewById(R.id.item_content); }
Example #24
Source File: IndexableStickyListView.java From SprintNBA with Apache License 2.0 | 5 votes |
private void initRightOverlayTextView(int color) { mTvRightOverlay = new AppCompatTextView(mContext); mTvRightOverlay.setBackgroundResource(R.drawable.bg_right_overlay); mTvRightOverlay.setSupportBackgroundTintList(ColorStateList.valueOf(color)); mTvRightOverlay.setTextColor(Color.WHITE); mTvRightOverlay.setTextSize(38); mTvRightOverlay.setGravity(Gravity.CENTER); int size = IndexBar.dp2px(mContext, 72); LayoutParams params = new LayoutParams(size, size); params.rightMargin = IndexBar.dp2px(mContext, 33); params.gravity = Gravity.RIGHT; mTvRightOverlay.setLayoutParams(params); mTvRightOverlay.setVisibility(INVISIBLE); }
Example #25
Source File: LogOnActivity.java From nono-android with GNU General Public License v3.0 | 5 votes |
void getDefinition() { mLogOnButton=(AppCompatImageView)this.findViewById(R.id.account_sign_in_button); mRegisterButton = (AppCompatButton)findViewById(R.id.account_register_button); passwordEditText=((EditText)this.findViewById(R.id.password)); tv_find_password = ((AppCompatTextView) this.findViewById(R.id.tv_find_password)); tv_quick_log_on = ((AppCompatTextView) this.findViewById(R.id.tv_quick_log_on)); }
Example #26
Source File: EmailVerificationActivity.java From ResearchStack with Apache License 2.0 | 5 votes |
private void updateEmailText() { int accentColor = ThemeUtils.getAccentColor(this); String accentColorString = "#" + Integer.toHexString(Color.red(accentColor)) + Integer.toHexString(Color.green(accentColor)) + Integer.toHexString(Color.blue(accentColor)); String formattedSummary = getString(R.string.rss_confirm_summary, "<font color=\"" + accentColorString + "\">" + email + "</font>"); ((AppCompatTextView) findViewById(R.id.email_verification_body)).setText(Html.fromHtml( formattedSummary)); }
Example #27
Source File: ActivityUtils.java From Stringlate with MIT License | 5 votes |
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) { AppCompatTextView textView = new AppCompatTextView(_context); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics()); textView.setMovementMethod(new LinkMovementMethod()); textView.setPadding(padding, 0, padding, 0); textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text); AlertDialog.Builder dialog = new AlertDialog.Builder(_context) .setPositiveButton(android.R.string.ok, null) .setOnDismissListener(dismissedListener) .setTitle(resTitleId) .setView(textView); dialog.show(); }
Example #28
Source File: ProfileFragment.java From citrus with Apache License 2.0 | 5 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Count of uncompleted tasks AppCompatTextView uncompletedTaskCount = findById(view, R.id.profile_uncompleted_count_text); long uncompletedCount = TaskRepository.countByCompleted(mUIThreadRealm, false); uncompletedTaskCount.setText(String.valueOf(uncompletedCount)); // Count of completed tasks AppCompatTextView completedTaskCount = findById(view, R.id.profile_completed_count_text); long completedCount = TaskRepository.countByCompleted(mUIThreadRealm, true); completedTaskCount.setText(String.valueOf(completedCount)); // Count of all tasks AppCompatTextView allTaskCount = findById(view, R.id.profile_all_count_text); long allCount = TaskRepository.count(mUIThreadRealm); allTaskCount.setText(String.valueOf(allCount)); // Description about state of task AppCompatTextView state = findById(view, R.id.profile_state_text); String stateStr; if (completedCount < uncompletedCount) { stateStr = getString(R.string.you_can_do_it); } else if (completedCount > uncompletedCount) { stateStr = getString(R.string.good_job); } else { stateStr = getString(R.string.keep_it_up); } state.setText(stateStr); }
Example #29
Source File: ActivityUtils.java From kimai-android with MIT License | 5 votes |
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) { ScrollView scroll = new ScrollView(_context); AppCompatTextView textView = new AppCompatTextView(_context); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics()); scroll.setPadding(padding, 0, padding, 0); scroll.addView(textView); textView.setMovementMethod(new LinkMovementMethod()); textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text); AlertDialog.Builder dialog = new AlertDialog.Builder(_context) .setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener) .setTitle(resTitleId).setView(scroll); dialog.show(); }
Example #30
Source File: BaseFilesListHolder.java From ExFilePicker with MIT License | 5 votes |
BaseFilesListHolder(@NonNull View itemView) { super(itemView); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); mFileName = (AppCompatTextView) itemView.findViewById(R.id.filename); mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.checkbox); }