mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-09 16:48:47 +01:00
アプリ設定に「見た目/通知カラムのクイックフィルタをカラム設定内部に表示する」を追加
This commit is contained in:
parent
b6e2e1b1c5
commit
2e9a5f7d97
@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.os.AsyncTask
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v4.view.ViewCompat
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
@ -34,6 +35,7 @@ import java.util.regex.Pattern
|
||||
import com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout
|
||||
import com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayoutDirection
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
class ColumnViewHolder(
|
||||
val activity : ActMain,
|
||||
val viewRoot : View
|
||||
@ -341,7 +343,7 @@ class ColumnViewHolder(
|
||||
btnQuickFilterFollow = viewRoot.findViewById(R.id.btnQuickFilterFollow)
|
||||
btnQuickFilterReaction = viewRoot.findViewById(R.id.btnQuickFilterReaction)
|
||||
btnQuickFilterVote = viewRoot.findViewById(R.id.btnQuickFilterVote)
|
||||
|
||||
val llColumnSettingInside : LinearLayout = viewRoot.findViewById(R.id.llColumnSettingInside)
|
||||
|
||||
btnQuickFilterAll.setOnClickListener(this)
|
||||
btnQuickFilterMention.setOnClickListener(this)
|
||||
@ -390,6 +392,22 @@ class ColumnViewHolder(
|
||||
cbEnableSpeech.setOnCheckedChangeListener(this)
|
||||
cbOldApi.setOnCheckedChangeListener(this)
|
||||
|
||||
if(Pref.bpMoveNotificationsQuickFilter(activity.pref)){
|
||||
(svQuickFilter.parent as? ViewGroup)?.removeView(svQuickFilter)
|
||||
llColumnSettingInside.addView(svQuickFilter,0)
|
||||
|
||||
svQuickFilter.setOnTouchListener { v, event ->
|
||||
val action = event.action
|
||||
if(action == MotionEvent.ACTION_DOWN){
|
||||
val sv = v as? HorizontalScrollView
|
||||
if(sv != null && sv.getChildAt(0).width > sv.width ){
|
||||
sv.requestDisallowInterceptTouchEvent(true)
|
||||
}
|
||||
}
|
||||
v.onTouchEvent(event)
|
||||
}
|
||||
}
|
||||
|
||||
initLoadingTextView()
|
||||
|
||||
// 入力の追跡
|
||||
@ -1456,27 +1474,56 @@ class ColumnViewHolder(
|
||||
|
||||
vg(btnQuickFilterFavourite, !column.isMisskey)
|
||||
|
||||
val colorBg = column.getHeaderBackgroundColor()
|
||||
val colorFg = column.getHeaderNameColor()
|
||||
val colorBgSelected = Color.rgb(
|
||||
(Color.red(colorBg) *3 + Color.red(colorFg)) / 4,
|
||||
(Color.green(colorBg)*3 + Color.green(colorFg)) / 4,
|
||||
(Color.blue(colorBg)*3 + Color.blue(colorFg)) / 4
|
||||
)
|
||||
svQuickFilter.setBackgroundColor(colorBg)
|
||||
val insideColumnSetting = Pref.bpMoveNotificationsQuickFilter(activity.pref)
|
||||
|
||||
fun showQuickFilterButton(btn : View, iconId : Int, selected : Boolean) {
|
||||
val showQuickFilterButton:(btn : View, iconId : Int, selected : Boolean)->Unit
|
||||
|
||||
if(insideColumnSetting){
|
||||
svQuickFilter.setBackgroundColor(0)
|
||||
|
||||
val colorFg = getAttributeColor(activity,R.attr.colorContentText)
|
||||
val colorBgSelected = colorFg.applyAlphaMultiplier(0.25f)
|
||||
|
||||
ViewCompat.setBackground(
|
||||
btn,
|
||||
getAdaptiveRippleDrawable(
|
||||
if(selected) colorBgSelected else colorBg,
|
||||
colorFg
|
||||
showQuickFilterButton = { btn , iconId , selected ->
|
||||
ViewCompat.setBackground(
|
||||
btn,
|
||||
if(selected) {
|
||||
getAdaptiveRippleDrawable(
|
||||
colorBgSelected,
|
||||
colorFg
|
||||
)
|
||||
}else {
|
||||
ContextCompat.getDrawable(activity,R.drawable.btn_bg_transparent)
|
||||
}
|
||||
)
|
||||
when(btn) {
|
||||
is ImageButton -> setIconDrawableId(activity, btn, iconId, colorFg)
|
||||
is TextView -> btn.textColor = colorFg
|
||||
}
|
||||
}
|
||||
}else {
|
||||
val colorBg = column.getHeaderBackgroundColor()
|
||||
val colorFg = column.getHeaderNameColor()
|
||||
val colorBgSelected = Color.rgb(
|
||||
(Color.red(colorBg) * 3 + Color.red(colorFg)) / 4,
|
||||
(Color.green(colorBg) * 3 + Color.green(colorFg)) / 4,
|
||||
(Color.blue(colorBg) * 3 + Color.blue(colorFg)) / 4
|
||||
)
|
||||
when(btn){
|
||||
is ImageButton ->setIconDrawableId(activity,btn,iconId,colorFg)
|
||||
is TextView -> btn.textColor = colorFg
|
||||
svQuickFilter.setBackgroundColor(colorBg)
|
||||
|
||||
showQuickFilterButton = { btn , iconId , selected ->
|
||||
|
||||
ViewCompat.setBackground(
|
||||
btn,
|
||||
getAdaptiveRippleDrawable(
|
||||
if(selected) colorBgSelected else colorBg,
|
||||
colorFg
|
||||
)
|
||||
)
|
||||
when(btn) {
|
||||
is ImageButton -> setIconDrawableId(activity, btn, iconId, colorFg)
|
||||
is TextView -> btn.textColor = colorFg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,6 +351,11 @@ object Pref {
|
||||
false,
|
||||
R.id.swLinksInContextMenu
|
||||
)
|
||||
val bpMoveNotificationsQuickFilter = BooleanPref(
|
||||
"MoveNotificationsQuickFilter",
|
||||
false,
|
||||
R.id.swMoveNotificationsQuickFilter
|
||||
)
|
||||
|
||||
// int
|
||||
|
||||
|
@ -513,5 +513,23 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/move_notifications_quick_filter_to_column_setting"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swMoveNotificationsQuickFilter"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -142,6 +142,7 @@
|
||||
android:paddingTop="3dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:id="@+id/llColumnSettingInside"
|
||||
>
|
||||
|
||||
<CheckBox
|
||||
|
@ -845,5 +845,6 @@
|
||||
<string name="all">All</string>
|
||||
<string name="show_links_in_context_menu">本文中のリンクをコンテキストメニューに表示する</string>
|
||||
<string name="scheduled_status_requires_mastodon_2_7_0">予約投稿はマストドン2.7.0以降で使えます</string>
|
||||
<string name="move_notifications_quick_filter_to_column_setting">通知カラムのクイックフィルタをカラム設定内部に表示する(アプリ再起動が必要)</string>
|
||||
|
||||
</resources>
|
||||
|
@ -866,5 +866,6 @@
|
||||
<string name="all">All</string>
|
||||
<string name="show_links_in_context_menu">Show links in context menu</string>
|
||||
<string name="scheduled_status_requires_mastodon_2_7_0">Scheduled status requires Mastodon 2.7.0 or later.</string>
|
||||
<string name="move_notifications_quick_filter_to_column_setting">Show notifications quick filter in column setting (app restart required)</string>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user