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:
amauri 2024-04-17 17:19:20 +02:00
parent cb094228c6
commit f562317749
11 changed files with 104 additions and 134 deletions

View File

@ -1,7 +1,6 @@
# Android SDK
Android SDK
===================
## Table of Contents
- [Import](#import)
- [Installation](#installation)
- [Project](#project)
@ -12,36 +11,25 @@
- [Authors](#authors)
<a name="import"></a>
## Import
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)
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)
```sh
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
```sh
cd newsmemory-android-sdk
git checkout tags/TAG
```
<a name="installation"></a>
## Installation
<a name="project"></a>
### Project Gradle
1. check main gradle repositories and dependencies
```java
buildscript {
repositories {
@ -58,13 +46,6 @@ buildscript {
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 {
@ -76,12 +57,18 @@ allprojects {
maven {
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
```java
maven {
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.
| variable | default | Description |
| :--------------------------------------------------------------------------------------------------- | :-----: | :-------------------------------------------------------- |
|:---------------------------------- |:-------:|:-------------------------------------------------------------- |
| compileSdk | 33 | |
| targetSdk | 33 | |
| minSdk | 24 | |
@ -124,27 +111,20 @@ maven {
```java
ext {
compileSdk 34
androidxVersion "1.4.0"
compileSdk = 34
androidxVersion = "1.4.0"
...
}
```
<a name="settings"></a>
### Settings Gradle
```java
include ':newsmemory-android-sdk'
```
<a name="app"></a>
### App Gradle
add the following lines if missing
```java
```java
plugin: "com.android.application"
apply plugin: "com.google.gms.google-services"
//add crashlytics only if the aar file is included
@ -174,13 +154,11 @@ dependencies{
...
}
```
<a name="fragment"></a>
## Add fragment to activity
```java
public class YourActivity extends AppCompatActivity {
private TaFragment taFragment;
...
@Override
@ -188,7 +166,8 @@ public class YourActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TaFragment fragment = new TaFragment()
if(taFragment == null) {
taFragment = new TaFragment()
.setDelegate(new TaFragmentDelegate() {
@Override
public void recreate() {
@ -225,10 +204,13 @@ public class YourActivity extends AppCompatActivity {
}
})
.setBuildProps(getBuildProps());
} else {
taFragment = (TaFragment) getSupportFragmentManager().findFragmentByTag("TA_FRAGMENT");
}
getSupportFragmentManager()
.beginTransaction()
.add(R.id.rnFragment, fragment)
.replace(R.id.rnFragment, taFragment, "TA_FRAGMENT")
.commit();
}
@ -238,7 +220,7 @@ public class YourActivity extends AppCompatActivity {
bundle.putString(TaConstants.TA_MACHINE, "replace_with_server");
bundle.putString(TaConstants.TA_LOCALE, "en");
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_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));
@ -252,13 +234,11 @@ public class YourActivity extends AppCompatActivity {
```
the following constant is required by SDK to be authorized
```java
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
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));
@ -267,8 +247,7 @@ the following constants are required by SDK otherwise there will be some inconsi
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
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
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).
## Authors
Nicolò Aquilini, iOS Software developer, Tecnavia
Andrea Mauri, Android Software developer, Tecnavia

View File

@ -55,7 +55,7 @@ publishing {
tareactnativeasyncstorageasyncstorage(MavenPublication) {
groupId 'tecnavia'
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")
}
@ -164,20 +164,6 @@ publishing {
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) {
groupId 'tecnavia'
artifactId 'react-native-idle-timer'
@ -335,7 +321,7 @@ publishing {
tatecnaviareactnativebridge(MavenPublication) {
groupId 'tecnavia'
artifactId 'tecnavia_react-native-bridge'
version '1.2.15'
version '1.2.20'
artifact("$libsDirName/tecnavia_react-native-bridge-release.aar")
}
@ -388,6 +374,13 @@ publishing {
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) {
groupId 'tecnavia'
artifactId 'tecnavia_react-native-zip-archive'
@ -500,7 +493,7 @@ def amazonSdkVersion = safeExtGet("amazonSdkVersion", "3.0.3")
dependencies {
implementation "tecnavia:react-native-android-open-settings:1.3.0"
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-community_art:1.2.0"
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-gesture-handler:1.10.3"
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-image-marker:0.9.2"
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-webview:11.17.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-dfp:1.5.0"
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-print:0.6.1"
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"
api "tecnavia:react-native:0.67.5"
implementation "tecnavia:hermes:1.0.0"
@ -603,8 +595,8 @@ dependencies {
//used by @firebase/app
implementation "com.android.billingclient:billing-ktx:$playBillingVersion"
implementation "com.amazon.device:amazon-appstore-sdk:$amazonSdkVersion"
//firebase

View File

@ -1,7 +1,7 @@
android.useAndroidX=true
APP_NAME=Android SDK
APP_VERSION_NAME=3.12.01
APP_VERSION_CODE=1711618364614
APP_VERSION_NAME=3.12.05
APP_VERSION_CODE=1713363289503
ANDROID_APP_ID=com.tecnaviaapplication
IS_ADDON=true

Binary file not shown.

Binary file not shown.

View File

@ -59,3 +59,4 @@ com.reactnativecommunity.webview.RNCWebViewPackage
com.RNFetchBlob.RNFetchBlobPackage
com.blueconic.reactnative.BlueConicClientPackage
com.tecnavia.chartbeat.ChartBeatPackage
com.tecnavia.workaround.WorkaroundPackage