Add support for photo preview button
Inspired by the solution from Calyx: https://gitlab.com/CalyxOS/platform_external_calyx_GCamPhotosPreview
This commit is contained in:
parent
517d95949d
commit
9f3ed24569
5 changed files with 75 additions and 12 deletions
16
.github/workflows/continuous.yml
vendored
16
.github/workflows/continuous.yml
vendored
|
|
@ -7,14 +7,20 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '11'
|
||||
- name: Build Debug APK with Gradle
|
||||
run: ./gradlew assembleDebug
|
||||
- name: Upload APK
|
||||
|
||||
- name: Build basic APK with Gradle
|
||||
run: ./gradlew assembleBasicDebug
|
||||
|
||||
- name: Build photos APK with Gradle
|
||||
run: ./gradlew assemblePhotosDebug
|
||||
|
||||
- name: Upload APKs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: App
|
||||
path: ${{ github.workspace }}/app/build/outputs/apk/debug/app-debug.apk
|
||||
name: APKs
|
||||
path: ${{ github.workspace }}/app/build/outputs/apk/**/debug/*.apk
|
||||
|
|
|
|||
|
|
@ -11,13 +11,17 @@ android {
|
|||
versionName "1.2"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
flavorDimensions 'default'
|
||||
productFlavors {
|
||||
basic {
|
||||
dimension 'default'
|
||||
applicationId 'de.lukaspieper.gcam.services'
|
||||
}
|
||||
photos {
|
||||
dimension 'default'
|
||||
applicationId 'com.google.android.apps.photos'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
|||
|
|
@ -9,13 +9,42 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@android:style/Theme.NoDisplay"
|
||||
tools:targetApi="30">
|
||||
|
||||
<provider
|
||||
android:name="com.google.android.gms.GServicesProvider"
|
||||
android:name="de.lukaspieper.gcam.GServicesProvider"
|
||||
android:authorities="com.google.android.gsf.gservices"
|
||||
android:exported="true"
|
||||
tools:ignore="ExportedContentProvider" />
|
||||
|
||||
<activity
|
||||
android:name="de.lukaspieper.gcam.PreviewRedirectActivity"
|
||||
android:exported="true">
|
||||
|
||||
<!-- Credits to Calyx developers: -->
|
||||
<!-- https://gitlab.com/CalyxOS/platform_external_calyx_GCamPhotosPreview -->
|
||||
<intent-filter>
|
||||
<action android:name="com.android.camera.action.REVIEW" />
|
||||
<action android:name="android.provider.action.REVIEW" />
|
||||
<action android:name="android.provider.action.REVIEW_SECURE" />
|
||||
<action android:name="com.google.android.apps.photos.mars.api.ACTION_REVIEW" />
|
||||
<action android:name="com.google.android.apps.photos.mars.api.ACTION_REVIEW_SECURE" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="content" />
|
||||
|
||||
<data android:mimeType="image/*" />
|
||||
<data android:mimeType="application/vnd.google.panorama360+jpg" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Needed only so GCam can query for and find us -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<data android:mimeType="image/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.google.android.gms
|
||||
package de.lukaspieper.gcam
|
||||
|
||||
import android.content.ContentProvider
|
||||
import android.content.ContentValues
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package de.lukaspieper.gcam
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.content.Intent
|
||||
|
||||
class PreviewRedirectActivity : Activity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
Log.d(javaClass.simpleName, intent.toString())
|
||||
|
||||
if (intent.`package` == packageName) {
|
||||
intent.data?.let { uri ->
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
finish()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue