diff --git a/app/build.gradle b/app/build.gradle index fac00a3c..a3370b42 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,6 +53,8 @@ dependencies { compile 'com.android.support:design:24.1.0' //Don't update. Broken up to 24.2.1 compile 'com.android.support:support-v4:24.2.1' compile "com.android.support:customtabs:24.2.1" + compile 'com.android.support:cardview-v7:24.2.1' + // More libraries compile 'com.jakewharton:butterknife:8.0.1' 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 83d8a64f..c1866601 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 @@ -21,8 +21,10 @@ package com.github.dfa.diaspora_android.activity; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.design.widget.AppBarLayout; @@ -37,6 +39,7 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -142,15 +145,30 @@ public class AboutActivity extends ThemedActivity /** * Fragment that shows general information about the app */ - public static class AboutFragment extends ThemedFragment { + public static class AboutFragment extends ThemedFragment implements View.OnClickListener { public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.AboutFragment"; - @BindView(R.id.fragment_about__about_text) - TextView aboutText; + @BindView(R.id.fragment_about__markdown_button) + protected Button btnMarkdown; + + @BindView(R.id.fragment_about__translate_button) + protected Button btnTranslate; + + @BindView(R.id.fragment_about__issue_tracker_button) + protected Button btnIssueTracker; + + @BindView(R.id.fragment_about__source_code_button) + protected Button btnSourceCode; + + @BindView(R.id.fragment_about__spread_the_word_button) + protected Button btnSpreadTheWord; @BindView(R.id.fragment_about__app_version) - TextView appVersion; + protected TextView txtAppVersion; + + @BindView(R.id.fragment_about__app_codename) + protected TextView txtAppCodename; public AboutFragment() { } @@ -163,18 +181,24 @@ public class AboutActivity extends ThemedActivity if (isAdded()) { try { PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); - appVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")")); + txtAppVersion.setText(getString(R.string.fragment_debug__app_version, pInfo.versionName + " (" + pInfo.versionCode + ")")); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } + txtAppCodename.setText(getString(R.string.fragment_debug__app_codename, "Alter Falter")); + btnIssueTracker.setOnClickListener(this); + btnMarkdown.setOnClickListener(this); + btnSourceCode.setOnClickListener(this); + btnSpreadTheWord.setOnClickListener(this); + btnTranslate.setOnClickListener(this); return rootView; } @Override protected void applyColorToViews() { - ThemeHelper.updateTextViewLinkColor(aboutText); + } @Override @@ -191,6 +215,42 @@ public class AboutActivity extends ThemedActivity public boolean onBackPressed() { return false; } + + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.fragment_about__markdown_button: { + openLink(getString(R.string.fragment_about__about_markdown_link)); + break; + } + case R.id.fragment_about__translate_button: { + openLink(getString(R.string.fragment_about__translations_link)); + break; + } + case R.id.fragment_about__issue_tracker_button: { + openLink(getString(R.string.fragment_about__github_issue_link)); + break; + } + case R.id.fragment_about__source_code_button: { + openLink(getString(R.string.fragment_about__github_repo_link)); + break; + } + case R.id.fragment_about__spread_the_word_button: { + Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); + sharingIntent.setType("text/plain"); + sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.app_name)); + sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.fragment_about__share_app_text, getString(R.string.fragment_about__fdroid_link))); + startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.action_share_dotdotdot))); + break; + } + } + } + + public void openLink(String address) { + Intent openBrowserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(address)); + openBrowserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(openBrowserIntent); + } } /** @@ -216,6 +276,7 @@ public class AboutActivity extends ThemedActivity View rootView = inflater.inflate(R.layout.about__fragment_license, container, false); ButterKnife.bind(this, rootView); final Context context = rootView.getContext(); + ThemeHelper.getInstance(getAppSettings()); accentColor = Helpers.colorToHex(ThemeHelper.getAccentColor()); textLicenseBox.setTextFormatted(getString(R.string.fragment_license__license_content, @@ -231,9 +292,8 @@ public class AboutActivity extends ThemedActivity } public String getContributorsHtml(Context context) { - String text = Helpers.readTextfileFromRawRessource(context, R.raw.contributors, + return Helpers.readTextfileFromRawRessource(context, R.raw.contributors, "* ", "
"); - return text; } public String getMaintainersHtml(Context context) { @@ -245,9 +305,8 @@ public class AboutActivity extends ThemedActivity } public String getLicenseHtml(Context context) { - String text = Helpers.readTextfileFromRawRessource(context, R.raw.license, + return Helpers.readTextfileFromRawRessource(context, R.raw.license, "", "").replace("\n\n", "

"); - return text; } public String getLicense3dPartyHtml(Context context) { @@ -371,7 +430,7 @@ public class AboutActivity extends ThemedActivity */ public class SectionsPagerAdapter extends FragmentPagerAdapter { - public SectionsPagerAdapter(FragmentManager fm) { + SectionsPagerAdapter(FragmentManager fm) { super(fm); } diff --git a/app/src/main/res/layout/about__fragment_about.xml b/app/src/main/res/layout/about__fragment_about.xml index 6283eee7..a2cfe681 100644 --- a/app/src/main/res/layout/about__fragment_about.xml +++ b/app/src/main/res/layout/about__fragment_about.xml @@ -1,10 +1,11 @@ - - - - + android:layout_marginTop="16dp" + android:layout_marginBottom="8dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + card_view:cardElevation="5dp" + card_view:cardCornerRadius="5dp"> + - + - + - + + + + + +