Browse Source

migrate to androidx artifacts

master
Peter Cai 3 years ago
parent
commit
6a3dab4623
No known key found for this signature in database GPG Key ID: 71F5FB4E4F3FD54F
  1. 5
      .idea/codeStyles/codeStyleConfig.xml
  2. 20
      app/build.gradle
  3. 4
      app/src/androidTest/java/net/typeblog/shelter/ExampleInstrumentedTest.java
  4. 4
      app/src/main/java/net/typeblog/shelter/services/FileShuttleService.java
  5. 3
      app/src/main/java/net/typeblog/shelter/services/KillerService.java
  6. 3
      app/src/main/java/net/typeblog/shelter/services/ShelterService.java
  7. 5
      app/src/main/java/net/typeblog/shelter/ui/AppListAdapter.java
  8. 17
      app/src/main/java/net/typeblog/shelter/ui/AppListFragment.java
  9. 6
      app/src/main/java/net/typeblog/shelter/ui/DummyActivity.java
  10. 24
      app/src/main/java/net/typeblog/shelter/ui/MainActivity.java
  11. 5
      app/src/main/java/net/typeblog/shelter/ui/SettingsActivity.java
  12. 7
      app/src/main/java/net/typeblog/shelter/ui/SettingsFragment.java
  13. 4
      app/src/main/java/net/typeblog/shelter/util/CrossProfileDocumentsProvider.java
  14. 6
      app/src/main/java/net/typeblog/shelter/util/FileProviderProxy.java
  15. 1
      app/src/main/java/net/typeblog/shelter/util/Utility.java
  16. 14
      app/src/main/res/layout/activity_main.xml
  17. 10
      app/src/main/res/layout/activity_settings.xml
  18. 4
      app/src/main/res/layout/app_list_item.xml
  19. 10
      app/src/main/res/layout/fragment_list.xml
  20. 20
      app/src/main/res/xml/preferences_settings.xml
  21. 2
      gradle.properties

5
.idea/codeStyles/codeStyleConfig.xml

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

20
app/build.gradle

@ -9,7 +9,7 @@ android {
targetSdkVersion 28
versionCode 8
versionName "1.3-alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@ -33,14 +33,14 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-core-ui:28.0.0-rc02'
implementation 'com.android.support:support-fragment:28.0.0-rc02'
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support:preference-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0-rc02'
implementation 'com.android.support:localbroadcastmanager:28.0.0-rc02'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}

4
app/src/androidTest/java/net/typeblog/shelter/ExampleInstrumentedTest.java

@ -1,8 +1,8 @@
package net.typeblog.shelter;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;

4
app/src/main/java/net/typeblog/shelter/services/FileShuttleService.java

@ -12,12 +12,12 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.webkit.MimeTypeMap;
import androidx.annotation.Nullable;
import net.typeblog.shelter.ShelterApplication;
import net.typeblog.shelter.util.CrossProfileDocumentsProvider;
import net.typeblog.shelter.util.Utility;

3
app/src/main/java/net/typeblog/shelter/services/KillerService.java

@ -4,7 +4,8 @@ import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import net.typeblog.shelter.util.Utility;

3
app/src/main/java/net/typeblog/shelter/services/ShelterService.java

@ -17,7 +17,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import net.typeblog.shelter.R;
import net.typeblog.shelter.ShelterApplication;

5
app/src/main/java/net/typeblog/shelter/ui/AppListAdapter.java

@ -5,14 +5,15 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import net.typeblog.shelter.R;
import net.typeblog.shelter.services.ILoadIconCallback;
import net.typeblog.shelter.services.IShelterService;

17
app/src/main/java/net/typeblog/shelter/ui/AppListFragment.java

@ -12,14 +12,6 @@ import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
@ -28,6 +20,15 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import net.typeblog.shelter.R;
import net.typeblog.shelter.services.IAppInstallCallback;
import net.typeblog.shelter.services.IGetAppsCallback;

6
app/src/main/java/net/typeblog/shelter/ui/DummyActivity.java

@ -13,14 +13,14 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import net.typeblog.shelter.R;
import net.typeblog.shelter.ShelterApplication;
import net.typeblog.shelter.receivers.ShelterDeviceAdminReceiver;
import net.typeblog.shelter.services.FileShuttleService;
import net.typeblog.shelter.services.IAppInstallCallback;
import net.typeblog.shelter.services.IFileShuttleService;
import net.typeblog.shelter.services.IFileShuttleServiceCallback;

24
app/src/main/java/net/typeblog/shelter/ui/MainActivity.java

