@Override public void onPageSelected(int position) { if (position + 1 == getSmoothPermissions().size()) { if (showSettings()) { yesButton.setText("Settings"); } else { yesButton.setText("Continue"); } } else { if (getSmoothPermissions().size() > 1) { yesButton.setText("Next"); } } updatePermissionState(position); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { AppCompatButton button = new AppCompatButton(inflater.getContext()); button.setText(R.string.action_access_grant); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivityForResult(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getActivity().getPackageName())), REQUEST_OVERLAY); } }); return button; } }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { AppCompatButton button = new AppCompatButton(inflater.getContext()); button.setText(R.string.action_access_grant); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivityForResult(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), REQUEST_ACCESSIBILITY); Toast.makeText(getContext(), R.string.msg_notification_switch_enable, Toast.LENGTH_LONG).show(); } }); return button; } }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { AppCompatButton button = new AppCompatButton(inflater.getContext()); button.setText(R.string.optimizations_name); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivityForResult(new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS), REQUEST_OPTIMIZATION); Toast.makeText(getContext(), R.string.msg_battery_optimizations_switch_enable, Toast.LENGTH_LONG).show(); } }); return button; } }
@Override public void onClick(View view) { pause = !pause; resumePauseButton.setText(getContext().getString(pause ? R.string.resume : R.string.pause)); if (pause) downloadTask.pause(); else downloadTask.resume(); } });
@Override public void onResume() { super.onResume(); ArrayList<SmoothPermission> smoothPermissions = new ArrayList<>(); showSettings = ((RationaleBase) getActivity()).showSettings(smoothPermissions, buildAnyway()); this.smoothPermissions = smoothPermissions; if (smoothPermissions.size() == 0) { dismissAllowingStateLoss(); returnCallback(getSmoothPermissions(), buildAnyway()); } else { initPager(); if (smoothPermissions.size() > 1) { if (showSettings) { yesButton.setText("Next"); } else { if (rationalePager.getCurrentItem() == 0) { yesButton.setText("Next"); } else { yesButton.setText("Continue"); } } } else { if (showSettings) { yesButton.setText("Settings"); } else { yesButton.setText("Continue"); } } } }
@Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { NormalViewHolder normalViewHolder = (NormalViewHolder) holder; ReadLaterArticleData data = mList.get(position); normalViewHolder.textAuthor.setText(data.getAuthor()); normalViewHolder.textTitle.setText(StringUtil.replaceInvalidChar(data.getTitle())); //if the text is too long, the button can not show it correctly.The solution is adding " ". normalViewHolder.btnCategory.setText(" "+data.getChapterName()+" "); normalViewHolder.textTime.setText(simpleDateFormat.format(new Date(data.getTimestamp()))); }
@Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { NormalViewHolder normalViewHolder = (NormalViewHolder) holder; FavoriteArticleDetailData data = mList.get(position); normalViewHolder.textAuthor.setText(data.getAuthor()); normalViewHolder.textTitle.setText(StringUtil.replaceInvalidChar(data.getTitle())); //if the text is too long, the button can not show it correctly.The solution is adding " ". normalViewHolder.btnCategory.setText(" "+data.getChapterName()+" "); normalViewHolder.textTime.setText(data.getNiceDate()); }
if (position == types.size()) { AppCompatButton button = new AppCompatButton(getContext()); button.setText("Add New Account Type"); button.setOnClickListener(this); return button;
if (position == categories.size()) { AppCompatButton ret = new AppCompatButton(getContext()); ret.setText("Add New Category"); ret.setOnClickListener(new View.OnClickListener() { @Override
@Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (getItemViewType(position) == HEADER_VIEW) { return; } NormalViewHolder normalViewHolder = (NormalViewHolder) holder; ArticleDetailData data = mList.get(getRealPosition(position)); normalViewHolder.textAuthor.setText(data.getAuthor()); normalViewHolder.textTitle.setText(StringUtil.replaceInvalidChar(data.getTitle())); //if the text is too long, the button can not show it correctly.The solution is adding " ". normalViewHolder.btnCategory.setText(" "+data.getChapterName()+" "); normalViewHolder.textTime.setText(data.getNiceDate()); }
selectAllButton.setText(getString(R.string.select_all)); checkBoxLayout.addView(selectAllButton);