mirror of
https://github.com/TrianguloY/UrlChecker.git
synced 2024-09-19 20:02:16 +02:00
increased minSdkVersion 14 -> 19
This commit is contained in:
parent
e2a4776881
commit
55aa2ae1c9
@ -8,7 +8,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.trianguloy.urlchecker"
|
||||
compileSdk 33
|
||||
minSdkVersion 14
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 33
|
||||
versionCode 29
|
||||
versionName "2.13.1"
|
||||
|
@ -151,9 +151,7 @@ public class ModulesActivity extends Activity {
|
||||
AndroidUtils.toggleableListener(
|
||||
title,
|
||||
v -> description.setVisibility(description.getVisibility() == View.GONE ? View.VISIBLE : View.GONE),
|
||||
v -> AndroidUtils.setStartDrawables(title,
|
||||
description.getVisibility() != View.GONE ? R.drawable.arrow_down : R.drawable.arrow_right
|
||||
)
|
||||
v -> title.setCompoundDrawablesRelativeWithIntrinsicBounds(description.getVisibility() != View.GONE ? R.drawable.arrow_down : R.drawable.arrow_right, 0, 0, 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.trianguloy.urlchecker.modules.companions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
@ -29,13 +28,6 @@ public class CTabs {
|
||||
return new GenericPref.Enumeration<>("open_ctabs", OnOffConfig.AUTO, OnOffConfig.class, cntx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff the CTabs feature is available on the device
|
||||
*/
|
||||
public static boolean isAvailable() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------- state ------------------- */
|
||||
|
||||
@ -51,41 +43,35 @@ public class CTabs {
|
||||
*/
|
||||
public void initFrom(Intent intent, ImageButton button) {
|
||||
boolean visible;
|
||||
if (CTabs.isAvailable()) {
|
||||
// configure
|
||||
switch (pref.get()) {
|
||||
case AUTO:
|
||||
default:
|
||||
default -> {
|
||||
// If auto we get it from the intent
|
||||
state = intent.hasExtra(CTabs.EXTRA);
|
||||
visible = true;
|
||||
break;
|
||||
case HIDDEN:
|
||||
}
|
||||
case HIDDEN -> {
|
||||
// If hidden we also get it from the intent
|
||||
state = intent.hasExtra(CTabs.EXTRA);
|
||||
visible = false;
|
||||
break;
|
||||
case DEFAULT_ON:
|
||||
state = true;
|
||||
visible = true;
|
||||
break;
|
||||
case DEFAULT_OFF:
|
||||
state = false;
|
||||
visible = true;
|
||||
break;
|
||||
case ALWAYS_ON:
|
||||
state = true;
|
||||
visible = false;
|
||||
break;
|
||||
case ALWAYS_OFF:
|
||||
state = false;
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// not available, just ignore
|
||||
case DEFAULT_ON -> {
|
||||
state = true;
|
||||
visible = true;
|
||||
}
|
||||
case DEFAULT_OFF -> {
|
||||
state = false;
|
||||
visible = true;
|
||||
}
|
||||
case ALWAYS_ON -> {
|
||||
state = true;
|
||||
visible = false;
|
||||
}
|
||||
case ALWAYS_OFF -> {
|
||||
state = false;
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// set
|
||||
if (visible) {
|
||||
@ -106,7 +92,6 @@ public class CTabs {
|
||||
* applies the setting to a given intent
|
||||
*/
|
||||
public void apply(Intent intent) {
|
||||
if (!CTabs.isAvailable()) return;
|
||||
if (state && !intent.hasExtra(CTabs.EXTRA)) {
|
||||
// enable Custom tabs
|
||||
Bundle extras = new Bundle();
|
||||
|
@ -2,7 +2,6 @@ package com.trianguloy.urlchecker.modules.list;
|
||||
|
||||
import static java.util.Objects.requireNonNullElse;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -77,7 +76,7 @@ class DebugDialog extends AModuleDialog {
|
||||
|
||||
// expand when touched (not only clicked, to avoid a double-click-required bug and because it feels better)
|
||||
textView.setOnTouchListener((v, event) -> {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN || textView.getMaxHeight() != Integer.MAX_VALUE) textView.setMaxHeight(Integer.MAX_VALUE);
|
||||
if (textView.getMaxHeight() != Integer.MAX_VALUE) textView.setMaxHeight(Integer.MAX_VALUE);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -310,11 +310,7 @@ class OpenConfig extends AModuleConfig {
|
||||
|
||||
@Override
|
||||
public void onInitialize(View views) {
|
||||
if (CTabs.isAvailable()) {
|
||||
CTabs.PREF(getActivity()).attachToSpinner(views.findViewById(R.id.ctabs_pref), null);
|
||||
} else {
|
||||
views.findViewById(R.id.ctabs_parent).setVisibility(View.GONE);
|
||||
}
|
||||
Incognito.PREF(getActivity()).attachToSpinner(views.findViewById(R.id.incognito_pref), null);
|
||||
OpenModule.CLOSEOPEN_PREF(getActivity()).attachToSwitch(views.findViewById(R.id.closeopen_pref));
|
||||
OpenModule.CLOSESHARE_PREF(getActivity()).attachToSwitch(views.findViewById(R.id.closeshare_pref));
|
||||
|
@ -141,10 +141,11 @@ class RemoveQueriesDialog extends AModuleDialog {
|
||||
* Sets the 'more' indicator.
|
||||
*/
|
||||
private void updateMoreIndicator() {
|
||||
AndroidUtils.setStartDrawables(info,
|
||||
info.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
box.getChildCount() == 0 ? 0
|
||||
: box.getVisibility() == View.VISIBLE ? R.drawable.arrow_down
|
||||
: R.drawable.arrow_right);
|
||||
: R.drawable.arrow_right,
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,9 +153,7 @@ class UriPartsDialog extends AModuleDialog {
|
||||
v -> JavaUtils.toggleContains(expandedGroups, name),
|
||||
v -> {
|
||||
group.setVisibility(expandedGroups.contains(name) ? View.VISIBLE : View.GONE);
|
||||
AndroidUtils.setStartDrawables(name_view,
|
||||
expandedGroups.contains(name) ? R.drawable.arrow_down : R.drawable.arrow_right
|
||||
);
|
||||
name_view.setCompoundDrawablesRelativeWithIntrinsicBounds(expandedGroups.contains(name) ? R.drawable.arrow_down : R.drawable.arrow_right, 0, 0, 0);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.trianguloy.urlchecker.utilities;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
@ -92,11 +91,7 @@ public interface AndroidSettings {
|
||||
* returns a specific string in a specific locale
|
||||
*/
|
||||
static String getStringForLocale(int id, Locale locale, Context cntx) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
return cntx.createConfigurationContext(getConfig(locale)).getString(id);
|
||||
} else {
|
||||
return new Resources(cntx.getAssets(), cntx.getResources().getDisplayMetrics(), getConfig(locale)).getString(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,6 @@ import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@ -32,26 +31,6 @@ import java.util.Set;
|
||||
*/
|
||||
public interface AndroidUtils {
|
||||
|
||||
/**
|
||||
* Sets the start drawable of a textview
|
||||
* Wrapped for android compatibility
|
||||
*/
|
||||
static void setStartDrawables(TextView txt, int start) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
// we can use the function directly!
|
||||
txt.setCompoundDrawablesRelativeWithIntrinsicBounds(start, 0, 0, 0);
|
||||
} else {
|
||||
// we need to manually adjust
|
||||
if ((txt.getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_LAYOUTDIR_MASK) == Configuration.SCREENLAYOUT_LAYOUTDIR_RTL) {
|
||||
// rtl
|
||||
txt.setCompoundDrawablesWithIntrinsicBounds(0, 0, start, 0);
|
||||
} else {
|
||||
// ltr
|
||||
txt.setCompoundDrawablesWithIntrinsicBounds(start, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For some reason some drawable buttons are displayed the same when enabled and disabled.
|
||||
* This method also sets an alpha as a workaround
|
||||
@ -142,7 +121,7 @@ public interface AndroidUtils {
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText("", text));
|
||||
|
||||
// show toast to notify it was copied (except on Android 13+, where the device shows a popup itself)
|
||||
if (Build.VERSION.SDK_INT < /*Build.VERSION_CODES.TIRAMISU*/33)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
|
||||
Toast.makeText(activity, toast, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.trianguloy.urlchecker.utilities.methods;
|
||||
|
||||
import android.animation.LayoutTransition;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@ -13,7 +12,6 @@ public interface Animations {
|
||||
* Enables animations for a specific view
|
||||
*/
|
||||
static void enableAnimations(View view) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
|
||||
if (view instanceof ViewGroup) {
|
||||
final LayoutTransition lt = ((ViewGroup) view).getLayoutTransition();
|
||||
if (lt != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user