fix(): bugs fixs and fix API32(Android 12L) crash problem in some case
This commit is contained in:
parent
c74b85e63e
commit
2b64c7ea3d
5 changed files with 16 additions and 5 deletions
|
@ -27,6 +27,8 @@ import androidx.appcompat.widget.AppCompatImageView;
|
|||
import com.google.android.material.card.MaterialCardView;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import io.github.muntashirakon.music.R;
|
||||
|
||||
public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package io.github.muntashirakon.music.lyrics;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
|
@ -211,7 +212,7 @@ class LrcUtils {
|
|||
|
||||
static void resetDurationScale() {
|
||||
try {
|
||||
Field mField = ValueAnimator.class.getDeclaredField("sDurationScale");
|
||||
@SuppressLint({"SoonBlockedPrivateApi"}) Field mField = ValueAnimator.class.getDeclaredField("sDurationScale");
|
||||
mField.setAccessible(true);
|
||||
mField.setFloat(null, 1);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package code.name.monkey.appthemehelper.common.prefs.supportv7;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.preference.Preference;
|
||||
|
@ -12,8 +15,9 @@ import code.name.monkey.appthemehelper.common.prefs.supportv7.dialogs.ATEPrefere
|
|||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public abstract class ATEPreferenceFragmentCompat extends PreferenceFragmentCompat {
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void onDisplayPreferenceDialog(Preference preference) {
|
||||
public void onDisplayPreferenceDialog(@NonNull Preference preference) {
|
||||
if (getCallbackFragment() instanceof OnPreferenceDisplayDialogCallback) {
|
||||
((OnPreferenceDisplayDialogCallback) getCallbackFragment()).onPreferenceDisplayDialog(this, preference);
|
||||
return;
|
||||
|
@ -24,6 +28,7 @@ public abstract class ATEPreferenceFragmentCompat extends PreferenceFragmentComp
|
|||
return;
|
||||
}
|
||||
|
||||
assert getFragmentManager() != null;
|
||||
if (getFragmentManager().findFragmentByTag("androidx.preference.PreferenceFragment.DIALOG") == null) {
|
||||
DialogFragment dialogFragment = onCreatePreferenceDialog(preference);
|
||||
|
||||
|
|
|
@ -60,9 +60,11 @@ public class ATEPreferenceDialogFragment extends DialogFragment implements Dialo
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
FragmentActivity context = this.getActivity();
|
||||
assert context != null;
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context,
|
||||
R.style.ThemeOverlay_MaterialComponents_Dialog_Alert)
|
||||
.setTitle(this.mPreference.getDialogTitle())
|
||||
|
|
|
@ -41,7 +41,7 @@ public final class TintHelper {
|
|||
@SuppressWarnings("JavaReflectionMemberAccess")
|
||||
public static void colorHandles(@NonNull TextView view, int color) {
|
||||
try {
|
||||
Field editorField = TextView.class.getDeclaredField("mEditor");
|
||||
@SuppressLint("DiscouragedPrivateApi") Field editorField = TextView.class.getDeclaredField("mEditor");
|
||||
if (!editorField.isAccessible()) {
|
||||
editorField.setAccessible(true);
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ public final class TintHelper {
|
|||
|
||||
public static void setCursorTint(@NonNull EditText editText, @ColorInt int color) {
|
||||
try {
|
||||
Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
@SuppressLint("SoonBlockedPrivateApi") Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
fCursorDrawableRes.setAccessible(true);
|
||||
int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
|
||||
Field fEditor = TextView.class.getDeclaredField("mEditor");
|
||||
@SuppressLint("DiscouragedPrivateApi") Field fEditor = TextView.class.getDeclaredField("mEditor");
|
||||
fEditor.setAccessible(true);
|
||||
Object editor = fEditor.get(editText);
|
||||
Class<?> clazz = editor.getClass();
|
||||
|
@ -171,6 +171,7 @@ public final class TintHelper {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public static void setTint(@NonNull EditText editText, @ColorInt int color, boolean useDarker) {
|
||||
final ColorStateList editTextColorStateList = new ColorStateList(new int[][]{
|
||||
new int[]{-android.R.attr.state_enabled},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue