mirror of
https://github.com/gsantner/dandelion
synced 2024-11-25 22:02:08 +01:00
Added license headers and some documentation to AboutActivity, HtmlTextView, HashtagProvider
This commit is contained in:
parent
48f0997864
commit
5a6910b447
2 changed files with 51 additions and 4 deletions
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.github.dfa.diaspora_android.activity;
|
package com.github.dfa.diaspora_android.activity;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
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.R;
|
||||||
import com.github.dfa.diaspora_android.data.AppSettings;
|
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 {
|
public class AboutActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
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 {
|
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 {
|
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 {
|
public static class DebugFragment extends Fragment {
|
||||||
|
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.github.dfa.diaspora_android.ui;
|
package com.github.dfa.diaspora_android.ui;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
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.Matcher;
|
||||||
import java.util.regex.Pattern;
|
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 class HtmlTextView extends TextView {
|
||||||
|
|
||||||
public HtmlTextView(Context context) {
|
public HtmlTextView(Context context) {
|
||||||
|
@ -37,6 +61,9 @@ public class HtmlTextView extends TextView {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Linkify, format markdown and escape the displayed text.
|
||||||
|
*/
|
||||||
private void init(){
|
private void init(){
|
||||||
setText(new SpannableString(Html.fromHtml(getText().toString())));
|
setText(new SpannableString(Html.fromHtml(getText().toString())));
|
||||||
Linkify.TransformFilter filter = new Linkify.TransformFilter() {
|
Linkify.TransformFilter filter = new Linkify.TransformFilter() {
|
||||||
|
@ -51,6 +78,5 @@ public class HtmlTextView extends TextView {
|
||||||
|
|
||||||
Pattern urlPattern = Patterns.WEB_URL;
|
Pattern urlPattern = Patterns.WEB_URL;
|
||||||
Linkify.addLinks(this, urlPattern, null, null, filter);
|
Linkify.addLinks(this, urlPattern, null, null, filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue