Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
/ OnActivityResult Public archive

Intercept onActivityResult from anywhere withing your application, all you need is a Context

License

Notifications You must be signed in to change notification settings

legobyte/OnActivityResult

Repository files navigation

OnActivityResult

Intercept activityForResult from anywhere withing your application, all you need is a Context

Usage

Proxy.with(context = applicationContext).listener { requestCode, resultCode, data ->
    // handle the result
    if(resultCode == Proxy.RESULT_INTENT_UNHANDLED){
        // in this case the intent that you have provided does not match to an activity in this device.
    }
}.launch(Intent(Intent.ACTION_GET_CONTENT).apply { type = "image/*" }, requestCode = MY_REQUEST_CODE)

requestCode is optional

Setup

In your ProjectLevel build.gradle

allprojects {
    repositories {
        jcenter()
    }
}

In your AppLevel build.gradle

dependencies {
    implementation 'org.legobyte:onactivityresult:1.0.4'
}

Please note if your get error when publishing to Google ERROR getting 'android:label' attribute: attribute is not a string value add lines below to module's AndroidManifest.xml file until i publish a new version:

<activity
            tools:node="replace"
            
            android:theme="@style/ProxyTheme"
            android:name="org.legobyte.onactivityresult.ProxyActivity"
            android:screenOrientation="unspecified"
            android:configChanges="screenSize|screenLayout|fontScale|keyboardHidden|keyboard|orientation|colorMode|density|layoutDirection|locale|mcc|mnc|navigation|smallestScreenSize|touchscreen|uiMode" />

License

Copyright 2019 LegoBytes

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Intercept onActivityResult from anywhere withing your application, all you need is a Context

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages