Skip to content

Commit

Permalink
donate
Browse files Browse the repository at this point in the history
Adds a donation link to the about dialog; https://forrestguice.github.io/SuntimesWidget/donate

Suntimes Calendars is available gratis, but if it has proven its value, please pay as you like.
  • Loading branch information
forrestguice committed Feb 11, 2024
1 parent f8d2fde commit 1d255d2
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;

import com.forrestguice.suntimescalendars.BuildConfig;
Expand Down Expand Up @@ -147,6 +149,18 @@ public void onClick(View v)
supportView.setMovementMethod(LinkMovementMethod.getInstance());
supportView.setText(Utils.fromHtml(context.getString(R.string.app_support_url)));

final TextView donateView = (TextView) dialogContent.findViewById(R.id.text_about_donate);
donateView.setMovementMethod(LinkMovementMethod.getInstance());
donateView.setText(Utils.fromHtml(context.getString(R.string.app_donate_url, context.getString(R.string.app_name))));
donateView.setVisibility(View.GONE);

CheckBox checkDonate = (CheckBox) dialogContent.findViewById(R.id.check_donate);
checkDonate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
donateView.setVisibility(isChecked ? View.VISIBLE : View.GONE);
}
});

TextView legalView1 = (TextView) dialogContent.findViewById(R.id.txt_about_legal1);
legalView1.setMovementMethod(LinkMovementMethod.getInstance());
legalView1.setText(Utils.fromHtml(context.getString(R.string.app_legal1)));
Expand Down
43 changes: 33 additions & 10 deletions app/src/main/res/layout/layout_dialog_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,39 @@
android:textSize="?attr/text_size_small" android:text="@string/app_legal1"
android:autoLink="web" />

<TextView
android:id="@+id/txt_about_url"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="2dp"
android:layout_marginTop="0dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="?attr/text_size_small" android:text="@string/app_url"
android:autoLink="web" />
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginBottom="2dp" android:layout_marginTop="4dp"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
android:layout_marginStart="8dp" android:layout_marginLeft="8dp"
android:animateLayoutChanges="true">

<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/check_donate"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:gravity="center_vertical" android:layout_gravity="center_vertical|start"
android:button="?attr/checkFavorite" android:paddingLeft="8dp"
android:checked="false"
tools:ignore="@string/expandMore" />

<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="true">

<TextView android:id="@+id/text_about_donate"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:textSize="?attr/text_size_small" android:layout_marginBottom="4dp"
android:text="@string/app_donate_url" />

<TextView
android:id="@+id/txt_about_url"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:textSize="?attr/text_size_small" android:text="@string/app_url"
android:autoLink="web" />

</LinearLayout>

</LinearLayout>

<TextView
android:id="@+id/txt_about_legal2"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-eo/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@
<b>Subteno:</b> vizitu la
<a href="https://github.com/forrestguice/SuntimesCalendars/issues">erar‑spurilon</a> por raporti problemon.
]]></string>
<string name="app_donate_url"><![CDATA[
La aplikaĵo %s estas disponebla senpage, sed se ĝi utilas al vi, bonvolu
<a href="https://forrestguice.github.io/SuntimesWidget/donate">konsideri donaci ajnan monkvanton</a>.
]]></string>
<string name="app_legal1"><![CDATA[
Aŭtorrajto &#169 2018-2024 Forrest GUICE <br />
Fontkodo disponebla laŭ la permesilo GPLv3.
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@
<string name="app_version"><![CDATA[<b>Wersja:</b>]]> <xliff:g id="versionString">%s</xliff:g></string>
<string name="app_shortdesc">Dodatek do apki Czasy Słońca: integracja z kalendarzem.</string>
<string name="app_support_url"><![CDATA[<b>Wsparcie:</b> odwiedź <a href="https://github.com/forrestguice/SuntimesCalendars/issues">stronę trackera błędów</a> aby zgłosić błąd/sugestię.]]></string>
<string name="app_donate_url"><![CDATA[
Aplikacja %s jest udostępniana bezpłatnie, ale jeżeli jest ona dla Ciebie użyteczna, prosimy
<a href="https://forrestguice.github.io/SuntimesWidget/donate">rozważyć wpłatę dowolnej kwoty</a>.
]]></string>
<string name="app_legal1"><![CDATA[Prawo autorskie &#169 2018–2024 Forrest Guice <br />Kod źródłowy dostępny na licencji GPLv3.]]></string>
<string name="app_legal2"><![CDATA[
<b>Tłumaczenia:</b><br/>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
<b>Support:</b> visit the
<a href="https://github.com/forrestguice/SuntimesWidget/issues">issue tracker</a> to submit a request.
]]></string>
<string name="app_donate_url"><![CDATA[
%s 免費使用,如果您認為它有價值,請
<a href="https://forrestguice.github.io/SuntimesWidget/donate">隨意付費</a>。
]]></string>
<string name="app_url"><xliff:g id="url"><![CDATA[
<a href="https://forrestguice.github.io/SuntimesWidget/">forrestguice.github.io/SuntimesWidget</a>
]]></xliff:g></string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@
<string name="app_url"><xliff:g id="url"><![CDATA[
<a href="https://forrestguice.github.io/SuntimesWidget/">forrestguice.github.io/SuntimesWidget</a>
]]></xliff:g></string>
<string name="app_donate_url"><![CDATA[
%s is available gratis, but if it has proven its value, please
<a href="https://forrestguice.github.io/SuntimesWidget/donate">pay as you like</a>.
]]></string>
<string name="app_legal1"><![CDATA[
<b>Source Code:</b><br />
Copyright &#169 2018-2024 Forrest Guice <br />
Expand Down

0 comments on commit 1d255d2

Please sign in to comment.