Skip to content

Commit 34e28b1

Browse files
committed
Add configChanges to MainActivity and pass version args to build.sh
1 parent 2cb631f commit 34e28b1

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

Dockerfile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ RUN cat <<MANIFEST_EOF > app/src/main/AndroidManifest.xml
6060
android:hardwareAccelerated="true"
6161
android:icon="@mipmap/ic_launcher">
6262
<activity android:name=".MainActivity" android:exported="true"
63+
android:configChanges="orientation|screenSize|keyboardHidden"
6364
android:windowSoftInputMode="adjustResize">
6465
<intent-filter>
6566
<action android:name="android.intent.action.MAIN" />
@@ -190,7 +191,22 @@ public class MainActivity extends AppCompatActivity {
190191
}
191192
});
192193

193-
webView.loadUrl(BASE_URL);
194+
webView.restoreState(savedInstanceState);
195+
if (webView.getUrl() == null || webView.getUrl().isEmpty()) {
196+
webView.loadUrl(BASE_URL);
197+
}
198+
}
199+
200+
@Override
201+
protected void onSaveInstanceState(Bundle outState) {
202+
webView.saveState(outState);
203+
super.onSaveInstanceState(outState);
204+
}
205+
206+
@Override
207+
protected void onRestoreInstanceState(Bundle savedInstanceState) {
208+
super.onRestoreInstanceState(savedInstanceState);
209+
webView.restoreState(savedInstanceState);
194210
}
195211

196212
private void openInCustomTab(String url) {

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
chmod +x ./android-web-app-builder.sh
3-
./android-web-app-builder.sh --url "https://deckk.it" --app-name "deckk.it" --package-name "com.deckk.it"
3+
./android-web-app-builder.sh --url "https://deckk.it" --app-name "deckk.it" --package-name "com.deckk.it" --version "$VERSION" --version-code "$VERSION_CODE"

0 commit comments

Comments
 (0)