chore(deps): Update dependencies and fix API changes

Signed-off-by: Stefan Niedermann <info@niedermann.it>
This commit is contained in:
Stefan Niedermann 2024-01-21 09:51:23 +01:00 committed by Andy Scherzinger
parent 189f54fcd0
commit 42d56e470f
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
9 changed files with 15 additions and 15 deletions

View file

@ -84,7 +84,7 @@ dependencies {
// Nextcloud SSO // Nextcloud SSO
implementation 'com.github.nextcloud.android-common:ui:0.13.0' implementation 'com.github.nextcloud.android-common:ui:0.13.0'
implementation 'com.github.nextcloud:Android-SingleSignOn:1.0.0' implementation 'com.github.nextcloud:Android-SingleSignOn:1.0.0'
implementation 'com.github.stefan-niedermann:android-commons:0.4.0' implementation 'com.github.stefan-niedermann:android-commons:1.0.0'
implementation "com.github.stefan-niedermann.nextcloud-commons:sso-glide:$commonsVersion" implementation "com.github.stefan-niedermann.nextcloud-commons:sso-glide:$commonsVersion"
implementation "com.github.stefan-niedermann.nextcloud-commons:exception:$commonsVersion" implementation "com.github.stefan-niedermann.nextcloud-commons:exception:$commonsVersion"
implementation("com.github.stefan-niedermann.nextcloud-commons:markdown:$commonsVersion") { implementation("com.github.stefan-niedermann.nextcloud-commons:markdown:$commonsVersion") {

View file

@ -125,7 +125,7 @@ public class NotesViewThemeUtils extends ViewThemeUtilsBase {
@ColorInt int colorPrimary, @ColorInt int colorPrimary,
@ColorInt int colorAccent) { @ColorInt int colorAccent) {
if (isDarkMode(context)) { // Dark background if (isDarkMode(context)) { // Dark background
if (ColorUtil.INSTANCE.isColorDark(mainColor)) { // Dark brand color if (ColorUtil.isColorDark(mainColor)) { // Dark brand color
if (NotesColorUtil.contrastRatioIsSufficient(mainColor, colorPrimary)) { // But also dark text if (NotesColorUtil.contrastRatioIsSufficient(mainColor, colorPrimary)) { // But also dark text
return mainColor; return mainColor;
} else { } else {
@ -139,7 +139,7 @@ public class NotesViewThemeUtils extends ViewThemeUtilsBase {
} }
} }
} else { // Light background } else { // Light background
if (ColorUtil.INSTANCE.isColorDark(mainColor)) { // Dark brand color if (ColorUtil.isColorDark(mainColor)) { // Dark brand color
if (NotesColorUtil.contrastRatioIsSufficient(mainColor, colorAccent)) { // But also dark text if (NotesColorUtil.contrastRatioIsSufficient(mainColor, colorAccent)) { // But also dark text
return Color.argb(77, Color.red(mainColor), Color.green(mainColor), Color.blue(mainColor)); return Color.argb(77, Color.red(mainColor), Color.green(mainColor), Color.blue(mainColor));
} else { } else {

View file

@ -38,14 +38,14 @@ public class ExceptionActivity extends AppCompatActivity {
} }
final var adapter = new TipsAdapter(this::startActivity); final var adapter = new TipsAdapter(this::startActivity);
final String debugInfos = ExceptionUtil.INSTANCE.getDebugInfos(this, throwable, BuildConfig.FLAVOR); final String debugInfos = ExceptionUtil.getDebugInfos(this, throwable, BuildConfig.FLAVOR);
binding.tips.setAdapter(adapter); binding.tips.setAdapter(adapter);
binding.tips.setNestedScrollingEnabled(false); binding.tips.setNestedScrollingEnabled(false);
binding.toolbar.setTitle(getString(R.string.simple_error)); binding.toolbar.setTitle(getString(R.string.simple_error));
binding.message.setText(throwable.getMessage()); binding.message.setText(throwable.getMessage());
binding.stacktrace.setText(debugInfos); binding.stacktrace.setText(debugInfos);
binding.copy.setOnClickListener((v) -> ClipboardUtil.INSTANCE.copyToClipboard(this, getString(R.string.simple_exception), "```\n" + debugInfos + "\n```")); binding.copy.setOnClickListener((v) -> ClipboardUtil.copyToClipboard(this, getString(R.string.simple_exception), "```\n" + debugInfos + "\n```"));
binding.close.setOnClickListener((v) -> finish()); binding.close.setOnClickListener((v) -> finish());
adapter.setThrowables(Collections.singletonList(throwable)); adapter.setThrowables(Collections.singletonList(throwable));

View file

@ -57,7 +57,7 @@ public class ExceptionDialogFragment extends AppCompatDialogFragment {
final var adapter = new TipsAdapter((actionIntent) -> requireActivity().startActivity(actionIntent)); final var adapter = new TipsAdapter((actionIntent) -> requireActivity().startActivity(actionIntent));
final String debugInfos = ExceptionUtil.INSTANCE.getDebugInfos(requireContext(), throwables, BuildConfig.FLAVOR); final String debugInfos = ExceptionUtil.getDebugInfos(requireContext(), throwables, BuildConfig.FLAVOR);
binding.tips.setAdapter(adapter); binding.tips.setAdapter(adapter);
binding.stacktrace.setText(debugInfos); binding.stacktrace.setText(debugInfos);
@ -67,7 +67,7 @@ public class ExceptionDialogFragment extends AppCompatDialogFragment {
return new MaterialAlertDialogBuilder(requireActivity()) return new MaterialAlertDialogBuilder(requireActivity())
.setView(binding.getRoot()) .setView(binding.getRoot())
.setTitle(R.string.error_dialog_title) .setTitle(R.string.error_dialog_title)
.setPositiveButton(android.R.string.copy, (a, b) -> ClipboardUtil.INSTANCE.copyToClipboard(requireContext(), getString(R.string.simple_exception), "```\n" + debugInfos + "\n```")) .setPositiveButton(android.R.string.copy, (a, b) -> ClipboardUtil.copyToClipboard(requireContext(), getString(R.string.simple_exception), "```\n" + debugInfos + "\n```"))
.setNegativeButton(R.string.simple_close, null) .setNegativeButton(R.string.simple_close, null)
.create(); .create();
} }

View file

@ -595,7 +595,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
util.notes.themeToolbarSearchView(binding.activityNotesListView.searchView); util.notes.themeToolbarSearchView(binding.activityNotesListView.searchView);
binding.headerView.setBackgroundColor(color); binding.headerView.setBackgroundColor(color);
@ColorInt final int headerTextColor = ColorUtil.INSTANCE.getForegroundColorForBackgroundColor(color); @ColorInt final int headerTextColor = ColorUtil.getForegroundColorForBackgroundColor(color);
binding.appName.setTextColor(headerTextColor); binding.appName.setTextColor(headerTextColor);
DrawableCompat.setTint(binding.logo.getDrawable(), headerTextColor); DrawableCompat.setTint(binding.logo.getDrawable(), headerTextColor);

View file

@ -113,13 +113,13 @@ public final class Migration_20_21 extends Migration {
values.put("MODIFIED", cursor.getLong(COLUMN_POSITION_MODIFIED) * 1_000); values.put("MODIFIED", cursor.getLong(COLUMN_POSITION_MODIFIED) * 1_000);
values.put("APIVERSION", cursor.getString(COLUMN_POSITION_API_VERSION)); values.put("APIVERSION", cursor.getString(COLUMN_POSITION_API_VERSION));
try { try {
values.put("COLOR", Color.parseColor(ColorUtil.INSTANCE.formatColorToParsableHexString(cursor.getString(COLUMN_POSITION_COLOR)))); values.put("COLOR", Color.parseColor(ColorUtil.formatColorToParsableHexString(cursor.getString(COLUMN_POSITION_COLOR))));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
values.put("COLOR", -16743735); values.put("COLOR", -16743735);
} }
try { try {
values.put("TEXTCOLOR", Color.parseColor(ColorUtil.INSTANCE.formatColorToParsableHexString(cursor.getString(COLUMN_POSITION_TEXT_COLOR)))); values.put("TEXTCOLOR", Color.parseColor(ColorUtil.formatColorToParsableHexString(cursor.getString(COLUMN_POSITION_TEXT_COLOR))));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
values.put("TEXTCOLOR", -16777216); values.put("TEXTCOLOR", -16777216);

View file

@ -51,14 +51,14 @@ public class CapabilitiesDeserializer implements JsonDeserializer<Capabilities>
final var theming = capabilities.getAsJsonObject(CAPABILITIES_THEMING); final var theming = capabilities.getAsJsonObject(CAPABILITIES_THEMING);
if (theming.has(CAPABILITIES_THEMING_COLOR)) { if (theming.has(CAPABILITIES_THEMING_COLOR)) {
try { try {
response.setColor(Color.parseColor(ColorUtil.INSTANCE.formatColorToParsableHexString(theming.get(CAPABILITIES_THEMING_COLOR).getAsString()))); response.setColor(Color.parseColor(ColorUtil.formatColorToParsableHexString(theming.get(CAPABILITIES_THEMING_COLOR).getAsString())));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
if (theming.has(CAPABILITIES_THEMING_COLOR_TEXT)) { if (theming.has(CAPABILITIES_THEMING_COLOR_TEXT)) {
try { try {
response.setTextColor(Color.parseColor(ColorUtil.INSTANCE.formatColorToParsableHexString(theming.get(CAPABILITIES_THEMING_COLOR_TEXT).getAsString()))); response.setTextColor(Color.parseColor(ColorUtil.formatColorToParsableHexString(theming.get(CAPABILITIES_THEMING_COLOR_TEXT).getAsString())));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -21,7 +21,7 @@ public final class NotesColorUtil {
final var key = new ColorPair(colorOne, colorTwo); final var key = new ColorPair(colorOne, colorTwo);
Boolean ret = CONTRAST_RATIO_SUFFICIENT_CACHE.get(key); Boolean ret = CONTRAST_RATIO_SUFFICIENT_CACHE.get(key);
if (ret == null) { if (ret == null) {
ret = ColorUtil.INSTANCE.getContrastRatio(colorOne, colorTwo) > 3d; ret = ColorUtil.getContrastRatio(colorOne, colorTwo) > 3d;
CONTRAST_RATIO_SUFFICIENT_CACHE.put(key, ret); CONTRAST_RATIO_SUFFICIENT_CACHE.put(key, ret);
return ret; return ret;
} }
@ -32,7 +32,7 @@ public final class NotesColorUtil {
final var key = new ColorPair(colorOne, colorTwo); final var key = new ColorPair(colorOne, colorTwo);
var ret = CONTRAST_RATIO_SUFFICIENT_CACHE.get(key); var ret = CONTRAST_RATIO_SUFFICIENT_CACHE.get(key);
if (ret == null) { if (ret == null) {
ret = ColorUtil.INSTANCE.getContrastRatio(colorOne, colorTwo) > 1.47d; ret = ColorUtil.getContrastRatio(colorOne, colorTwo) > 1.47d;
CONTRAST_RATIO_SUFFICIENT_CACHE.put(key, ret); CONTRAST_RATIO_SUFFICIENT_CACHE.put(key, ret);
return ret; return ret;
} }

View file

@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript { buildscript {
ext { ext {
kotlinVersion = '1.9.22' kotlinVersion = '1.9.22'
commonsVersion = '1.9.0' commonsVersion = '2.0.0'
} }
repositories { repositories {
mavenCentral() mavenCentral()