FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(Android): a crash on application restart after livesync changes by vchimev · Pull Request #6756 · NativeScript/NativeScript · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
24 changes: 14 additions & 10 deletions tns-core-modules/ui/frame/frame.android.ts
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
Expand Up @@ -85,10 +85,14 @@ function getAttachListener(): android.view.View.OnAttachStateChangeListener {
export function reloadPage(): void {
const activity = application.android.foregroundActivity;
const callbacks: AndroidActivityCallbacks = activity[CALLBACKS];
const rootView: View = callbacks.getRootView();
if (callbacks) {
const rootView: View = callbacks.getRootView();

if (!rootView || !rootView._onLivesync()) {
callbacks.resetActivityContent(activity);
if (!rootView || !rootView._onLivesync()) {
callbacks.resetActivityContent(activity);
}
} else {
traceError(`${activity}[CALLBACKS] is null or undefined`);
}
}

Expand Down Expand Up @@ -469,19 +473,19 @@ export class Frame extends FrameBase {
switch (this.actionBarVisibility) {
case "never":
return false;

case "always":
return true;

default:
if (page.actionBarHidden !== undefined) {
return !page.actionBarHidden;
}

if (this._android && this._android.showActionBar !== undefined) {
return this._android.showActionBar;
}

return true;
}
}
Expand Down Expand Up @@ -530,15 +534,15 @@ function restoreAnimatorState(entry: BackstackEntry, snapshot: AnimatorState): v
if (snapshot.enterAnimator) {
expandedEntry.enterAnimator = snapshot.enterAnimator;
}

if (snapshot.exitAnimator) {
expandedEntry.exitAnimator = snapshot.exitAnimator;
}

if (snapshot.popEnterAnimator) {
expandedEntry.popEnterAnimator = snapshot.popEnterAnimator;
}

if (snapshot.popExitAnimator) {
expandedEntry.popExitAnimator = snapshot.popExitAnimator;
}
Expand Down Expand Up @@ -858,7 +862,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
// parent while its supposed parent believes it properly removed its children; in order to "force" the child to
// lose its parent we temporarily add it to the parent, and then remove it (addViewInLayout doesn't trigger layout pass)
const nativeView = page.nativeViewProtected;
if (nativeView != null) {
if (nativeView != null) {
const parentView = nativeView.getParent();
if (parentView instanceof android.view.ViewGroup) {
if (parentView.getChildCount() === 0) {
Expand Down

Back | FazBrowse Home | New Git URL