@ -7,23 +7,25 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import net.typeblog.shelter.R;
import net.typeblog.shelter.ShelterApplication;
import net.typeblog.shelter.receivers.ShelterDeviceAdminReceiver;
@ -36,8 +38,6 @@ import net.typeblog.shelter.util.SettingsManager;
import net.typeblog.shelter.util.UriForwardProxy;
import net.typeblog.shelter.util.Utility;
import java.io.IOException;
public class MainActivity extends AppCompatActivity {
public static final String BROADCAST_CONTEXT_MENU_CLOSED = "net.typeblog.shelter.broadcast.CONTEXT_MENU_CLOSED";

5
app/src/main/java/net/typeblog/shelter/ui/SettingsActivity.java

@ -1,8 +1,9 @@
package net.typeblog.shelter.ui;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import net.typeblog.shelter.R;

7
app/src/main/java/net/typeblog/shelter/ui/SettingsFragment.java

@ -4,9 +4,10 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import androidx.preference.CheckBoxPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import net.typeblog.shelter.R;
import net.typeblog.shelter.util.SettingsManager;

4
app/src/main/java/net/typeblog/shelter/util/CrossProfileDocumentsProvider.java

@ -13,7 +13,8 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.provider.DocumentsContract;
import android.provider.DocumentsProvider;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import net.typeblog.shelter.R;
import net.typeblog.shelter.services.FileShuttleService;
@ -21,7 +22,6 @@ import net.typeblog.shelter.services.IFileShuttleService;
import net.typeblog.shelter.services.IFileShuttleServiceCallback;
import net.typeblog.shelter.ui.DummyActivity;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Map;

6
app/src/main/java/net/typeblog/shelter/util/FileProviderProxy.java

@ -2,11 +2,11 @@ package net.typeblog.shelter.util;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.support.annotation.NonNull;
import android.support.v4.content.FileProvider;
import androidx.annotation.NonNull;
import androidx.core.content.FileProvider;
import java.io.FileNotFoundException;
import java.io.IOException;
// A simple and naïve FileProvider which forwards content Uris
// to a given Uri from another profile through UriForwardProxy

1
app/src/main/java/net/typeblog/shelter/util/Utility.java

@ -17,7 +17,6 @@ import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Build;
import android.os.UserManager;
import android.provider.MediaStore;

14
app/src/main/res/layout/activity_main.xml

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.MainActivity">
<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/main_appbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -21,16 +21,16 @@
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
<com.google.android.material.tabs.TabLayout
android:id="@+id/main_tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ToolbarTheme"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/main_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
@ -39,4 +39,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

10
app/src/main/res/layout/activity_settings.xml

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/settings_appbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<android.support.v7.widget.Toolbar
<androidx.appcompat.widget.Toolbar
android:id="@+id/settings_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -18,7 +18,7 @@
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<fragment
android:name="net.typeblog.shelter.ui.SettingsFragment"
@ -30,4 +30,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

4
app/src/main/res/layout/app_list_item.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
@ -44,4 +44,4 @@
app:layout_constraintTop_toBottomOf="@id/list_app_title"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

10
app/src/main/res/layout/fragment_list.xml

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/fragment_swipe_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
@ -13,12 +13,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment_list_recycler_view"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

20
app/src/main/res/xml/preferences_settings.xml

@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.preference.PreferenceScreen
<androidx.preference.PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v7.preference.PreferenceCategory
<androidx.preference.PreferenceCategory
android:title="@string/settings_interaction">
<android.support.v7.preference.CheckBoxPreference
<androidx.preference.CheckBoxPreference
android:key="settings_cross_profile_file_chooser"
android:title="@string/settings_cross_profile_file_chooser"
android:summary="@string/settings_cross_profile_file_chooser_desc" />
</android.support.v7.preference.PreferenceCategory>
</androidx.preference.PreferenceCategory>
<android.support.v7.preference.PreferenceCategory
<androidx.preference.PreferenceCategory
android:title="@string/settings_about">
<android.support.v7.preference.Preference
<androidx.preference.Preference
android:key="settings_version"
android:title="@string/settings_version" />
<android.support.v7.preference.Preference
<androidx.preference.Preference
android:key="settings_source_code"
android:title="@string/settings_source_code"
android:summary="@string/settings_source_code_url" />
<android.support.v7.preference.Preference
<androidx.preference.Preference
android:key="settings_bug_report"
android:title="@string/settings_bug_report"
android:summary="@string/settings_bug_report_url" />
</android.support.v7.preference.PreferenceCategory>
</androidx.preference.PreferenceCategory>
</android.support.v7.preference.PreferenceScreen>
</androidx.preference.PreferenceScreen>

2
gradle.properties

@ -6,6 +6,8 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit

Loading…
Cancel
Save