- Add a FileProvider to the Manifest, to enable the app to share images with other applications.

- Modify the method that creates a temp image of the screenshot to use the FileProvider described above.
- Improve ReceiveTransactionFragment UI so that the QR screenshot looks nicely spaced.
master
Severiano Jaramillo 2018-12-21 18:12:34 -06:00
parent 9647e700ed
commit 5240e88e1f
5 changed files with 26 additions and 8 deletions

View File

@ -51,6 +51,16 @@
android:screenOrientation="portrait"
android:theme="@style/Theme.Bitsy.NoActionBar"
android:windowSoftInputMode="adjustPan"/>
<!-- Used to share QR code on QRCodeActivity -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="cy.agorise.bitsybitshareswallet.FileProvider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/tmp_image_path" />
</provider>
</application>
</manifest>

View File

@ -43,6 +43,6 @@ object Constants {
/** Key used to store the night mode setting into the shared preferences */
const val KEY_NIGHT_MODE_ACTIVATED = "key_night_mode_activated"
const val MERCHANTS_WEBSERVICE_URL = "https://websvc.palmpay.io/"
}

View File

@ -54,7 +54,7 @@ class Helper {
val newFile = File(imagePath, "image.png")
// Create and return image uri
return FileProvider.getUriForFile(context, "cy.agorise.FileProvider", newFile)
return FileProvider.getUriForFile(context, "cy.agorise.bitsybitshareswallet.FileProvider", newFile)
}
}
}

View File

@ -5,10 +5,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
tools:context=".fragments.ReceiveTransactionFragment">
<androidx.constraintlayout.widget.Guideline
@ -23,8 +19,10 @@
style="@style/Widget.Bitsy.TextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/text__amount"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="12dp"
android:hint="@string/text__amount"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline">
@ -64,6 +62,8 @@
style="@style/Widget.Bitsy.TextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/spacing_same_topic"
android:visibility="gone"
android:hint="@string/text__asset"
@ -87,6 +87,8 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:background="?android:windowBackground"
app:layout_constraintTop_toBottomOf="@+id/tilAsset"
app:layout_constraintBottom_toBottomOf="parent">
@ -96,7 +98,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/spacing_different_topic"
android:layout_marginBottom="@dimen/spacing_different_topic"
android:layout_marginBottom="@dimen/spacing_same_topic"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/llText"
@ -108,6 +110,7 @@
android:id="@+id/llText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_same_topic"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivQR">

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<!-- Used to share QR code on QRCodeActivity -->
<cache-path name="shared_images" path="images/"/>
</paths>