-
Notifications
You must be signed in to change notification settings - Fork 79
Add invisible FragmentHostActivity to support custom HTML in-app messages on NativeActivity #809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
simonbullen
wants to merge
8
commits into
develop
Choose a base branch
from
NativeActivity-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
74279f2
Merge pull request #766 from CleverTap/develop
CTLalit 0d26980
Merge pull request #782 from CleverTap/develop
Anush-Shand cc4b305
Merge pull request #802 from CleverTap/develop
CTLalit a193d30
Fragment based InApp notifications now launch a FragmentHostActivity …
simonbullen 5fbaf83
AtomicBoolean hosting flag
simonbullen a18d385
Manifest nit
simonbullen c0c1e84
add(0,n) instead of addFirst(n)
simonbullen 0f0ca5b
registerFragmentLifecycleCallbacks in onCreate() instead of onResume()
simonbullen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
clevertap-core/src/main/java/com/clevertap/android/sdk/FragmentHostActivity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| package com.clevertap.android.sdk; | ||
|
|
||
| import android.app.Activity; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.os.Bundle; | ||
| import androidx.annotation.NonNull; | ||
| import androidx.appcompat.app.AppCompatActivity; | ||
| import androidx.fragment.app.Fragment; | ||
| import androidx.fragment.app.FragmentActivity; | ||
| import androidx.fragment.app.FragmentManager; | ||
|
|
||
| public class FragmentHostActivity extends AppCompatActivity { | ||
|
|
||
| private static boolean hosting = false; | ||
| public static boolean isHosting() { return hosting; } | ||
|
|
||
| public static void launch(Activity current) { | ||
| Intent intent = new Intent(current, FragmentHostActivity.class); | ||
| intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| current.startActivity(intent); | ||
|
|
||
| // try to supress any transitions | ||
| current.overridePendingTransition(0, 0); | ||
| } | ||
|
|
||
| @Override protected void onCreate(Bundle b) { | ||
| super.onCreate(b); | ||
| hosting = true; | ||
|
|
||
| // try to supress any transitions | ||
| overridePendingTransition(0, 0); | ||
| } | ||
|
|
||
| @Override protected void onResume() { | ||
| super.onResume(); | ||
|
|
||
| // try to supress any transitions | ||
| getSupportFragmentManager() | ||
| .registerFragmentLifecycleCallbacks(new FragmentManager.FragmentLifecycleCallbacks() { | ||
| @Override | ||
| public void onFragmentPreAttached(@NonNull FragmentManager fm, @NonNull Fragment f, @NonNull Context context) { | ||
| f.setEnterTransition(null); | ||
| f.setExitTransition(null); | ||
| f.setReenterTransition(null); | ||
| f.setReturnTransition(null); | ||
| } | ||
| }, true); | ||
| } | ||
|
|
||
| @Override protected void onDestroy() { | ||
| super.onDestroy(); | ||
| hosting = false; | ||
|
|
||
| // try to supress any transitions | ||
| overridePendingTransition(0, 0); | ||
| } | ||
| } | ||
simonbullen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <style name="CleverTapFragmentHostTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||
| <item name="android:windowIsTranslucent">true</item> | ||
| <item name="android:windowBackground">@android:color/transparent</item> | ||
| <item name="android:windowNoTitle">true</item> | ||
| <item name="android:windowFullscreen">true</item> | ||
| </style> | ||
| </resources> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.