Init commit

ignore_sdcard
Dmitry Myachin 1 year ago
commit 244acc4f1c
  1. 45
      app/build.gradle
  2. 21
      app/proguard-rules.pro
  3. 34
      app/src/main/AndroidManifest.xml
  4. BIN
      app/src/main/ic_launcher-playstore.png
  5. 96
      app/src/main/java/xyz/myachin/saveto/ui/MainActivity.kt
  6. 128
      app/src/main/java/xyz/myachin/saveto/ui/SharingActivity.kt
  7. 32
      app/src/main/res/drawable/ic_launcher_foreground.xml
  8. 10
      app/src/main/res/drawable/ic_save_svgrepo_com.xml
  9. 82
      app/src/main/res/layout/activity_main.xml
  10. 8
      app/src/main/res/layout/activity_sharing.xml
  11. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  12. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  13. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  14. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  15. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  16. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  17. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  18. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  19. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  20. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  21. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  22. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  23. 16
      app/src/main/res/values-night/themes.xml
  24. 10
      app/src/main/res/values/colors.xml
  25. 4
      app/src/main/res/values/ic_launcher_background.xml
  26. 9
      app/src/main/res/values/strings.xml
  27. 16
      app/src/main/res/values/themes.xml
  28. 26
      build.gradle
  29. 21
      gradle.properties
  30. BIN
      gradle/wrapper/gradle-wrapper.jar
  31. 6
      gradle/wrapper/gradle-wrapper.properties
  32. 172
      gradlew
  33. 84
      gradlew.bat
  34. 2
      settings.gradle

@ -0,0 +1,45 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "xyz.myachin.saveto"
minSdkVersion 26
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
shrinkResources false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
}

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xyz.myachin.saveto">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.СохраниВ"
tools:ignore="AllowBackup">
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.SharingActivity">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

@ -0,0 +1,96 @@
package xyz.myachin.saveto.ui
import android.Manifest
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.PermissionChecker
import xyz.myachin.saveto.R
class MainActivity : AppCompatActivity(), View.OnClickListener {
companion object {
const val TAG = "MainAct"
const val READ_ES_PERM = Manifest.permission.READ_EXTERNAL_STORAGE
const val REQ_PERM = 10
}
private var btSaveNow: Button? = null
private var tvReqNow: TextView? = null
private var dv: View? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
checkPerms()
}
private fun checkPerms() {
if (PermissionChecker.checkSelfPermission(
this,
READ_ES_PERM
) != PermissionChecker.PERMISSION_GRANTED
) {
dv = findViewById(R.id.divider)
tvReqNow = findViewById(R.id.tvReqNow)
btSaveNow = findViewById(R.id.btRequestNow)
setPermsVisible()
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
when (requestCode) {
REQ_PERM -> {
when (grantResults[0]) {
PermissionChecker.PERMISSION_GRANTED -> {
setPermsGone()
}
PermissionChecker.PERMISSION_DENIED, PermissionChecker.PERMISSION_DENIED_APP_OP -> {
tvReqNow?.text = getString(R.string.tvSetPermsManual)
btSaveNow?.visibility = View.GONE
val btReqMan = findViewById<Button>(R.id.btRequestManual)
btReqMan.visibility = View.VISIBLE
btReqMan.setOnClickListener(this)
}
}
}
}
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.btRequestNow -> {
requestPermissions(arrayOf(READ_ES_PERM), REQ_PERM)
}
R.id.btRequestManual -> {
Intent().apply {
action = Intent.ACTION_AUTO_REVOKE_PERMISSIONS
data = Uri.fromParts("package", applicationContext.packageName, null)
}.also {
startActivity(it)
}
}
}
}
private fun setPermsVisible() {
dv?.visibility = View.VISIBLE
tvReqNow?.visibility = View.VISIBLE
btSaveNow?.visibility = View.VISIBLE
btSaveNow?.setOnClickListener(this)
}
private fun setPermsGone() {
dv?.visibility = View.GONE
tvReqNow?.visibility = View.GONE
btSaveNow?.visibility = View.GONE
}
}

