Browse Source

allow opening /storage for microsd access

Andrew Dolgov 5 months ago
parent
commit
13016e9a6a

+ 4 - 4
org.fox.ttcomics/build.gradle

@@ -47,10 +47,10 @@ android {
 }
 
 dependencies {
-    implementation 'com.android.support:support-v4:27.1.0'
-    implementation 'com.android.support:appcompat-v7:27.1.0'
-    implementation 'com.android.support:cardview-v7:27.1.0'
-    implementation 'com.android.support:design:27.1.0'
+    implementation 'com.android.support:support-v4:28.0.0'
+    implementation 'com.android.support:appcompat-v7:28.0.0'
+    implementation 'com.android.support:cardview-v7:28.0.0'
+    implementation 'com.android.support:design:28.0.0'
     implementation 'com.shamanland:fab:0.0.8'
     implementation 'jp.co.recruit_mp:android-HeaderFooterGridView:0.2.4'
     implementation 'com.github.bumptech.glide:glide:3.8.0'

+ 47 - 31
org.fox.ttcomics/org.fox.ttcomics.iml

@@ -125,53 +125,69 @@
     </content>
     <orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="Gradle: com.google.auto.service:auto-service:[email protected]ar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:design:[email protected]ar" level="project" />
     <orderEntry type="library" name="Gradle: stencil:stencil:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.guava:guava:[email protected]ar" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:1.1[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-fragment:[email protected]ar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: org.clojure:data.priority-map:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:loader:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:runtime:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: net.rdrei.android.dirchooser:library:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:cursoradapter:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: __local_aars__:C.\Users\fox\Projects\tt-comics\org.fox.ttcomics\libs\nineoldandroids-2.4.0.jar:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.ToxicBakery.viewpager.transforms:view-pager-transforms:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-compat:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.gu:option:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:cardview-v7:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: quoin:quoin:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: jp.co.recruit_mp:android-HeaderFooterGridView:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:interpolator:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:transition:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: org.clojure:clojure:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:drawerlayout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-v4:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.guava:guava:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.auto.service:auto-service:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:documentfile:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: frankiesardo:icepick:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:slidingpanelayout:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: scout:scout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.github.livefront:bridge:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: ch.acra:acra:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-media-compat:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: net.rdrei.android.dirchooser:library:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:transition:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:runtime:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:collections:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: frankiesardo:icepick-processor:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: __local_aars__:C.\Users\fox\Projects\tt-comics\org.fox.ttcomics\libs\nineoldandroids-2.4.0.jar:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.auto:auto-common:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.ToxicBakery.viewpager.transforms:view-pager-transforms:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.gu:option:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-v4:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: quoin:quoin:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:design:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:print:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: org.clojure:core.cache:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:common:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:versionedparcelable:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.shamanland:fab:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-auth:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: slingshot:slingshot:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:viewpager:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.nhaarman.listviewanimations:lib-core:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-fragment:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: jp.co.recruit_mp:android-HeaderFooterGridView:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-auth-api-phone:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: org.clojure:clojure:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:common:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:coordinatorlayout:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:customview:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout:[email protected]" level="project" />
     <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-auth-base:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:cardview-v7:[email protected]" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-compat:[email protected]" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-media-compat:[email protected]" level="project" />
   </component>
 </module>

+ 2 - 2
org.fox.ttcomics/src/main/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     package="org.fox.ttcomics2"
-    android:versionCode="86"
-    android:versionName="1.44" >
+    android:versionCode="87"
+    android:versionName="1.45" >
 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.INTERNET" />

+ 2 - 2
org.fox.ttcomics/src/main/java/org/fox/ttcomics2/PreferencesActivity.java

@@ -61,13 +61,13 @@ public class PreferencesActivity extends CommonActivity {
         super.onActivityResult(requestCode, resultCode, data);
     }
 
-    public void startPicker() {
+    public void startPicker(String initialDir) {
         Intent intent = new Intent(PreferencesActivity.this, DirectoryChooserActivity.class);
 
         SharedPreferences prefs = PreferenceManager
                 .getDefaultSharedPreferences(getApplicationContext());
 
-        String initialDir = prefs.getString("comics_directory",
+        if (initialDir == null) initialDir = prefs.getString("comics_directory",
                 Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
 
         intent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, DirectoryChooserConfig.builder()

+ 12 - 1
org.fox.ttcomics/src/main/java/org/fox/ttcomics2/PreferencesFragment.java

@@ -72,7 +72,18 @@ public class PreferencesFragment extends PreferenceFragment {
         findPreference("comics_directory").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
             @Override
             public boolean onPreferenceClick(Preference preference) {
-                ((PreferencesActivity)getActivity()).startPicker();
+                ((PreferencesActivity)getActivity()).startPicker(null);
+                return true;
+            }
+        });
+
+        findPreference("comics_directory").setSummary(prefs.getString("comics_directory",
+                getString(R.string.prefs_comics_directory_summary)));
+
+        findPreference("open_storage_dir").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+            @Override
+            public boolean onPreferenceClick(Preference preference) {
+                ((PreferencesActivity)getActivity()).startPicker("/storage");
                 return true;
             }
         });

+ 2 - 0
org.fox.ttcomics/src/main/res/values/strings.xml

@@ -78,4 +78,6 @@
     <string name="dialog_close">Close</string>
     <string name="sync_account_not_set">Not specified</string>
     <string name="prefs_use_page_transformer">Enable animations</string>
+    <string name="prefs_open_storage_dir_summary">For MicroSD access.</string>
+    <string name="prefs_open_storage_dir">Open /storage directory</string>
 </resources>

+ 6 - 0
org.fox.ttcomics/src/main/res/xml/preferences.xml

@@ -8,6 +8,12 @@
             android:summary="@string/prefs_comics_directory_summary"
             android:title="@string/prefs_comics_directory" >
         </Preference>
+        <Preference
+            android:key="open_storage_dir"
+            android:summary="@string/prefs_open_storage_dir_summary"
+            android:title="@string/prefs_open_storage_dir" >
+        </Preference>
+
         <org.fox.ttcomics2.utils.LessBrokenSwitchPreference
             android:defaultValue="true"
             android:key="enable_fab"

+ 1 - 2
tt-comics.iml

@@ -12,9 +12,8 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <excludeFolder url="file://$MODULE_DIR$/.gradle" />
-      <excludeFolder url="file://$MODULE_DIR$/build" />
     </content>
-    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
+    <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>
 </module>