Commit e9d38598 authored by Mark Murphy's avatar Mark Murphy

updates for Q Beta 3 and misc improvements

parent ef817d50
......@@ -58,8 +58,8 @@ class MainActivity : AppCompatActivity() {
.setTitle("This is the title")
.setDescription("This is the description")
.setSubtitle("This is the subtitle")
.setRequireConfirmation(true)
.setAllowDeviceCredential(true)
.setConfirmationRequired(true)
.setDeviceCredentialAllowed(true)
.build()
fingerprint.apply {
......
......@@ -65,7 +65,7 @@ class MainActivity : AppCompatActivity() {
.setSubtitle("This is the subtitle")
.apply {
if (BuildCompat.isAtLeastQ()) {
setAllowDeviceCredential(true)
setDeviceCredentialAllowed(true)
} else {
setNegativeButton(
"Ick!",
......
......@@ -21,56 +21,43 @@ android {
}
}
flavorDimensions "scenario"
flavorDimensions "target", "perm", "sandbox"
productFlavors {
legacy {
dimension "scenario"
buildConfigField "boolean", "REQUEST_RUNTIME_PERMISSIONS", "true"
buildConfigField "String", "ROLE", "null"
}
qmusic {
dimension "scenario"
applicationId "com.commonsware.android.storage.qmusic"
minSdkVersion "Q"
targetSdkVersion "Q"
buildConfigField "boolean", "REQUEST_RUNTIME_PERMISSIONS", "false"
buildConfigField "String", "ROLE", "android.app.role.RoleManager.ROLE_MUSIC"
p {
dimension "target"
applicationIdSuffix ".p"
}
qgallery {
dimension "scenario"
applicationId "com.commonsware.android.storage.qgallery"
q {
dimension "target"
applicationIdSuffix ".q"
minSdkVersion "Q"
targetSdkVersion "Q"
buildConfigField "boolean", "REQUEST_RUNTIME_PERMISSIONS", "false"
buildConfigField "String", "ROLE", "android.app.role.RoleManager.ROLE_GALLERY"
}
qperm {
dimension "scenario"
applicationId "com.commonsware.android.storage.qperm"
minSdkVersion "Q"
targetSdkVersion "Q"
perm {
dimension "perm"
applicationIdSuffix ".perm"
buildConfigField "boolean", "REQUEST_RUNTIME_PERMISSIONS", "true"
buildConfigField "String", "ROLE", "null"
}
qnoperm {
dimension "scenario"
applicationId "com.commonsware.android.storage.qnoperm"
minSdkVersion "Q"
targetSdkVersion "Q"
noperm {
dimension "perm"
applicationIdSuffix ".noperm"
buildConfigField "boolean", "REQUEST_RUNTIME_PERMISSIONS", "false"
buildConfigField "String", "ROLE", "null"
}
noperm {
dimension "scenario"
applicationId "com.commonsware.android.storage.noperm"
buildConfigField "boolean", "REQUEST_RUNTIME_PERMISSIONS", "false"
buildConfigField "String", "ROLE", "null"
sandbox {
dimension "sandbox"
applicationIdSuffix ".sandbox"
resValue "bool", "useSandbox", "true"
}
normal {
dimension "sandbox"
applicationIdSuffix ".normal"
resValue "bool", "useSandbox", "false"
}
}
}
......@@ -83,8 +70,9 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation "androidx.viewpager:viewpager:$viewpager_version"
implementation "androidx.fragment:fragment-ktx:1.0.0"
implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
implementation 'com.google.android.material:material:1.0.0'
}
......@@ -11,7 +11,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
tools:ignore="GoogleAppIndexingWarning"
android:allowExternalStorageSandbox="@bool/useSandbox">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -53,16 +53,19 @@ class ContentSource(
) :
IStorageSource {
companion object {
fun on(ctxt: Context, file: File) =
ContentSource(ctxt, DocumentFile.fromFile(file))
fun onPublic(ctxt: Context, loc: String) =
ContentSource(
ctxt,
DocumentFile.fromFile(
Environment.getExternalStoragePublicDirectory(loc)
)
)
fun on(ctxt: Context, dir: File): ContentSource {
dir.mkdirs()
return ContentSource(ctxt, DocumentFile.fromFile(dir))
}
fun onPublic(ctxt: Context, loc: String): ContentSource {
val dir = Environment.getExternalStoragePublicDirectory(loc)
dir.mkdirs()
return ContentSource(ctxt, DocumentFile.fromFile(dir))
}
}
override val supportsDirectory = true
......
......@@ -22,6 +22,7 @@ import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.observe
import androidx.recyclerview.widget.*
import kotlinx.android.synthetic.main.fragment_storage.*
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
......@@ -98,12 +99,11 @@ class StorageFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val adapter = Adapter(layoutInflater)
val rv = view as RecyclerView
val manager = LinearLayoutManager(activity)
rv.layoutManager = manager
rv.addItemDecoration(DividerItemDecoration(activity, manager.orientation))
rv.adapter = adapter
items.layoutManager = manager
items.addItemDecoration(DividerItemDecoration(activity, manager.orientation))
items.adapter = adapter
motor.states.observe(this) { state ->
adapter.submitList(state.items)
......@@ -113,6 +113,8 @@ class StorageFragment : Fragment() {
topViewModel.refreshEvents.observe(this) { event ->
event.handle { motor.refresh() }
}
location.text = arguments?.scenario?.name
}
class Adapter(private val inflater: LayoutInflater) :
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
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=".MainActivity">
android:fitsSystemWindows="true"
tools:openDrawer="start">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar">
<androidx.viewpager.widget.PagerTabStrip
android:layout_width="match_parent"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top" />
</androidx.viewpager.widget.ViewPager>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
android:background="@color/colorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/frame"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
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">
</androidx.recyclerview.widget.RecyclerView>
\ No newline at end of file
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="8dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/items"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/location" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_internal_files"
android:checked="true"
android:title="@string/title_internal_files" />
<item
android:id="@+id/nav_external_files"
android:title="@string/title_external_files" />
<item
android:id="@+id/nav_external_cache"
android:title="@string/title_external_cache" />
<item
android:id="@+id/nav_external_root"
android:title="@string/title_external_root" />
<item
android:id="@+id/nav_external_music"
android:title="@string/title_external_music" />
<item
android:id="@+id/nav_external_images"
android:title="@string/title_external_images" />
<item
android:id="@+id/nav_external_videos"
android:title="@string/title_external_videos" />
<item
android:id="@+id/nav_external_downloads"
android:title="@string/title_external_downloads" />
<item
android:id="@+id/nav_external_documents"
android:title="@string/title_external_documents" />
<item
android:id="@+id/nav_external_alarms"
android:title="@string/title_external_alarms" />
<item
android:id="@+id/nav_external_dcim"
android:title="@string/title_external_dcim" />
<item
android:id="@+id/nav_external_notifications"
android:title="@string/title_external_notifications" />
<item
android:id="@+id/nav_external_podcasts"
android:title="@string/title_external_podcasts" />
<item
android:id="@+id/nav_external_ringtones"
android:title="@string/title_external_ringtones" />
<item
android:id="@+id/nav_media_music"
android:title="@string/title_media_music" />
<item
android:id="@+id/nav_media_images"
android:title="@string/title_media_images" />
<item
android:id="@+id/nav_media_videos"
android:title="@string/title_media_videos" />
<item
android:id="@+id/nav_media_files"
android:title="@string/title_media_files" />
</group>
</menu>
......@@ -8,7 +8,11 @@
android:title="@string/menu_refresh"
app:showAsAction="ifRoom" />
<item
android:id="@+id/requestRole"
android:title="@string/menu_request_role"
android:id="@+id/openDoc"
android:title="@string/menu_open_doc"
app:showAsAction="never" />
<item
android:id="@+id/openTree"
android:title="@string/menu_open_tree"
app:showAsAction="never" />
</menu>
\ No newline at end of file
......@@ -24,4 +24,8 @@
<string name="menu_create">Create</string>
<string name="menu_refresh">Refresh</string>
<string name="menu_create_folder">Create Folder</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="menu_open_doc">Open Document</string>
<string name="menu_open_tree">Open Tree</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">NoPerm Storage Explorer</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">QNoPerm Storage Explorer</string>
<string name="app_name">P NoPerm Storage Explorer</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
package="com.commonsware.android.storage"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<application tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.APP_GALLERY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">QGallery Storage Explorer</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
package="com.commonsware.android.storage"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<application tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.APP_MUSIC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">QMusic Storage Explorer</string>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
package="com.commonsware.android.storage"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<application tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="permissions">
<item>android.permission.READ_MEDIA_AUDIO</item>
<item>android.permission.READ_MEDIA_IMAGES</item>
<item>android.permission.READ_MEDIA_VIDEO</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">QPerm Storage Explorer</string>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment