Adding a donate button
This commit is contained in:
parent
677621f2da
commit
8bbfa2e417
|
@ -190,6 +190,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
items.add(checkForUpdateItem);
|
items.add(checkForUpdateItem);
|
||||||
}
|
}
|
||||||
items.add(new TextItem(R.string.sk_settings_contribute, ()->UiUtils.launchWebBrowser(getActivity(), "https://github.com/LucasGGamerM/moshidon")));
|
items.add(new TextItem(R.string.sk_settings_contribute, ()->UiUtils.launchWebBrowser(getActivity(), "https://github.com/LucasGGamerM/moshidon")));
|
||||||
|
items.add(new TextItem(R.string.sk_settings_donate, ()->UiUtils.launchWebBrowser(getActivity(), "https://github.com/sponsors/LucasGGamerM"), R.drawable.ic_fluent_heart_24_regular));
|
||||||
items.add(new TextItem(R.string.settings_clear_cache, this::clearImageCache));
|
items.add(new TextItem(R.string.settings_clear_cache, this::clearImageCache));
|
||||||
items.add(new TextItem(R.string.sk_clear_recent_languages, ()->UiUtils.showConfirmationAlert(getActivity(), R.string.sk_clear_recent_languages, R.string.sk_confirm_clear_recent_languages, R.string.clear, ()->{
|
items.add(new TextItem(R.string.sk_clear_recent_languages, ()->UiUtils.showConfirmationAlert(getActivity(), R.string.sk_clear_recent_languages, R.string.sk_confirm_clear_recent_languages, R.string.clear, ()->{
|
||||||
GlobalUserPreferences.recentLanguages.remove(accountID);
|
GlobalUserPreferences.recentLanguages.remove(accountID);
|
||||||
|
@ -548,15 +549,25 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
private String text;
|
private String text;
|
||||||
private Runnable onClick;
|
private Runnable onClick;
|
||||||
private boolean loading;
|
private boolean loading;
|
||||||
|
private int icon;
|
||||||
|
|
||||||
public TextItem(@StringRes int text, Runnable onClick) {
|
public TextItem(@StringRes int text, Runnable onClick) {
|
||||||
this(text, onClick, false);
|
this(text, onClick, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextItem(@StringRes int text, Runnable onClick, boolean loading) {
|
public TextItem(@StringRes int text, Runnable onClick, boolean loading) {
|
||||||
|
this(text, onClick, loading, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextItem(@StringRes int text, Runnable onClick, @DrawableRes int icon) {
|
||||||
|
this(text, onClick, false, icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextItem(@StringRes int text, Runnable onClick, boolean loading, @DrawableRes int icon){
|
||||||
this.text=getString(text);
|
this.text=getString(text);
|
||||||
this.onClick=onClick;
|
this.onClick=onClick;
|
||||||
this.loading=loading;
|
this.loading=loading;
|
||||||
|
this.icon=icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -809,17 +820,20 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
private class TextViewHolder extends BindableViewHolder<TextItem> implements UsableRecyclerView.Clickable{
|
private class TextViewHolder extends BindableViewHolder<TextItem> implements UsableRecyclerView.Clickable{
|
||||||
private final TextView text;
|
private final TextView text;
|
||||||
private final ProgressBar progress;
|
private final ProgressBar progress;
|
||||||
|
private final ImageView icon;
|
||||||
|
|
||||||
public TextViewHolder(){
|
public TextViewHolder(){
|
||||||
super(getActivity(), R.layout.item_settings_text, list);
|
super(getActivity(), R.layout.item_settings_text, list);
|
||||||
text = itemView.findViewById(R.id.text);
|
text = itemView.findViewById(R.id.text);
|
||||||
progress = itemView.findViewById(R.id.progress);
|
progress = itemView.findViewById(R.id.progress);
|
||||||
|
icon = itemView.findViewById(R.id.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBind(TextItem item){
|
public void onBind(TextItem item){
|
||||||
text.setText(item.text);
|
text.setText(item.text);
|
||||||
progress.animate().alpha(item.loading ? 1 : 0);
|
progress.animate().alpha(item.loading ? 1 : 0);
|
||||||
|
if (item.icon != 0) icon.setImageDrawable(getActivity().getTheme().getDrawable(item.icon));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||||
|
<path android:pathData="M12.82 5.58l-0.821 0.822-0.823-0.823c-2.1-2.1-5.503-2.1-7.602 0-2.099 2.099-2.099 5.502 0 7.601l7.896 7.896c0.293 0.293 0.767 0.293 1.06 0l7.902-7.897c2.094-2.106 2.098-5.5-0.002-7.6-2.103-2.102-5.507-2.102-7.61 0zm6.548 6.541L12 19.485 4.635 12.12c-1.513-1.514-1.513-3.967 0-5.48 1.513-1.514 3.967-1.514 5.48 0l1.357 1.357c0.298 0.298 0.783 0.292 1.074-0.013L13.88 6.64c1.517-1.517 3.973-1.517 5.49 0 1.513 1.514 1.51 3.96-0.002 5.481z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||||
|
</vector>
|
|
@ -2,23 +2,22 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layoutDirection="locale">
|
android:layoutDirection="locale">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text"
|
android:id="@+id/text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
android:paddingRight="16dp"
|
android:minHeight="48dp"
|
||||||
|
android:paddingVertical="8dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="end"
|
|
||||||
tools:text="Account settings"/>
|
tools:text="Account settings"/>
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress"
|
android:id="@+id/progress"
|
||||||
|
@ -27,4 +26,8 @@
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
/>
|
/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue