Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Awful.apk/src/main/java/com/ferg/awfulapp/MessageFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}

@Override
public void onSaveInstanceState(@androidx.annotation.NonNull Bundle outState) {
super.onSaveInstanceState(outState);
Comment on lines +112 to +113
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style consistency: elsewhere in the codebase @NonNull is imported (import androidx.annotation.NonNull) rather than using the fully-qualified @androidx.annotation.NonNull in method signatures. Importing NonNull here would match the existing convention.

Copilot uses AI. Check for mistakes.
// Issue #691: persist the message WebView so re-entering the
// fragment after the settings activity does not redraw blank.
if (messageWebView != null) {
messageWebView.saveState(outState);
}
Comment on lines +114 to +118
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebView#saveState writes keys directly into the provided Bundle; to avoid accidental key collisions with fragment/view state and to make it possible to detect whether anything was actually saved, consider saving into a dedicated nested Bundle (e.g., outState.putBundle(...)) and/or tracking saveState’s return value.

Copilot uses AI. Check for mistakes.
}

public View onCreateView(LayoutInflater aInflater, ViewGroup aContainer, Bundle aSavedState) {
super.onCreateView(aInflater, aContainer, aSavedState);
Expand Down Expand Up @@ -134,9 +144,16 @@ public View onCreateView(LayoutInflater aInflater, ViewGroup aContainer, Bundle
messageWebView.setJavascriptHandler(new WebViewJsInterface());
messageWebView.setContent(AwfulHtmlPage.getContainerHtml(mPrefs, null, false));

// Issue #691: restore the saved WebView snapshot when the
// fragment is recreated so the message body does not come back
// blank after popping back from the settings activity.
if (aSavedState != null) {
messageWebView.restoreState(aSavedState);
Comment on lines 145 to +151
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restoreState is being called after setContent(...) has already loaded the container HTML. Per WebView lifecycle expectations, restore is most reliable before any load; consider restoring first (or skipping setContent entirely when restoring) to avoid overwriting/restoring inconsistently or causing an extra blank load/flicker.

Suggested change
messageWebView.setContent(AwfulHtmlPage.getContainerHtml(mPrefs, null, false));
// Issue #691: restore the saved WebView snapshot when the
// fragment is recreated so the message body does not come back
// blank after popping back from the settings activity.
if (aSavedState != null) {
messageWebView.restoreState(aSavedState);
// Issue #691: restore the saved WebView snapshot when the
// fragment is recreated so the message body does not come back
// blank after popping back from the settings activity.
if (aSavedState != null) {
messageWebView.restoreState(aSavedState);
} else {
messageWebView.setContent(AwfulHtmlPage.getContainerHtml(mPrefs, null, false));

Copilot uses AI. Check for mistakes.
}

if(pmId <=0){
messageWebView.setVisibility(GONE);
}else{
}else if (aSavedState == null) {
syncPM();
Comment on lines 154 to 157
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using aSavedState == null as the only gate for syncPM() can skip the network fetch even when no WebView state was actually restored (e.g., saveState returned null / state missing in the Bundle). Consider gating on “restore succeeded” (e.g., restoreState return value != null, or presence of a dedicated saved Bundle) rather than just Bundle non-nullness.

Copilot uses AI. Check for mistakes.
}

Expand Down
Loading