|
|
|
@ -40,6 +40,7 @@ import android.widget.TextView;
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
|
import androidx.core.graphics.ColorUtils;
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
|
|
|
|
|
import com.flask.colorpicker.ColorPickerView;
|
|
|
|
@ -99,8 +100,12 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
|
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
|
|
|
|
boolean highlight = prefs.getBoolean("widget." + appWidgetId + ".highlight", false);
|
|
|
|
|
int highlight_color = prefs.getInt("widget." + appWidgetId + ".highlight_color", Color.TRANSPARENT);
|
|
|
|
|
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
|
|
|
|
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
|
|
|
|
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
|
|
|
|
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
|
|
|
|
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
|
|
|
|
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
|
|
|
|
? Color.TRANSPARENT
|
|
|
|
|
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
|
|
|
|
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
|
|
|
|
int font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
|
|
|
|
int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
|
|
|
@ -146,6 +151,14 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cbSemiTransparent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
|
if (isChecked && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
|
|
|
|
btnColor.setColor(Color.TRANSPARENT);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
cbHighlight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
@ -187,6 +200,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
|
btnColor.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
int color = btnColor.getColor();
|
|
|
|
|
int editTextColor = Helper.resolveColor(ActivityWidgetUnified.this, android.R.attr.editTextColor);
|
|
|
|
|
|
|
|
|
|
ColorPickerDialogBuilder
|
|
|
|
@ -196,10 +210,14 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|
|
|
|
.setColorEditTextColor(editTextColor)
|
|
|
|
|
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
|
|
|
|
.density(6)
|
|
|
|
|
.lightnessSliderOnly()
|
|
|
|
|
.initialColor(color == Color.TRANSPARENT ? Color.WHITE : color)
|
|
|
|
|
.showLightnessSlider(true)
|
|
|
|
|
.showAlphaSlider(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
|
|
|
|
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
|
|
|
|
cbSemiTransparent.setChecked(false);
|
|
|
|
|
btnColor.setColor(selectedColor);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|