Skip to content

Commit

Permalink
Oops, forgot about that one...
Browse files Browse the repository at this point in the history
  • Loading branch information
8BallBomBom committed Nov 6, 2021
1 parent efd3fb0 commit c961d84
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ ScreenLock.acquire();
ScreenLock.release();
```

This is an **experimental feature implementation** that hasn't been fully tested and finalised yet. We will be looking to improve or add more functionality in the future.
This is an **experimental feature implementation** that hasn't been fully tested and finalised yet. We will be looking to improve and/or add more functionality in the future.
For starters this will allow you to adjust the size of the Picture in Picture window, good for changing between landscape and portrait. We will be looking to implement some automated solution for that scenario.

```javascript
// Android API 26+
Expand All @@ -141,22 +142,22 @@ PictureInPicture.toggleAutoEnter();
```

Here are 3 different ways you can import icons ready for use with actions.
**Make sure the icons are 24dp x 24dp or you will experience issues, all icons are rendered white as default.**
**Make sure the icons are 24dp x 24dp or you will experience issues, all icons are rendered white as default.**

```javascript
// Font Icon
// Feathers Font Icon
import Icon from 'react-native-vector-icons/dist/Feather';
let camera = Icon.getImageSource( 'camera', 24 );
const camera = Icon.getImageSource( 'camera', 24 );

// Image Icon
// Image
import { Image } from 'react-native';
let mic = Image.resolveAssetSource( require( './assets/images/mic.png' ) );
const mic = Image.resolveAssetSource( require( './assets/images/mic.png' ) );

// Font Icon
let phone = 'font://Feather/phone/24';
// Font URI
const phone = 'font://Feather/phone/24';
```

Here is an example of how to use Picture in Picture actions. In future we do plan to simplify and give more fine grained control over editing existing actions rather than replacing them each time, maybe even better event handling?
Here is an example of how to use Picture in Picture actions. In future we do plan to simplify and give more fine grained control over editing existing actions rather than replacing them each time. Maybe even better event handling? **Make sure not to use spaces or weird characters for action ids.**

```javascript
// Android API 26+
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 19)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 10
versionName "0.2.0"
versionCode 11
versionName "0.2.1"
}
}

Expand Down
18 changes: 0 additions & 18 deletions android/src/main/java/app/stumble/utils/UtilsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,22 +448,4 @@ public void enterPictureInPictureMode() {

activity.enterPictureInPictureMode();
}

@TargetApi( Build.VERSION_CODES.N )
@ReactMethod
public void exitPictureInPictureMode() {
if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.N ) {
return;
}

final Activity activity = getCurrentActivity();

if ( activity == null ) {
return;
}

if ( !activity.isInPictureInPictureMode() ) {
return;
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-app-utils",
"version": "0.2.0",
"version": "0.2.1",
"description": "A simple React Native utils library with useful functions.",
"nativePackage": true,
"main": "src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function setPictureInPictureActions( actions: Actions ) {
};

function enterPictureInPictureMode() { return UtilsModule.enterPictureInPictureMode(); };
function exitPictureInPictureMode() { return UtilsModule.exitPictureInPictureMode(); };
function exitPictureInPictureMode() { return UtilsModule.startActivity(); };

export const PictureInPicture = {
setAspectRatio: setPictureInPictureAspectRatio,
Expand Down

0 comments on commit c961d84

Please sign in to comment.