Skip to content

Commit

Permalink
New Color picker, bump Android minSdk from 16 to 18, closes gsantner#…
Browse files Browse the repository at this point in the history
…1428 (PR gsantner#2203 by @halfdane)

* fixes gsantner#1428 by introducing a new color picker

* Update preferences_master.xml

* Restore preference

---------

Co-authored-by: Gregor Santner <[email protected]>
(cherry picked from commit 19e0cdc)
  • Loading branch information
halfdane authored and elyahw committed Sep 26, 2024
1 parent 9eea515 commit 8f07ede
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (enable_plugin_kotlin) {
apply plugin: 'kotlin-kapt'
}

rootProject.ext.version_minSdk = 16
rootProject.ext.version_minSdk = 18

// https://github.com/vsch/flexmark-java/releases
ext.version_library_flexmark = "0.42.14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import net.gsantner.notepad2.model.AppSettings;
import net.gsantner.notepad2.model.Document;
import net.gsantner.notepad2.util.MarkorContextUtils;

import net.gsantner.opoc.format.GsTextUtils;
import net.gsantner.opoc.util.GsCollectionUtils;
//import net.gsantner.opoc.util.GsContextUtils;
Expand Down Expand Up @@ -876,45 +877,6 @@ public void runSpecialKeyAction() {
});
}

// public void showColorPickerDialog() {
// MarkorDialogFactory.showColorSelectionModeDialog(getActivity(), new GsCallback.a1<Integer>() {
// @Override
// public void callback(Integer colorInsertType) {
// ColorPickerDialogBuilder
// .with(_hlEditor.getContext())
// .setTitle(R.string.color)
// .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
// .density(12)
// .setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
// String hex = Utils.getHexString(selectedColor, false).toLowerCase();
// int pos = _hlEditor.getSelectionStart();
// switch (colorInsertType) {
// case R.string.hexcode: {
// _hlEditor.getText().insert(pos, hex);
// break;
// }
// case R.string.foreground: {
// _hlEditor.getText().insert(pos, "<span style='color:" + hex + ";'></span>");
// _hlEditor.setSelection(_hlEditor.getSelectionStart() - 7);
// break;
// }
// case R.string.background: {
// _hlEditor.getText().insert(pos, "<span style='background-color:" + hex + ";'></span>");
// _hlEditor.setSelection(_hlEditor.getSelectionStart() - 7);
// break;
// }
// }
//
// }
// })
// .setNegativeButton(R.string.cancel, null)
// .build()
// .show();
// }
// });
// }

public void runJumpBottomTopAction(ActionItem.DisplayMode displayMode) {
if (displayMode == ActionItem.DisplayMode.EDIT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {

if (activity != null && activity.getTheme() != null) {
TypedArray array = activity.getTheme().obtainStyledAttributes(new int[]{android.R.attr.colorBackground});
int bgcolor = array.getColor(0, 0xFFFFFFFF);
int bgcolor = array.getColor(0, 0xFFFFFF);
_defaultIconTintColor = _cu.shouldColorOnTopBeLight(bgcolor) ? Color.WHITE : Color.BLACK;
}

Expand Down

0 comments on commit 8f07ede

Please sign in to comment.