@ -0,0 +1,128 @@
package xyz.myachin.saveto.ui
import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.os.Parcelable
import android.provider.DocumentsContract
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.PermissionChecker
import xyz.myachin.saveto.R
import java.io.File
import java.io.InputStream
import java.nio.file.Paths
class SharingActivity : AppCompatActivity() {
companion object {
const val TAG = "SharingAct"
const val CREATE_FILE = 101
}
private var fromSaveScreen = false
private var inputStream: InputStream? = null
private var fileData: ByteArray? = null
override fun onCreate(savedInstanceState: Bundle?) {
val perm = android.Manifest.permission.READ_EXTERNAL_STORAGE
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sharing)
if (PermissionChecker.checkSelfPermission(
this,
perm
) != PermissionChecker.PERMISSION_GRANTED
) {
requestPermissions(arrayOf(perm), 110)
}
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
when (intent?.action) {
Intent.ACTION_SEND -> {
if (intent.type?.startsWith("image/") == true) {
handleSendImage(intent)
}
}
}
}
private fun handleSendImage(intent: Intent) {
(intent.getParcelableExtra<Parcelable>(Intent.EXTRA_STREAM) as? Uri)?.let {
val createIntent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
type = intent.type
addCategory(Intent.CATEGORY_OPENABLE)
putExtra(Intent.EXTRA_TITLE, extractName(it, type!!))
putExtra(DocumentsContract.EXTRA_INITIAL_URI, it)
}
inputStream = contentResolver.openInputStream(it)
fromSaveScreen = true
startActivityForResult(createIntent, CREATE_FILE)
}
}
private fun extractName(uri: Uri, type: String): String {
Log.d(TAG, "extractName: uri= $uri")
Log.d(TAG, "extractName: type=$type")
Log.d(TAG, "extractName: ${uri.lastPathSegment}")
val typeMod = type.substringAfter("/")
val stub = "fileName.$typeMod"
val fn = "?filename="
var result = when {
uri.path == null -> stub
uri.path!!.contains(fn) -> uri.path!!.substringAfter(fn).substringBefore("/")
!uri.lastPathSegment.isNullOrEmpty() -> "${uri.lastPathSegment}"
else -> stub
}
File(result).extension.also {
if (it.isEmpty() || it.isBlank() || it.length > 5) {
result = result.plus(".$typeMod")
}
}
return result.replace(":", "_")
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
CREATE_FILE -> {
when (resultCode) {
Activity.RESULT_CANCELED -> return
Activity.RESULT_OK -> {
readFileContent()
writeFile(data?.data)
}
else -> Log.wtf(TAG, "onActivityResult: result code: $resultCode")
}
}
}
finish()
}
override fun onResume() {
super.onResume()
if (!fromSaveScreen) {
finish()
}
}
private fun readFileContent() {
fileData = inputStream?.readBytes()
inputStream?.close()
inputStream = null
}
private fun writeFile(data: Uri?) {
if (data == null) {
Log.e(TAG, "writeFile: Data is null")
return
}
val outputStream = contentResolver.openOutputStream(data)
outputStream?.write(fileData)
outputStream?.close()
fileData = null
}
}

