pref: 颜色选取器

This commit is contained in:
HuanCheng65 2023-10-05 17:05:02 +08:00
parent dc188b9d2d
commit 369f5e9394
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
3 changed files with 18 additions and 10 deletions

View File

@ -253,7 +253,7 @@ dependencies {
implementation 'com.github.DSAppTeam:PanelSwitchHelper:v1.5.2'
implementation "org.litepal.android:kotlin:3.0.0"
implementation 'cn.jzvd:jiaozivideoplayer:7.7.2.3300'
implementation "com.jrummyapps:colorpicker:2.1.7"
implementation 'com.jaredrummler:colorpicker:1.1.0'
implementation "com.scwang.smart:refresh-layout-kernel:2.0.1"
implementation "com.scwang.smart:refresh-header-material:2.0.1"

View File

@ -47,8 +47,8 @@ import com.huanchengfly.tieba.post.ui.widgets.theme.TintMaterialButton
import com.huanchengfly.tieba.post.utils.*
import com.huanchengfly.tieba.post.utils.ThemeUtil.TRANSLUCENT_THEME_DARK
import com.huanchengfly.tieba.post.utils.ThemeUtil.TRANSLUCENT_THEME_LIGHT
import com.jrummyapps.android.colorpicker.ColorPickerDialog
import com.jrummyapps.android.colorpicker.ColorPickerDialogListener
import com.jaredrummler.android.colorpicker.ColorPickerDialog
import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
import com.yalantis.ucrop.UCrop
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
@ -510,7 +510,10 @@ class TranslucentThemeActivity : BaseActivity(), View.OnClickListener, OnSeekBar
.setColor(ThemeUtils.getColorById(this, R.color.default_color_primary))
.create()
primaryColorPicker.setColorPickerDialogListener(this)
primaryColorPicker.show(fragmentManager, "ColorPicker_TranslucentThemePrimaryColor")
primaryColorPicker.show(
supportFragmentManager,
"ColorPicker_TranslucentThemePrimaryColor"
)
}
R.id.dark_color -> {
appPreferences.translucentBackgroundTheme = TRANSLUCENT_THEME_DARK

View File

@ -11,13 +11,14 @@ import android.widget.CompoundButton
import android.widget.LinearLayout
import androidx.annotation.ColorInt
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.FragmentActivity
import com.huanchengfly.tieba.post.App.ThemeDelegate.getColorByAttr
import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.ui.common.theme.utils.ThemeUtils
import com.huanchengfly.tieba.post.utils.ThemeUtil
import com.huanchengfly.tieba.post.utils.appPreferences
import com.jrummyapps.android.colorpicker.ColorPickerDialog
import com.jrummyapps.android.colorpicker.ColorPickerDialogListener
import com.jaredrummler.android.colorpicker.ColorPickerDialog
import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
class CustomThemeDialog(context: Context) : AlertDialog(context),
View.OnClickListener, DialogInterface.OnClickListener, CompoundButton.OnCheckedChangeListener,
@ -67,10 +68,14 @@ class CustomThemeDialog(context: Context) : AlertDialog(context),
.setColor(primaryColor)
.create()
primaryColorPicker.setColorPickerDialogListener(this)
val activity = ThemeUtils.getWrapperActivity(context)
if (activity is FragmentActivity) {
primaryColorPicker.show(
ThemeUtils.getWrapperActivity(context)!!.fragmentManager,
activity.supportFragmentManager,
"ColorPicker_PrimaryColor"
)
return
}
}
refreshView()
}