diff --git a/app/build.gradle b/app/build.gradle index a3dc3632..2c5aedf2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,9 +44,9 @@ dependencies { // Android standard libs compile 'com.android.support:appcompat-v7:24.2.1' - compile 'com.android.support:design:24.1.0' //Don't update. Broken up to 24.2.1 + compile 'com.android.support:design:24.1.0' //Don't update. Broken up to 25.0.0 compile 'com.android.support:support-v4:24.2.1' - compile "com.android.support:customtabs:24.2.1" + compile 'com.android.support:customtabs:24.2.1' compile 'com.android.support:cardview-v7:24.2.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 21f4f2b2..4fcaa3a7 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 @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.graphics.PorterDuff; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -48,6 +49,7 @@ import com.github.dfa.diaspora_android.App; import com.github.dfa.diaspora_android.R; import com.github.dfa.diaspora_android.listener.IntellihideToolbarActivityListener; import com.github.dfa.diaspora_android.ui.HtmlTextView; +import com.github.dfa.diaspora_android.ui.theme.CustomFragment; import com.github.dfa.diaspora_android.ui.theme.ThemeHelper; import com.github.dfa.diaspora_android.ui.theme.ThemedActivity; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; @@ -170,6 +172,9 @@ public class AboutActivity extends ThemedActivity @BindView(R.id.fragment_about__app_codename) protected TextView txtAppCodename; + @BindView(R.id.fragment_about__spread_the_word) + protected HtmlTextView txtSpreadTheWord; + public AboutFragment() { } @@ -198,7 +203,14 @@ public class AboutActivity extends ThemedActivity @Override protected void applyColorToViews() { - + ThemeHelper.getInstance(getAppSettings()); + int colorBtn = ThemeHelper.getAccentColor(); + ThemeHelper.updateButtonColor(btnIssueTracker, colorBtn); + ThemeHelper.updateButtonColor(btnMarkdown, colorBtn); + ThemeHelper.updateButtonColor(btnSourceCode, colorBtn); + ThemeHelper.updateButtonColor(btnSpreadTheWord, colorBtn); + ThemeHelper.updateButtonColor(btnTranslate, colorBtn); + ThemeHelper.updateTextViewLinkColor(txtSpreadTheWord); } @Override @@ -337,6 +349,37 @@ public class AboutActivity extends ThemedActivity } } + public static class ChangelogFragment extends CustomFragment { + public static final String TAG = "com.github.dfa.diaspora_android.AboutActivity.ChangelogFragment"; + + @BindView(R.id.fragment_changelog__content) + protected TextView textChangelogContent; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.about__fragment_changelog, container, false); + ButterKnife.bind(this, rootView); + final Context context = rootView.getContext(); + textChangelogContent.setText(Helpers.readTextfileFromRawRessource(context, R.raw.changelog, "", "")); + return rootView; + } + + @Override + public String getFragmentTag() { + return TAG; + } + + @Override + public void onCreateBottomOptionsMenu(Menu menu, MenuInflater inflater) { + /* Nothing to do */ + } + + @Override + public boolean onBackPressed() { + return false; + } + } + /** * Fragment that shows debug information like app version, pod version... */ @@ -421,8 +464,13 @@ public class AboutActivity extends ThemedActivity @Override public void update(Observable observable, Object o) { - if (logBox != null) { - logBox.setText(AppLog.Log.getLogBuffer()); + if (isAdded() && logBox != null) { + getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + logBox.setText(AppLog.Log.getLogBuffer()); + } + }); } } } @@ -444,6 +492,8 @@ public class AboutActivity extends ThemedActivity return new AboutFragment(); case 1: //License return new LicenseFragment(); + case 2: //Changelog + return new ChangelogFragment(); case 3: //Debug default: return new DebugFragment(); @@ -452,8 +502,8 @@ public class AboutActivity extends ThemedActivity @Override public int getCount() { - // Show 3 total pages. - return 3; + // Show 4 total pages. + return 4; } @Override @@ -464,6 +514,8 @@ public class AboutActivity extends ThemedActivity case 1: return getString(R.string.about_activity__title_about_license); case 2: + return getString(R.string.fragment_changelog__changelog); + case 3: return getString(R.string.about_activity__title_debug_info); } return null; diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java index 72661e1b..94163bc6 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java @@ -1111,6 +1111,8 @@ public class MainActivity extends ThemedActivity ThemeHelper.updateActionMenuViewColor(toolbarBottom); navDrawerLayout.setBackgroundColor(appSettings.getPrimaryColor()); navProfilePictureArea.setBackgroundColor(appSettings.getPrimaryColor()); + navheaderTitle.setTextColor(ThemeHelper.getTextColorFromBackgroundColor(ThemeHelper.getPrimaryColor())); + navheaderDescription.setTextColor(ThemeHelper.getTextColorFromBackgroundColor(ThemeHelper.getPrimaryColor())); } @Override diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java index 268c11a1..08ec9398 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/SettingsActivity.java @@ -307,11 +307,13 @@ public class SettingsActivity extends ThemedActivity { shade.setColors(ColorPalette.getColors(context, current[0])); shade.setSelectedColor(current[1]); titleBackground.setBackgroundColor(shade.getColor()); + title.setTextColor(ThemeHelper.getTextColorFromBackgroundColor(shade.getColor())); base.setOnColorChangedListener(new OnColorChangedListener() { @Override public void onColorChanged(int i) { shade.setColors(ColorPalette.getColors(context, i)); titleBackground.setBackgroundColor(i); + title.setTextColor(ThemeHelper.getTextColorFromBackgroundColor(i)); if (i == current[0]) { shade.setSelectedColor(current[1]); titleBackground.setBackgroundColor(shade.getColor()); @@ -324,6 +326,7 @@ public class SettingsActivity extends ThemedActivity { @Override public void onColorChanged(int i) { titleBackground.setBackgroundColor(i); + title.setTextColor(ThemeHelper.getTextColorFromBackgroundColor(i)); } }); diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java index ef74eafc..d8409f4c 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/BadgeDrawable.java @@ -54,7 +54,7 @@ public class BadgeDrawable extends Drawable { badgeBackground.setAntiAlias(true); badgeBackground.setStyle(Paint.Style.FILL); badgeStroke = new Paint(); - badgeStroke.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.colorPrimaryDark)); + badgeStroke.setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.color_primary_dark)); badgeStroke.setAntiAlias(true); badgeStroke.setStyle(Paint.Style.FILL); diff --git a/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemeHelper.java b/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemeHelper.java index 64030905..c5b89636 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemeHelper.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/ui/theme/ThemeHelper.java @@ -29,6 +29,7 @@ import android.support.v4.widget.CompoundButtonCompat; import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.Toolbar; import android.view.View; +import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ProgressBar; @@ -84,8 +85,13 @@ public class ThemeHelper { public static void updateTabLayoutColor(TabLayout tabLayout) { if (tabLayout != null) { - tabLayout.setBackgroundColor(getInstance().appSettings.getPrimaryColor()); - tabLayout.setSelectedTabIndicatorColor(getInstance().appSettings.getAccentColor()); + tabLayout.setBackgroundColor(getPrimaryColor()); + tabLayout.setSelectedTabIndicatorColor(getAccentColor()); + int selectedColor = getTextColorFromBackgroundColor(getPrimaryColor()); + int normalColor = selectedColor == Color.WHITE ? + tabLayout.getContext().getResources().getColor(R.color.md_grey_300) : + tabLayout.getContext().getResources().getColor(R.color.md_grey_700); + tabLayout.setTabTextColors(normalColor, selectedColor); } } @@ -105,6 +111,7 @@ public class ThemeHelper { public static void updateToolbarColor(Toolbar toolbar) { if (toolbar != null) { toolbar.setBackgroundColor(getInstance().appSettings.getPrimaryColor()); + toolbar.setTitleTextColor(getTextColorFromBackgroundColor(getInstance().appSettings.getPrimaryColor())); } } @@ -150,7 +157,23 @@ public class ThemeHelper { } } + public static void updateButtonColor(Button button, int color) { + if(button != null) { + button.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY); + button.setTextColor(getTextColorFromBackgroundColor(color)); + } + } + public static int getNeutralGreyColor() { return ContextCompat.getColor(getInstance().appSettings.getApplicationContext(), R.color.md_grey_800); } + + public static int getTextColorFromBackgroundColor(int backgroundColor) { + int med = (Color.red(backgroundColor) + Color.green(backgroundColor) + Color.blue(backgroundColor)) / 3; + return med < 128 ? Color.WHITE : Color.BLACK; + } + + public static boolean darkDrawables() { + return getTextColorFromBackgroundColor(getInstance().appSettings.getPrimaryColor()) == Color.BLACK; + } } diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/AppLog.java b/app/src/main/java/com/github/dfa/diaspora_android/util/AppLog.java index 8f3df81b..76a823a7 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/util/AppLog.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/util/AppLog.java @@ -59,37 +59,37 @@ public class AppLog { */ public static void v(Object source, String _text) { if (isLoggingEnabled()) { - Log.v(getLogPrefix(source), _text); + Log.v(source != null? getLogPrefix(source) : "null", _text); } } public static void i(Object source, String _text) { if (isLoggingEnabled()) { - Log.i(getLogPrefix(source), _text); + Log.i(source != null? getLogPrefix(source) : "null", _text); } } public static void d(Object source, String _text) { if (isLoggingEnabled()) { - Log.d(getLogPrefix(source), _text); + Log.d(source != null? getLogPrefix(source) : "null", _text); } } public static void e(Object source, String _text) { if (isLoggingEnabled()) { - Log.e(getLogPrefix(source), _text); + Log.e(source != null? getLogPrefix(source) : "null", _text); } } public static void w(Object source, String _text) { if (isLoggingEnabled()) { - Log.w(getLogPrefix(source), _text); + Log.w(source != null? getLogPrefix(source) : "null", _text); } } public static void spam(Object source, String _text) { if (isLoggingEnabled() && isLoggingSpamEnabled()) { - Log.v(getLogPrefix(source), _text); + Log.v(source != null? getLogPrefix(source) : "null", _text); } } diff --git a/app/src/main/res/drawable/ic_media_video_poster.xml b/app/src/main/res/drawable/ic_media_video_poster.xml new file mode 100644 index 00000000..8c977c38 --- /dev/null +++ b/app/src/main/res/drawable/ic_media_video_poster.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/about__activity.xml b/app/src/main/res/layout/about__activity.xml index 6f0f2006..8fc92f51 100644 --- a/app/src/main/res/layout/about__activity.xml +++ b/app/src/main/res/layout/about__activity.xml @@ -31,7 +31,8 @@ + android:layout_height="wrap_content" + app:tabMode="scrollable"/> diff --git a/app/src/main/res/layout/about__fragment_about.xml b/app/src/main/res/layout/about__fragment_about.xml index a2cfe681..631d122b 100644 --- a/app/src/main/res/layout/about__fragment_about.xml +++ b/app/src/main/res/layout/about__fragment_about.xml @@ -16,12 +16,12 @@ + android:layout_marginTop="@dimen/card_view__margin__top_bottom_double" + android:layout_marginBottom="@dimen/card_view__margin__top_bottom" + android:layout_marginStart="@dimen/card_view__margin__start_end" + android:layout_marginEnd="@dimen/card_view__margin__start_end" + card_view:cardElevation="@dimen/card_view__elevation" + card_view:cardCornerRadius="@dimen/card_view__corner_radius"> + android:layout_marginTop="@dimen/card_view__margin__top_bottom" + android:layout_marginBottom="@dimen/card_view__margin__top_bottom_double" + android:layout_marginStart="@dimen/card_view__margin__start_end" + android:layout_marginEnd="@dimen/card_view__margin__start_end" + card_view:cardElevation="@dimen/card_view__elevation" + card_view:cardCornerRadius="@dimen/card_view__corner_radius"> + + + + + + + + + + + + diff --git a/app/src/main/res/layout/main__app_bar.xml b/app/src/main/res/layout/main__app_bar.xml index 225de964..06023228 100644 --- a/app/src/main/res/layout/main__app_bar.xml +++ b/app/src/main/res/layout/main__app_bar.xml @@ -39,7 +39,7 @@ android:id="@+id/main__bottombar" android:layout_width="match_parent" android:layout_height="45dp" - android:background="@color/colorPrimary" + android:background="@color/color_primary" android:theme="@style/BottomToolbarMenuOverflowStyle" app:layout_scrollFlags="scroll|enterAlways|snap" app:popupTheme="@style/Theme.AppCompat.NoActionBar" /> diff --git a/app/src/main/res/layout/main__nav_header.xml b/app/src/main/res/layout/main__nav_header.xml index d3294497..49c025fa 100644 --- a/app/src/main/res/layout/main__nav_header.xml +++ b/app/src/main/res/layout/main__nav_header.xml @@ -3,7 +3,7 @@ android:id="@+id/nav_drawer" android:layout_width="wrap_content" android:layout_height="110dp" - android:background="@color/colorPrimary" + android:background="@color/color_primary" android:gravity="bottom" android:orientation="vertical" android:theme="@style/ThemeOverlay.AppCompat.Dark"> diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 5b55f978..5d49171d 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -4,6 +4,6 @@ false true true - @color/colorPrimary + @color/color_primary diff --git a/app/src/main/res/values/color.xml b/app/src/main/res/values/color.xml index 14025f63..d808bacc 100644 --- a/app/src/main/res/values/color.xml +++ b/app/src/main/res/values/color.xml @@ -1,8 +1,8 @@ - @color/md_blue_650 - @color/md_blue_750 - @color/md_deep_orange_650 + @color/md_blue_650 + @color/md_blue_750 + @color/md_deep_orange_650 @color/md_blue_650 @@ -17,7 +17,7 @@ #ffffff #000000 - #eeeeee + #eeeeee #c4000000 @color/md_grey_200 diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index cebddacb..521f49f7 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -16,4 +16,10 @@ 11sp 30dp + + 16dp + 8dp + 16dp + 5dp + 5dp diff --git a/app/src/main/res/values/strings-about.xml b/app/src/main/res/values/strings-about.xml index e65acc24..6252d60e 100644 --- a/app/src/main/res/values/strings-about.xml +++ b/app/src/main/res/values/strings-about.xml @@ -46,6 +46,9 @@ Spread the word! Hey! Check out #DiasporaForAndroid! %1$s https://f-droid.org/app/com.github.dfa.diaspora_android + + + Changelog Auch gibt es niemanden, der den Schmerz an sich liebt, sucht oder wünscht, nur, weil er Schmerz ist, es sei denn, es kommt zu zufälligen Umständen, in denen Mühen und Schmerz ihm große Freude bereiten können. Um ein triviales Beispiel zu nehmen, wer von uns unterzieht sich je anstrengender körperlicher Betätigung, außer um Vorteile daraus zu ziehen? Aber wer hat irgend ein Recht, einen Menschen zu tadeln, der die Entscheidung trifft, eine Freude zu genießen, die keine unangenehmen Folgen hat, oder einen, der Schmerz vermeidet, welcher keine daraus resultierende Freude nach sich zieht? Auch gibt es niemanden, der den Schmerz an sich liebt, sucht oder wünscht, nur, weil er Schmerz ist, es sei denn, es kommt zu zufälligen Umständen, in denen Mühen und Schmerz ihm große Freude bereiten können. Um ein triviales Beispiel zu nehmen, wer von uns unterzieht sich je anstrengender körperlicher Betätigung, außer um Vorteile daraus zu ziehen? Aber wer hat irgend ein Recht, einen Menschen zu tadeln, der die Entscheidung trifft, eine Freude zu genießen, die keine unangenehmen Folgen hat, oder einen, der Schmerz vermeidet, welcher keine daraus resultierende Freude nach sich zieht? diff --git a/app/src/main/res/values/strings-preferences.xml b/app/src/main/res/values/strings-preferences.xml index 16fec09c..4f521455 100644 --- a/app/src/main/res/values/strings-preferences.xml +++ b/app/src/main/res/values/strings-preferences.xml @@ -116,8 +116,8 @@ Proxy Diaspora\'s traffic to circumvent firewalls.\nMay require restart. This might not work on some phones. Host Port - HTTP - SOCKS5 + HTTP + SOCKS5 App needs to restart to disable proxy usage Orbot proxy preset loaded diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d0c10108..b8e20045 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -3,10 +3,10 @@