@ -0,0 +1,32 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.123811245"
android:scaleY="0.123811245"
android:translateX="29.7"
android:translateY="29.7">
<path
android:pathData="M359.822,21.786h-29.673v103.305c0,6.012 -4.848,10.925 -10.925,10.925h-236.8c-6.012,0 -10.925,-4.848 -10.925,-10.925V21.786H53.527L21.786,53.527v306.23c0,6.012 4.848,10.925 10.925,10.925h38.853V213.657c0,-6.012 4.848,-10.925 10.925,-10.925h236.865c6.012,0 10.925,4.848 10.925,10.925v157.091h29.543c6.012,0 10.925,-4.848 10.925,-10.925V32.711C370.747,26.699 365.834,21.786 359.822,21.786z"
android:fillColor="#56ACE0"/>
<path
android:pathData="M93.349,21.786h215.079v92.444h-215.079z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M93.349,224.582v146.23h215.079v-146.23H93.349zM260.008,334.998H141.64c-6.012,0 -10.861,-4.848 -10.861,-10.925c0,-6.012 4.848,-10.925 10.861,-10.925h118.368c6.012,0 10.925,4.848 10.925,10.925C270.933,330.085 266.02,334.998 260.008,334.998zM260.008,282.117H141.64c-6.012,0 -10.861,-4.913 -10.861,-10.861c0,-6.012 4.848,-10.925 10.861,-10.925h118.368c6.012,0 10.925,4.848 10.925,10.925C270.933,277.269 266.02,282.117 260.008,282.117z"
android:fillColor="#FFC10D"/>
<path
android:pathData="M359.822,0H49.067c-2.844,0 -5.624,1.164 -7.758,3.168L3.168,41.309C1.164,43.378 0,46.158 0,49.067v310.756c0,18.036 14.675,32.711 32.711,32.711h327.111c18.036,0 32.711,-14.675 32.711,-32.711V32.711C392.533,14.675 377.859,0 359.822,0zM93.349,21.786h215.079v92.444H93.349V21.786zM93.349,370.747v-146.23h215.079v146.23H93.349zM370.747,359.822c0,6.012 -4.848,10.925 -10.925,10.925h-29.673V213.657c0,-6.012 -4.848,-10.925 -10.925,-10.925h-236.8c-6.012,0 -10.925,4.848 -10.925,10.925v157.091H32.711c-6.012,0 -10.925,-4.848 -10.925,-10.925V53.527l31.741,-31.741h18.036v103.305c0,6.012 4.848,10.925 10.925,10.925h236.865c6.012,0 10.925,-4.848 10.925,-10.925V21.786h29.543c6.012,0 10.925,4.848 10.925,10.925V359.822z"
android:fillColor="#194F82"/>
<path
android:pathData="M270.158,31.418c-6.012,0 -10.925,4.848 -10.925,10.925v35.62c0,6.012 4.848,10.925 10.925,10.925c6.012,0 10.925,-4.848 10.925,-10.925v-35.62C281.018,36.331 276.17,31.418 270.158,31.418z"
android:fillColor="#194F82"/>
<path
android:pathData="M260.008,260.331H141.64c-6.012,0 -10.925,4.848 -10.925,10.925c0,5.947 4.848,10.925 10.925,10.925h118.368c6.012,0 10.925,-4.848 10.925,-10.925C270.933,265.18 266.02,260.331 260.008,260.331z"
android:fillColor="#194F82"/>
<path
android:pathData="M260.008,313.212H141.64c-6.012,0 -10.925,4.848 -10.925,10.925c0,6.012 4.848,10.925 10.925,10.925h118.368c6.012,0 10.925,-4.849 10.925,-10.925S266.02,313.212 260.008,313.212z"
android:fillColor="#194F82"/>
</group>
</vector>

