init
This commit is contained in:
17
node_modules/@capacitor/splash-screen/CapacitorSplashScreen.podspec
generated
vendored
Normal file
17
node_modules/@capacitor/splash-screen/CapacitorSplashScreen.podspec
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
require 'json'
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'CapacitorSplashScreen'
|
||||
s.version = package['version']
|
||||
s.summary = package['description']
|
||||
s.license = package['license']
|
||||
s.homepage = 'https://capacitorjs.com'
|
||||
s.author = package['author']
|
||||
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
||||
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'splash-screen/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
||||
s.ios.deployment_target = '14.0'
|
||||
s.dependency 'Capacitor'
|
||||
s.swift_version = '5.1'
|
||||
end
|
||||
23
node_modules/@capacitor/splash-screen/LICENSE
generated
vendored
Normal file
23
node_modules/@capacitor/splash-screen/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright 2020-present Ionic
|
||||
https://ionic.io
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
28
node_modules/@capacitor/splash-screen/Package.swift
generated
vendored
Normal file
28
node_modules/@capacitor/splash-screen/Package.swift
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// swift-tools-version: 5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "CapacitorSplashScreen",
|
||||
platforms: [.iOS(.v14)],
|
||||
products: [
|
||||
.library(
|
||||
name: "CapacitorSplashScreen",
|
||||
targets: ["SplashScreenPlugin"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "SplashScreenPlugin",
|
||||
dependencies: [
|
||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||
.product(name: "Cordova", package: "capacitor-swift-pm")
|
||||
],
|
||||
path: "ios/Sources/SplashScreenPlugin"),
|
||||
.testTarget(
|
||||
name: "SplashScreenPluginTests",
|
||||
dependencies: ["SplashScreenPlugin"],
|
||||
path: "ios/Tests/SplashScreenPluginTests")
|
||||
]
|
||||
)
|
||||
262
node_modules/@capacitor/splash-screen/README.md
generated
vendored
Normal file
262
node_modules/@capacitor/splash-screen/README.md
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
# @capacitor/splash-screen
|
||||
|
||||
The Splash Screen API provides methods for showing or hiding a Splash image.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install @capacitor/splash-screen
|
||||
npx cap sync
|
||||
```
|
||||
|
||||
### Android 12 Splash Screen API
|
||||
|
||||
_**This only affects the launch splash screen and is not used when utilizing the programmatic `show()` method.**_
|
||||
|
||||
Capacitor 4 uses the **[Android 12 Splash Screen API](https://developer.android.com/guide/topics/ui/splash-screen)** and the `androidx.core:core-splashscreen` compatibility library to make it work on Android 11 and below.
|
||||
|
||||
The compatibility library can be disabled by changing the parent of `AppTheme.NoActionBarLaunch` from `Theme.SplashScreen` to `AppTheme.NoActionBar` in `android/app/src/main/res/values/styles.xml`.
|
||||
The Android 12 Splash Screen API can't be disabled on Android 12+ as it's part of the Android OS.
|
||||
|
||||
```xml
|
||||
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
|
||||
<item name="android:background">@drawable/splash</item>
|
||||
</style>
|
||||
```
|
||||
|
||||
**NOTE**: On Android 12 and Android 12L devices the Splash Screen image is not showing when launched from third party launchers such as Nova Launcher, MIUI, Realme Launcher, OPPO Launcher, etc., from app info in Settings App, or from IDEs such as Android Studio.
|
||||
**[Google Issue Tracker](https://issuetracker.google.com/issues/205021357)**
|
||||
**[Google Issue Tracker](https://issuetracker.google.com/issues/207386164)**
|
||||
Google have fixed those problems on Android 13 but they won't be backport the fixes to Android 12 and Android 12L.
|
||||
Launcher related issues might get fixed by a launcher update.
|
||||
If you still find issues related to the Splash Screen on Android 13, please, report them to [Google](https://issuetracker.google.com/).
|
||||
|
||||
## Example
|
||||
|
||||
```typescript
|
||||
import { SplashScreen } from '@capacitor/splash-screen';
|
||||
|
||||
// Hide the splash (you should do this on app launch)
|
||||
await SplashScreen.hide();
|
||||
|
||||
// Show the splash for an indefinite amount of time:
|
||||
await SplashScreen.show({
|
||||
autoHide: false,
|
||||
});
|
||||
|
||||
// Show the splash for two seconds and then automatically hide it:
|
||||
await SplashScreen.show({
|
||||
showDuration: 2000,
|
||||
autoHide: true,
|
||||
});
|
||||
```
|
||||
|
||||
## Hiding the Splash Screen
|
||||
|
||||
By default, the Splash Screen is set to automatically hide after 500 ms.
|
||||
|
||||
If you want to be sure the splash screen never disappears before your app is ready, set `launchAutoHide` to `false`; the splash screen will then stay visible until manually hidden. For the best user experience, your app should call `hide()` as soon as possible.
|
||||
|
||||
If, instead, you want to show the splash screen for a fixed amount of time, set `launchShowDuration` in your [Capacitor configuration file](https://capacitorjs.com/docs/config).
|
||||
|
||||
## Background Color
|
||||
|
||||
In certain conditions, especially if the splash screen does not fully cover the device screen, it might happen that the app screen is visible around the corners (due to transparency). Instead of showing a transparent color, you can set a `backgroundColor` to cover those areas.
|
||||
|
||||
Possible values for `backgroundColor` are either `#RRGGBB` or `#RRGGBBAA`.
|
||||
|
||||
## Spinner
|
||||
|
||||
If you want to show a spinner on top of the splash screen, set `showSpinner` to `true` in your [Capacitor configuration file](https://capacitorjs.com/docs/config).
|
||||
|
||||
You can customize the appearance of the spinner with the following configuration.
|
||||
|
||||
For Android, `androidSpinnerStyle` has the following options:
|
||||
|
||||
- `horizontal`
|
||||
- `small`
|
||||
- `large` (default)
|
||||
- `inverse`
|
||||
- `smallInverse`
|
||||
- `largeInverse`
|
||||
|
||||
For iOS, `iosSpinnerStyle` has the following options:
|
||||
|
||||
- `large` (default)
|
||||
- `small`
|
||||
|
||||
To set the color of the spinner use `spinnerColor`, values are either `#RRGGBB` or `#RRGGBBAA`.
|
||||
|
||||
## Configuration
|
||||
|
||||
<docgen-config>
|
||||
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
||||
|
||||
These config values are available:
|
||||
|
||||
| Prop | Type | Description | Default | Since |
|
||||
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- |
|
||||
| **`launchShowDuration`** | <code>number</code> | How long to show the launch splash screen when autoHide is enabled (in ms) | <code>500</code> | 1.0.0 |
|
||||
| **`launchAutoHide`** | <code>boolean</code> | Whether to auto hide the splash after launchShowDuration. | <code>true</code> | 1.0.0 |
|
||||
| **`launchFadeOutDuration`** | <code>number</code> | Duration for the fade out animation of the launch splash screen (in ms) Only available for Android, when using the Android 12 Splash Screen API. | <code>200</code> | 4.2.0 |
|
||||
| **`backgroundColor`** | <code>string</code> | Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. | | 1.0.0 |
|
||||
| **`androidSplashResourceName`** | <code>string</code> | Name of the resource to be used as Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | <code>splash</code> | 1.0.0 |
|
||||
| **`androidScaleType`** | <code>'CENTER' \| 'CENTER_CROP' \| 'CENTER_INSIDE' \| 'FIT_CENTER' \| 'FIT_END' \| 'FIT_START' \| 'FIT_XY' \| 'MATRIX'</code> | The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale the Splash Screen image. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. Only available on Android. | <code>FIT_XY</code> | 1.0.0 |
|
||||
| **`showSpinner`** | <code>boolean</code> | Show a loading spinner on the Splash Screen. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. | | 1.0.0 |
|
||||
| **`androidSpinnerStyle`** | <code>'horizontal' \| 'small' \| 'large' \| 'inverse' \| 'smallInverse' \| 'largeInverse'</code> | Style of the Android spinner. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. | <code>large</code> | 1.0.0 |
|
||||
| **`iosSpinnerStyle`** | <code>'small' \| 'large'</code> | Style of the iOS spinner. Doesn't work if `useDialog` is true. Only available on iOS. | <code>large</code> | 1.0.0 |
|
||||
| **`spinnerColor`** | <code>string</code> | Color of the spinner in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. | | 1.0.0 |
|
||||
| **`splashFullScreen`** | <code>boolean</code> | Hide the status bar on the Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.0.0 |
|
||||
| **`splashImmersive`** | <code>boolean</code> | Hide the status bar and the software navigation buttons on the Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.0.0 |
|
||||
| **`layoutName`** | <code>string</code> | If `useDialog` is set to true, configure the Dialog layout. If `useDialog` is not set or false, use a layout instead of the ImageView. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.1.0 |
|
||||
| **`useDialog`** | <code>boolean</code> | Use a Dialog instead of an ImageView. If `layoutName` is not configured, it will use a layout that uses the splash image as background. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.1.0 |
|
||||
|
||||
### Examples
|
||||
|
||||
In `capacitor.config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": {
|
||||
"SplashScreen": {
|
||||
"launchShowDuration": 3000,
|
||||
"launchAutoHide": true,
|
||||
"launchFadeOutDuration": 3000,
|
||||
"backgroundColor": "#ffffffff",
|
||||
"androidSplashResourceName": "splash",
|
||||
"androidScaleType": "CENTER_CROP",
|
||||
"showSpinner": true,
|
||||
"androidSpinnerStyle": "large",
|
||||
"iosSpinnerStyle": "small",
|
||||
"spinnerColor": "#999999",
|
||||
"splashFullScreen": true,
|
||||
"splashImmersive": true,
|
||||
"layoutName": "launch_screen",
|
||||
"useDialog": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In `capacitor.config.ts`:
|
||||
|
||||
```ts
|
||||
/// <reference types="@capacitor/splash-screen" />
|
||||
|
||||
import { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
plugins: {
|
||||
SplashScreen: {
|
||||
launchShowDuration: 3000,
|
||||
launchAutoHide: true,
|
||||
launchFadeOutDuration: 3000,
|
||||
backgroundColor: "#ffffffff",
|
||||
androidSplashResourceName: "splash",
|
||||
androidScaleType: "CENTER_CROP",
|
||||
showSpinner: true,
|
||||
androidSpinnerStyle: "large",
|
||||
iosSpinnerStyle: "small",
|
||||
spinnerColor: "#999999",
|
||||
splashFullScreen: true,
|
||||
splashImmersive: true,
|
||||
layoutName: "launch_screen",
|
||||
useDialog: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
```
|
||||
|
||||
</docgen-config>
|
||||
|
||||
### Android
|
||||
|
||||
To use splash screen images named something other than `splash.png`, set `androidSplashResourceName` to the new resource name. Additionally, in `android/app/src/main/res/values/styles.xml`, change the resource name in the following block:
|
||||
|
||||
```xml
|
||||
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
|
||||
<item name="android:background">@drawable/NAME</item>
|
||||
</style>
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
This plugin will use the following project variables (defined in your app's `variables.gradle` file):
|
||||
|
||||
- `coreSplashScreenVersion` version of `androidx.core:core-splashscreen` (default: `1.0.1`)
|
||||
|
||||
## Example Guides
|
||||
|
||||
[Adding Your Own Icons and Splash Screen Images ›](https://www.joshmorony.com/adding-icons-splash-screens-launch-images-to-capacitor-projects/)
|
||||
|
||||
[Creating a Dynamic/Adaptable Splash Screen for Capacitor (Android) ›](https://www.joshmorony.com/creating-a-dynamic-universal-splash-screen-for-capacitor-android/)
|
||||
|
||||
## API
|
||||
|
||||
<docgen-index>
|
||||
|
||||
* [`show(...)`](#show)
|
||||
* [`hide(...)`](#hide)
|
||||
* [Interfaces](#interfaces)
|
||||
|
||||
</docgen-index>
|
||||
|
||||
<docgen-api>
|
||||
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
||||
|
||||
### show(...)
|
||||
|
||||
```typescript
|
||||
show(options?: ShowOptions | undefined) => Promise<void>
|
||||
```
|
||||
|
||||
Show the splash screen
|
||||
|
||||
| Param | Type |
|
||||
| ------------- | --------------------------------------------------- |
|
||||
| **`options`** | <code><a href="#showoptions">ShowOptions</a></code> |
|
||||
|
||||
**Since:** 1.0.0
|
||||
|
||||
--------------------
|
||||
|
||||
|
||||
### hide(...)
|
||||
|
||||
```typescript
|
||||
hide(options?: HideOptions | undefined) => Promise<void>
|
||||
```
|
||||
|
||||
Hide the splash screen
|
||||
|
||||
| Param | Type |
|
||||
| ------------- | --------------------------------------------------- |
|
||||
| **`options`** | <code><a href="#hideoptions">HideOptions</a></code> |
|
||||
|
||||
**Since:** 1.0.0
|
||||
|
||||
--------------------
|
||||
|
||||
|
||||
### Interfaces
|
||||
|
||||
|
||||
#### ShowOptions
|
||||
|
||||
| Prop | Type | Description | Default | Since |
|
||||
| --------------------- | -------------------- | ------------------------------------------------------------------- | ----------------- | ----- |
|
||||
| **`autoHide`** | <code>boolean</code> | Whether to auto hide the splash after showDuration | | 1.0.0 |
|
||||
| **`fadeInDuration`** | <code>number</code> | How long (in ms) to fade in. | <code>200</code> | 1.0.0 |
|
||||
| **`fadeOutDuration`** | <code>number</code> | How long (in ms) to fade out. | <code>200</code> | 1.0.0 |
|
||||
| **`showDuration`** | <code>number</code> | How long to show the splash screen when autoHide is enabled (in ms) | <code>3000</code> | 1.0.0 |
|
||||
|
||||
|
||||
#### HideOptions
|
||||
|
||||
| Prop | Type | Description | Default | Since |
|
||||
| --------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ----- |
|
||||
| **`fadeOutDuration`** | <code>number</code> | How long (in ms) to fade out. On Android, if using the Android 12 Splash Screen API, it's not being used. Use launchFadeOutDuration configuration option instead. | <code>200</code> | 1.0.0 |
|
||||
|
||||
</docgen-api>
|
||||
81
node_modules/@capacitor/splash-screen/android/build.gradle
generated
vendored
Normal file
81
node_modules/@capacitor/splash-screen/android/build.gradle
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
ext {
|
||||
capacitorVersion = System.getenv('CAPACITOR_VERSION')
|
||||
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
||||
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
||||
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
||||
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
||||
coreSplashScreenVersion = project.hasProperty('coreSplashScreenVersion') ? rootProject.ext.coreSplashScreenVersion : '1.0.1'
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.7.2'
|
||||
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
||||
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
||||
apply plugin: 'io.github.gradle-nexus.publish-plugin'
|
||||
apply from: file('../../scripts/android/publish-root.gradle')
|
||||
apply from: file('../../scripts/android/publish-module.gradle')
|
||||
}
|
||||
|
||||
android {
|
||||
namespace "com.capacitorjs.plugins.splashscreen"
|
||||
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
||||
defaultConfig {
|
||||
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
||||
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_21
|
||||
targetCompatibility JavaVersion.VERSION_21
|
||||
}
|
||||
publishing {
|
||||
singleVariant("release")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
||||
implementation "com.capacitorjs:core:$capacitorVersion"
|
||||
} else {
|
||||
implementation project(':capacitor-android')
|
||||
}
|
||||
|
||||
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
||||
testImplementation "junit:junit:$junitVersion"
|
||||
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
||||
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
||||
}
|
||||
2
node_modules/@capacitor/splash-screen/android/src/main/AndroidManifest.xml
generated
vendored
Normal file
2
node_modules/@capacitor/splash-screen/android/src/main/AndroidManifest.xml
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
</manifest>
|
||||
6
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashListener.java
generated
vendored
Normal file
6
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashListener.java
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.capacitorjs.plugins.splashscreen;
|
||||
|
||||
public interface SplashListener {
|
||||
void completed();
|
||||
void error();
|
||||
}
|
||||
689
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java
generated
vendored
Normal file
689
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java
generated
vendored
Normal file
@@ -0,0 +1,689 @@
|
||||
package com.capacitorjs.plugins.splashscreen;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnPreDrawListener;
|
||||
import android.view.Window;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import com.getcapacitor.Logger;
|
||||
|
||||
/**
|
||||
* A Splash Screen service for showing and hiding a splash screen in the app.
|
||||
*/
|
||||
public class SplashScreen {
|
||||
|
||||
private Dialog dialog;
|
||||
private View splashImage;
|
||||
private ProgressBar spinnerBar;
|
||||
private WindowManager windowManager;
|
||||
private boolean isVisible = false;
|
||||
private boolean isHiding = false;
|
||||
private Context context;
|
||||
private View content;
|
||||
private SplashScreenConfig config;
|
||||
private OnPreDrawListener onPreDrawListener;
|
||||
|
||||
SplashScreen(Context context, SplashScreenConfig config) {
|
||||
this.context = context;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the splash screen on launch without fading in
|
||||
*
|
||||
* @param activity
|
||||
*/
|
||||
public void showOnLaunch(final AppCompatActivity activity) {
|
||||
if (config.getLaunchShowDuration() == 0) {
|
||||
return;
|
||||
}
|
||||
SplashScreenSettings settings = new SplashScreenSettings();
|
||||
settings.setShowDuration(config.getLaunchShowDuration());
|
||||
settings.setAutoHide(config.isLaunchAutoHide());
|
||||
|
||||
// Method can fail if styles are incorrectly set...
|
||||
// If it fails, log error & fallback to old method
|
||||
try {
|
||||
showWithAndroid12API(activity, settings);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Logger.warn("Android 12 Splash API failed... using previous method.");
|
||||
this.onPreDrawListener = null;
|
||||
}
|
||||
|
||||
settings.setFadeInDuration(config.getLaunchFadeInDuration());
|
||||
if (config.isUsingDialog()) {
|
||||
showDialog(activity, settings, null, true);
|
||||
} else {
|
||||
show(activity, settings, null, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Splash Screen using the Android 12 API (31+)
|
||||
* Uses Compat Library for backwards compatibility
|
||||
*
|
||||
* @param activity
|
||||
* @param settings Settings used to show the Splash Screen
|
||||
*/
|
||||
private void showWithAndroid12API(final AppCompatActivity activity, final SplashScreenSettings settings) {
|
||||
if (activity == null || activity.isFinishing()) return;
|
||||
|
||||
activity.runOnUiThread(
|
||||
() -> {
|
||||
androidx.core.splashscreen.SplashScreen windowSplashScreen = androidx.core.splashscreen.SplashScreen.installSplashScreen(
|
||||
activity
|
||||
);
|
||||
windowSplashScreen.setKeepOnScreenCondition(() -> isVisible || isHiding);
|
||||
|
||||
if (config.getLaunchFadeOutDuration() > 0) {
|
||||
// Set Fade Out Animation
|
||||
windowSplashScreen.setOnExitAnimationListener(
|
||||
windowSplashScreenView -> {
|
||||
final ObjectAnimator fadeAnimator = ObjectAnimator.ofFloat(
|
||||
windowSplashScreenView.getView(),
|
||||
View.ALPHA,
|
||||
1f,
|
||||
0f
|
||||
);
|
||||
fadeAnimator.setInterpolator(new LinearInterpolator());
|
||||
fadeAnimator.setDuration(config.getLaunchFadeOutDuration());
|
||||
|
||||
fadeAnimator.addListener(
|
||||
new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
isHiding = false;
|
||||
windowSplashScreenView.remove();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
activity.getSplashScreen().clearOnExitAnimationListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
fadeAnimator.start();
|
||||
|
||||
isHiding = true;
|
||||
isVisible = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Set Pre Draw Listener & Delay Drawing Until Duration Elapses
|
||||
content = activity.findViewById(android.R.id.content);
|
||||
|
||||
this.onPreDrawListener =
|
||||
new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
// Start Timer On First Run
|
||||
if (!isVisible && !isHiding) {
|
||||
isVisible = true;
|
||||
|
||||
new Handler(context.getMainLooper())
|
||||
.postDelayed(
|
||||
() -> {
|
||||
// Splash screen is done... start drawing content.
|
||||
if (settings.isAutoHide()) {
|
||||
isVisible = false;
|
||||
onPreDrawListener = null;
|
||||
content.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
}
|
||||
},
|
||||
settings.getShowDuration()
|
||||
);
|
||||
}
|
||||
|
||||
// Not ready to dismiss splash screen
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
content.getViewTreeObserver().addOnPreDrawListener(this.onPreDrawListener);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Splash Screen
|
||||
*
|
||||
* @param activity
|
||||
* @param settings Settings used to show the Splash Screen
|
||||
* @param splashListener A listener to handle the finish of the animation (if any)
|
||||
*/
|
||||
public void show(final AppCompatActivity activity, final SplashScreenSettings settings, final SplashListener splashListener) {
|
||||
if (config.isUsingDialog()) {
|
||||
showDialog(activity, settings, splashListener, false);
|
||||
} else {
|
||||
show(activity, settings, splashListener, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void showDialog(
|
||||
final AppCompatActivity activity,
|
||||
final SplashScreenSettings settings,
|
||||
final SplashListener splashListener,
|
||||
final boolean isLaunchSplash
|
||||
) {
|
||||
if (activity == null || activity.isFinishing()) return;
|
||||
|
||||
if (isVisible) {
|
||||
splashListener.completed();
|
||||
return;
|
||||
}
|
||||
|
||||
activity.runOnUiThread(
|
||||
() -> {
|
||||
if (config.isImmersive()) {
|
||||
dialog = new Dialog(activity, R.style.capacitor_immersive_style);
|
||||
} else if (config.isFullScreen()) {
|
||||
dialog = new Dialog(activity, R.style.capacitor_full_screen_style);
|
||||
} else {
|
||||
dialog = new Dialog(activity, R.style.capacitor_default_style);
|
||||
}
|
||||
int splashId = 0;
|
||||
if (config.getLayoutName() != null) {
|
||||
splashId = context.getResources().getIdentifier(config.getLayoutName(), "layout", context.getPackageName());
|
||||
if (splashId == 0) {
|
||||
Logger.warn("Layout not found, using default");
|
||||
}
|
||||
}
|
||||
if (splashId != 0) {
|
||||
dialog.setContentView(splashId);
|
||||
} else {
|
||||
Drawable splash = getSplashDrawable();
|
||||
LinearLayout parent = new LinearLayout(context);
|
||||
parent.setLayoutParams(
|
||||
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
);
|
||||
parent.setOrientation(LinearLayout.VERTICAL);
|
||||
if (splash != null) {
|
||||
parent.setBackground(splash);
|
||||
}
|
||||
dialog.setContentView(parent);
|
||||
}
|
||||
|
||||
dialog.setCancelable(false);
|
||||
if (!dialog.isShowing()) {
|
||||
dialog.show();
|
||||
}
|
||||
isVisible = true;
|
||||
|
||||
if (settings.isAutoHide()) {
|
||||
new Handler(context.getMainLooper())
|
||||
.postDelayed(
|
||||
() -> {
|
||||
hideDialog(activity, isLaunchSplash);
|
||||
|
||||
if (splashListener != null) {
|
||||
splashListener.completed();
|
||||
}
|
||||
},
|
||||
settings.getShowDuration()
|
||||
);
|
||||
} else {
|
||||
// If no autoHide, call complete
|
||||
if (splashListener != null) {
|
||||
splashListener.completed();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the Splash Screen
|
||||
*
|
||||
* @param settings Settings used to hide the Splash Screen
|
||||
*/
|
||||
public void hide(SplashScreenSettings settings) {
|
||||
hide(settings.getFadeOutDuration(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the Splash Screen when showing it as a dialog
|
||||
*
|
||||
* @param activity the activity showing the dialog
|
||||
*/
|
||||
public void hideDialog(final AppCompatActivity activity) {
|
||||
hideDialog(activity, false);
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
tearDown(true);
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
tearDown(true);
|
||||
}
|
||||
|
||||
private void buildViews() {
|
||||
if (splashImage == null) {
|
||||
int splashId = 0;
|
||||
Drawable splash;
|
||||
|
||||
if (config.getLayoutName() != null) {
|
||||
splashId = context.getResources().getIdentifier(config.getLayoutName(), "layout", context.getPackageName());
|
||||
if (splashId == 0) {
|
||||
Logger.warn("Layout not found, defaulting to ImageView");
|
||||
}
|
||||
}
|
||||
|
||||
if (splashId != 0) {
|
||||
Activity activity = (Activity) context;
|
||||
LayoutInflater inflator = activity.getLayoutInflater();
|
||||
ViewGroup root = new FrameLayout(context);
|
||||
root.setLayoutParams(
|
||||
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
);
|
||||
splashImage = inflator.inflate(splashId, root, false);
|
||||
} else {
|
||||
splash = getSplashDrawable();
|
||||
if (splash != null) {
|
||||
if (splash instanceof Animatable) {
|
||||
((Animatable) splash).start();
|
||||
}
|
||||
|
||||
if (splash instanceof LayerDrawable) {
|
||||
LayerDrawable layeredSplash = (LayerDrawable) splash;
|
||||
|
||||
for (int i = 0; i < layeredSplash.getNumberOfLayers(); i++) {
|
||||
Drawable layerDrawable = layeredSplash.getDrawable(i);
|
||||
|
||||
if (layerDrawable instanceof Animatable) {
|
||||
((Animatable) layerDrawable).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
splashImage = new ImageView(context);
|
||||
// Stops flickers dead in their tracks
|
||||
// https://stackoverflow.com/a/21847579/32140
|
||||
ImageView imageView = (ImageView) splashImage;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
} else {
|
||||
legacyStopFlickers(imageView);
|
||||
}
|
||||
imageView.setScaleType(config.getScaleType());
|
||||
imageView.setImageDrawable(splash);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
splashImage.setFitsSystemWindows(true);
|
||||
|
||||
if (config.getBackgroundColor() != null) {
|
||||
splashImage.setBackgroundColor(config.getBackgroundColor());
|
||||
}
|
||||
}
|
||||
|
||||
if (spinnerBar == null) {
|
||||
if (config.getSpinnerStyle() != null) {
|
||||
int spinnerBarStyle = config.getSpinnerStyle();
|
||||
spinnerBar = new ProgressBar(context, null, spinnerBarStyle);
|
||||
} else {
|
||||
spinnerBar = new ProgressBar(context);
|
||||
}
|
||||
spinnerBar.setIndeterminate(true);
|
||||
|
||||
Integer spinnerBarColor = config.getSpinnerColor();
|
||||
if (spinnerBarColor != null) {
|
||||
int[][] states = new int[][] {
|
||||
new int[] { android.R.attr.state_enabled }, // enabled
|
||||
new int[] { -android.R.attr.state_enabled }, // disabled
|
||||
new int[] { -android.R.attr.state_checked }, // unchecked
|
||||
new int[] { android.R.attr.state_pressed } // pressed
|
||||
};
|
||||
int[] colors = new int[] { spinnerBarColor, spinnerBarColor, spinnerBarColor, spinnerBarColor };
|
||||
ColorStateList colorStateList = new ColorStateList(states, colors);
|
||||
spinnerBar.setIndeterminateTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void legacyStopFlickers(ImageView imageView) {
|
||||
imageView.setDrawingCacheEnabled(true);
|
||||
}
|
||||
|
||||
private Drawable getSplashDrawable() {
|
||||
int splashId = context.getResources().getIdentifier(config.getResourceName(), "drawable", context.getPackageName());
|
||||
try {
|
||||
Drawable drawable = context.getResources().getDrawable(splashId, context.getTheme());
|
||||
return drawable;
|
||||
} catch (Resources.NotFoundException ex) {
|
||||
Logger.warn("No splash screen found, not displaying");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void show(
|
||||
final AppCompatActivity activity,
|
||||
final SplashScreenSettings settings,
|
||||
final SplashListener splashListener,
|
||||
final boolean isLaunchSplash
|
||||
) {
|
||||
windowManager = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
|
||||
|
||||
if (activity.isFinishing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
buildViews();
|
||||
|
||||
if (isVisible) {
|
||||
splashListener.completed();
|
||||
return;
|
||||
}
|
||||
|
||||
final Animator.AnimatorListener listener = new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
isVisible = true;
|
||||
|
||||
if (settings.isAutoHide()) {
|
||||
new Handler(context.getMainLooper())
|
||||
.postDelayed(
|
||||
() -> {
|
||||
hide(settings.getFadeOutDuration(), isLaunchSplash);
|
||||
|
||||
if (splashListener != null) {
|
||||
splashListener.completed();
|
||||
}
|
||||
},
|
||||
settings.getShowDuration()
|
||||
);
|
||||
} else {
|
||||
// If no autoHide, call complete
|
||||
if (splashListener != null) {
|
||||
splashListener.completed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animator) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animator) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {}
|
||||
};
|
||||
|
||||
Handler mainHandler = new Handler(context.getMainLooper());
|
||||
|
||||
mainHandler.post(
|
||||
() -> {
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.gravity = Gravity.CENTER;
|
||||
params.flags = activity.getWindow().getAttributes().flags;
|
||||
|
||||
// Required to enable the view to actually fade
|
||||
params.format = PixelFormat.TRANSLUCENT;
|
||||
|
||||
try {
|
||||
windowManager.addView(splashImage, params);
|
||||
} catch (IllegalStateException | IllegalArgumentException ex) {
|
||||
Logger.debug("Could not add splash view");
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.isImmersive()) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
activity.runOnUiThread(
|
||||
() -> {
|
||||
Window window = activity.getWindow();
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false);
|
||||
WindowInsetsController controller = splashImage.getWindowInsetsController();
|
||||
controller.hide(WindowInsetsCompat.Type.systemBars());
|
||||
controller.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
legacyImmersive();
|
||||
}
|
||||
} else if (config.isFullScreen()) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
activity.runOnUiThread(
|
||||
() -> {
|
||||
Window window = activity.getWindow();
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false);
|
||||
WindowInsetsController controller = splashImage.getWindowInsetsController();
|
||||
controller.hide(WindowInsetsCompat.Type.statusBars());
|
||||
}
|
||||
);
|
||||
} else {
|
||||
legacyFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
splashImage.setAlpha(0f);
|
||||
|
||||
splashImage
|
||||
.animate()
|
||||
.alpha(1f)
|
||||
.setInterpolator(new LinearInterpolator())
|
||||
.setDuration(settings.getFadeInDuration())
|
||||
.setListener(listener)
|
||||
.start();
|
||||
|
||||
splashImage.setVisibility(View.VISIBLE);
|
||||
|
||||
if (spinnerBar != null) {
|
||||
spinnerBar.setVisibility(View.INVISIBLE);
|
||||
|
||||
if (spinnerBar.getParent() != null) {
|
||||
windowManager.removeView(spinnerBar);
|
||||
}
|
||||
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
windowManager.addView(spinnerBar, params);
|
||||
|
||||
if (config.isShowSpinner()) {
|
||||
spinnerBar.setAlpha(0f);
|
||||
|
||||
spinnerBar
|
||||
.animate()
|
||||
.alpha(1f)
|
||||
.setInterpolator(new LinearInterpolator())
|
||||
.setDuration(settings.getFadeInDuration())
|
||||
.start();
|
||||
|
||||
spinnerBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void legacyImmersive() {
|
||||
final int flags =
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
splashImage.setSystemUiVisibility(flags);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void legacyFullscreen() {
|
||||
splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
private void hide(final int fadeOutDuration, boolean isLaunchSplash) {
|
||||
// Warn the user if the splash was hidden automatically, which means they could be experiencing an app
|
||||
// that feels slower than it actually is.
|
||||
if (isLaunchSplash && isVisible) {
|
||||
Logger.debug(
|
||||
"SplashScreen was automatically hidden after the launch timeout. " +
|
||||
"You should call `SplashScreen.hide()` as soon as your web app is loaded (or increase the timeout)." +
|
||||
"Read more at https://capacitorjs.com/docs/apis/splash-screen#hiding-the-splash-screen"
|
||||
);
|
||||
}
|
||||
|
||||
if (isHiding) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide with Android 12 API
|
||||
if (null != this.onPreDrawListener) {
|
||||
if (fadeOutDuration != 200) {
|
||||
Logger.warn(
|
||||
"fadeOutDuration parameter doesn't work on initial splash screen, use launchFadeOutDuration configuration option"
|
||||
);
|
||||
}
|
||||
this.isVisible = false;
|
||||
if (null != content) {
|
||||
content.getViewTreeObserver().removeOnPreDrawListener(this.onPreDrawListener);
|
||||
}
|
||||
this.onPreDrawListener = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (splashImage == null || splashImage.getParent() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
isHiding = true;
|
||||
|
||||
final Animator.AnimatorListener listener = new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
tearDown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
tearDown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animator) {}
|
||||
};
|
||||
|
||||
Handler mainHandler = new Handler(context.getMainLooper());
|
||||
|
||||
mainHandler.post(
|
||||
() -> {
|
||||
if (spinnerBar != null) {
|
||||
spinnerBar.setAlpha(1f);
|
||||
|
||||
spinnerBar.animate().alpha(0).setInterpolator(new LinearInterpolator()).setDuration(fadeOutDuration).start();
|
||||
}
|
||||
|
||||
splashImage.setAlpha(1f);
|
||||
|
||||
splashImage
|
||||
.animate()
|
||||
.alpha(0)
|
||||
.setInterpolator(new LinearInterpolator())
|
||||
.setDuration(fadeOutDuration)
|
||||
.setListener(listener)
|
||||
.start();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void hideDialog(final AppCompatActivity activity, boolean isLaunchSplash) {
|
||||
// Warn the user if the splash was hidden automatically, which means they could be experiencing an app
|
||||
// that feels slower than it actually is.
|
||||
if (isLaunchSplash && isVisible) {
|
||||
Logger.debug(
|
||||
"SplashScreen was automatically hidden after the launch timeout. " +
|
||||
"You should call `SplashScreen.hide()` as soon as your web app is loaded (or increase the timeout)." +
|
||||
"Read more at https://capacitorjs.com/docs/apis/splash-screen#hiding-the-splash-screen"
|
||||
);
|
||||
}
|
||||
|
||||
if (isHiding) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide with Android 12 API
|
||||
if (null != this.onPreDrawListener) {
|
||||
this.isVisible = false;
|
||||
if (null != content) {
|
||||
content.getViewTreeObserver().removeOnPreDrawListener(this.onPreDrawListener);
|
||||
}
|
||||
this.onPreDrawListener = null;
|
||||
return;
|
||||
}
|
||||
|
||||
isHiding = true;
|
||||
|
||||
activity.runOnUiThread(
|
||||
() -> {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
if (!activity.isFinishing() && !activity.isDestroyed()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
dialog = null;
|
||||
isHiding = false;
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void tearDown(boolean removeSpinner) {
|
||||
if (spinnerBar != null && spinnerBar.getParent() != null) {
|
||||
spinnerBar.setVisibility(View.INVISIBLE);
|
||||
|
||||
if (removeSpinner) {
|
||||
windowManager.removeView(spinnerBar);
|
||||
}
|
||||
}
|
||||
|
||||
if (splashImage != null && splashImage.getParent() != null) {
|
||||
splashImage.setVisibility(View.INVISIBLE);
|
||||
|
||||
windowManager.removeView(splashImage);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && config.isFullScreen() || config.isImmersive()) {
|
||||
// Exit fullscreen mode
|
||||
Window window = ((Activity) context).getWindow();
|
||||
WindowCompat.setDecorFitsSystemWindows(window, true);
|
||||
}
|
||||
isHiding = false;
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
129
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreenConfig.java
generated
vendored
Normal file
129
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreenConfig.java
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
package com.capacitorjs.plugins.splashscreen;
|
||||
|
||||
import android.widget.ImageView.ScaleType;
|
||||
|
||||
public class SplashScreenConfig {
|
||||
|
||||
private Integer backgroundColor;
|
||||
private Integer spinnerStyle;
|
||||
private Integer spinnerColor;
|
||||
private boolean showSpinner = false;
|
||||
private Integer launchShowDuration = 500;
|
||||
private boolean launchAutoHide = true;
|
||||
private Integer launchFadeInDuration = 0;
|
||||
private Integer launchFadeOutDuration = 200;
|
||||
private String resourceName = "splash";
|
||||
private boolean immersive = false;
|
||||
private boolean fullScreen = false;
|
||||
private ScaleType scaleType = ScaleType.FIT_XY;
|
||||
private boolean usingDialog = false;
|
||||
private String layoutName;
|
||||
|
||||
public Integer getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public void setBackgroundColor(Integer backgroundColor) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
public Integer getSpinnerStyle() {
|
||||
return spinnerStyle;
|
||||
}
|
||||
|
||||
public void setSpinnerStyle(Integer spinnerStyle) {
|
||||
this.spinnerStyle = spinnerStyle;
|
||||
}
|
||||
|
||||
public Integer getSpinnerColor() {
|
||||
return spinnerColor;
|
||||
}
|
||||
|
||||
public void setSpinnerColor(Integer spinnerColor) {
|
||||
this.spinnerColor = spinnerColor;
|
||||
}
|
||||
|
||||
public boolean isShowSpinner() {
|
||||
return showSpinner;
|
||||
}
|
||||
|
||||
public void setShowSpinner(boolean showSpinner) {
|
||||
this.showSpinner = showSpinner;
|
||||
}
|
||||
|
||||
public Integer getLaunchShowDuration() {
|
||||
return launchShowDuration;
|
||||
}
|
||||
|
||||
public void setLaunchShowDuration(Integer launchShowDuration) {
|
||||
this.launchShowDuration = launchShowDuration;
|
||||
}
|
||||
|
||||
public boolean isLaunchAutoHide() {
|
||||
return launchAutoHide;
|
||||
}
|
||||
|
||||
public void setLaunchAutoHide(boolean launchAutoHide) {
|
||||
this.launchAutoHide = launchAutoHide;
|
||||
}
|
||||
|
||||
public Integer getLaunchFadeInDuration() {
|
||||
return launchFadeInDuration;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public boolean isImmersive() {
|
||||
return immersive;
|
||||
}
|
||||
|
||||
public void setImmersive(boolean immersive) {
|
||||
this.immersive = immersive;
|
||||
}
|
||||
|
||||
public boolean isFullScreen() {
|
||||
return fullScreen;
|
||||
}
|
||||
|
||||
public void setFullScreen(boolean fullScreen) {
|
||||
this.fullScreen = fullScreen;
|
||||
}
|
||||
|
||||
public ScaleType getScaleType() {
|
||||
return scaleType;
|
||||
}
|
||||
|
||||
public void setScaleType(ScaleType scaleType) {
|
||||
this.scaleType = scaleType;
|
||||
}
|
||||
|
||||
public boolean isUsingDialog() {
|
||||
return usingDialog;
|
||||
}
|
||||
|
||||
public void setUsingDialog(boolean usingDialog) {
|
||||
this.usingDialog = usingDialog;
|
||||
}
|
||||
|
||||
public String getLayoutName() {
|
||||
return layoutName;
|
||||
}
|
||||
|
||||
public void setLayoutName(String layoutName) {
|
||||
this.layoutName = layoutName;
|
||||
}
|
||||
|
||||
public Integer getLaunchFadeOutDuration() {
|
||||
return launchFadeOutDuration;
|
||||
}
|
||||
|
||||
public void setLaunchFadeOutDuration(Integer launchFadeOutDuration) {
|
||||
this.launchFadeOutDuration = launchFadeOutDuration;
|
||||
}
|
||||
}
|
||||
166
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreenPlugin.java
generated
vendored
Normal file
166
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreenPlugin.java
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
package com.capacitorjs.plugins.splashscreen;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import com.getcapacitor.Logger;
|
||||
import com.getcapacitor.Plugin;
|
||||
import com.getcapacitor.PluginCall;
|
||||
import com.getcapacitor.PluginMethod;
|
||||
import com.getcapacitor.annotation.CapacitorPlugin;
|
||||
import com.getcapacitor.util.WebColor;
|
||||
import java.util.Locale;
|
||||
|
||||
@CapacitorPlugin(name = "SplashScreen")
|
||||
public class SplashScreenPlugin extends Plugin {
|
||||
|
||||
private SplashScreen splashScreen;
|
||||
private SplashScreenConfig config;
|
||||
|
||||
public void load() {
|
||||
config = getSplashScreenConfig();
|
||||
splashScreen = new SplashScreen(getContext(), config);
|
||||
if (!bridge.isMinimumWebViewInstalled() && bridge.getConfig().getErrorPath() != null && !config.isLaunchAutoHide()) {
|
||||
return;
|
||||
} else {
|
||||
splashScreen.showOnLaunch(getActivity());
|
||||
}
|
||||
}
|
||||
|
||||
@PluginMethod
|
||||
public void show(final PluginCall call) {
|
||||
splashScreen.show(
|
||||
getActivity(),
|
||||
getSettings(call),
|
||||
new SplashListener() {
|
||||
@Override
|
||||
public void completed() {
|
||||
call.resolve();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error() {
|
||||
call.reject("An error occurred while showing splash");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@PluginMethod
|
||||
public void hide(PluginCall call) {
|
||||
if (config.isUsingDialog()) {
|
||||
splashScreen.hideDialog(getActivity());
|
||||
} else {
|
||||
splashScreen.hide(getSettings(call));
|
||||
}
|
||||
call.resolve();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleOnPause() {
|
||||
splashScreen.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleOnDestroy() {
|
||||
splashScreen.onDestroy();
|
||||
}
|
||||
|
||||
private SplashScreenSettings getSettings(PluginCall call) {
|
||||
SplashScreenSettings settings = new SplashScreenSettings();
|
||||
if (call.getInt("showDuration") != null) {
|
||||
settings.setShowDuration(call.getInt("showDuration"));
|
||||
}
|
||||
if (call.getInt("fadeInDuration") != null) {
|
||||
settings.setFadeInDuration(call.getInt("fadeInDuration"));
|
||||
}
|
||||
if (call.getInt("fadeOutDuration") != null) {
|
||||
settings.setFadeOutDuration(call.getInt("fadeOutDuration"));
|
||||
}
|
||||
if (call.getBoolean("autoHide") != null) {
|
||||
settings.setAutoHide(call.getBoolean("autoHide"));
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
private SplashScreenConfig getSplashScreenConfig() {
|
||||
SplashScreenConfig config = new SplashScreenConfig();
|
||||
String backgroundColor = getConfig().getString("backgroundColor");
|
||||
if (backgroundColor != null) {
|
||||
try {
|
||||
config.setBackgroundColor(WebColor.parseColor(backgroundColor));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Logger.debug("Background color not applied");
|
||||
}
|
||||
}
|
||||
Integer duration = getConfig().getInt("launchShowDuration", config.getLaunchShowDuration());
|
||||
config.setLaunchShowDuration(duration);
|
||||
Integer fadeOutDuration = getConfig().getInt("launchFadeOutDuration", config.getLaunchFadeOutDuration());
|
||||
config.setLaunchFadeOutDuration(fadeOutDuration);
|
||||
Boolean autohide = getConfig().getBoolean("launchAutoHide", config.isLaunchAutoHide());
|
||||
config.setLaunchAutoHide(autohide);
|
||||
if (getConfig().getString("androidSplashResourceName") != null) {
|
||||
config.setResourceName(getConfig().getString("androidSplashResourceName"));
|
||||
}
|
||||
Boolean immersive = getConfig().getBoolean("splashImmersive", config.isImmersive());
|
||||
config.setImmersive(immersive);
|
||||
|
||||
Boolean fullScreen = getConfig().getBoolean("splashFullScreen", config.isFullScreen());
|
||||
config.setFullScreen(fullScreen);
|
||||
|
||||
String spinnerStyle = getConfig().getString("androidSpinnerStyle");
|
||||
if (spinnerStyle != null) {
|
||||
int spinnerBarStyle = android.R.attr.progressBarStyleLarge;
|
||||
|
||||
switch (spinnerStyle.toLowerCase(Locale.ROOT)) {
|
||||
case "horizontal":
|
||||
spinnerBarStyle = android.R.attr.progressBarStyleHorizontal;
|
||||
break;
|
||||
case "small":
|
||||
spinnerBarStyle = android.R.attr.progressBarStyleSmall;
|
||||
break;
|
||||
case "large":
|
||||
spinnerBarStyle = android.R.attr.progressBarStyleLarge;
|
||||
break;
|
||||
case "inverse":
|
||||
spinnerBarStyle = android.R.attr.progressBarStyleInverse;
|
||||
break;
|
||||
case "smallinverse":
|
||||
spinnerBarStyle = android.R.attr.progressBarStyleSmallInverse;
|
||||
break;
|
||||
case "largeinverse":
|
||||
spinnerBarStyle = android.R.attr.progressBarStyleLargeInverse;
|
||||
break;
|
||||
}
|
||||
config.setSpinnerStyle(spinnerBarStyle);
|
||||
}
|
||||
String spinnerColor = getConfig().getString("spinnerColor");
|
||||
if (spinnerColor != null) {
|
||||
try {
|
||||
config.setSpinnerColor(WebColor.parseColor(spinnerColor));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
Logger.debug("Spinner color not applied");
|
||||
}
|
||||
}
|
||||
String scaleTypeName = getConfig().getString("androidScaleType");
|
||||
if (scaleTypeName != null) {
|
||||
ImageView.ScaleType scaleType = null;
|
||||
try {
|
||||
scaleType = ImageView.ScaleType.valueOf(scaleTypeName);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
scaleType = ImageView.ScaleType.FIT_XY;
|
||||
}
|
||||
config.setScaleType(scaleType);
|
||||
}
|
||||
|
||||
Boolean showSpinner = getConfig().getBoolean("showSpinner", config.isShowSpinner());
|
||||
config.setShowSpinner(showSpinner);
|
||||
|
||||
Boolean useDialog = getConfig().getBoolean("useDialog", config.isUsingDialog());
|
||||
config.setUsingDialog(useDialog);
|
||||
|
||||
if (getConfig().getString("layoutName") != null) {
|
||||
config.setLayoutName(getConfig().getString("layoutName"));
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
41
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreenSettings.java
generated
vendored
Normal file
41
node_modules/@capacitor/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreenSettings.java
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.capacitorjs.plugins.splashscreen;
|
||||
|
||||
public class SplashScreenSettings {
|
||||
|
||||
private Integer showDuration = 3000;
|
||||
private Integer fadeInDuration = 200;
|
||||
private Integer fadeOutDuration = 200;
|
||||
private boolean autoHide = true;
|
||||
|
||||
public Integer getShowDuration() {
|
||||
return showDuration;
|
||||
}
|
||||
|
||||
public void setShowDuration(Integer showDuration) {
|
||||
this.showDuration = showDuration;
|
||||
}
|
||||
|
||||
public Integer getFadeInDuration() {
|
||||
return fadeInDuration;
|
||||
}
|
||||
|
||||
public void setFadeInDuration(Integer fadeInDuration) {
|
||||
this.fadeInDuration = fadeInDuration;
|
||||
}
|
||||
|
||||
public Integer getFadeOutDuration() {
|
||||
return fadeOutDuration;
|
||||
}
|
||||
|
||||
public void setFadeOutDuration(Integer fadeOutDuration) {
|
||||
this.fadeOutDuration = fadeOutDuration;
|
||||
}
|
||||
|
||||
public boolean isAutoHide() {
|
||||
return autoHide;
|
||||
}
|
||||
|
||||
public void setAutoHide(boolean autoHide) {
|
||||
this.autoHide = autoHide;
|
||||
}
|
||||
}
|
||||
0
node_modules/@capacitor/splash-screen/android/src/main/res/.gitkeep
generated
vendored
Normal file
0
node_modules/@capacitor/splash-screen/android/src/main/res/.gitkeep
generated
vendored
Normal file
11
node_modules/@capacitor/splash-screen/android/src/main/res/values/styles.xml
generated
vendored
Normal file
11
node_modules/@capacitor/splash-screen/android/src/main/res/values/styles.xml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="capacitor_default_style" parent="AppTheme.NoActionBar">
|
||||
</style>
|
||||
<style name="capacitor_full_screen_style" parent="AppTheme.NoActionBar">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
</style>
|
||||
<style name="capacitor_immersive_style" parent="capacitor_full_screen_style">
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
416
node_modules/@capacitor/splash-screen/dist/docs.json
generated
vendored
Normal file
416
node_modules/@capacitor/splash-screen/dist/docs.json
generated
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
{
|
||||
"api": {
|
||||
"name": "SplashScreenPlugin",
|
||||
"slug": "splashscreenplugin",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [
|
||||
{
|
||||
"name": "show",
|
||||
"signature": "(options?: ShowOptions | undefined) => Promise<void>",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "options",
|
||||
"docs": "",
|
||||
"type": "ShowOptions | undefined"
|
||||
}
|
||||
],
|
||||
"returns": "Promise<void>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "1.0.0"
|
||||
}
|
||||
],
|
||||
"docs": "Show the splash screen",
|
||||
"complexTypes": [
|
||||
"ShowOptions"
|
||||
],
|
||||
"slug": "show"
|
||||
},
|
||||
{
|
||||
"name": "hide",
|
||||
"signature": "(options?: HideOptions | undefined) => Promise<void>",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "options",
|
||||
"docs": "",
|
||||
"type": "HideOptions | undefined"
|
||||
}
|
||||
],
|
||||
"returns": "Promise<void>",
|
||||
"tags": [
|
||||
{
|
||||
"name": "since",
|
||||
"text": "1.0.0"
|
||||
}
|
||||
],
|
||||
"docs": "Hide the splash screen",
|
||||
"complexTypes": [
|
||||
"HideOptions"
|
||||
],
|
||||
"slug": "hide"
|
||||
}
|
||||
],
|
||||
"properties": []
|
||||
},
|
||||
"interfaces": [
|
||||
{
|
||||
"name": "ShowOptions",
|
||||
"slug": "showoptions",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "autoHide",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
}
|
||||
],
|
||||
"docs": "Whether to auto hide the splash after showDuration",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "fadeInDuration",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "200",
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"docs": "How long (in ms) to fade in.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "fadeOutDuration",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "200",
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"docs": "How long (in ms) to fade out.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "showDuration",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "3000",
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"docs": "How long to show the splash screen when autoHide is enabled (in ms)",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "HideOptions",
|
||||
"slug": "hideoptions",
|
||||
"docs": "",
|
||||
"tags": [],
|
||||
"methods": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "fadeOutDuration",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "200",
|
||||
"name": "default"
|
||||
}
|
||||
],
|
||||
"docs": "How long (in ms) to fade out.\n\nOn Android, if using the Android 12 Splash Screen API, it's not being used.\nUse launchFadeOutDuration configuration option instead.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"enums": [],
|
||||
"typeAliases": [],
|
||||
"pluginConfigs": [
|
||||
{
|
||||
"name": "SplashScreen",
|
||||
"slug": "splashscreen",
|
||||
"properties": [
|
||||
{
|
||||
"name": "launchShowDuration",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "500",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "3000",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "How long to show the launch splash screen when autoHide is enabled (in ms)",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "launchAutoHide",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "true",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "true",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Whether to auto hide the splash after launchShowDuration.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "launchFadeOutDuration",
|
||||
"tags": [
|
||||
{
|
||||
"text": "4.2.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "200",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "3000",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Duration for the fade out animation of the launch splash screen (in ms)\n\nOnly available for Android, when using the Android 12 Splash Screen API.",
|
||||
"complexTypes": [],
|
||||
"type": "number | undefined"
|
||||
},
|
||||
{
|
||||
"name": "backgroundColor",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "\"#ffffffff\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "androidSplashResourceName",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "splash",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "\"splash\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Name of the resource to be used as Splash Screen.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "androidScaleType",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "FIT_XY",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "\"CENTER_CROP\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\nthe Splash Screen image.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.\n\nOnly available on Android.",
|
||||
"complexTypes": [],
|
||||
"type": "'CENTER' | 'CENTER_CROP' | 'CENTER_INSIDE' | 'FIT_CENTER' | 'FIT_END' | 'FIT_START' | 'FIT_XY' | 'MATRIX' | undefined"
|
||||
},
|
||||
{
|
||||
"name": "showSpinner",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "true",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Show a loading spinner on the Splash Screen.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "androidSpinnerStyle",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "large",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "\"large\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Style of the Android spinner.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.",
|
||||
"complexTypes": [],
|
||||
"type": "'horizontal' | 'small' | 'large' | 'inverse' | 'smallInverse' | 'largeInverse' | undefined"
|
||||
},
|
||||
{
|
||||
"name": "iosSpinnerStyle",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "large",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"text": "\"small\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Style of the iOS spinner.\nDoesn't work if `useDialog` is true.\n\nOnly available on iOS.",
|
||||
"complexTypes": [],
|
||||
"type": "'small' | 'large' | undefined"
|
||||
},
|
||||
{
|
||||
"name": "spinnerColor",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "\"#999999\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "splashFullScreen",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "true",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Hide the status bar on the Splash Screen.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "splashImmersive",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.0.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "true",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Hide the status bar and the software navigation buttons on the Splash Screen.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
},
|
||||
{
|
||||
"name": "layoutName",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.1.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "\"launch_screen\"",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "If `useDialog` is set to true, configure the Dialog layout.\nIf `useDialog` is not set or false, use a layout instead of the ImageView.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
|
||||
"complexTypes": [],
|
||||
"type": "string | undefined"
|
||||
},
|
||||
{
|
||||
"name": "useDialog",
|
||||
"tags": [
|
||||
{
|
||||
"text": "1.1.0",
|
||||
"name": "since"
|
||||
},
|
||||
{
|
||||
"text": "true",
|
||||
"name": "example"
|
||||
}
|
||||
],
|
||||
"docs": "Use a Dialog instead of an ImageView.\nIf `layoutName` is not configured, it will use\na layout that uses the splash image as background.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
|
||||
"complexTypes": [],
|
||||
"type": "boolean | undefined"
|
||||
}
|
||||
],
|
||||
"docs": "These config values are available:"
|
||||
}
|
||||
]
|
||||
}
|
||||
205
node_modules/@capacitor/splash-screen/dist/esm/definitions.d.ts
generated
vendored
Normal file
205
node_modules/@capacitor/splash-screen/dist/esm/definitions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
declare module '@capacitor/cli' {
|
||||
interface PluginsConfig {
|
||||
/**
|
||||
* These config values are available:
|
||||
*/
|
||||
SplashScreen?: {
|
||||
/**
|
||||
* How long to show the launch splash screen when autoHide is enabled (in ms)
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default 500
|
||||
* @example 3000
|
||||
*/
|
||||
launchShowDuration?: number;
|
||||
/**
|
||||
* Whether to auto hide the splash after launchShowDuration.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default true
|
||||
* @example true
|
||||
*/
|
||||
launchAutoHide?: boolean;
|
||||
/**
|
||||
* Duration for the fade out animation of the launch splash screen (in ms)
|
||||
*
|
||||
* Only available for Android, when using the Android 12 Splash Screen API.
|
||||
*
|
||||
* @since 4.2.0
|
||||
* @default 200
|
||||
* @example 3000
|
||||
*/
|
||||
launchFadeOutDuration?: number;
|
||||
/**
|
||||
* Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.
|
||||
* Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @example "#ffffffff"
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
* Name of the resource to be used as Splash Screen.
|
||||
*
|
||||
* Doesn't work on launch when using the Android 12 API.
|
||||
*
|
||||
* Only available on Android.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default splash
|
||||
* @example "splash"
|
||||
*/
|
||||
androidSplashResourceName?: string;
|
||||
/**
|
||||
* The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale
|
||||
* the Splash Screen image.
|
||||
* Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
|
||||
*
|
||||
* Only available on Android.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default FIT_XY
|
||||
* @example "CENTER_CROP"
|
||||
*/
|
||||
androidScaleType?: 'CENTER' | 'CENTER_CROP' | 'CENTER_INSIDE' | 'FIT_CENTER' | 'FIT_END' | 'FIT_START' | 'FIT_XY' | 'MATRIX';
|
||||
/**
|
||||
* Show a loading spinner on the Splash Screen.
|
||||
* Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @example true
|
||||
*/
|
||||
showSpinner?: boolean;
|
||||
/**
|
||||
* Style of the Android spinner.
|
||||
* Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default large
|
||||
* @example "large"
|
||||
*/
|
||||
androidSpinnerStyle?: 'horizontal' | 'small' | 'large' | 'inverse' | 'smallInverse' | 'largeInverse';
|
||||
/**
|
||||
* Style of the iOS spinner.
|
||||
* Doesn't work if `useDialog` is true.
|
||||
*
|
||||
* Only available on iOS.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default large
|
||||
* @example "small"
|
||||
*/
|
||||
iosSpinnerStyle?: 'large' | 'small';
|
||||
/**
|
||||
* Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.
|
||||
* Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @example "#999999"
|
||||
*/
|
||||
spinnerColor?: string;
|
||||
/**
|
||||
* Hide the status bar on the Splash Screen.
|
||||
*
|
||||
* Doesn't work on launch when using the Android 12 API.
|
||||
*
|
||||
* Only available on Android.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @example true
|
||||
*/
|
||||
splashFullScreen?: boolean;
|
||||
/**
|
||||
* Hide the status bar and the software navigation buttons on the Splash Screen.
|
||||
*
|
||||
* Doesn't work on launch when using the Android 12 API.
|
||||
*
|
||||
* Only available on Android.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @example true
|
||||
*/
|
||||
splashImmersive?: boolean;
|
||||
/**
|
||||
* If `useDialog` is set to true, configure the Dialog layout.
|
||||
* If `useDialog` is not set or false, use a layout instead of the ImageView.
|
||||
*
|
||||
* Doesn't work on launch when using the Android 12 API.
|
||||
*
|
||||
* Only available on Android.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @example "launch_screen"
|
||||
*/
|
||||
layoutName?: string;
|
||||
/**
|
||||
* Use a Dialog instead of an ImageView.
|
||||
* If `layoutName` is not configured, it will use
|
||||
* a layout that uses the splash image as background.
|
||||
*
|
||||
* Doesn't work on launch when using the Android 12 API.
|
||||
*
|
||||
* Only available on Android.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @example true
|
||||
*/
|
||||
useDialog?: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
export interface ShowOptions {
|
||||
/**
|
||||
* Whether to auto hide the splash after showDuration
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
autoHide?: boolean;
|
||||
/**
|
||||
* How long (in ms) to fade in.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default 200
|
||||
*/
|
||||
fadeInDuration?: number;
|
||||
/**
|
||||
* How long (in ms) to fade out.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default 200
|
||||
*/
|
||||
fadeOutDuration?: number;
|
||||
/**
|
||||
* How long to show the splash screen when autoHide is enabled (in ms)
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default 3000
|
||||
*/
|
||||
showDuration?: number;
|
||||
}
|
||||
export interface HideOptions {
|
||||
/**
|
||||
* How long (in ms) to fade out.
|
||||
*
|
||||
* On Android, if using the Android 12 Splash Screen API, it's not being used.
|
||||
* Use launchFadeOutDuration configuration option instead.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @default 200
|
||||
*/
|
||||
fadeOutDuration?: number;
|
||||
}
|
||||
export interface SplashScreenPlugin {
|
||||
/**
|
||||
* Show the splash screen
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
show(options?: ShowOptions): Promise<void>;
|
||||
/**
|
||||
* Hide the splash screen
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
hide(options?: HideOptions): Promise<void>;
|
||||
}
|
||||
3
node_modules/@capacitor/splash-screen/dist/esm/definitions.js
generated
vendored
Normal file
3
node_modules/@capacitor/splash-screen/dist/esm/definitions.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/// <reference types="@capacitor/cli" />
|
||||
export {};
|
||||
//# sourceMappingURL=definitions.js.map
|
||||
1
node_modules/@capacitor/splash-screen/dist/esm/definitions.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/splash-screen/dist/esm/definitions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/@capacitor/splash-screen/dist/esm/index.d.ts
generated
vendored
Normal file
4
node_modules/@capacitor/splash-screen/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { SplashScreenPlugin } from './definitions';
|
||||
declare const SplashScreen: SplashScreenPlugin;
|
||||
export * from './definitions';
|
||||
export { SplashScreen };
|
||||
7
node_modules/@capacitor/splash-screen/dist/esm/index.js
generated
vendored
Normal file
7
node_modules/@capacitor/splash-screen/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { registerPlugin } from '@capacitor/core';
|
||||
const SplashScreen = registerPlugin('SplashScreen', {
|
||||
web: () => import('./web').then(m => new m.SplashScreenWeb()),
|
||||
});
|
||||
export * from './definitions';
|
||||
export { SplashScreen };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@capacitor/splash-screen/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/splash-screen/dist/esm/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;IACtE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { SplashScreenPlugin } from './definitions';\n\nconst SplashScreen = registerPlugin<SplashScreenPlugin>('SplashScreen', {\n web: () => import('./web').then(m => new m.SplashScreenWeb()),\n});\n\nexport * from './definitions';\nexport { SplashScreen };\n"]}
|
||||
6
node_modules/@capacitor/splash-screen/dist/esm/web.d.ts
generated
vendored
Normal file
6
node_modules/@capacitor/splash-screen/dist/esm/web.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
import type { HideOptions, ShowOptions, SplashScreenPlugin } from './definitions';
|
||||
export declare class SplashScreenWeb extends WebPlugin implements SplashScreenPlugin {
|
||||
show(_options?: ShowOptions): Promise<void>;
|
||||
hide(_options?: HideOptions): Promise<void>;
|
||||
}
|
||||
10
node_modules/@capacitor/splash-screen/dist/esm/web.js
generated
vendored
Normal file
10
node_modules/@capacitor/splash-screen/dist/esm/web.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
export class SplashScreenWeb extends WebPlugin {
|
||||
async show(_options) {
|
||||
return undefined;
|
||||
}
|
||||
async hide(_options) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
node_modules/@capacitor/splash-screen/dist/esm/web.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/splash-screen/dist/esm/web.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,KAAK,CAAC,IAAI,CAAC,QAAsB;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAsB;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n HideOptions,\n ShowOptions,\n SplashScreenPlugin,\n} from './definitions';\n\nexport class SplashScreenWeb extends WebPlugin implements SplashScreenPlugin {\n async show(_options?: ShowOptions): Promise<void> {\n return undefined;\n }\n\n async hide(_options?: HideOptions): Promise<void> {\n return undefined;\n }\n}\n"]}
|
||||
24
node_modules/@capacitor/splash-screen/dist/plugin.cjs.js
generated
vendored
Normal file
24
node_modules/@capacitor/splash-screen/dist/plugin.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@capacitor/core');
|
||||
|
||||
const SplashScreen = core.registerPlugin('SplashScreen', {
|
||||
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.SplashScreenWeb()),
|
||||
});
|
||||
|
||||
class SplashScreenWeb extends core.WebPlugin {
|
||||
async show(_options) {
|
||||
return undefined;
|
||||
}
|
||||
async hide(_options) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
var web = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
SplashScreenWeb: SplashScreenWeb
|
||||
});
|
||||
|
||||
exports.SplashScreen = SplashScreen;
|
||||
//# sourceMappingURL=plugin.cjs.js.map
|
||||
1
node_modules/@capacitor/splash-screen/dist/plugin.cjs.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/splash-screen/dist/plugin.cjs.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst SplashScreen = registerPlugin('SplashScreen', {\n web: () => import('./web').then(m => new m.SplashScreenWeb()),\n});\nexport * from './definitions';\nexport { SplashScreen };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SplashScreenWeb extends WebPlugin {\n async show(_options) {\n return undefined;\n }\n async hide(_options) {\n return undefined;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ;;;;;;;;;"}
|
||||
27
node_modules/@capacitor/splash-screen/dist/plugin.js
generated
vendored
Normal file
27
node_modules/@capacitor/splash-screen/dist/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var capacitorSplashScreen = (function (exports, core) {
|
||||
'use strict';
|
||||
|
||||
const SplashScreen = core.registerPlugin('SplashScreen', {
|
||||
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.SplashScreenWeb()),
|
||||
});
|
||||
|
||||
class SplashScreenWeb extends core.WebPlugin {
|
||||
async show(_options) {
|
||||
return undefined;
|
||||
}
|
||||
async hide(_options) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
var web = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
SplashScreenWeb: SplashScreenWeb
|
||||
});
|
||||
|
||||
exports.SplashScreen = SplashScreen;
|
||||
|
||||
return exports;
|
||||
|
||||
})({}, capacitorExports);
|
||||
//# sourceMappingURL=plugin.js.map
|
||||
1
node_modules/@capacitor/splash-screen/dist/plugin.js.map
generated
vendored
Normal file
1
node_modules/@capacitor/splash-screen/dist/plugin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst SplashScreen = registerPlugin('SplashScreen', {\n web: () => import('./web').then(m => new m.SplashScreenWeb()),\n});\nexport * from './definitions';\nexport { SplashScreen };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SplashScreenWeb extends WebPlugin {\n async show(_options) {\n return undefined;\n }\n async hide(_options) {\n return undefined;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACjE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,OAAO,SAAS;IACxB,IAAI;IACJ,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,OAAO,SAAS;IACxB,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
||||
160
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreen.swift
generated
vendored
Normal file
160
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreen.swift
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
import Foundation
|
||||
import Capacitor
|
||||
|
||||
@objc public class SplashScreen: NSObject {
|
||||
|
||||
var parentView: UIView
|
||||
var viewController = UIViewController()
|
||||
var spinner = UIActivityIndicatorView()
|
||||
var config: SplashScreenConfig = SplashScreenConfig()
|
||||
var hideTask: Any?
|
||||
var isVisible: Bool = false
|
||||
|
||||
init(parentView: UIView, config: SplashScreenConfig) {
|
||||
self.parentView = parentView
|
||||
self.config = config
|
||||
}
|
||||
|
||||
public func showOnLaunch() {
|
||||
buildViews()
|
||||
if self.config.launchShowDuration == 0 {
|
||||
return
|
||||
}
|
||||
var settings = SplashScreenSettings()
|
||||
settings.showDuration = config.launchShowDuration
|
||||
settings.fadeInDuration = config.launchFadeInDuration
|
||||
settings.autoHide = config.launchAutoHide
|
||||
showSplash(settings: settings, completion: {}, isLaunchSplash: true)
|
||||
}
|
||||
|
||||
public func show(settings: SplashScreenSettings, completion: @escaping () -> Void) {
|
||||
self.showSplash(settings: settings, completion: completion, isLaunchSplash: false)
|
||||
}
|
||||
|
||||
public func hide(settings: SplashScreenSettings) {
|
||||
hideSplash(fadeOutDuration: settings.fadeOutDuration, isLaunchSplash: false)
|
||||
}
|
||||
|
||||
private func showSplash(settings: SplashScreenSettings, completion: @escaping () -> Void, isLaunchSplash: Bool) {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if let backgroundColor = strongSelf.config.backgroundColor {
|
||||
strongSelf.viewController.view.backgroundColor = backgroundColor
|
||||
}
|
||||
|
||||
if strongSelf.config.showSpinner {
|
||||
if let style = strongSelf.config.spinnerStyle {
|
||||
strongSelf.spinner.style = style
|
||||
}
|
||||
|
||||
if let spinnerColor = strongSelf.config.spinnerColor {
|
||||
strongSelf.spinner.color = spinnerColor
|
||||
}
|
||||
}
|
||||
|
||||
strongSelf.parentView.addSubview(strongSelf.viewController.view)
|
||||
|
||||
if strongSelf.config.showSpinner {
|
||||
strongSelf.parentView.addSubview(strongSelf.spinner)
|
||||
strongSelf.spinner.centerXAnchor.constraint(equalTo: strongSelf.parentView.centerXAnchor).isActive = true
|
||||
strongSelf.spinner.centerYAnchor.constraint(equalTo: strongSelf.parentView.centerYAnchor).isActive = true
|
||||
}
|
||||
|
||||
strongSelf.parentView.isUserInteractionEnabled = false
|
||||
|
||||
UIView.transition(with: strongSelf.viewController.view, duration: TimeInterval(Double(settings.fadeInDuration) / 1000), options: .curveLinear, animations: {
|
||||
strongSelf.viewController.view.alpha = 1
|
||||
|
||||
if strongSelf.config.showSpinner {
|
||||
strongSelf.spinner.alpha = 1
|
||||
}
|
||||
}) { (_: Bool) in
|
||||
strongSelf.isVisible = true
|
||||
|
||||
if settings.autoHide {
|
||||
strongSelf.hideTask = DispatchQueue.main.asyncAfter(
|
||||
deadline: DispatchTime.now() + (Double(settings.showDuration) / 1000)
|
||||
) {
|
||||
strongSelf.hideSplash(fadeOutDuration: settings.fadeOutDuration, isLaunchSplash: isLaunchSplash)
|
||||
completion()
|
||||
}
|
||||
} else {
|
||||
completion()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func buildViews() {
|
||||
let storyboardName = Bundle.main.infoDictionary?["UILaunchStoryboardName"] as? String ?? "LaunchScreen"
|
||||
if let vc = UIStoryboard(name: storyboardName.replacingOccurrences(of: ".storyboard", with: ""), bundle: nil).instantiateInitialViewController() {
|
||||
viewController = vc
|
||||
}
|
||||
|
||||
// Observe for changes on frame and bounds to handle rotation resizing
|
||||
parentView.addObserver(self, forKeyPath: "frame", options: .new, context: nil)
|
||||
parentView.addObserver(self, forKeyPath: "bounds", options: .new, context: nil)
|
||||
|
||||
updateSplashImageBounds()
|
||||
if config.showSpinner {
|
||||
spinner.translatesAutoresizingMaskIntoConstraints = false
|
||||
spinner.startAnimating()
|
||||
}
|
||||
}
|
||||
|
||||
private func tearDown() {
|
||||
isVisible = false
|
||||
parentView.isUserInteractionEnabled = true
|
||||
viewController.view.removeFromSuperview()
|
||||
|
||||
if config.showSpinner {
|
||||
spinner.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
// Update the bounds for the splash image. This will also be called when
|
||||
// the parent view observers fire
|
||||
private func updateSplashImageBounds() {
|
||||
var window: UIWindow? = UIApplication.shared.delegate?.window ?? nil
|
||||
|
||||
if window == nil {
|
||||
let scene: UIWindowScene? = UIApplication.shared.connectedScenes.first as? UIWindowScene
|
||||
window = scene?.windows.filter({$0.isKeyWindow}).first
|
||||
if window == nil {
|
||||
window = scene?.windows.first
|
||||
}
|
||||
}
|
||||
|
||||
if let unwrappedWindow = window {
|
||||
viewController.view.frame = CGRect(origin: CGPoint(x: 0, y: 0), size: unwrappedWindow.bounds.size)
|
||||
} else {
|
||||
CAPLog.print("Unable to find root window object for SplashScreen bounds. Please file an issue")
|
||||
}
|
||||
}
|
||||
|
||||
override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change _: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
|
||||
updateSplashImageBounds()
|
||||
}
|
||||
|
||||
private func hideSplash(fadeOutDuration: Int, isLaunchSplash: Bool) {
|
||||
if isLaunchSplash, isVisible {
|
||||
CAPLog.print("SplashScreen.hideSplash: SplashScreen was automatically hidden after default timeout. " +
|
||||
"You should call `SplashScreen.hide()` as soon as your web app is loaded (or increase the timeout). " +
|
||||
"Read more at https://capacitorjs.com/docs/apis/splash-screen#hiding-the-splash-screen")
|
||||
}
|
||||
if !isVisible { return }
|
||||
DispatchQueue.main.async {
|
||||
UIView.transition(with: self.viewController.view, duration: TimeInterval(Double(fadeOutDuration) / 1000), options: .curveLinear, animations: {
|
||||
self.viewController.view.alpha = 0
|
||||
|
||||
if self.config.showSpinner {
|
||||
self.spinner.alpha = 0
|
||||
}
|
||||
}) { (_: Bool) in
|
||||
self.tearDown()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreenConfig.swift
generated
vendored
Normal file
11
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreenConfig.swift
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import UIKit
|
||||
|
||||
public struct SplashScreenConfig {
|
||||
var backgroundColor: UIColor?
|
||||
var spinnerStyle: UIActivityIndicatorView.Style?
|
||||
var spinnerColor: UIColor?
|
||||
var showSpinner = false
|
||||
var launchShowDuration = 500
|
||||
var launchAutoHide = true
|
||||
let launchFadeInDuration = 0
|
||||
}
|
||||
88
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreenPlugin.swift
generated
vendored
Normal file
88
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreenPlugin.swift
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
import Foundation
|
||||
import Capacitor
|
||||
|
||||
@objc(SplashScreenPlugin)
|
||||
public class SplashScreenPlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
public let identifier = "SplashScreenPlugin"
|
||||
public let jsName = "SplashScreen"
|
||||
public let pluginMethods: [CAPPluginMethod] = [
|
||||
CAPPluginMethod(name: "show", returnType: CAPPluginReturnPromise),
|
||||
CAPPluginMethod(name: "hide", returnType: CAPPluginReturnPromise)
|
||||
]
|
||||
private var splashScreen: SplashScreen?
|
||||
|
||||
override public func load() {
|
||||
if let view = bridge?.viewController?.view {
|
||||
splashScreen = SplashScreen(parentView: view, config: splashScreenConfig())
|
||||
splashScreen?.showOnLaunch()
|
||||
}
|
||||
}
|
||||
|
||||
// Show the splash screen
|
||||
@objc public func show(_ call: CAPPluginCall) {
|
||||
if let splash = splashScreen {
|
||||
let settings = splashScreenSettings(from: call)
|
||||
splash.show(settings: settings,
|
||||
completion: {
|
||||
call.resolve()
|
||||
})
|
||||
} else {
|
||||
call.reject("Unable to show Splash Screen")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Hide the splash screen
|
||||
@objc public func hide(_ call: CAPPluginCall) {
|
||||
if let splash = splashScreen {
|
||||
let settings = splashScreenSettings(from: call)
|
||||
splash.hide(settings: settings)
|
||||
call.resolve()
|
||||
} else {
|
||||
call.reject("Unable to hide Splash Screen")
|
||||
}
|
||||
}
|
||||
|
||||
private func splashScreenSettings(from call: CAPPluginCall) -> SplashScreenSettings {
|
||||
var settings = SplashScreenSettings()
|
||||
|
||||
if let showDuration = call.getInt("showDuration") {
|
||||
settings.showDuration = showDuration
|
||||
}
|
||||
if let fadeInDuration = call.getInt("fadeInDuration") {
|
||||
settings.fadeInDuration = fadeInDuration
|
||||
}
|
||||
if let fadeOutDuration = call.getInt("fadeOutDuration") {
|
||||
settings.fadeOutDuration = fadeOutDuration
|
||||
}
|
||||
if let autoHide = call.getBool("autoHide") {
|
||||
settings.autoHide = autoHide
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
private func splashScreenConfig() -> SplashScreenConfig {
|
||||
var config = SplashScreenConfig()
|
||||
|
||||
if let backgroundColor = getConfig().getString("backgroundColor") {
|
||||
config.backgroundColor = UIColor.capacitor.color(fromHex: backgroundColor)
|
||||
}
|
||||
if let spinnerStyle = getConfig().getString("iosSpinnerStyle") {
|
||||
switch spinnerStyle.lowercased() {
|
||||
case "small":
|
||||
config.spinnerStyle = .medium
|
||||
default:
|
||||
config.spinnerStyle = .large
|
||||
}
|
||||
}
|
||||
if let spinnerColor = getConfig().getString("spinnerColor") {
|
||||
config.spinnerColor = UIColor.capacitor.color(fromHex: spinnerColor)
|
||||
}
|
||||
config.showSpinner = getConfig().getBoolean("showSpinner", config.showSpinner)
|
||||
|
||||
config.launchShowDuration = getConfig().getInt("launchShowDuration", config.launchShowDuration)
|
||||
config.launchAutoHide = getConfig().getBoolean("launchAutoHide", config.launchAutoHide)
|
||||
return config
|
||||
}
|
||||
|
||||
}
|
||||
8
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreenSettings.swift
generated
vendored
Normal file
8
node_modules/@capacitor/splash-screen/ios/Sources/SplashScreenPlugin/SplashScreenSettings.swift
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import UIKit
|
||||
|
||||
public struct SplashScreenSettings {
|
||||
var showDuration = 3000
|
||||
var fadeInDuration = 200
|
||||
var fadeOutDuration = 200
|
||||
var autoHide = true
|
||||
}
|
||||
5
node_modules/@capacitor/splash-screen/ios/Tests/SplashScreenPluginTests/SplashScreenPluginTests.swift
generated
vendored
Normal file
5
node_modules/@capacitor/splash-screen/ios/Tests/SplashScreenPluginTests/SplashScreenPluginTests.swift
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import XCTest
|
||||
@testable import SplashScreenPlugin
|
||||
|
||||
class SplashScreenTests: XCTestCase {
|
||||
}
|
||||
86
node_modules/@capacitor/splash-screen/package.json
generated
vendored
Normal file
86
node_modules/@capacitor/splash-screen/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "@capacitor/splash-screen",
|
||||
"version": "7.0.3",
|
||||
"description": "The Splash Screen API provides methods for showing or hiding a Splash image.",
|
||||
"main": "dist/plugin.cjs.js",
|
||||
"module": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"unpkg": "dist/plugin.js",
|
||||
"files": [
|
||||
"android/src/main/",
|
||||
"android/build.gradle",
|
||||
"dist/",
|
||||
"ios/Sources",
|
||||
"ios/Tests",
|
||||
"Package.swift",
|
||||
"CapacitorSplashScreen.podspec"
|
||||
],
|
||||
"author": "Ionic <hi@ionicframework.com>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ionic-team/capacitor-plugins.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ionic-team/capacitor-plugins/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"capacitor",
|
||||
"plugin",
|
||||
"native"
|
||||
],
|
||||
"scripts": {
|
||||
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
||||
"verify:ios": "xcodebuild build -scheme CapacitorSplashScreen -destination generic/platform=iOS",
|
||||
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
||||
"verify:web": "npm run build",
|
||||
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
||||
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
||||
"eslint": "eslint . --ext ts",
|
||||
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
||||
"swiftlint": "node-swiftlint",
|
||||
"docgen": "docgen --api SplashScreenPlugin --output-readme README.md --output-json dist/docs.json",
|
||||
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
||||
"clean": "rimraf ./dist",
|
||||
"watch": "tsc --watch",
|
||||
"prepublishOnly": "npm run build",
|
||||
"publish:cocoapod": "pod trunk push ./CapacitorSplashScreen.podspec --allow-warnings"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/android": "^7.0.0",
|
||||
"@capacitor/cli": "^7.0.0",
|
||||
"@capacitor/core": "^7.0.0",
|
||||
"@capacitor/docgen": "0.2.2",
|
||||
"@capacitor/ios": "^7.0.0",
|
||||
"@ionic/eslint-config": "^0.4.0",
|
||||
"@ionic/prettier-config": "~1.0.1",
|
||||
"@ionic/swiftlint-config": "^1.1.2",
|
||||
"eslint": "^8.57.0",
|
||||
"prettier": "~2.3.0",
|
||||
"prettier-plugin-java": "~1.0.2",
|
||||
"rimraf": "^6.0.1",
|
||||
"rollup": "^4.26.0",
|
||||
"swiftlint": "^1.0.1",
|
||||
"typescript": "~4.1.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@capacitor/core": ">=7.0.0"
|
||||
},
|
||||
"prettier": "@ionic/prettier-config",
|
||||
"swiftlint": "@ionic/swiftlint-config",
|
||||
"eslintConfig": {
|
||||
"extends": "@ionic/eslint-config/recommended"
|
||||
},
|
||||
"capacitor": {
|
||||
"ios": {
|
||||
"src": "ios"
|
||||
},
|
||||
"android": {
|
||||
"src": "android"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "20f29ffc2234a89b18ddbb030c6deeda749c595c"
|
||||
}
|
||||
Reference in New Issue
Block a user