Fix Fragment lifecycle when rotation change, fix crash caused by conflict between input field and androidx.appcompat:1.4.0
This commit is contained in:
parent
cb094228c6
commit
f562317749
69
README.md
69
README.md
|
@ -1,7 +1,6 @@
|
||||||
# Android SDK
|
Android SDK
|
||||||
|
===================
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
- [Import](#import)
|
- [Import](#import)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Project](#project)
|
- [Project](#project)
|
||||||
|
@ -12,36 +11,25 @@
|
||||||
- [Authors](#authors)
|
- [Authors](#authors)
|
||||||
|
|
||||||
<a name="import"></a>
|
<a name="import"></a>
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
You must use git to download the sdk from [repository](https://github.com/tecnaviapress/newsmemory-android-sdk)
|
You must use git to download the sdk from [repository](https://github.com/tecnaviapress/newsmemory-android-sdk)
|
||||||
|
|
||||||
1. The repository is private, to clone it you must generate an ssh key, see the [guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
1. The repository is private, to clone it you must generate an ssh key, see the [guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
||||||
2. Once the key is generate you must send to Tecnavia the public key and wait a confirmation that you are enabled
|
2. Once the key is generate you must send to Tecnavia the public key and wait a confirmation that you are enabled
|
||||||
3. Inside root folder run the following command, replace TAG with the latest release, see the list on [releases](https://github.com/tecnaviapress/newsmemory-android-sdk/releases)
|
3. Inside root folder run the following command, replace TAG with the latest release, see the list on [releases](https://github.com/tecnaviapress/newsmemory-android-sdk/releases)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --depth 1 --brach TAG git@github.com:tecnaviapress/newsmemory-android-sdk.git
|
git clone --depth 1 --brach TAG git@github.com:tecnaviapress/newsmemory-android-sdk.git
|
||||||
```
|
```
|
||||||
|
|
||||||
4. if you already has the module you could update to another release by the following commands
|
4. if you already has the module you could update to another release by the following commands
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd newsmemory-android-sdk
|
cd newsmemory-android-sdk
|
||||||
git checkout tags/TAG
|
git checkout tags/TAG
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="installation"></a>
|
<a name="installation"></a>
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
<a name="project"></a>
|
<a name="project"></a>
|
||||||
|
|
||||||
### Project Gradle
|
### Project Gradle
|
||||||
|
|
||||||
1. check main gradle repositories and dependencies
|
1. check main gradle repositories and dependencies
|
||||||
|
|
||||||
```java
|
```java
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -58,13 +46,6 @@ buildscript {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//If photodraweeview:1.1.3 for some reason is not available from Maven force this version
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy {
|
|
||||||
force "me.relex:photodraweeview:2.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
@ -76,12 +57,18 @@ allprojects {
|
||||||
maven {
|
maven {
|
||||||
url "https://jitpack.io"
|
url "https://jitpack.io"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If photodraweeview:1.1.3 for some reason is not available from Maven force this version
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
force "me.relex:photodraweeview:2.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. if you are using sdk for amazon and it is built for it add the following maven repository
|
2. if you are using sdk for amazon and it is built for it add the following maven repository
|
||||||
|
|
||||||
```java
|
```java
|
||||||
maven {
|
maven {
|
||||||
url "https://s3.amazonaws.com/android-listener/mvn-repo"
|
url "https://s3.amazonaws.com/android-listener/mvn-repo"
|
||||||
|
@ -91,7 +78,7 @@ maven {
|
||||||
3. you could customize all dependencies version by updating the following variables, !pay attention, because the sdk may not starts or works properly add these variables to ext object in main gradle file, see below example.
|
3. you could customize all dependencies version by updating the following variables, !pay attention, because the sdk may not starts or works properly add these variables to ext object in main gradle file, see below example.
|
||||||
|
|
||||||
| variable | default | Description |
|
| variable | default | Description |
|
||||||
| :--------------------------------------------------------------------------------------------------- | :-----: | :-------------------------------------------------------- |
|
|:---------------------------------- |:-------:|:-------------------------------------------------------------- |
|
||||||
| compileSdk | 33 | |
|
| compileSdk | 33 | |
|
||||||
| targetSdk | 33 | |
|
| targetSdk | 33 | |
|
||||||
| minSdk | 24 | |
|
| minSdk | 24 | |
|
||||||
|
@ -124,26 +111,19 @@ maven {
|
||||||
|
|
||||||
```java
|
```java
|
||||||
ext {
|
ext {
|
||||||
compileSdk 34
|
compileSdk = 34
|
||||||
androidxVersion "1.4.0"
|
androidxVersion = "1.4.0"
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="settings"></a>
|
<a name="settings"></a>
|
||||||
|
|
||||||
### Settings Gradle
|
### Settings Gradle
|
||||||
|
|
||||||
```java
|
```java
|
||||||
include ':newsmemory-android-sdk'
|
include ':newsmemory-android-sdk'
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="app"></a>
|
<a name="app"></a>
|
||||||
|
|
||||||
### App Gradle
|
### App Gradle
|
||||||
|
|
||||||
add the following lines if missing
|
add the following lines if missing
|
||||||
|
|
||||||
```java
|
```java
|
||||||
plugin: "com.android.application"
|
plugin: "com.android.application"
|
||||||
apply plugin: "com.google.gms.google-services"
|
apply plugin: "com.google.gms.google-services"
|
||||||
|
@ -174,13 +154,11 @@ dependencies{
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="fragment"></a>
|
<a name="fragment"></a>
|
||||||
|
|
||||||
## Add fragment to activity
|
## Add fragment to activity
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class YourActivity extends AppCompatActivity {
|
public class YourActivity extends AppCompatActivity {
|
||||||
|
private TaFragment taFragment;
|
||||||
...
|
...
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,7 +166,8 @@ public class YourActivity extends AppCompatActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
TaFragment fragment = new TaFragment()
|
if(taFragment == null) {
|
||||||
|
taFragment = new TaFragment()
|
||||||
.setDelegate(new TaFragmentDelegate() {
|
.setDelegate(new TaFragmentDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void recreate() {
|
public void recreate() {
|
||||||
|
@ -225,10 +204,13 @@ public class YourActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setBuildProps(getBuildProps());
|
.setBuildProps(getBuildProps());
|
||||||
|
} else {
|
||||||
|
taFragment = (TaFragment) getSupportFragmentManager().findFragmentByTag("TA_FRAGMENT");
|
||||||
|
}
|
||||||
|
|
||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.add(R.id.rnFragment, fragment)
|
.replace(R.id.rnFragment, taFragment, "TA_FRAGMENT")
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +220,7 @@ public class YourActivity extends AppCompatActivity {
|
||||||
bundle.putString(TaConstants.TA_MACHINE, "replace_with_server");
|
bundle.putString(TaConstants.TA_MACHINE, "replace_with_server");
|
||||||
bundle.putString(TaConstants.TA_LOCALE, "en");
|
bundle.putString(TaConstants.TA_LOCALE, "en");
|
||||||
bundle.putString(TaConstants.TA_TOKEN, "replace with a valid token");
|
bundle.putString(TaConstants.TA_TOKEN, "replace with a valid token");
|
||||||
//the value inside R.string will be available after first build
|
//the value inside R.string will be avilable after first build
|
||||||
bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME));
|
bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME));
|
||||||
bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE));
|
bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE));
|
||||||
bundle.putString(TaConstants.TA_ANDROID_APP_ID,getString(com.tecnavia.sdk.R.string.ANDROID_APP_ID));
|
bundle.putString(TaConstants.TA_ANDROID_APP_ID,getString(com.tecnavia.sdk.R.string.ANDROID_APP_ID));
|
||||||
|
@ -252,13 +234,11 @@ public class YourActivity extends AppCompatActivity {
|
||||||
```
|
```
|
||||||
|
|
||||||
the following constant is required by SDK to be authorized
|
the following constant is required by SDK to be authorized
|
||||||
|
|
||||||
```java
|
```java
|
||||||
bundle.putString(TaConstants.TA_API_KEY, "");
|
bundle.putString(TaConstants.TA_API_KEY, "");
|
||||||
```
|
```
|
||||||
|
|
||||||
the following constants are required by SDK otherwise there will be some inconsistencies and bugs
|
the following constants are required by SDK otherwise there will be some inconsinstecies and bugs
|
||||||
|
|
||||||
```java
|
```java
|
||||||
bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME));
|
bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME));
|
||||||
bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE));
|
bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE));
|
||||||
|
@ -267,8 +247,7 @@ the following constants are required by SDK otherwise there will be some inconsi
|
||||||
bundle.putBoolean(TaConstants.TA_IS_ADDON, true);
|
bundle.putBoolean(TaConstants.TA_IS_ADDON, true);
|
||||||
```
|
```
|
||||||
|
|
||||||
1. The activity that load TaFragment must implement the following interface _DefaultHardwareBackBtnHandler_
|
1. The activity that load TaFragment must implement the following interface *DefaultHardwareBackBtnHandler*
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class YourActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
|
public class YourActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
|
||||||
...
|
...
|
||||||
|
@ -280,8 +259,7 @@ public class YourActivity extends AppCompatActivity implements DefaultHardwareBa
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
2. you could extends activity class with TaActivity that already has an implementation of _DefaultHardwareBackBtnHandler_ but also add some other methods to force locale.
|
2. you could extends activity class with TaActivity that already has an implementation of *DefaultHardwareBackBtnHandler* but also add some other methods to force locale.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class YourActivity extends TaActivity {
|
public class YourActivity extends TaActivity {
|
||||||
...
|
...
|
||||||
|
@ -328,6 +306,5 @@ protected void onCreate(Bundle savedInstanceState) {
|
||||||
For more information, refer to this [GitHub issue comment](https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067).
|
For more information, refer to this [GitHub issue comment](https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067).
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
Nicolò Aquilini, iOS Software developer, Tecnavia
|
Nicolò Aquilini, iOS Software developer, Tecnavia
|
||||||
Andrea Mauri, Android Software developer, Tecnavia
|
Andrea Mauri, Android Software developer, Tecnavia
|
||||||
|
|
36
build.gradle
36
build.gradle
|
@ -55,7 +55,7 @@ publishing {
|
||||||
tareactnativeasyncstorageasyncstorage(MavenPublication) {
|
tareactnativeasyncstorageasyncstorage(MavenPublication) {
|
||||||
groupId 'tecnavia'
|
groupId 'tecnavia'
|
||||||
artifactId 'react-native-async-storage_async-storage'
|
artifactId 'react-native-async-storage_async-storage'
|
||||||
version '1.17.9'
|
version '1.23.1'
|
||||||
artifact("$libsDirName/react-native-async-storage_async-storage-release.aar")
|
artifact("$libsDirName/react-native-async-storage_async-storage-release.aar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,20 +164,6 @@ publishing {
|
||||||
artifact("$libsDirName/react-native-html-to-pdf-release.aar")
|
artifact("$libsDirName/react-native-html-to-pdf-release.aar")
|
||||||
}
|
}
|
||||||
|
|
||||||
tareactnativeiapplay(MavenPublication) {
|
|
||||||
groupId 'tecnavia'
|
|
||||||
artifactId 'react-native-iap-play'
|
|
||||||
version '12.4.0'
|
|
||||||
artifact("$libsDirName/react-native-iap-play-release.aar")
|
|
||||||
}
|
|
||||||
|
|
||||||
tareactnativeiapamazon(MavenPublication) {
|
|
||||||
groupId 'tecnavia'
|
|
||||||
artifactId 'react-native-iap-amazon'
|
|
||||||
version '12.4.0'
|
|
||||||
artifact("$libsDirName/react-native-iap-amazon-release.aar")
|
|
||||||
}
|
|
||||||
|
|
||||||
tareactnativeidletimer(MavenPublication) {
|
tareactnativeidletimer(MavenPublication) {
|
||||||
groupId 'tecnavia'
|
groupId 'tecnavia'
|
||||||
artifactId 'react-native-idle-timer'
|
artifactId 'react-native-idle-timer'
|
||||||
|
@ -335,7 +321,7 @@ publishing {
|
||||||
tatecnaviareactnativebridge(MavenPublication) {
|
tatecnaviareactnativebridge(MavenPublication) {
|
||||||
groupId 'tecnavia'
|
groupId 'tecnavia'
|
||||||
artifactId 'tecnavia_react-native-bridge'
|
artifactId 'tecnavia_react-native-bridge'
|
||||||
version '1.2.15'
|
version '1.2.20'
|
||||||
artifact("$libsDirName/tecnavia_react-native-bridge-release.aar")
|
artifact("$libsDirName/tecnavia_react-native-bridge-release.aar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +374,13 @@ publishing {
|
||||||
artifact("$libsDirName/tecnavia_react-native-web-analytics-release.aar")
|
artifact("$libsDirName/tecnavia_react-native-web-analytics-release.aar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tatecnaviareactnativeworkaround(MavenPublication) {
|
||||||
|
groupId 'tecnavia'
|
||||||
|
artifactId 'tecnavia_react-native-workaround'
|
||||||
|
version '0.0.2'
|
||||||
|
artifact("$libsDirName/tecnavia_react-native-workaround-release.aar")
|
||||||
|
}
|
||||||
|
|
||||||
tatecnaviareactnativeziparchive(MavenPublication) {
|
tatecnaviareactnativeziparchive(MavenPublication) {
|
||||||
groupId 'tecnavia'
|
groupId 'tecnavia'
|
||||||
artifactId 'tecnavia_react-native-zip-archive'
|
artifactId 'tecnavia_react-native-zip-archive'
|
||||||
|
@ -500,7 +493,7 @@ def amazonSdkVersion = safeExtGet("amazonSdkVersion", "3.0.3")
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "tecnavia:react-native-android-open-settings:1.3.0"
|
implementation "tecnavia:react-native-android-open-settings:1.3.0"
|
||||||
implementation "tecnavia:react-native-app-settings:2.0.1"
|
implementation "tecnavia:react-native-app-settings:2.0.1"
|
||||||
implementation "tecnavia:react-native-async-storage_async-storage:1.17.9"
|
implementation "tecnavia:react-native-async-storage_async-storage:1.23.1"
|
||||||
implementation "tecnavia:react-native-color-matrix-image-filters:5.2.10"
|
implementation "tecnavia:react-native-color-matrix-image-filters:5.2.10"
|
||||||
implementation "tecnavia:react-native-community_art:1.2.0"
|
implementation "tecnavia:react-native-community_art:1.2.0"
|
||||||
implementation "tecnavia:react-native-community_datetimepicker:6.7.5"
|
implementation "tecnavia:react-native-community_datetimepicker:6.7.5"
|
||||||
|
@ -516,8 +509,6 @@ dependencies {
|
||||||
implementation "tecnavia:react-native-fs:2.20.0"
|
implementation "tecnavia:react-native-fs:2.20.0"
|
||||||
implementation "tecnavia:react-native-gesture-handler:1.10.3"
|
implementation "tecnavia:react-native-gesture-handler:1.10.3"
|
||||||
implementation "tecnavia:react-native-html-to-pdf:0.12.0"
|
implementation "tecnavia:react-native-html-to-pdf:0.12.0"
|
||||||
playImplementation "tecnavia:react-native-iap-play:12.4.0"
|
|
||||||
amazonImplementation "tecnavia:react-native-iap-amazon:12.4.0"
|
|
||||||
implementation "tecnavia:react-native-idle-timer:2.1.6"
|
implementation "tecnavia:react-native-idle-timer:2.1.6"
|
||||||
implementation "tecnavia:react-native-image-marker:0.9.2"
|
implementation "tecnavia:react-native-image-marker:0.9.2"
|
||||||
implementation "tecnavia:react-native-linear-gradient:2.8.3"
|
implementation "tecnavia:react-native-linear-gradient:2.8.3"
|
||||||
|
@ -540,7 +531,7 @@ dependencies {
|
||||||
implementation "tecnavia:react-native-volume-control:1.0.1"
|
implementation "tecnavia:react-native-volume-control:1.0.1"
|
||||||
implementation "tecnavia:react-native-webview:11.17.2"
|
implementation "tecnavia:react-native-webview:11.17.2"
|
||||||
implementation "tecnavia:rn-fetch-blob:0.11.2"
|
implementation "tecnavia:rn-fetch-blob:0.11.2"
|
||||||
api "tecnavia:tecnavia_react-native-bridge:1.2.15"
|
api "tecnavia:tecnavia_react-native-bridge:1.2.20"
|
||||||
implementation "tecnavia:tecnavia_react-native-default-preference:1.5.0"
|
implementation "tecnavia:tecnavia_react-native-default-preference:1.5.0"
|
||||||
implementation "tecnavia:tecnavia_react-native-dfp:1.5.0"
|
implementation "tecnavia:tecnavia_react-native-dfp:1.5.0"
|
||||||
implementation "tecnavia:tecnavia_react-native-geolocation:3.0.1"
|
implementation "tecnavia:tecnavia_react-native-geolocation:3.0.1"
|
||||||
|
@ -548,6 +539,7 @@ dependencies {
|
||||||
implementation "tecnavia:tecnavia_react-native-pdf:5.1.6"
|
implementation "tecnavia:tecnavia_react-native-pdf:5.1.6"
|
||||||
implementation "tecnavia:tecnavia_react-native-print:0.6.1"
|
implementation "tecnavia:tecnavia_react-native-print:0.6.1"
|
||||||
implementation "tecnavia:tecnavia_react-native-web-analytics:1.0.0"
|
implementation "tecnavia:tecnavia_react-native-web-analytics:1.0.0"
|
||||||
|
implementation "tecnavia:tecnavia_react-native-workaround:0.0.2"
|
||||||
implementation "tecnavia:tecnavia_react-native-zip-archive:5.2.0"
|
implementation "tecnavia:tecnavia_react-native-zip-archive:5.2.0"
|
||||||
api "tecnavia:react-native:0.67.5"
|
api "tecnavia:react-native:0.67.5"
|
||||||
implementation "tecnavia:hermes:1.0.0"
|
implementation "tecnavia:hermes:1.0.0"
|
||||||
|
@ -603,8 +595,8 @@ dependencies {
|
||||||
|
|
||||||
//used by @firebase/app
|
//used by @firebase/app
|
||||||
|
|
||||||
implementation "com.android.billingclient:billing-ktx:$playBillingVersion"
|
|
||||||
implementation "com.amazon.device:amazon-appstore-sdk:$amazonSdkVersion"
|
|
||||||
//firebase
|
//firebase
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
|
||||||
APP_NAME=Android SDK
|
APP_NAME=Android SDK
|
||||||
APP_VERSION_NAME=3.12.01
|
APP_VERSION_NAME=3.12.05
|
||||||
APP_VERSION_CODE=1711618364614
|
APP_VERSION_CODE=1713363289503
|
||||||
ANDROID_APP_ID=com.tecnaviaapplication
|
ANDROID_APP_ID=com.tecnaviaapplication
|
||||||
IS_ADDON=true
|
IS_ADDON=true
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -59,3 +59,4 @@ com.reactnativecommunity.webview.RNCWebViewPackage
|
||||||
com.RNFetchBlob.RNFetchBlobPackage
|
com.RNFetchBlob.RNFetchBlobPackage
|
||||||
com.blueconic.reactnative.BlueConicClientPackage
|
com.blueconic.reactnative.BlueConicClientPackage
|
||||||
com.tecnavia.chartbeat.ChartBeatPackage
|
com.tecnavia.chartbeat.ChartBeatPackage
|
||||||
|
com.tecnavia.workaround.WorkaroundPackage
|
Loading…
Reference in New Issue