From 5a6910b447ff289f9ac5ed0086a1ed017f29c8b6 Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Sat, 27 Aug 2016 09:23:58 +0200 Subject: [PATCH] Added license headers and some documentation to AboutActivity, HtmlTextView, HashtagProvider --- .../activity/AboutActivity.java | 27 ++++++++++++++++-- .../dfa/diaspora_android/ui/HtmlTextView.java | 28 ++++++++++++++++++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java index e32cc66a..94c2c713 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/AboutActivity.java @@ -1,3 +1,21 @@ +/* + This file is part of the Diaspora for Android. + + Diaspora for Android is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora for Android is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora for Android. + + If not, see . + */ package com.github.dfa.diaspora_android.activity; import android.content.BroadcastReceiver; @@ -24,6 +42,9 @@ import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.data.AppSettings; +/** + * Activity that holds some fragments that show information about the app in a tab layout + */ public class AboutActivity extends AppCompatActivity { private SectionsPagerAdapter mSectionsPagerAdapter; @@ -62,7 +83,7 @@ public class AboutActivity extends AppCompatActivity { } /** - * Fragment that shows information about the app + * Fragment that shows general information about the app */ public static class AboutFragment extends Fragment { @@ -89,7 +110,7 @@ public class AboutActivity extends AppCompatActivity { } /** - * Fragment that shows information about the app + * Fragment that shows information about the license of the app and used 3rd party libraries */ public static class LicenseFragment extends Fragment { @@ -105,7 +126,7 @@ public class AboutActivity extends AppCompatActivity { } /** - * Fragment that shows information about the app + * Fragment that shows debug information like app version, pod version... */ public static class DebugFragment extends Fragment { diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/HtmlTextView.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/HtmlTextView.java index bb90c344..1fe23ef4 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/ui/HtmlTextView.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/HtmlTextView.java @@ -1,3 +1,21 @@ +/* + This file is part of the Diaspora for Android. + + Diaspora for Android is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Diaspora for Android is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the Diaspora for Android. + + If not, see . + */ package com.github.dfa.diaspora_android.ui; import android.annotation.TargetApi; @@ -14,6 +32,12 @@ import com.github.dfa.diaspora_android.activity.MainActivity; import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * TextView, that renders HTML with highlited and clickable links and hashtags. + * Links are opened in a webbrowser. + * Hashtags open the MainActivity, load the new-post site of the selected pod and insert the + * hashtag into the post editor. See data/HashtagProvider. + */ public class HtmlTextView extends TextView { public HtmlTextView(Context context) { @@ -37,6 +61,9 @@ public class HtmlTextView extends TextView { init(); } + /** + * Linkify, format markdown and escape the displayed text. + */ private void init(){ setText(new SpannableString(Html.fromHtml(getText().toString()))); Linkify.TransformFilter filter = new Linkify.TransformFilter() { @@ -51,6 +78,5 @@ public class HtmlTextView extends TextView { Pattern urlPattern = Patterns.WEB_URL; Linkify.addLinks(this, urlPattern, null, null, filter); - } } \ No newline at end of file