mirror of
https://github.com/YTVanced/VancedMicroG
synced 2025-01-06 23:41:01 +00:00
Migrate to androidx
This commit is contained in:
parent
0dedff9746
commit
9aa4b857f1
22 changed files with 68 additions and 58 deletions
|
@ -26,13 +26,13 @@ String getMyVersionName() {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdk()
|
||||
compileSdkVersion androidCompileSdk
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
defaultConfig {
|
||||
versionName getMyVersionName()
|
||||
minSdkVersion androidMinSdk()
|
||||
targetSdkVersion androidTargetSdk()
|
||||
versionName version
|
||||
minSdkVersion androidMinSdk
|
||||
targetSdkVersion androidTargetSdk
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
@ -47,8 +47,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.android.support:support-v4:$supportLibraryVersion"
|
||||
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
|
||||
implementation "com.takisoft.fix:preference-v7:$supportLibraryVersion.0"
|
||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||
implementation "androidx.preference:preference:$preferenceVersion"
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,10 @@ import android.content.Context;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PermissionGroupInfo;
|
||||
import android.content.pm.PermissionInfo;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import org.microg.tools.ui.R;
|
||||
|
||||
import static android.os.Build.VERSION_CODES.M;
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
package org.microg.tools.selfcheck;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public interface SelfCheckGroup {
|
||||
String getGroupName(Context context);
|
||||
|
|
|
@ -20,8 +20,6 @@ import android.content.Context;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -31,6 +29,9 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -103,9 +104,6 @@ public abstract class AbstractAboutFragment extends Fragment {
|
|||
|
||||
List<Library> libraries = new ArrayList<Library>();
|
||||
libraries.add(new Library(BuildConfig.APPLICATION_ID, getString(R.string.lib_name), getString(R.string.lib_license)));
|
||||
libraries.add(new Library("android.support.v4", getString(R.string.about_android_support_v4), getString(R.string.about_android_support_license)));
|
||||
libraries.add(new Library("android.support.v7.appcompat", getString(R.string.about_android_support_v7_appcompat), getString(R.string.about_android_support_license)));
|
||||
libraries.add(new Library("android.support.v7.preference#hide_version", getString(R.string.about_android_support_v7_preference), getString(R.string.about_android_support_license)));
|
||||
collectLibraries(libraries);
|
||||
Collections.sort(libraries);
|
||||
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[libraries.size()])));
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package org.microg.tools.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
package org.microg.tools.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -27,6 +25,9 @@ import android.view.ViewGroup;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import org.microg.tools.selfcheck.SelfCheckGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package org.microg.tools.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
public abstract class AbstractSettingsActivity extends AppCompatActivity {
|
||||
protected boolean showHomeAsUp = false;
|
||||
protected int preferencesResource = 0;
|
||||
|
|
|
@ -16,16 +16,14 @@
|
|||
|
||||
package org.microg.tools.ui;
|
||||
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
public abstract class AbstractSettingsFragment extends PreferenceFragmentCompat {
|
||||
private static final String TAG = AbstractSettingsFragment.class.getSimpleName();
|
||||
|
||||
private static final String DIALOG_FRAGMENT_TAG =
|
||||
"android.support.v7.preference.PreferenceFragment.DIALOG";
|
||||
private static final String DIALOG_FRAGMENT_TAG = "androidx.preference.PreferenceFragment.DIALOG";
|
||||
|
||||
@Override
|
||||
public void onDisplayPreferenceDialog(Preference preference) {
|
||||
|
|
|
@ -18,10 +18,6 @@ package org.microg.tools.ui;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.PluralsRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -29,6 +25,11 @@ import android.widget.Button;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.PluralsRes;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
public class Condition {
|
||||
@DrawableRes
|
||||
private final int iconRes;
|
||||
|
|
|
@ -19,17 +19,18 @@ package org.microg.tools.ui;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceDialogFragmentCompat;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class DialogPreference extends android.support.v7.preference.DialogPreference implements PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceDialogFragmentCompat;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
public class DialogPreference extends androidx.preference.DialogPreference implements PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
|
||||
|
||||
private static final String DIALOG_FRAGMENT_TAG =
|
||||
"android.support.v7.preference.PreferenceFragment.DIALOG";
|
||||
|
|
|
@ -18,14 +18,15 @@ package org.microg.tools.ui;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
/**
|
||||
* A preference item that can dim the icon when it's disabled, either directly or because its parent
|
||||
* is disabled.
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
package org.microg.tools.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
public class LongTextPreference extends Preference {
|
||||
|
||||
public LongTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
|
|
|
@ -18,10 +18,11 @@ package org.microg.tools.ui;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.res.TypedArrayUtils;
|
||||
import android.support.v7.preference.CheckBoxPreference;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.core.content.res.TypedArrayUtils;
|
||||
import androidx.preference.CheckBoxPreference;
|
||||
|
||||
public class RadioButtonPreference extends CheckBoxPreference {
|
||||
|
||||
public RadioButtonPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
package org.microg.tools.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class ResourceSettingsFragment extends AbstractSettingsFragment {
|
||||
|
||||
|
@ -26,7 +27,7 @@ public class ResourceSettingsFragment extends AbstractSettingsFragment {
|
|||
protected int preferencesResource;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
|
||||
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
|
||||
Bundle b = getArguments();
|
||||
if (b != null) {
|
||||
preferencesResource = b.getInt(EXTRA_PREFERENCE_RESOURCE, preferencesResource);
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.content.Context;
|
|||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
|
@ -32,6 +31,8 @@ import android.widget.CompoundButton;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
|
@ -73,7 +74,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||
mTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
}
|
||||
mLabel = getResources().getString(R.string.abc_capital_off);
|
||||
mSummarySpan = new TextAppearanceSpan(context, android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Widget_Switch);
|
||||
mSummarySpan = new TextAppearanceSpan(context, androidx.appcompat.R.style.TextAppearance_AppCompat_Widget_Switch);
|
||||
updateText();
|
||||
|
||||
mSwitch = (ToggleSwitch) findViewById(R.id.switch_widget);
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
package org.microg.tools.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
public abstract class SwitchBarResourceSettingsFragment extends ResourceSettingsFragment implements SwitchBar.OnSwitchChangeListener {
|
||||
protected SwitchBar switchBar;
|
||||
|
|
|
@ -2,11 +2,12 @@ package org.microg.tools.ui;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static android.os.Build.VERSION_CODES.LOLLIPOP;
|
||||
|
||||
|
|
|
@ -19,9 +19,10 @@ package org.microg.tools.ui;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public class ToggleSwitch extends SwitchCompat {
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
android:paddingEnd="12dp"
|
||||
android:paddingTop="4dp">
|
||||
|
||||
<android.support.v7.internal.widget.PreferenceImageView
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
android:layout_height="0.25dp"
|
||||
android:background="@android:color/white"/>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
<androidx.appcompat.widget.ButtonBarLayout
|
||||
android:id="@+id/buttonBar"
|
||||
style="?attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -130,7 +130,7 @@
|
|||
android:visibility="gone"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</androidx.appcompat.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.AppCompat.Settings" parent="@style/PreferenceFixTheme.Light.NoActionBar">
|
||||
<style name="Theme.AppCompat.Settings" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/settings_theme_primary</item>
|
||||
<item name="colorPrimaryDark">@color/settings_theme_primary_dark</item>
|
||||
<item name="colorAccent">@color/settings_theme_accent</item>
|
||||
|
|
Loading…
Reference in a new issue