use of org.wikipedia.page.LinkMovementMethodExt in project apps-android-wikipedia by wikimedia.
the class ReadingListSyncBehaviorDialogs method promptLogInToSyncDialog.
static void promptLogInToSyncDialog(@NonNull Activity activity) {
if (!Prefs.shouldShowReadingListSyncEnablePrompt()) {
return;
}
View view = activity.getLayoutInflater().inflate(R.layout.dialog_with_checkbox, null);
TextView message = view.findViewById(R.id.dialog_message);
CheckBox checkbox = view.findViewById(R.id.dialog_checkbox);
message.setText(StringUtil.fromHtml(activity.getString(R.string.reading_lists_login_reminder_text_with_link)));
message.setMovementMethod(new LinkMovementMethodExt((@NonNull String url, @Nullable String notUsed) -> {
FeedbackUtil.showAndroidAppFAQ(activity);
}));
new AlertDialog.Builder(activity).setCancelable(false).setTitle(R.string.reading_list_login_reminder_title).setView(view).setPositiveButton(R.string.reading_list_preference_login_or_signup_to_enable_sync_dialog_login, (dialogInterface, i) -> {
Intent loginIntent = LoginActivity.newIntent(activity, LoginFunnel.SOURCE_READING_MANUAL_SYNC);
activity.startActivity(loginIntent);
}).setNegativeButton(R.string.reading_list_prompt_turned_sync_on_dialog_no_thanks, null).setOnDismissListener((dialog) -> {
Prefs.shouldShowReadingListSyncEnablePrompt(!checkbox.isChecked());
}).show();
}
use of org.wikipedia.page.LinkMovementMethodExt in project apps-android-wikipedia by wikimedia.
the class LocalCompilationsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_local_compilations, container, false);
unbinder = ButterKnife.bind(this, view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
errorView.setBackClickListener(v -> getActivity().finish());
emptyDescription.setMovementMethod(LinkMovementMethod.getInstance());
emptyDescription.setText(StringUtil.fromHtml(getString(R.string.offline_library_empty_description_sideload)));
RichTextUtil.removeUnderlinesFromLinks(emptyDescription);
packsHint.setMovementMethod(LinkMovementMethod.getInstance());
packsHint.setText(StringUtil.fromHtml(getString(R.string.offline_library_packs_hint)));
RichTextUtil.removeUnderlinesFromLinks(packsHint);
dataUsageHint.setMovementMethod(new LinkMovementMethodExt((url, titleString) -> {
if (url.equals(UriUtil.LOCAL_URL_SETTINGS)) {
startActivity(SettingsActivity.newIntent(getContext()));
}
}));
dataUsageHint.setText(StringUtil.fromHtml(getString(R.string.offline_library_data_usage_hint)));
RichTextUtil.removeUnderlinesFromLinks(dataUsageHint);
funnel = new OfflineLibraryFunnel(WikipediaApp.getInstance(), 0);
return view;
}
use of org.wikipedia.page.LinkMovementMethodExt in project apps-android-wikipedia by wikimedia.
the class OnboardingPageView method init.
private void init(@Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
setOrientation(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ? VERTICAL : HORIZONTAL);
inflate(getContext(), R.layout.view_onboarding_page, this);
ButterKnife.bind(this);
if (attrs != null) {
TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.OnboardingPageView, defStyleAttr, defStyleRes);
Drawable centeredImage = ContextCompat.getDrawable(getContext(), array.getResourceId(R.styleable.OnboardingPageView_centeredImage, -1));
String primaryText = array.getString(R.styleable.OnboardingPageView_primaryText);
String secondaryText = array.getString(R.styleable.OnboardingPageView_secondaryText);
String tertiaryText = array.getString(R.styleable.OnboardingPageView_tertiaryText);
String switchText = array.getString(R.styleable.OnboardingPageView_switchText);
int imageSize = array.getDimensionPixelSize(R.styleable.OnboardingPageView_imageSize, 0);
Drawable background = array.getDrawable(R.styleable.OnboardingPageView_background);
if (background != null) {
setBackground(background);
}
FrameLayout.LayoutParams imageParams = (FrameLayout.LayoutParams) imageViewCentered.getLayoutParams();
imageParams.width = imageSize;
imageParams.height = imageSize;
imageViewCentered.setLayoutParams(imageParams);
imageViewCentered.setImageDrawable(centeredImage);
primaryTextView.setText(primaryText);
secondaryTextView.setText(StringUtil.fromHtml(secondaryText));
tertiaryTextView.setText(tertiaryText);
switchContainer.setVisibility(TextUtils.isEmpty(switchText) ? GONE : VISIBLE);
switchView.setText(switchText);
secondaryTextView.setMovementMethod(new LinkMovementMethodExt((@NonNull String url, @Nullable String notUsed) -> {
if (callback != null) {
callback.onLinkClick(OnboardingPageView.this, url);
}
}));
array.recycle();
}
}
use of org.wikipedia.page.LinkMovementMethodExt in project apps-android-wikipedia by wikimedia.
the class EditSectionActivity method updateEditLicenseText.
private void updateEditLicenseText() {
TextView editLicenseText = findViewById(R.id.edit_section_license_text);
editLicenseText.setText(StringUtil.fromHtml(String.format(getString(AccountUtil.isLoggedIn() ? R.string.edit_save_action_license_logged_in : R.string.edit_save_action_license_anon), getString(R.string.terms_of_use_url), getString(R.string.cc_by_sa_3_url))));
editLicenseText.setMovementMethod(new LinkMovementMethodExt((@NonNull String url, @Nullable String notUsed) -> {
if (url.equals("https://#login")) {
funnel.logLoginAttempt();
Intent loginIntent = LoginActivity.newIntent(EditSectionActivity.this, LoginFunnel.SOURCE_EDIT, funnel.getSessionToken());
startActivityForResult(loginIntent, Constants.ACTIVITY_REQUEST_LOGIN);
} else {
handleExternalLink(EditSectionActivity.this, Uri.parse(url));
}
}));
}
use of org.wikipedia.page.LinkMovementMethodExt in project apps-android-wikipedia by wikimedia.
the class ReadingListSyncBehaviorDialogs method promptEnableSyncDialog.
public static void promptEnableSyncDialog(@NonNull Activity activity) {
if (!Prefs.shouldShowReadingListSyncEnablePrompt()) {
return;
}
View view = activity.getLayoutInflater().inflate(R.layout.dialog_with_checkbox, null);
TextView message = view.findViewById(R.id.dialog_message);
CheckBox checkbox = view.findViewById(R.id.dialog_checkbox);
message.setText(StringUtil.fromHtml(activity.getString(R.string.reading_list_prompt_turned_sync_on_dialog_text)));
message.setMovementMethod(new LinkMovementMethodExt((@NonNull String url, @Nullable String notUsed) -> {
FeedbackUtil.showAndroidAppFAQ(activity);
}));
new AlertDialog.Builder(activity).setCancelable(false).setTitle(R.string.reading_list_prompt_turned_sync_on_dialog_title).setView(view).setPositiveButton(R.string.reading_list_prompt_turned_sync_on_dialog_enable_syncing, (dialogInterface, i) -> {
Prefs.shouldShowReadingListSyncMergePrompt(true);
ReadingListSyncAdapter.setSyncEnabledWithSetup();
}).setNegativeButton(R.string.reading_list_prompt_turned_sync_on_dialog_no_thanks, null).setOnDismissListener((dialog) -> {
Prefs.shouldShowReadingListSyncEnablePrompt(!checkbox.isChecked());
}).show();
}
Aggregations