Theme refactoring (#1656)
* Theme refactoring * disable the automatic tinting of surfaces with elevation in dark mode * make the media warning visible again with the dark theme * fix nav bar on api 27+ * use correct color for all media warnings
This commit is contained in:
parent
29ef92edd3
commit
8767d2ed3d
122 changed files with 330 additions and 724 deletions
|
@ -27,19 +27,16 @@ import kotlinx.android.synthetic.main.item_picker_list.view.*
|
|||
|
||||
class ListSelectionAdapter(context: Context) : ArrayAdapter<MastoList>(context, R.layout.item_autocomplete_hashtag) {
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
var view = convertView
|
||||
|
||||
if (convertView == null) {
|
||||
val layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
view = layoutInflater.inflate(R.layout.item_picker_list, parent, false)
|
||||
}
|
||||
view!!
|
||||
val layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
|
||||
val list = getItem(position)
|
||||
if (list != null) {
|
||||
val view = convertView
|
||||
?: layoutInflater.inflate(R.layout.item_picker_list, parent, false)
|
||||
|
||||
getItem(position)?.let { list ->
|
||||
val title = view.title
|
||||
title.text = list.title
|
||||
val icon = ThemeUtils.getTintedDrawable(context, R.drawable.ic_list, android.R.attr.textColorTertiary)
|
||||
val icon = ThemeUtils.getTintedDrawable(context, R.drawable.ic_list, R.attr.iconColor)
|
||||
title.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null)
|
||||
}
|
||||
|
||||
|
|
|
@ -153,10 +153,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
this.avatarRadius36dp = itemView.getContext().getResources().getDimensionPixelSize(R.dimen.avatar_radius_36dp);
|
||||
this.avatarRadius24dp = itemView.getContext().getResources().getDimensionPixelSize(R.dimen.avatar_radius_24dp);
|
||||
|
||||
mediaPreviewUnloaded = itemView.getContext().getDrawable(
|
||||
ThemeUtils.getDrawableId(itemView.getContext(),
|
||||
R.attr.media_preview_unloaded_drawable, android.R.color.black)
|
||||
);
|
||||
mediaPreviewUnloaded = new ColorDrawable(ThemeUtils.getColor(itemView.getContext(), R.attr.colorBackgroundAccent));
|
||||
}
|
||||
|
||||
protected abstract int getMediaPreviewHeight(Context context);
|
||||
|
@ -353,12 +350,10 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
int inactiveId;
|
||||
int activeId;
|
||||
if (visibility == Status.Visibility.PRIVATE) {
|
||||
inactiveId = ThemeUtils.getDrawableId(reblogButton.getContext(),
|
||||
R.attr.status_reblog_disabled_drawable, R.drawable.reblog_private_dark);
|
||||
activeId = R.drawable.reblog_private_active;
|
||||
inactiveId = R.drawable.ic_reblog_private_24dp;
|
||||
activeId = R.drawable.ic_reblog_private_active_24dp;
|
||||
} else {
|
||||
inactiveId = ThemeUtils.getDrawableId(reblogButton.getContext(),
|
||||
R.attr.status_reblog_inactive_drawable, R.drawable.reblog_inactive_dark);
|
||||
inactiveId = R.drawable.ic_reblog_24dp;
|
||||
activeId = R.drawable.ic_reblog_active_24dp;
|
||||
}
|
||||
reblogButton.setInactiveImage(inactiveId);
|
||||
|
@ -366,11 +361,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
} else {
|
||||
int disabledId;
|
||||
if (visibility == Status.Visibility.DIRECT) {
|
||||
disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
|
||||
R.attr.status_reblog_direct_drawable, R.drawable.reblog_direct_dark);
|
||||
disabledId = R.drawable.ic_reblog_direct_24dp;
|
||||
} else {
|
||||
disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
|
||||
R.attr.status_reblog_disabled_drawable, R.drawable.reblog_private_dark);
|
||||
disabledId = R.drawable.ic_reblog_private_24dp;
|
||||
}
|
||||
reblogButton.setInactiveImage(disabledId);
|
||||
reblogButton.setActiveImage(disabledId);
|
||||
|
@ -468,8 +461,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
BitmapDrawable blurhashBitmap = decodeBlurHash(attachment.getBlurhash());
|
||||
imageView.setImageDrawable(blurhashBitmap);
|
||||
} else {
|
||||
imageView.setImageDrawable(new ColorDrawable(ThemeUtils.getColor(
|
||||
context, R.attr.sensitive_media_warning_background_color)));
|
||||
imageView.setImageDrawable(mediaPreviewUnloaded);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class TabAdapter(private var data: List<TabData>,
|
|||
ThemeUtils.setDrawableTint(
|
||||
holder.itemView.context,
|
||||
holder.itemView.removeButton.drawable,
|
||||
(if (removeButtonEnabled) android.R.attr.textColorTertiary else R.attr.image_button_disabled_tint)
|
||||
(if (removeButtonEnabled) android.R.attr.textColorTertiary else R.attr.textColorDisabled)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue