pref: 透明主题优化
This commit is contained in:
parent
ecc70507d4
commit
3345d30894
|
|
@ -290,17 +290,17 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorText -> {
|
||||
return if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
context.getColorCompat(R.color.color_text_translucent)
|
||||
context.getColorCompat(R.color.color_text_translucent_light)
|
||||
} else context.getColorCompat(if (ThemeUtil.isNightMode(context)) R.color.color_text_night else R.color.color_text)
|
||||
}
|
||||
R.attr.color_text_disabled -> {
|
||||
return if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
context.getColorCompat(R.color.color_text_disabled_translucent)
|
||||
context.getColorCompat(R.color.color_text_disabled_translucent_light)
|
||||
} else context.getColorCompat(if (ThemeUtil.isNightMode(context)) R.color.color_text_disabled_night else R.color.color_text_disabled)
|
||||
}
|
||||
R.attr.colorTextSecondary -> {
|
||||
return if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
context.getColorCompat(R.color.color_text_secondary_translucent)
|
||||
context.getColorCompat(R.color.color_text_secondary_translucent_light)
|
||||
} else context.getColorCompat(if (ThemeUtil.isNightMode(context)) R.color.color_text_secondary_night else R.color.color_text_secondary)
|
||||
}
|
||||
R.attr.colorTextOnPrimary -> {
|
||||
|
|
@ -318,7 +318,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorUnselected -> {
|
||||
return if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
context.getColorCompat(R.color.theme_color_unselected_translucent)
|
||||
context.getColorCompat(R.color.theme_color_unselected_translucent_light)
|
||||
} else context.getColorCompat(if (ThemeUtil.isNightMode(context)) resources.getIdentifier("theme_color_unselected_$theme", "color", packageName) else R.color.theme_color_unselected_day)
|
||||
}
|
||||
R.attr.colorNavBar -> {
|
||||
|
|
@ -331,7 +331,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorFloorCard -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_floor_card_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_floor_card_translucent_light)
|
||||
}
|
||||
return if (ThemeUtil.isNightMode(context)) {
|
||||
context.getColorCompat(resources.getIdentifier("theme_color_floor_card_$theme", "color", packageName))
|
||||
|
|
@ -339,7 +339,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorCard -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_card_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_card_translucent_light)
|
||||
}
|
||||
return if (ThemeUtil.isNightMode(context)) {
|
||||
context.getColorCompat(resources.getIdentifier("theme_color_card_$theme", "color", packageName))
|
||||
|
|
@ -347,7 +347,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorDivider -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_divider_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_divider_translucent_light)
|
||||
}
|
||||
return if (ThemeUtil.isNightMode(context)) {
|
||||
context.getColorCompat(resources.getIdentifier("theme_color_divider_$theme", "color", packageName))
|
||||
|
|
@ -360,7 +360,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorToolbarItem -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_toolbar_item_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_toolbar_item_translucent_light)
|
||||
}
|
||||
return if (ThemeUtil.isNightMode(context)) {
|
||||
context.getColorCompat(R.color.theme_color_toolbar_item_night)
|
||||
|
|
@ -368,7 +368,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.colorToolbarItemActive -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_toolbar_item_active_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_toolbar_item_active_translucent_light)
|
||||
}
|
||||
if (ThemeUtil.THEME_WHITE == theme) {
|
||||
return context.getColorCompat(resources.getIdentifier("theme_color_toolbar_item_active_$theme", "color", packageName))
|
||||
|
|
@ -379,7 +379,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.color_toolbar_item_secondary -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_toolbar_item_secondary_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_toolbar_item_secondary_translucent_light)
|
||||
}
|
||||
return if (ThemeUtil.THEME_WHITE == theme || ThemeUtil.isNightMode(theme)) {
|
||||
context.getColorCompat(resources.getIdentifier("theme_color_toolbar_item_secondary_$theme", "color", packageName))
|
||||
|
|
@ -387,7 +387,7 @@ class BaseApplication : Application() {
|
|||
}
|
||||
R.attr.color_swipe_refresh_layout_background -> {
|
||||
if (ThemeUtil.THEME_TRANSLUCENT == theme) {
|
||||
return context.getColorCompat(R.color.theme_color_swipe_refresh_view_background_translucent)
|
||||
return context.getColorCompat(R.color.theme_color_swipe_refresh_view_background_translucent_light)
|
||||
}
|
||||
return if (ThemeUtil.isNightMode(theme)) {
|
||||
context.getColorCompat(resources.getIdentifier("theme_color_swipe_refresh_view_background_$theme", "color", packageName))
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
package com.huanchengfly.tieba.post.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
|
|
@ -63,7 +57,9 @@ import org.jetbrains.annotations.NotNull;
|
|||
import org.litepal.LitePal;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import butterknife.BindView;
|
||||
import cn.dreamtobe.kpswitch.util.KPSwitchConflictUtil;
|
||||
import cn.dreamtobe.kpswitch.util.KeyboardUtil;
|
||||
import cn.dreamtobe.kpswitch.widget.KPSwitchFSPanelFrameLayout;
|
||||
|
|
@ -75,52 +71,52 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
public static final int REQUEST_CODE_CHOOSE = 2;
|
||||
|
||||
public static final String TAG = "ReplyActivity";
|
||||
private UndoableEditText editText;
|
||||
private KPSwitchFSPanelFrameLayout panelFrameLayout;
|
||||
private RelativeLayout emotionView;
|
||||
private FrameLayout insertImageView;
|
||||
private TintImageView emotionBtn;
|
||||
private TintImageView insertImageBtn;
|
||||
private ViewPager emotionViewPager;
|
||||
|
||||
@BindView(R.id.activity_reply_edit_text)
|
||||
UndoableEditText editText;
|
||||
@BindView(R.id.activity_reply_panel_root)
|
||||
KPSwitchFSPanelFrameLayout panelFrameLayout;
|
||||
@BindView(R.id.activity_reply_emotion)
|
||||
RelativeLayout emotionView;
|
||||
@BindView(R.id.activity_reply_insert_photo)
|
||||
FrameLayout insertImageView;
|
||||
@BindView(R.id.activity_reply_edit_emotion)
|
||||
TintImageView emotionBtn;
|
||||
@BindView(R.id.activity_reply_edit_insert_photo)
|
||||
TintImageView insertImageBtn;
|
||||
@BindView(R.id.activity_reply_emotion_view_pager)
|
||||
ViewPager emotionViewPager;
|
||||
@BindView(R.id.activity_reply_insert_photo_view)
|
||||
RecyclerView insertView;
|
||||
@BindView(R.id.webview_container)
|
||||
FrameLayout webViewContainer;
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
private ReplyInfoBean replyInfoBean;
|
||||
private RecyclerView insertView;
|
||||
private LoadingDialog loadingDialog;
|
||||
private InsertPhotoAdapter insertPhotoAdapter;
|
||||
private Callback<WebReplyResultBean> mCallback;
|
||||
private MenuItem sendItem;
|
||||
private Toolbar toolbar;
|
||||
private boolean replySuccess;
|
||||
private String content;
|
||||
|
||||
private FrameLayout webViewContainer;
|
||||
private WebView mWebView;
|
||||
|
||||
public static Bitmap tintBitmap(Bitmap inBitmap, int tintColor) {
|
||||
if (inBitmap == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap outBitmap = Bitmap.createBitmap(inBitmap.getWidth(), inBitmap.getHeight(), inBitmap.getConfig());
|
||||
Canvas canvas = new Canvas(outBitmap);
|
||||
Paint paint = new Paint();
|
||||
paint.setColorFilter(new PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_IN));
|
||||
canvas.drawBitmap(inBitmap, 0, 0, paint);
|
||||
return outBitmap;
|
||||
}
|
||||
|
||||
public static Bitmap getBitmapFromVectorDrawable(Context context, int drawableId) {
|
||||
return Util.getBitmapFromVectorDrawable(context, drawableId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNeedImmersionBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_reply;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setSwipeBackEnable(false);
|
||||
setContentView(R.layout.activity_reply);
|
||||
if (ThemeUtil.THEME_TRANSLUCENT.equals(ThemeUtil.getTheme(this))) {
|
||||
TintConstraintLayout constraintLayout = (TintConstraintLayout) findViewById(R.id.activity_reply_layout);
|
||||
constraintLayout.setBackgroundTintResId(0);
|
||||
|
|
@ -131,7 +127,6 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.transparent));
|
||||
getWindow().setBackgroundDrawableResource(R.drawable.bg_trans);
|
||||
initData();
|
||||
findView();
|
||||
initView();
|
||||
}
|
||||
|
||||
|
|
@ -179,24 +174,9 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
}
|
||||
}
|
||||
|
||||
protected void findView() {
|
||||
webViewContainer = (FrameLayout) findViewById(R.id.webview_container);
|
||||
panelFrameLayout = (KPSwitchFSPanelFrameLayout) findViewById(R.id.activity_reply_panel_root);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
editText = (UndoableEditText) findViewById(R.id.activity_reply_edit_text);
|
||||
emotionView = (RelativeLayout) findViewById(R.id.activity_reply_emotion);
|
||||
emotionViewPager = (ViewPager) findViewById(R.id.activity_reply_emotion_view_pager);
|
||||
emotionBtn = (TintImageView) findViewById(R.id.activity_reply_edit_emotion);
|
||||
insertImageView = (FrameLayout) findViewById(R.id.activity_reply_insert_photo);
|
||||
insertImageBtn = (TintImageView) findViewById(R.id.activity_reply_edit_insert_photo);
|
||||
insertView = (RecyclerView) findViewById(R.id.activity_reply_insert_photo_view);
|
||||
setSupportActionBar(toolbar);
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void initView() {
|
||||
setSupportActionBar(toolbar);
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||
ItemTouchHelper mItemTouchHelper = new ItemTouchHelper(new ItemTouchHelper.Callback() {
|
||||
@Override
|
||||
public void clearView(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
||||
|
|
@ -268,10 +248,8 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
layoutManager.setOrientation(RecyclerView.HORIZONTAL);
|
||||
insertView.setLayoutManager(layoutManager);
|
||||
KeyboardUtil.attach(this, panelFrameLayout);
|
||||
KPSwitchConflictUtil.attach(panelFrameLayout, editText, new KPSwitchConflictUtil.SubPanelAndTrigger(emotionView, emotionBtn), new KPSwitchConflictUtil.SubPanelAndTrigger(insertImageView, insertImageBtn));
|
||||
if (replyInfoBean.getReplyUser() != null) {
|
||||
editText.setHint("回复:" + replyInfoBean.getReplyUser());
|
||||
editText.setHint(getString(R.string.hint_reply, replyInfoBean.getReplyUser()));
|
||||
}
|
||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.activity_reply_emotion_tab);
|
||||
TabViewPagerAdapter emotionViewPagerAdapter = new TabViewPagerAdapter();
|
||||
|
|
@ -279,17 +257,16 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
GridView emojiEmotionGridView = new GridView(this);
|
||||
EmotionViewFactory.initGridView(this, EmotionUtil.EMOTION_CLASSIC_WEB_TYPE, classicEmotionGridView);
|
||||
EmotionViewFactory.initGridView(this, EmotionUtil.EMOTION_EMOJI_WEB_TYPE, emojiEmotionGridView);
|
||||
emotionViewPagerAdapter.addView(classicEmotionGridView, "经典");
|
||||
emotionViewPagerAdapter.addView(emojiEmotionGridView, "符号");
|
||||
emotionViewPagerAdapter.addView(classicEmotionGridView, getString(R.string.title_emotion_classic));
|
||||
emotionViewPagerAdapter.addView(emojiEmotionGridView, getString(R.string.title_emotion_emoji));
|
||||
emotionViewPager.setAdapter(emotionViewPagerAdapter);
|
||||
tabLayout.setupWithViewPager(emotionViewPager);
|
||||
EmotionUtil.GlobalOnItemClickManagerUtil.getInstance(this).attachToEditText(editText);
|
||||
initListener();
|
||||
if (content != null) {
|
||||
editText.getMgr().disable();
|
||||
editText.setText(StringUtil.getEmotionContent(EmotionUtil.EMOTION_ALL_WEB_TYPE, editText, content));
|
||||
editText.getMgr().enable();
|
||||
}
|
||||
initListener();
|
||||
}
|
||||
|
||||
private boolean canSend() {
|
||||
|
|
@ -461,16 +438,14 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
if (sendItem != null) sendItem.setEnabled(canSend());
|
||||
}
|
||||
});
|
||||
/*
|
||||
insertPhotoAdapter.setInsertPhotoListener((UploadResultBean.UploadInfo info) -> {
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
|
||||
Bitmap bitmap = getBitmapFromVectorDrawable(this, R.drawable.ic_round_insert_photo);
|
||||
bitmap = Bitmap.createScaledBitmap(bitmap, (int) editText.getTextSize(), (int) editText.getTextSize(), true);
|
||||
bitmap = tintBitmap(bitmap, Util.getColorByStyle(this, R.styleable.Theme_colorAccent, R.color.colorAccent));
|
||||
spannableStringBuilder.append(info.getPic(), new IconTextSpan(this, bitmap, getString(R.string.text_pic), Util.getColorByStyle(this, R.styleable.Theme_colorAccent, R.color.colorAccent), true), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
editText.append(spannableStringBuilder);
|
||||
});
|
||||
*/
|
||||
KeyboardUtil.attach(this, panelFrameLayout);
|
||||
KPSwitchConflictUtil.attach(
|
||||
panelFrameLayout,
|
||||
editText,
|
||||
new KPSwitchConflictUtil.SubPanelAndTrigger(emotionView, emotionBtn),
|
||||
new KPSwitchConflictUtil.SubPanelAndTrigger(insertImageView, insertImageBtn)
|
||||
);
|
||||
EmotionUtil.GlobalOnItemClickManagerUtil.getInstance(this).attachToEditText(editText);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -489,32 +464,28 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_send:
|
||||
mCallback = new Callback<WebReplyResultBean>() {
|
||||
@Override
|
||||
public void onResponse(@NotNull Call<WebReplyResultBean> call, @NotNull Response<WebReplyResultBean> response) {
|
||||
WebReplyResultBean data = response.body();
|
||||
if (loadingDialog != null) loadingDialog.cancel();
|
||||
Toast.makeText(ReplyActivity.this, R.string.toast_reply_success, Toast.LENGTH_SHORT).show();
|
||||
sendBroadcast(new Intent()
|
||||
.setAction(ThreadActivity.ACTION_REPLY_SUCCESS)
|
||||
.putExtra("pid", replyInfoBean.getPid() != null ? replyInfoBean.getPid() : data.getData().getPid()));
|
||||
replySuccess = true;
|
||||
finish();
|
||||
}
|
||||
if (item.getItemId() == R.id.menu_send) {
|
||||
mCallback = new Callback<WebReplyResultBean>() {
|
||||
@Override
|
||||
public void onResponse(@NotNull Call<WebReplyResultBean> call, @NotNull Response<WebReplyResultBean> response) {
|
||||
WebReplyResultBean data = response.body();
|
||||
if (loadingDialog != null) loadingDialog.cancel();
|
||||
Toast.makeText(ReplyActivity.this, R.string.toast_reply_success, Toast.LENGTH_SHORT).show();
|
||||
sendBroadcast(new Intent()
|
||||
.setAction(ThreadActivity.ACTION_REPLY_SUCCESS)
|
||||
.putExtra("pid", replyInfoBean.getPid() != null ? replyInfoBean.getPid() : data.getData().getPid()));
|
||||
replySuccess = true;
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Call<WebReplyResultBean> call, @NotNull Throwable t) {
|
||||
if (loadingDialog != null) loadingDialog.cancel();
|
||||
int code = t instanceof TiebaException ? ((TiebaException) t).getCode() : -1;
|
||||
Toast.makeText(ReplyActivity.this, getString(R.string.toast_reply_failed, code, t.getMessage()), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
};
|
||||
realReply();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@Override
|
||||
public void onFailure(@NotNull Call<WebReplyResultBean> call, @NotNull Throwable t) {
|
||||
if (loadingDialog != null) loadingDialog.cancel();
|
||||
int code = t instanceof TiebaException ? ((TiebaException) t).getCode() : -1;
|
||||
Toast.makeText(ReplyActivity.this, getString(R.string.toast_reply_failed, code, t.getMessage()), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
};
|
||||
realReply();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
@ -602,34 +573,6 @@ public class ReplyActivity extends BaseActivity implements View.OnClickListener
|
|||
Toast.makeText(ReplyActivity.this, error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
/*
|
||||
getReplyContent(new ReplyContentCallback() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
loadingDialog.setTipText("正在提交...");
|
||||
if (replyInfoBean.getPid() == null && replyInfoBean.getFloorNum() == null)
|
||||
mDeprecatedTiebaApi.reply(replyInfoBean.getThreadId(), data, replyInfoBean.getForumId(), replyInfoBean.getForumName(), replyInfoBean.getTbs(), code, md5, replyAPICallback);
|
||||
else
|
||||
mDeprecatedTiebaApi.reply(replyInfoBean.getThreadId(), data, replyInfoBean.getForumId(), replyInfoBean.getForumName(), replyInfoBean.getTbs(), replyInfoBean.getPid(), replyInfoBean.getFloorNum(), code, md5, replyAPICallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(int total) {
|
||||
loadingDialog.setTipText("正在上传图片...(0/" + String.valueOf(total) + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int current, int total) {
|
||||
loadingDialog.setTipText("正在上传图片...(" + String.valueOf(current) + "/" + String.valueOf(total) + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String error) {
|
||||
loadingDialog.cancel();
|
||||
Toast.makeText(ReplyActivity.this, error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -50,8 +50,14 @@ public class ThemeColorAdapter extends RecyclerView.Adapter<MyViewHolder> {
|
|||
|
||||
public void setPalette(Palette palette) {
|
||||
mColors = new ArrayList<>();
|
||||
mColors.add(palette.getVibrantColor(Color.BLACK));
|
||||
mColors.add(palette.getMutedColor(Color.BLACK));
|
||||
int[] colors = new int[]{
|
||||
palette.getVibrantColor(Color.TRANSPARENT),
|
||||
palette.getMutedColor(Color.TRANSPARENT),
|
||||
palette.getDominantColor(Color.TRANSPARENT)
|
||||
};
|
||||
for (int color : colors) {
|
||||
if (color != Color.TRANSPARENT) mColors.add(color);
|
||||
}
|
||||
for (int color : sColors) {
|
||||
mColors.add(color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
package com.huanchengfly.tieba.post.components.dialogs;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.components.MyImageEngine;
|
||||
import com.huanchengfly.tieba.post.utils.SharedPreferencesUtil;
|
||||
import com.huanchengfly.tieba.post.utils.ThemeUtil;
|
||||
import com.huanchengfly.tieba.post.utils.PermissionUtil;
|
||||
import com.yanzhenjie.permission.Action;
|
||||
import com.yanzhenjie.permission.runtime.Permission;
|
||||
import com.zhihu.matisse.Matisse;
|
||||
import com.zhihu.matisse.MimeType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.huanchengfly.tieba.post.activities.TranslucentThemeActivity.REQUEST_CODE_CHOOSE;
|
||||
|
||||
public class TranslucentThemeDialog extends BaseFullScreenDialog implements View.OnClickListener, SeekBar.OnSeekBarChangeListener {
|
||||
public static final String TAG = TranslucentThemeDialog.class.getSimpleName();
|
||||
private final Context mContext;
|
||||
|
||||
public TranslucentThemeDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_translucent_theme;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView(View contentView) {
|
||||
Button selectPicBtn = contentView.findViewById(R.id.select_pic);
|
||||
SeekBar alphaSeekBar = contentView.findViewById(R.id.alpha);
|
||||
SeekBar blueSeekBar = contentView.findViewById(R.id.blur);
|
||||
alphaSeekBar.setOnSeekBarChangeListener(this);
|
||||
blueSeekBar.setOnSeekBarChangeListener(this);
|
||||
selectPicBtn.setOnClickListener(this);
|
||||
ThemeUtil.setTranslucentThemeBackground(contentView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.select_pic:
|
||||
askPermission(data -> Matisse.from((Activity) mContext)
|
||||
.choose(MimeType.ofImage())
|
||||
.theme(ThemeUtil.isNightMode(getContext()) ? R.style.Matisse_Dracula : R.style.Matisse_Zhihu)
|
||||
.imageEngine(new MyImageEngine())
|
||||
.forResult(REQUEST_CODE_CHOOSE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void askPermission(Action<List<String>> granted) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
PermissionUtil.askPermission(getContext(), granted, R.string.toast_no_permission_insert_photo,
|
||||
new PermissionUtil.Permission(Permission.Group.STORAGE, getContext().getString(R.string.tip_permission_storage)));
|
||||
} else {
|
||||
PermissionUtil.askPermission(getContext(), granted, R.string.toast_no_permission_insert_photo,
|
||||
new PermissionUtil.Permission(Permission.READ_EXTERNAL_STORAGE, getContext().getString(R.string.tip_permission_storage)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
switch (seekBar.getId()) {
|
||||
case R.id.alpha:
|
||||
SharedPreferencesUtil.put(getContext(), SharedPreferencesUtil.SP_SETTINGS, "translucent_background_alpha", progress);
|
||||
break;
|
||||
case R.id.blur:
|
||||
SharedPreferencesUtil.put(getContext(), SharedPreferencesUtil.SP_SETTINGS, "translucent_background_blur", progress);
|
||||
break;
|
||||
}
|
||||
ThemeUtil.setTranslucentThemeBackground(getContentView());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
}
|
||||
|
|
@ -15,12 +15,12 @@ import butterknife.OnClick
|
|||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCallback
|
||||
import com.huanchengfly.tieba.post.R
|
||||
import com.huanchengfly.tieba.post.activities.ReplyActivity
|
||||
import com.huanchengfly.tieba.post.activities.ThreadActivity
|
||||
import com.huanchengfly.tieba.post.adapters.RecyclerFloorAdapter
|
||||
import com.huanchengfly.tieba.post.api.TiebaApi
|
||||
import com.huanchengfly.tieba.post.api.models.SubFloorListBean
|
||||
import com.huanchengfly.tieba.post.R
|
||||
import com.huanchengfly.tieba.post.activities.ThreadActivity
|
||||
import com.huanchengfly.tieba.post.activities.ReplyActivity
|
||||
import com.huanchengfly.tieba.post.adapters.RecyclerFloorAdapter
|
||||
import com.huanchengfly.tieba.post.components.MyLinearLayoutManager
|
||||
import com.huanchengfly.tieba.post.components.dividers.ThreadDivider
|
||||
import com.huanchengfly.tieba.post.components.transformations.RadiusTransformation
|
||||
|
|
@ -101,6 +101,7 @@ class FloorFragment : BaseBottomSheetDialogFragment() {
|
|||
|
||||
override fun initView() {
|
||||
ThemeUtil.setTranslucentThemeBackground(rootView.findViewById(R.id.background),
|
||||
false,
|
||||
false,
|
||||
RadiusTransformation(attachContext,
|
||||
8,
|
||||
|
|
|
|||
|
|
@ -13,18 +13,18 @@ import androidx.preference.ListPreference
|
|||
import androidx.preference.Preference
|
||||
import androidx.preference.SwitchPreference
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||
import com.huanchengfly.tieba.post.api.LiteApi.Companion.instance
|
||||
import com.huanchengfly.tieba.post.api.interfaces.CommonAPICallback
|
||||
import com.huanchengfly.tieba.post.api.models.NewUpdateBean
|
||||
import com.huanchengfly.tieba.post.R
|
||||
import com.huanchengfly.tieba.post.activities.BlockListActivity
|
||||
import com.huanchengfly.tieba.post.activities.LoginActivity
|
||||
import com.huanchengfly.tieba.post.api.LiteApi.Companion.instance
|
||||
import com.huanchengfly.tieba.post.api.interfaces.CommonAPICallback
|
||||
import com.huanchengfly.tieba.post.api.models.NewUpdateBean
|
||||
import com.huanchengfly.tieba.post.components.prefs.TimePickerPreference
|
||||
import com.huanchengfly.tieba.post.fragments.preference.PreferencesFragment
|
||||
import com.huanchengfly.tieba.post.models.database.Account
|
||||
import com.huanchengfly.tieba.post.models.database.Block
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||
import com.huanchengfly.tieba.post.utils.*
|
||||
import com.huanchengfly.tieba.post.utils.GlideCacheUtil
|
||||
import com.lapism.searchview.database.SearchHistoryTable
|
||||
import java.util.*
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import android.os.Bundle;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.XmlRes;
|
||||
|
||||
import com.huanchengfly.tieba.post.fragments.PreferencesFragment;
|
||||
import com.huanchengfly.tieba.post.fragments.preference.PreferencesFragment;
|
||||
|
||||
public class IntroSettingsFragment extends PreferencesFragment {
|
||||
private String spName;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.huanchengfly.tieba.post.fragments.preference
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.preference.EditTextPreferenceDialogFragmentCompat
|
||||
import androidx.preference.PreferenceDialogFragmentCompat
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils
|
||||
|
||||
class EditTextPreferenceDialogFragment : EditTextPreferenceDialogFragmentCompat() {
|
||||
companion object {
|
||||
fun newInstance(key: String): EditTextPreferenceDialogFragment {
|
||||
val fragment = EditTextPreferenceDialogFragment()
|
||||
val b = Bundle(1)
|
||||
b.putString(PreferenceDialogFragmentCompat.ARG_KEY, key)
|
||||
fragment.arguments = b
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindDialogView(view: View) {
|
||||
super.onBindDialogView(view)
|
||||
ThemeUtils.refreshUI(view.context)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.huanchengfly.tieba.post.fragments;
|
||||
package com.huanchengfly.tieba.post.fragments.preference;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
|
|
@ -9,10 +9,12 @@ import android.os.Bundle;
|
|||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.preference.EditTextPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import com.huanchengfly.tieba.post.components.prefs.TimePickerPreference;
|
||||
import com.huanchengfly.tieba.post.fragments.TimePreferenceDialogFragmentCompat;
|
||||
|
||||
public abstract class PreferencesFragment extends PreferenceFragmentCompat {
|
||||
private Context attachContext;
|
||||
|
|
@ -51,11 +53,12 @@ public abstract class PreferencesFragment extends PreferenceFragmentCompat {
|
|||
Bundle bundle = new Bundle(1);
|
||||
bundle.putString("key", preference.getKey());
|
||||
dialogFragment.setArguments(bundle);
|
||||
} else if (preference instanceof EditTextPreference) {
|
||||
dialogFragment = EditTextPreferenceDialogFragment.newInstance(preference.getKey());
|
||||
}
|
||||
|
||||
if (dialogFragment != null) {
|
||||
dialogFragment.setTargetFragment(this, 0);
|
||||
dialogFragment.show(getFragmentManager(), "androidx.preference.PreferenceFragment.DIALOG");
|
||||
dialogFragment.show(getParentFragmentManager(), "androidx.preference.PreferenceFragment.DIALOG");
|
||||
} else {
|
||||
super.onDisplayPreferenceDialog(preference);
|
||||
}
|
||||
|
|
@ -3,15 +3,14 @@ package com.huanchengfly.tieba.post.utils;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import androidx.appcompat.view.menu.MenuPopupHelper;
|
||||
import androidx.appcompat.widget.ListPopupWindow;
|
||||
import androidx.appcompat.widget.MenuPopupWindow;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
|
@ -25,13 +24,10 @@ public class PopupUtil {
|
|||
Field contextField = ListPopupWindow.class.getDeclaredField("mContext");
|
||||
contextField.setAccessible(true);
|
||||
Context context = (Context) contextField.get(listPopupWindow);
|
||||
Field field = ListPopupWindow.class.getDeclaredField("mPopup");
|
||||
field.setAccessible(true);
|
||||
PopupWindow popupWindow = (PopupWindow) field.get(listPopupWindow);
|
||||
if (ThemeUtil.THEME_TRANSLUCENT.equals(ThemeUtil.getTheme(context))) {
|
||||
popupWindow.setBackgroundDrawable(ThemeUtils.tintDrawable(context.getDrawable(R.drawable.bg_popup), context.getResources().getColor(R.color.white)));
|
||||
listPopupWindow.setBackgroundDrawable(ThemeUtils.tintDrawable(context.getDrawable(R.drawable.bg_popup), context.getResources().getColor(R.color.theme_color_background_dark)));
|
||||
} else {
|
||||
popupWindow.setBackgroundDrawable(ThemeUtils.tintDrawable(context.getDrawable(R.drawable.bg_popup), ThemeUtils.getColorByAttr(context, R.attr.colorCard)));
|
||||
listPopupWindow.setBackgroundDrawable(ThemeUtils.tintDrawable(context.getDrawable(R.drawable.bg_popup), ThemeUtils.getColorByAttr(context, R.attr.colorCard)));
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import android.content.SharedPreferences;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -34,6 +35,8 @@ import com.huanchengfly.tieba.post.activities.BaseActivity;
|
|||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.post.widgets.theme.TintSwipeRefreshLayout;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ThemeUtil {
|
||||
|
|
@ -45,6 +48,8 @@ public class ThemeUtil {
|
|||
public static final String SP_SWITCH_REASON = "switch_reason";
|
||||
|
||||
public static final String THEME_TRANSLUCENT = "translucent";
|
||||
public static final String THEME_TRANSLUCENT_LIGHT = "translucent_light";
|
||||
public static final String THEME_TRANSLUCENT_DARK = "translucent_dark";
|
||||
public static final String THEME_CUSTOM = "custom";
|
||||
public static final String THEME_WHITE = "white";
|
||||
public static final String THEME_TIEBA = "tieba";
|
||||
|
|
@ -230,11 +235,22 @@ public class ThemeUtil {
|
|||
view.setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
public static void setTranslucentThemeBackground(View view, boolean setFitsSystemWindow, BitmapTransformation... transformations) {
|
||||
public static void setTranslucentDialogBackground(View view) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
if (!THEME_TRANSLUCENT.equals(ThemeUtil.getTheme(view.getContext()))) {
|
||||
return;
|
||||
}
|
||||
view.setBackgroundTintList(null);
|
||||
view.setBackgroundColor(ThemeUtils.getColorById(view.getContext(), R.color.theme_color_card_grey_dark));
|
||||
}
|
||||
|
||||
public static void setTranslucentThemeBackground(View view, boolean setFitsSystemWindow, boolean useCache, BitmapTransformation... transformations) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
if (!THEME_TRANSLUCENT.equals(ThemeUtil.getTheme(BaseApplication.getInstance()))) {
|
||||
if (setFitsSystemWindow) {
|
||||
setAppBarFitsSystemWindow(view, false);
|
||||
view.setFitsSystemWindows(false);
|
||||
|
|
@ -254,23 +270,29 @@ public class ThemeUtil {
|
|||
}
|
||||
}
|
||||
view.setBackgroundTintList(null);
|
||||
String backgroundFilePath = SharedPreferencesUtil.get(view.getContext(), SharedPreferencesUtil.SP_SETTINGS)
|
||||
String backgroundFilePath = SharedPreferencesUtil.get(BaseApplication.getInstance(), SharedPreferencesUtil.SP_SETTINGS)
|
||||
.getString(SP_TRANSLUCENT_THEME_BACKGROUND_PATH, null);
|
||||
if (backgroundFilePath == null) {
|
||||
view.setBackgroundColor(Color.BLACK);
|
||||
return;
|
||||
}
|
||||
if (BaseApplication.getTranslucentBackground() != null && (transformations == null || transformations.length == 0)) {
|
||||
if (useCache &&
|
||||
BaseApplication.getTranslucentBackground() != null &&
|
||||
(!(BaseApplication.getTranslucentBackground() instanceof BitmapDrawable)
|
||||
|| (BaseApplication.getTranslucentBackground() instanceof BitmapDrawable &&
|
||||
!((BitmapDrawable) BaseApplication.getTranslucentBackground()).getBitmap().isRecycled())) &&
|
||||
(transformations == null || transformations.length == 0)) {
|
||||
view.setBackground(BaseApplication.getTranslucentBackground());
|
||||
return;
|
||||
}
|
||||
RequestOptions bgOptions = RequestOptions.centerCropTransform()
|
||||
.optionalFitCenter()
|
||||
.skipMemoryCache(true)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE);
|
||||
if (transformations != null && transformations.length > 0) {
|
||||
bgOptions = bgOptions.transforms(transformations);
|
||||
bgOptions = bgOptions.transform(transformations);
|
||||
}
|
||||
Glide.with(view)
|
||||
Glide.with(BaseApplication.getInstance())
|
||||
.asDrawable()
|
||||
.load(new File(backgroundFilePath))
|
||||
.apply(bgOptions)
|
||||
|
|
@ -282,7 +304,9 @@ public class ThemeUtil {
|
|||
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
BaseApplication.setTranslucentBackground(resource);
|
||||
if (useCache && (transformations == null || transformations.length == 0)) {
|
||||
BaseApplication.setTranslucentBackground(resource);
|
||||
}
|
||||
getView().setBackground(resource);
|
||||
}
|
||||
|
||||
|
|
@ -294,16 +318,17 @@ public class ThemeUtil {
|
|||
}
|
||||
|
||||
public static void setTranslucentThemeBackground(View view) {
|
||||
setTranslucentThemeBackground(view, true);
|
||||
setTranslucentThemeBackground(view, true, true);
|
||||
}
|
||||
|
||||
@StyleRes
|
||||
public static int getThemeByName(String themeName) {
|
||||
private static int getThemeByName(@NotNull String themeName) {
|
||||
switch (themeName.toLowerCase()) {
|
||||
case THEME_TRANSLUCENT:
|
||||
return R.style.TiebaLite_Translucent;
|
||||
case THEME_WHITE:
|
||||
return R.style.TiebaLite_White;
|
||||
case THEME_TRANSLUCENT_LIGHT:
|
||||
return R.style.TiebaLite_Translucent_Light;
|
||||
case THEME_TRANSLUCENT_DARK:
|
||||
return R.style.TiebaLite_Translucent_Dark;
|
||||
case THEME_TIEBA:
|
||||
return R.style.TiebaLite_Tieba;
|
||||
case THEME_BLACK:
|
||||
|
|
@ -320,6 +345,9 @@ public class ThemeUtil {
|
|||
return R.style.TiebaLite_Dark_Grey;
|
||||
case THEME_AMOLED_DARK:
|
||||
return R.style.TiebaLite_Dark_Amoled;
|
||||
case THEME_CUSTOM:
|
||||
return R.style.TiebaLite_Custom;
|
||||
case THEME_WHITE:
|
||||
default:
|
||||
return R.style.TiebaLite_White;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.huanchengfly.tieba.post.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class UnPressableLinearLayout extends LinearLayout {
|
||||
public UnPressableLinearLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public UnPressableLinearLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchSetPressed(boolean pressed) {
|
||||
// Skip dispatching the pressed key state to the children so that they don't trigger any
|
||||
// pressed state animation on their stateful drawables.
|
||||
}
|
||||
}
|
||||
|
|
@ -8,9 +8,9 @@ import android.util.AttributeSet;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AlertDialogLayout;
|
||||
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.utils.ThemeUtil;
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
|
|
@ -48,6 +48,6 @@ public class TintAlertDialogLayout extends AlertDialogLayout implements Tintable
|
|||
} else {
|
||||
setBackground(ThemeUtils.tintDrawable(getBackground(), ThemeUtils.getColorById(getContext(), mBackgroundTintResId)));
|
||||
}
|
||||
ThemeUtil.setTranslucentThemeBackground(this);
|
||||
ThemeUtil.setTranslucentDialogBackground(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.huanchengfly.tieba.post.widgets.theme
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import com.huanchengfly.tieba.post.R
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ColorStateListUtils
|
||||
|
||||
class TintEditText @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.editTextStyle
|
||||
) : AppCompatEditText(context, attrs, defStyleAttr), Tintable {
|
||||
private var textColorResId: Int
|
||||
private var textColorHintResId: Int
|
||||
|
||||
init {
|
||||
if (isInEditMode || attrs == null) {
|
||||
textColorResId = 0
|
||||
textColorHintResId = 0
|
||||
} else {
|
||||
val array = getContext().obtainStyledAttributes(attrs, R.styleable.TintEditText, defStyleAttr, 0)
|
||||
textColorResId = array.getResourceId(R.styleable.TintEditText_textColor, 0)
|
||||
textColorHintResId = array.getResourceId(R.styleable.TintEditText_android_textColorHint, 0)
|
||||
array.recycle()
|
||||
}
|
||||
tint()
|
||||
}
|
||||
|
||||
override fun tint() {
|
||||
if (textColorResId != 0) {
|
||||
setTextColor(ColorStateListUtils.createColorStateList(context, textColorResId))
|
||||
}
|
||||
if (textColorHintResId != 0) {
|
||||
setHintTextColor(ColorStateListUtils.createColorStateList(context, textColorHintResId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,15 +10,17 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatSeekBar;
|
||||
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ColorStateListUtils;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
|
||||
@SuppressLint("CustomViewStyleable")
|
||||
public class TintSeekBar extends AppCompatSeekBar implements Tintable {
|
||||
private int mBackgroundTintResId;
|
||||
private int mProgressTintResId;
|
||||
private int mProgressBackgroundTintResId;
|
||||
private int mThumbColorResId;
|
||||
|
||||
public TintSeekBar(@NonNull Context context) {
|
||||
this(context, null);
|
||||
|
|
@ -35,15 +37,17 @@ public class TintSeekBar extends AppCompatSeekBar implements Tintable {
|
|||
}
|
||||
if (attrs == null) {
|
||||
mBackgroundTintResId = 0;
|
||||
mProgressTintResId = R.color.default_color_primary;
|
||||
mProgressTintResId = 0;
|
||||
mProgressBackgroundTintResId = 0;
|
||||
mThumbColorResId = 0;
|
||||
applyTintColor();
|
||||
return;
|
||||
}
|
||||
TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.TintSeekbar, defStyleAttr, 0);
|
||||
mBackgroundTintResId = array.getResourceId(R.styleable.TintSeekbar_seekbarBackgroundTint, 0);
|
||||
mProgressTintResId = array.getResourceId(R.styleable.TintSeekbar_progressTint, R.color.default_color_primary);
|
||||
mProgressTintResId = array.getResourceId(R.styleable.TintSeekbar_progressTint, 0);
|
||||
mProgressBackgroundTintResId = array.getResourceId(R.styleable.TintSeekbar_progressBackgroundTint, 0);
|
||||
mThumbColorResId = array.getResourceId(R.styleable.TintSeekbar_thumbColor, 0);
|
||||
array.recycle();
|
||||
applyTintColor();
|
||||
}
|
||||
|
|
@ -61,9 +65,13 @@ public class TintSeekBar extends AppCompatSeekBar implements Tintable {
|
|||
setBackgroundTintList(ColorStateList.valueOf(ThemeUtils.getColorById(getContext(), mBackgroundTintResId)));
|
||||
}
|
||||
}
|
||||
setProgressTintList(ColorStateList.valueOf(ThemeUtils.getColorById(getContext(), mProgressTintResId)));
|
||||
if (mProgressTintResId != 0)
|
||||
setProgressTintList(ColorStateList.valueOf(ThemeUtils.getColorById(getContext(), mProgressTintResId)));
|
||||
if (mProgressBackgroundTintResId != 0) {
|
||||
setProgressBackgroundTintList(ColorStateList.valueOf(ThemeUtils.getColorById(getContext(), mProgressBackgroundTintResId)));
|
||||
}
|
||||
if (mThumbColorResId != 0) {
|
||||
setThumbTintList(ColorStateListUtils.createColorStateList(getContext(), mThumbColorResId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,38 +8,61 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ColorStateListUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class TintTextInputLayout extends TextInputLayout implements Tintable {
|
||||
private int mBoxStrokeColor;
|
||||
private int mBoxStrokeColorResId;
|
||||
private int mHintTextColorResId;
|
||||
private int mPlaceholderTextColorResId;
|
||||
|
||||
public TintTextInputLayout(@NonNull Context context) {
|
||||
super(context);
|
||||
init(context, null, 0);
|
||||
}
|
||||
|
||||
public TintTextInputLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs, 0);
|
||||
}
|
||||
|
||||
public TintTextInputLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private void init(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
if (isInEditMode()) {
|
||||
return;
|
||||
}
|
||||
if (attrs == null) {
|
||||
mBoxStrokeColor = R.color.default_color_primary;
|
||||
mBoxStrokeColorResId = 0;
|
||||
mHintTextColorResId = 0;
|
||||
mPlaceholderTextColorResId = 0;
|
||||
tint();
|
||||
return;
|
||||
}
|
||||
TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.TintTextInputLayout, defStyleAttr, 0);
|
||||
mBoxStrokeColor = array.getResourceId(R.styleable.TintTextInputLayout_inputLayoutBoxStrokeColor, R.color.default_color_primary);
|
||||
mBoxStrokeColorResId = array.getResourceId(R.styleable.TintTextInputLayout_boxStrokeColor, 0);
|
||||
mHintTextColorResId = array.getResourceId(R.styleable.TintTextInputLayout_hintTextColor, 0);
|
||||
mPlaceholderTextColorResId = array.getResourceId(R.styleable.TintTextInputLayout_placeholderTextColor, 0);
|
||||
array.recycle();
|
||||
tint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tint() {
|
||||
setBoxStrokeColor(ThemeUtils.getColorById(getContext(), mBoxStrokeColor));
|
||||
if (mBoxStrokeColorResId != 0) {
|
||||
setBoxStrokeColorStateList(Objects.requireNonNull(ColorStateListUtils.createColorStateList(getContext(), mBoxStrokeColorResId)));
|
||||
}
|
||||
if (mHintTextColorResId != 0) {
|
||||
setHintTextColor(ColorStateListUtils.createColorStateList(getContext(), mHintTextColorResId));
|
||||
}
|
||||
if (mPlaceholderTextColorResId != 0) {
|
||||
setPlaceholderTextColor(ColorStateListUtils.createColorStateList(getContext(), mPlaceholderTextColorResId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,11 @@ import android.util.Log;
|
|||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.ActionMenuView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ThemeUtils;
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.utils.ThemeUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class TintToolbar extends Toolbar implements Tintable {
|
||||
public static final String TAG = "TintToolbar";
|
||||
|
|
@ -150,39 +146,6 @@ public class TintToolbar extends Toolbar implements Tintable {
|
|||
applyTintColor();
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void tintOverflowMenu() {
|
||||
int popupTheme = R.style.OverflowMenu;
|
||||
switch (ThemeUtil.getTheme(getContext())) {
|
||||
case ThemeUtil.THEME_BLUE_DARK:
|
||||
popupTheme = R.style.OverflowMenu_Dark;
|
||||
break;
|
||||
case ThemeUtil.THEME_AMOLED_DARK:
|
||||
popupTheme = R.style.OverflowMenu_Dark_Amoled;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
setPopupTheme(popupTheme);
|
||||
try {
|
||||
getMenu();
|
||||
Field field = Toolbar.class.getDeclaredField("mMenuView");
|
||||
field.setAccessible(true);
|
||||
ActionMenuView actionMenuView = (ActionMenuView) field.get(this);
|
||||
if (actionMenuView == null) {
|
||||
return;
|
||||
}
|
||||
actionMenuView.setPopupTheme(popupTheme);
|
||||
Log.i(TAG, "tintOverflowMenu: finish");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setBackgroundTintResId(int mBackgroundTintResId) {
|
||||
this.mBackgroundTintResId = mBackgroundTintResId;
|
||||
tint();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.huanchengfly.tieba.post.widgets.theme;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.huanchengfly.tieba.post.R;
|
||||
import com.huanchengfly.tieba.post.ui.theme.interfaces.Tintable;
|
||||
import com.huanchengfly.tieba.post.ui.theme.utils.ColorStateListUtils;
|
||||
import com.huanchengfly.tieba.post.widgets.edittext.widget.UndoableEditText;
|
||||
|
||||
public class TintUndoableEditText extends UndoableEditText implements Tintable {
|
||||
private int mTextColorResId;
|
||||
private int mHintTextColorResId;
|
||||
|
||||
public TintUndoableEditText(Context context) {
|
||||
super(context);
|
||||
init(null, 0);
|
||||
}
|
||||
|
||||
public TintUndoableEditText(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(attrs, 0);
|
||||
}
|
||||
|
||||
public TintUndoableEditText(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private void init(AttributeSet attrs, int defStyleAttr) {
|
||||
if (isInEditMode()) {
|
||||
return;
|
||||
}
|
||||
if (attrs == null) {
|
||||
mTextColorResId = 0;
|
||||
mHintTextColorResId = 0;
|
||||
tint();
|
||||
return;
|
||||
}
|
||||
TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable.TintUndoableEditText, defStyleAttr, 0);
|
||||
mTextColorResId = array.getResourceId(R.styleable.TintUndoableEditText_textColor, 0);
|
||||
mHintTextColorResId = array.getResourceId(R.styleable.TintUndoableEditText_hintTextColor, 0);
|
||||
array.recycle();
|
||||
tint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tint() {
|
||||
if (mTextColorResId != 0) {
|
||||
setTextColor(ColorStateListUtils.createColorStateList(getContext(), mTextColorResId));
|
||||
}
|
||||
if (mHintTextColorResId != 0) {
|
||||
setHintTextColor(ColorStateListUtils.createColorStateList(getContext(), mHintTextColorResId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,12 +9,11 @@
|
|||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<scale
|
||||
android:scaleWidth="100%">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="@color/default_color_accent" />
|
||||
</shape>
|
||||
</scale>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -43,25 +43,28 @@
|
|||
app:title="@string/title_reply" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<com.huanchengfly.tieba.post.widgets.edittext.widget.UndoableEditText
|
||||
android:textSize="14sp"
|
||||
<com.huanchengfly.tieba.post.widgets.theme.TintUndoableEditText
|
||||
android:id="@+id/activity_reply_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:importantForAutofill="no"
|
||||
android:gravity="top|start"
|
||||
android:hint="@string/tip_reply"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textMultiLine|textImeMultiLine"
|
||||
android:lines="5"
|
||||
android:padding="12dp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/activity_reply_btn_bar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/appbar"
|
||||
app:textColor="@color/default_color_text"
|
||||
app:hintTextColor="@color/default_color_text_secondary"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<requestFocus />
|
||||
</com.huanchengfly.tieba.post.widgets.edittext.widget.UndoableEditText>
|
||||
</com.huanchengfly.tieba.post.widgets.theme.TintUndoableEditText>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/activity_reply_btn_bar"
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:toolbarBackgroundTint="@color/transparent"
|
||||
app:itemTint="@color/theme_color_toolbar_item_translucent"
|
||||
app:secondaryItemTint="@color/theme_color_toolbar_item_secondary_translucent"
|
||||
app:activeItemTint="@color/theme_color_toolbar_item_active_translucent"
|
||||
app:itemTint="@color/theme_color_toolbar_item_translucent_light"
|
||||
app:secondaryItemTint="@color/theme_color_toolbar_item_secondary_translucent_light"
|
||||
app:activeItemTint="@color/theme_color_toolbar_item_active_translucent_light"
|
||||
app:title="@string/title_dialog_translucent_theme" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:id="@+id/select_pic"
|
||||
android:text="@string/title_select_pic"
|
||||
app:buttonTextColor="@color/color_text_translucent"
|
||||
app:buttonTextColor="@color/color_text_translucent_light"
|
||||
style="@style/Widget.Button.Dense"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:textColor="@color/color_text_translucent"
|
||||
android:textColor="@color/color_text_translucent_light"
|
||||
android:text="@string/title_select_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
<com.huanchengfly.tieba.post.widgets.theme.TintMaterialButton
|
||||
android:id="@+id/custom_color"
|
||||
android:text="@string/title_custom_color"
|
||||
app:buttonTextColor="@color/color_text_translucent"
|
||||
app:buttonTextColor="@color/color_text_translucent_light"
|
||||
style="@style/Widget.Button.Dense"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/title_translucent_theme_alpha"
|
||||
android:textColor="@color/color_text_translucent"
|
||||
android:textColor="@color/color_text_translucent_light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<com.huanchengfly.tieba.post.widgets.theme.TintSeekBar
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/title_translucent_theme_blur"
|
||||
android:textColor="@color/color_text_translucent"
|
||||
android:textColor="@color/color_text_translucent_light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<com.huanchengfly.tieba.post.widgets.theme.TintSeekBar
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
|
||||
<TextView
|
||||
android:layout_marginTop="12dp"
|
||||
android:textColor="@color/color_text_translucent"
|
||||
android:textColor="@color/color_text_translucent_light"
|
||||
android:id="@+id/tip"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
|
@ -15,17 +14,23 @@
|
|||
android:layout_marginEnd="8dp"
|
||||
android:textColorHint="?attr/colorAccent"
|
||||
app:boxBackgroundColor="@color/transparent"
|
||||
app:boxStrokeColor="@color/default_color_primary"
|
||||
app:hintTextColor="@color/default_color_primary"
|
||||
app:placeholderTextColor="@color/default_color_primary"
|
||||
app:hintAnimationEnabled="true"
|
||||
app:hintEnabled="true"
|
||||
app:inputLayoutBoxStrokeColor="@color/default_color_primary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:textCursorDrawable="@null"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/tip_input" />
|
||||
android:hint="@string/tip_input">
|
||||
|
||||
<requestFocus />
|
||||
</com.google.android.material.textfield.TextInputEditText>
|
||||
|
||||
</com.huanchengfly.tieba.post.widgets.theme.TintTextInputLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,12 @@
|
|||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextInputLayout
|
||||
app:inputLayoutBoxStrokeColor="@color/default_color_primary"
|
||||
android:layout_marginTop="8dp"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
app:boxBackgroundColor="@color/transparent"
|
||||
app:boxStrokeColor="@color/default_color_primary"
|
||||
app:hintTextColor="@color/default_color_primary"
|
||||
app:placeholderTextColor="@color/default_color_primary"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
|
|
@ -36,6 +39,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:textCursorDrawable="@null"
|
||||
android:id="@android:id/edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.preference.UnPressableLinearLayout
|
||||
<com.huanchengfly.tieba.post.widgets.UnPressableLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
|
|
@ -68,14 +68,18 @@
|
|||
style="@style/Widget.AppCompat.SeekBar"
|
||||
app:progressTint="@color/default_color_primary"
|
||||
android:id="@+id/seekbar"
|
||||
android:progressDrawable="@drawable/bg_seekbar_round"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="16dp"
|
||||
android:paddingStart="@dimen/preference_seekbar_padding_horizontal"
|
||||
android:paddingEnd="@dimen/preference_seekbar_padding_horizontal"
|
||||
android:paddingTop="@dimen/preference_seekbar_padding_vertical"
|
||||
android:paddingBottom="@dimen/preference_seekbar_padding_vertical"
|
||||
android:background="@null"/>
|
||||
android:background="@null"
|
||||
android:thumb="@null"
|
||||
tools:ignore="PrivateResource" />
|
||||
|
||||
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
|
||||
android:id="@+id/seekbar_value"
|
||||
|
|
@ -90,9 +94,10 @@
|
|||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
app:tintList="@drawable/text_color_secondary_selector"
|
||||
android:scrollbars="none"/>
|
||||
android:scrollbars="none"
|
||||
tools:ignore="PrivateResource" />
|
||||
|
||||
</androidx.preference.UnPressableLinearLayout>
|
||||
</com.huanchengfly.tieba.post.widgets.UnPressableLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -93,6 +93,7 @@
|
|||
<attr name="seekbarBackgroundTint" format="color" />
|
||||
<attr name="progressTint" format="color" />
|
||||
<attr name="progressBackgroundTint" format="color" />
|
||||
<attr name="thumbColor" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TintMaterialButton">
|
||||
|
|
@ -114,11 +115,23 @@
|
|||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TintTextInputLayout">
|
||||
<attr name="inputLayoutBoxStrokeColor" format="color" />
|
||||
<attr name="boxStrokeColor" />
|
||||
<attr name="hintTextColor" />
|
||||
<attr name="placeholderTextColor" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TintUndoableEditText">
|
||||
<attr name="hintTextColor" format="color" />
|
||||
<attr name="textColor" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="MyViewPager">
|
||||
<attr name="orientation" />
|
||||
<attr format="boolean" name="can_scroll"/>
|
||||
<attr format="boolean" name="can_scroll" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TintEditText">
|
||||
<attr name="textColor" />
|
||||
<attr name="android:textColorHint" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
|
@ -31,9 +31,13 @@
|
|||
<color name="color_text_secondary_night">#B3E6E7EE</color>
|
||||
<color name="color_text_disabled_night">#80E6E7EE</color>
|
||||
|
||||
<color name="color_text_translucent">#FFFFFFFF</color>
|
||||
<color name="color_text_secondary_translucent">#B3FFFFFF</color>
|
||||
<color name="color_text_disabled_translucent">#80FFFFFF</color>
|
||||
<color name="color_text_translucent_light">#DFFFFFFF</color>
|
||||
<color name="color_text_secondary_translucent_light">#8AFFFFFF</color>
|
||||
<color name="color_text_disabled_translucent_light">#61FFFFFF</color>
|
||||
|
||||
<color name="color_text_translucent_dark">#FF000000</color>
|
||||
<color name="color_text_secondary_translucent_dark">#B3000000</color>
|
||||
<color name="color_text_disabled_translucent_dark">#80000000</color>
|
||||
|
||||
<color name="default_color_primary">#FF4477E0</color>
|
||||
<color name="default_color_accent">#FF4477E0</color>
|
||||
|
|
@ -80,19 +84,22 @@
|
|||
<color name="theme_color_toolbar_amoled_dark">@color/black</color>
|
||||
|
||||
<color name="theme_color_toolbar_item_light">#FF474B54</color>
|
||||
<color name="theme_color_toolbar_item_translucent">#FFFFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_translucent_light">#DFFFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_translucent_dark">#FF000000</color>
|
||||
<color name="theme_color_toolbar_item_dark">@color/white</color>
|
||||
<color name="theme_color_toolbar_item_night">#FFE6E7EE</color>
|
||||
|
||||
<color name="theme_color_toolbar_item_secondary_white">#DD545967</color>
|
||||
<color name="theme_color_toolbar_item_secondary_light">#99FFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_secondary_translucent">#99FFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_secondary_translucent_light">#8AFFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_secondary_translucent_dark">#B3000000</color>
|
||||
<color name="theme_color_toolbar_item_secondary_dark">#CCE6E7EE</color>
|
||||
<color name="theme_color_toolbar_item_secondary_grey_dark">#CCE6E7EE</color>
|
||||
<color name="theme_color_toolbar_item_secondary_amoled_dark">#CCE6E7EE</color>
|
||||
|
||||
<color name="theme_color_toolbar_item_active_white">@color/theme_color_accent_white</color>
|
||||
<color name="theme_color_toolbar_item_active_translucent">#FFFFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_active_translucent_light">#FFFFFFFF</color>
|
||||
<color name="theme_color_toolbar_item_active_translucent_dark">#FF000000</color>
|
||||
<color name="theme_color_toolbar_item_active_dark">@color/white</color>
|
||||
<color name="theme_color_toolbar_item_active_grey_dark">@color/white</color>
|
||||
<color name="theme_color_toolbar_item_active_amoled_dark">@color/white</color>
|
||||
|
|
@ -108,31 +115,36 @@
|
|||
<color name="theme_color_nav_amoled_dark">@color/black</color>
|
||||
|
||||
<color name="theme_color_unselected_day">@color/colorUnselected</color>
|
||||
<color name="theme_color_unselected_translucent">#5CFFFFFF</color>
|
||||
<color name="theme_color_unselected_translucent_light">#43FFFFFF</color>
|
||||
<color name="theme_color_unselected_translucent_dark">#4D000000</color>
|
||||
<color name="theme_color_unselected_dark">#FF415C68</color>
|
||||
<color name="theme_color_unselected_grey_dark">#FF5C5C5C</color>
|
||||
<color name="theme_color_unselected_amoled_dark">#FF415C68</color>
|
||||
|
||||
<color name="theme_color_floor_card_light">@color/colorFloorCard</color>
|
||||
<color name="theme_color_floor_card_translucent">#15FFFFFF</color>
|
||||
<color name="theme_color_floor_card_translucent_light">#15FFFFFF</color>
|
||||
<color name="theme_color_floor_card_translucent_dark">#2A000000</color>
|
||||
<color name="theme_color_floor_card_dark">#FF1A2A39</color>
|
||||
<color name="theme_color_floor_card_grey_dark">#FF2A2A2A</color>
|
||||
<color name="theme_color_floor_card_amoled_dark">#FF151515</color>
|
||||
|
||||
<color name="theme_color_card_light">@color/white</color>
|
||||
<color name="theme_color_card_translucent">#10FFFFFF</color>
|
||||
<color name="theme_color_card_light">#FFFFFFFF</color>
|
||||
<color name="theme_color_card_translucent_light">#10FFFFFF</color>
|
||||
<color name="theme_color_card_translucent_dark">#20000000</color>
|
||||
<color name="theme_color_card_dark">#FF15202B</color>
|
||||
<color name="theme_color_card_grey_dark">#FF2A2A2A</color>
|
||||
<color name="theme_color_card_amoled_dark">#FF101010</color>
|
||||
|
||||
<color name="theme_color_swipe_refresh_view_background_light">@color/white</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_translucent">#FFFFFFFF</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_light">#FFFFFFFF</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_translucent_light">#FFFFFFFF</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_translucent_dark">#FF1C1C1C</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_dark">#FF1C2938</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_grey_dark">#FF252525</color>
|
||||
<color name="theme_color_swipe_refresh_view_background_amoled_dark">#FF1C1C1C</color>
|
||||
|
||||
<color name="theme_color_divider_light">@color/color_divider</color>
|
||||
<color name="theme_color_divider_translucent">#10FFFFFF</color>
|
||||
<color name="theme_color_divider_translucent_light">#10FFFFFF</color>
|
||||
<color name="theme_color_divider_translucent_dark">#15000000</color>
|
||||
<color name="theme_color_divider_dark">#FF10171D</color>
|
||||
<color name="theme_color_divider_grey_dark">#FF151515</color>
|
||||
<color name="theme_color_divider_amoled_dark">#FF101010</color>
|
||||
|
|
|
|||
|
|
@ -355,4 +355,7 @@
|
|||
<string name="title_dialog_notice">免责声明</string>
|
||||
<string name="message_dialog_notice">本软件仅供交流学习使用,严禁用于商业用途,请于下载后 24 小时内删除。</string>
|
||||
<string name="title_load_picture_when_scroll">滑动时加载图片</string>
|
||||
<string name="hint_reply">回复 %1$s</string>
|
||||
<string name="title_emotion_classic">经典</string>
|
||||
<string name="title_emotion_emoji">符号</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -231,24 +231,18 @@
|
|||
<item name="android:colorControlNormal">@color/theme_color_toolbar_item_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu" parent="Widget.AppCompat.Light.PopupMenu.Overflow">
|
||||
<item name="android:popupBackground">@drawable/bg_popup</item>
|
||||
<item name="android:dropDownHorizontalOffset">5dip</item>
|
||||
<item name="android:dropDownVerticalOffset">5dip</item>
|
||||
<item name="android:dropDownWidth">wrap_content</item>
|
||||
<item name="android:overlapAnchor">true</item>
|
||||
<style name="Animation" parent="@android:style/Animation.Activity" />
|
||||
|
||||
<style name="Animation.Bottom" parent="@style/Animation">
|
||||
<item name="android:windowEnterAnimation">@anim/in_bottom</item>
|
||||
<item name="android:windowExitAnimation">@anim/out_bottom</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu.Dark" parent="Widget.AppCompat.PopupMenu.Overflow">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu.Dark.Grey" parent="OverflowMenu.Dark">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_dark_grey</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu.Dark.Amoled" parent="OverflowMenu.Dark">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_amoled_dark</item>
|
||||
<style name="Animation.Fade" parent="@style/Animation">
|
||||
<item name="android:activityOpenEnterAnimation">@anim/anim_fade_in</item>
|
||||
<item name="android:activityOpenExitAnimation">@anim/anim_fade_out</item>
|
||||
<item name="android:activityCloseEnterAnimation">@anim/anim_fade_in</item>
|
||||
<item name="android:activityCloseExitAnimation">@anim/anim_fade_out</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Floating" parent="AppTheme">
|
||||
|
|
@ -271,20 +265,6 @@
|
|||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="Animation" parent="@android:style/Animation.Activity" />
|
||||
|
||||
<style name="Animation.Bottom" parent="@style/Animation">
|
||||
<item name="android:windowEnterAnimation">@anim/in_bottom</item>
|
||||
<item name="android:windowExitAnimation">@anim/out_bottom</item>
|
||||
</style>
|
||||
|
||||
<style name="Animation.Fade" parent="@style/Animation">
|
||||
<item name="android:activityOpenEnterAnimation">@anim/anim_fade_in</item>
|
||||
<item name="android:activityOpenExitAnimation">@anim/anim_fade_out</item>
|
||||
<item name="android:activityCloseEnterAnimation">@anim/anim_fade_in</item>
|
||||
<item name="android:activityCloseExitAnimation">@anim/anim_fade_out</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Intro" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
<item name="preferenceTheme">@style/PreferenceTheme</item>
|
||||
<item name="android:colorPrimary">@color/tieba</item>
|
||||
|
|
@ -350,12 +330,6 @@
|
|||
<item name="android:widgetLayout">@layout/layout_switch</item>
|
||||
</style>
|
||||
|
||||
<style name="MultiWaveHeader" />
|
||||
<style name="MultiWaveHeader.Wave">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="PreferenceTheme.DialogPreference" parent="Preference.DialogPreference.Material">
|
||||
<item name="android:layout">@layout/layout_preference</item>
|
||||
</style>
|
||||
|
|
@ -443,6 +417,41 @@
|
|||
<item name="android:windowDisablePreview">false</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu" parent="Widget.AppCompat.Light.PopupMenu.Overflow">
|
||||
<item name="android:popupBackground">@drawable/bg_popup</item>
|
||||
<item name="android:dropDownHorizontalOffset">5dip</item>
|
||||
<item name="android:dropDownVerticalOffset">5dip</item>
|
||||
<item name="android:dropDownWidth">wrap_content</item>
|
||||
<item name="android:overlapAnchor">true</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu.Dark" parent="Widget.AppCompat.PopupMenu.Overflow">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu.Dark.Grey" parent="OverflowMenu.Dark">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_dark_grey</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenu.Dark.Amoled" parent="OverflowMenu.Dark">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_amoled_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="LightTranslucentPopupMenu" parent="Widget.AppCompat.PopupMenu">
|
||||
<item name="android:popupBackground">@drawable/bg_popup</item>
|
||||
</style>
|
||||
|
||||
<style name="DarkTranslucentPopupMenu" parent="Widget.AppCompat.Light.PopupMenu">
|
||||
<item name="android:popupBackground">@drawable/bg_popup_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="TiebaLite.Custom" parent="TiebaLite.White">
|
||||
<item name="colorPrimary">@color/theme_color_toolbar_grey_dark</item>
|
||||
<item name="colorAccent">@color/theme_color_toolbar_grey_dark</item>
|
||||
<item name="android:textCursorDrawable">@null</item>
|
||||
<item name="rippleColor">#1A000000</item>
|
||||
</style>
|
||||
|
||||
<style name="TiebaLite.White" parent="AppTheme">
|
||||
<item name="colorPrimary">@color/tieba</item>
|
||||
<item name="colorToolbar">@color/white</item>
|
||||
|
|
@ -452,20 +461,48 @@
|
|||
<item name="color_toolbar_item_secondary">@color/color_text_secondary</item>
|
||||
</style>
|
||||
|
||||
<style name="TiebaLite.Translucent" parent="AppTheme">
|
||||
<style name="TiebaLite.Translucent.Light" parent="AppTheme">
|
||||
<item name="popupMenuStyle">@style/LightTranslucentPopupMenu</item>
|
||||
<item name="android:popupMenuStyle">@style/LightTranslucentPopupMenu</item>
|
||||
<item name="colorPrimary">@color/theme_color_primary_tieba</item>
|
||||
<item name="colorAccent">@color/theme_color_primary_tieba</item>
|
||||
<item name="colorToolbar">@color/transparent</item>
|
||||
<item name="colorBg">@color/transparent</item>
|
||||
<item name="colorNavBar">@color/transparent</item>
|
||||
<item name="colorToolbarItem">@color/theme_color_toolbar_item_translucent</item>
|
||||
<item name="colorToolbarItemActive">@color/theme_color_toolbar_item_active_translucent</item>
|
||||
<item name="color_toolbar_item_secondary">@color/theme_color_toolbar_item_secondary_translucent</item>
|
||||
<item name="colorText">@color/color_text_translucent</item>
|
||||
<item name="colorTextSecondary">@color/color_text_secondary_translucent</item>
|
||||
<item name="colorUnselected">@color/theme_color_unselected_translucent</item>
|
||||
<item name="colorFloorCard">@color/theme_color_floor_card_translucent</item>
|
||||
<item name="colorCard">@color/theme_color_card_translucent</item>
|
||||
<item name="colorToolbarItem">@color/theme_color_toolbar_item_translucent_light</item>
|
||||
<item name="colorToolbarItemActive">
|
||||
@color/theme_color_toolbar_item_active_translucent_light
|
||||
</item>
|
||||
<item name="color_toolbar_item_secondary">
|
||||
@color/theme_color_toolbar_item_secondary_translucent_light
|
||||
</item>
|
||||
<item name="colorText">@color/color_text_translucent_light</item>
|
||||
<item name="colorTextSecondary">@color/color_text_secondary_translucent_light</item>
|
||||
<item name="colorUnselected">@color/theme_color_unselected_translucent_light</item>
|
||||
<item name="colorFloorCard">@color/theme_color_floor_card_translucent_light</item>
|
||||
<item name="colorCard">@color/theme_color_card_translucent_light</item>
|
||||
</style>
|
||||
|
||||
<style name="TiebaLite.Translucent.Dark" parent="AppTheme.Dark">
|
||||
<item name="popupMenuStyle">@style/DarkTranslucentPopupMenu</item>
|
||||
<item name="android:popupMenuStyle">@style/DarkTranslucentPopupMenu</item>
|
||||
<item name="colorPrimary">@color/theme_color_primary_tieba</item>
|
||||
<item name="colorAccent">@color/theme_color_primary_tieba</item>
|
||||
<item name="colorToolbar">@color/transparent</item>
|
||||
<item name="colorBg">@color/transparent</item>
|
||||
<item name="colorNavBar">@color/transparent</item>
|
||||
<item name="colorToolbarItem">@color/theme_color_toolbar_item_translucent_dark</item>
|
||||
<item name="colorToolbarItemActive">
|
||||
@color/theme_color_toolbar_item_active_translucent_dark
|
||||
</item>
|
||||
<item name="color_toolbar_item_secondary">
|
||||
@color/theme_color_toolbar_item_secondary_translucent_dark
|
||||
</item>
|
||||
<item name="colorText">@color/color_text_translucent_dark</item>
|
||||
<item name="colorTextSecondary">@color/color_text_secondary_translucent_dark</item>
|
||||
<item name="colorUnselected">@color/theme_color_unselected_translucent_dark</item>
|
||||
<item name="colorFloorCard">@color/theme_color_floor_card_translucent_dark</item>
|
||||
<item name="colorCard">@color/theme_color_card_translucent_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="TiebaLite.Tieba" parent="AppTheme">
|
||||
|
|
|
|||
Loading…
Reference in New Issue