Fixes crash when opening the block list. Also, fixes an issue where the collapsed toolbar appears dark on profiles even when using the light theme.
This commit is contained in:
parent
864f47c353
commit
37bb799efc
9 changed files with 77 additions and 19 deletions
|
@ -25,11 +25,11 @@ dependencies {
|
|||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||
compile 'com.android.support:recyclerview-v7:25.1.0'
|
||||
compile 'com.android.support:support-v13:25.1.0'
|
||||
compile 'com.android.support:appcompat-v7:25.2.0'
|
||||
compile 'com.android.support:recyclerview-v7:25.2.0'
|
||||
compile 'com.android.support:support-v13:25.2.0'
|
||||
compile 'com.android.support:design:25.2.0'
|
||||
compile 'com.android.volley:volley:1.0.0'
|
||||
compile 'com.android.support:design:25.1.0'
|
||||
compile 'com.squareup.picasso:picasso:2.5.2'
|
||||
compile 'com.pkmmte.view:circularimageview:1.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
|
|
|
@ -19,15 +19,16 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.icu.text.NumberFormat;
|
||||
import android.media.Image;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.AttrRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.design.widget.CollapsingToolbarLayout;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
@ -42,10 +43,8 @@ import com.android.volley.AuthFailureError;
|
|||
import com.android.volley.Request;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.ImageLoader;
|
||||
import com.android.volley.toolbox.JsonArrayRequest;
|
||||
import com.android.volley.toolbox.JsonObjectRequest;
|
||||
import com.android.volley.toolbox.NetworkImageView;
|
||||
import com.pkmmte.view.CircularImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
|
@ -82,7 +81,7 @@ public class AccountActivity extends BaseActivity {
|
|||
accessToken = preferences.getString("accessToken", null);
|
||||
String loggedInAccountId = preferences.getString("loggedInAccountId", null);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
@ -93,6 +92,31 @@ public class AccountActivity extends BaseActivity {
|
|||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
// Add a listener to change the toolbar icon color when it enters/exits its collapsed state.
|
||||
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.account_app_bar_layout);
|
||||
final CollapsingToolbarLayout collapsingToolbar =
|
||||
(CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
@AttrRes int priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed;
|
||||
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||
@AttrRes int attribute;
|
||||
if (collapsingToolbar.getHeight() + verticalOffset
|
||||
< 2 * ViewCompat.getMinimumHeight(collapsingToolbar)) {
|
||||
attribute = R.attr.account_toolbar_icon_tint_collapsed;
|
||||
} else {
|
||||
attribute = R.attr.account_toolbar_icon_tint_uncollapsed;
|
||||
}
|
||||
if (attribute != priorAttribute) {
|
||||
priorAttribute = attribute;
|
||||
Context context = toolbar.getContext();
|
||||
ThemeUtils.setDrawableTint(context, toolbar.getNavigationIcon(), attribute);
|
||||
ThemeUtils.setDrawableTint(context, toolbar.getOverflowIcon(), attribute);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FloatingActionButton floatingBtn = (FloatingActionButton) findViewById(R.id.floating_btn);
|
||||
floatingBtn.hide();
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
package com.keylesspalace.tusky;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.AttrRes;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.TypedValue;
|
||||
|
@ -48,16 +49,20 @@ class ThemeUtils {
|
|||
}
|
||||
}
|
||||
|
||||
static @ColorRes int getColor(Context context, @AttrRes int attribute) {
|
||||
static @ColorInt int getColor(Context context, @AttrRes int attribute) {
|
||||
TypedValue value = new TypedValue();
|
||||
if (context.getTheme().resolveAttribute(attribute, value, true)) {
|
||||
return value.data;
|
||||
} else {
|
||||
return android.R.color.black;
|
||||
return Color.BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
static void setImageViewTint(ImageView view, @AttrRes int attribute) {
|
||||
view.setColorFilter(getColor(view.getContext(), attribute), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
static void setDrawableTint(Context context, Drawable drawable, @AttrRes int attribute) {
|
||||
drawable.setColorFilter(getColor(context, attribute), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@
|
|||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:theme="@style/AppTheme"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.Account.AppBarLayout"
|
||||
android:id="@+id/account_app_bar_layout">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing_toolbar"
|
||||
|
@ -91,7 +92,9 @@
|
|||
android:textColor="?android:textColorTertiary"
|
||||
android:padding="16dp"
|
||||
android:paddingTop="10dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
|
@ -101,7 +104,8 @@
|
|||
android:background="@android:color/transparent"
|
||||
android:layout_gravity="top"
|
||||
android:layout_alignParentTop="true"
|
||||
app:layout_collapseMode="pin" />
|
||||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="?attr/account_toolbar_popup_theme" />
|
||||
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/blocked_user_username"
|
||||
android:textColor="?attr/status_text_color_secondary" />
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/notification_username"
|
||||
android:textColor="?attr/status_text_color_secondary" />
|
||||
android:textColor="?android:textColorSecondary" />
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -21,13 +21,15 @@
|
|||
<attr name="status_favourite_button_marked_tint" format="reference|color" />
|
||||
<attr name="content_warning_button" format="reference" />
|
||||
<attr name="sensitive_media_warning_background_color" format="reference|color" />
|
||||
<attr name="status_text_color_secondary" format="reference|color" />
|
||||
<attr name="media_preview_unloaded_drawable" format="reference" />
|
||||
<attr name="status_divider_drawable" format="reference" />
|
||||
<attr name="tab_page_margin_drawable" format="reference" />
|
||||
<attr name="notification_content" format="reference" />
|
||||
<attr name="notification_icon_tint" format="reference|color" />
|
||||
<attr name="account_header_background_color" format="reference|color" />
|
||||
<attr name="account_toolbar_icon_tint_uncollapsed" format="reference|color" />
|
||||
<attr name="account_toolbar_icon_tint_collapsed" format="reference|color" />
|
||||
<attr name="account_toolbar_popup_theme" format="reference" />
|
||||
<attr name="compose_media_button_tint" format="reference|color" />
|
||||
<attr name="compose_media_button_disabled_tint" format="reference|color" />
|
||||
<attr name="compose_mention_color" format="reference|color" />
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<color name="status_text_secondary_dark">#A4B4BC</color>
|
||||
<color name="status_divider_dark">#2f3441</color>
|
||||
<color name="tab_page_margin_dark">#4C534B</color>
|
||||
<color name="account_toolbar_icon_collapsed_dark">#FFFFFF</color>
|
||||
<color name="account_header_background_dark">#000000</color>
|
||||
<color name="compose_media_button_dark">#FFFFFF</color>
|
||||
<color name="compose_media_button_disabled_dark">#8F8F8F</color>
|
||||
|
@ -65,6 +66,7 @@
|
|||
<color name="status_text_secondary_light">#34444C</color>
|
||||
<color name="status_divider_light">#CFCFCF</color>
|
||||
<color name="tab_page_margin_light">#9F9F9F</color>
|
||||
<color name="account_toolbar_icon_collapsed_light">#000000</color>
|
||||
<color name="account_header_background_light">#EFEFEF</color>
|
||||
<color name="compose_media_button_light">#000000</color>
|
||||
<color name="compose_media_button_disabled_light">#8F8F8F</color>
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
<item name="android:textStyle">normal|bold</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Account.AppBarLayout" parent="ThemeOverlay.AppCompat">
|
||||
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
|
||||
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
|
||||
<item name="android:textColorTertiary">@color/text_color_tertiary_dark</item>
|
||||
</style>
|
||||
|
||||
<!--Base Application Theme Styles (Dark)-->
|
||||
|
||||
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
|
||||
|
@ -25,6 +31,7 @@
|
|||
<item name="android:textColorPrimaryInverse">@color/text_color_primary_inverse_dark</item>
|
||||
<item name="android:textColorSecondaryInverse">@color/text_color_secondary_inverse_dark</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/text_color_tertiary_inverse_dark</item>
|
||||
<item name="android:actionMenuTextColor">@color/text_color_primary_dark</item>
|
||||
|
||||
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>
|
||||
|
||||
|
@ -42,6 +49,9 @@
|
|||
<item name="status_divider_drawable">@drawable/status_divider_dark</item>
|
||||
<item name="tab_page_margin_drawable">@drawable/tab_page_margin_dark</item>
|
||||
<item name="account_header_background_color">@color/account_header_background_dark</item>
|
||||
<item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item>
|
||||
<item name="account_toolbar_icon_tint_collapsed">@color/account_toolbar_icon_collapsed_dark</item>
|
||||
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Dark</item>
|
||||
<item name="compose_media_button_tint">@color/compose_media_button_dark</item>
|
||||
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_dark</item>
|
||||
<item name="compose_mention_color">@color/compose_mention_dark</item>
|
||||
|
@ -61,6 +71,10 @@
|
|||
<item name="android:colorBackground">@color/color_background_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Account.ToolbarPopupTheme.Dark" parent="ThemeOverlay.AppCompat">
|
||||
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
|
||||
</style>
|
||||
|
||||
<!--Light Application Theme Styles-->
|
||||
|
||||
<style name="AppTheme.Light" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
|
@ -78,6 +92,7 @@
|
|||
<item name="android:textColorPrimaryInverse">@color/text_color_primary_inverse_light</item>
|
||||
<item name="android:textColorSecondaryInverse">@color/text_color_secondary_inverse_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@color/text_color_tertiary_inverse_light</item>
|
||||
<item name="android:actionMenuTextColor">@color/text_color_primary_light</item>
|
||||
|
||||
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Light</item>
|
||||
|
||||
|
@ -91,10 +106,12 @@
|
|||
<item name="status_favourite_button_marked_tint">@color/status_favourite_button_marked_light</item>
|
||||
<item name="content_warning_button">@drawable/toggle_small_light</item>
|
||||
<item name="sensitive_media_warning_background_color">@color/sensitive_media_warning_background_light</item>
|
||||
<item name="status_text_color_secondary">@color/status_text_secondary_light</item>
|
||||
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_light</item>
|
||||
<item name="status_divider_drawable">@drawable/status_divider_light</item>
|
||||
<item name="tab_page_margin_drawable">@drawable/tab_page_margin_light</item>
|
||||
<item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item> <!--Default to dark on purpose, because header backgrounds with gradients are always dark.-->
|
||||
<item name="account_toolbar_icon_tint_collapsed">@color/account_toolbar_icon_collapsed_light</item>
|
||||
<item name="account_toolbar_popup_theme">@style/AppTheme.Account.ToolbarPopupTheme.Light</item>
|
||||
<item name="account_header_background_color">@color/account_header_background_light</item>
|
||||
<item name="compose_media_button_tint">@color/compose_media_button_light</item>
|
||||
<item name="compose_media_button_disabled_tint">@color/compose_media_button_disabled_light</item>
|
||||
|
@ -115,4 +132,8 @@
|
|||
<item name="android:colorBackground">@color/color_background_light</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Account.ToolbarPopupTheme.Light" parent="ThemeOverlay.AppCompat">
|
||||
<item name="android:textColorPrimary">@color/text_color_primary_light</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue