Skip to content

Commit

Permalink
Added useful links in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
lubenard committed Jun 5, 2021
1 parent 47d974e commit c6fbb32
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,21 @@ public boolean onPreferenceClick(Preference preference) {
}
});

// useful links menu preference click listener
Preference usefulLinks = findPreference("other_useful_links");
usefulLinks.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(R.string.custom_useful_links);
final View customLayout = getLayoutInflater().inflate(R.layout.useful_links_alertdialog, null);
builder.setView(customLayout);
builder.setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.create();
dialog.show();
return true;
}
});

// feedback preference click listener
Preference feedback = findPreference("other_feedback");
feedback.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/res/layout/useful_links_alertdialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginLeft="10dp"
android:autoLink="web"
android:text="garcon.link" />

<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:autoLink="web"
android:text="planning-familial.org" />

<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:autoLink="web"
android:text="https://www.love-health-center.org/media/ecrit/carnet-dobservation-cycles-masculins/" />
</LinearLayout>
3 changes: 3 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@
<string name="first_entry">La première entrée est le :&#160;</string>
<string name="no_access_to_storage">Merci d\'autoriser l\'accès au stockage pour exporter / importer.</string>
<string name="create_new_session">Nouvelle session</string>
<string name="settings_other_useful_links_title">Liens utiles</string>
<string name="custom_useful_links">Liens utils :</string>
<string name="settings_other_useful_links_description">Une poignée de liens utils !</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@
<string name="first_entry">The first entry is:&#160;</string>
<string name="no_access_to_storage">Please allow access to storage to export / import datas.</string>
<string name="create_new_session">New session</string>
<string name="settings_other_useful_links_title">Useful links:</string>
<string name="settings_other_useful_links_description">A bunch of useful links!</string>
<string name="custom_useful_links">Useful links</string>
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/xml/settings_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
app:title="@string/debug_menu_title"
app:summary="@string/debug_menu_description"/>

<Preference
app:key="other_useful_links"
app:title="@string/settings_other_useful_links_title"
app:summary="@string/settings_other_useful_links_description"/>

<Preference
app:key="other_feedback"
app:title="@string/settings_other_feedback_title"
Expand Down

0 comments on commit c6fbb32

Please sign in to comment.