@ -0,0 +1,10 @@
<vector android:height="100dp" android:viewportHeight="392.533"
android:viewportWidth="392.533" android:width="100dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#56ACE0" android:pathData="M359.822,21.786h-29.673v103.305c0,6.012 -4.848,10.925 -10.925,10.925h-236.8c-6.012,0 -10.925,-4.848 -10.925,-10.925V21.786H53.527L21.786,53.527v306.23c0,6.012 4.848,10.925 10.925,10.925h38.853V213.657c0,-6.012 4.848,-10.925 10.925,-10.925h236.865c6.012,0 10.925,4.848 10.925,10.925v157.091h29.543c6.012,0 10.925,-4.848 10.925,-10.925V32.711C370.747,26.699 365.834,21.786 359.822,21.786z"/>
<path android:fillColor="#FFFFFF" android:pathData="M93.349,21.786h215.079v92.444h-215.079z"/>
<path android:fillColor="#FFC10D" android:pathData="M93.349,224.582v146.23h215.079v-146.23H93.349zM260.008,334.998H141.64c-6.012,0 -10.861,-4.848 -10.861,-10.925c0,-6.012 4.848,-10.925 10.861,-10.925h118.368c6.012,0 10.925,4.848 10.925,10.925C270.933,330.085 266.02,334.998 260.008,334.998zM260.008,282.117H141.64c-6.012,0 -10.861,-4.913 -10.861,-10.861c0,-6.012 4.848,-10.925 10.861,-10.925h118.368c6.012,0 10.925,4.848 10.925,10.925C270.933,277.269 266.02,282.117 260.008,282.117z"/>
<path android:fillColor="#194F82" android:pathData="M359.822,0H49.067c-2.844,0 -5.624,1.164 -7.758,3.168L3.168,41.309C1.164,43.378 0,46.158 0,49.067v310.756c0,18.036 14.675,32.711 32.711,32.711h327.111c18.036,0 32.711,-14.675 32.711,-32.711V32.711C392.533,14.675 377.859,0 359.822,0zM93.349,21.786h215.079v92.444H93.349V21.786zM93.349,370.747v-146.23h215.079v146.23H93.349zM370.747,359.822c0,6.012 -4.848,10.925 -10.925,10.925h-29.673V213.657c0,-6.012 -4.848,-10.925 -10.925,-10.925h-236.8c-6.012,0 -10.925,4.848 -10.925,10.925v157.091H32.711c-6.012,0 -10.925,-4.848 -10.925,-10.925V53.527l31.741,-31.741h18.036v103.305c0,6.012 4.848,10.925 10.925,10.925h236.865c6.012,0 10.925,-4.848 10.925,-10.925V21.786h29.543c6.012,0 10.925,4.848 10.925,10.925V359.822z"/>
<path android:fillColor="#194F82" android:pathData="M270.158,31.418c-6.012,0 -10.925,4.848 -10.925,10.925v35.62c0,6.012 4.848,10.925 10.925,10.925c6.012,0 10.925,-4.848 10.925,-10.925v-35.62C281.018,36.331 276.17,31.418 270.158,31.418z"/>
<path android:fillColor="#194F82" android:pathData="M260.008,260.331H141.64c-6.012,0 -10.925,4.848 -10.925,10.925c0,5.947 4.848,10.925 10.925,10.925h118.368c6.012,0 10.925,-4.848 10.925,-10.925C270.933,265.18 266.02,260.331 260.008,260.331z"/>
<path android:fillColor="#194F82" android:pathData="M260.008,313.212H141.64c-6.012,0 -10.925,4.848 -10.925,10.925c0,6.012 4.848,10.925 10.925,10.925h118.368c6.012,0 10.925,-4.849 10.925,-10.925S266.02,313.212 260.008,313.212z"/>
</vector>

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<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">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="8dp"
android:contentDescription="@string/floppy"
android:scaleType="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_save_svgrepo_com" />
<TextView
android:id="@+id/tvMainScreenDesc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/tvMainScreenDesc"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/listDivider"
android:layout_margin="8dp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/tvMainScreenDesc"/>
<TextView
android:id="@+id/tvReqNow"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/reqNowTv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/divider" />
<Button
android:id="@+id/btRequestNow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/reqPermBt"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvReqNow" />
<Button
android:id="@+id/btRequestManual"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/btSetPermsManual"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvReqNow" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.SharingActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.СохраниВ" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#7F79FF</color>
</resources>

@ -0,0 +1,9 @@
<resources>
<string name="app_name">Сохрани это</string>
<string name="floppy">3.5 floppy</string>
<string name="tvMainScreenDesc">Приложение ожидает входящие изображения и поднимает запрос на сохранение этого изображения. Может быть полезно для приложений типа WhatsApp, которые не имеют своего удобного механизма сохранения картинок.\nТо есть вам нужно просто \"поделиться\" изображением в это приложение и, в первый раз, предоставить разрешение на чтение медиа.\nВажно! Приложение не следит за вашей файловой системой. Оно всякий раз сохраняет файлы через системные экраны, а не втихую. Также у приложения нет прав на доступ в Интернет, так что вы можете быть уверены, то ничего никуда не уйдёт</string>
<string name="reqPermBt">Запросить сейчас</string>
<string name="reqNowTv">Разрешение на сохранение файлов ещё не предоставлено. Оно будет запрошено в будущем, либо вы можете вызвать запрос сейчас, если так вам будет удобнее</string>
<string name="tvSetPermsManual">Права через запрос не были получены. Попробуйте выдать разрешение вручную</string>
<string name="btSetPermsManual">Выдать вручную</string>
</resources>

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.СохраниВ" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -0,0 +1,26 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# 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.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

Binary file not shown.

@ -0,0 +1,6 @@
#Sun Jan 31 13:18:23 MSK 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

172
gradlew vendored

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,2 @@
include ':app'
rootProject.name = "SaveTo"
Loading…
Cancel
Save