Skip to content

Commit

Permalink
make export settings activity transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHalko committed Sep 27, 2023
1 parent 2250e1b commit 72ae132
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 37 deletions.
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
android:name=".ExportSettingsActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:theme="@style/ExportSettingsTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"/>
android:resource="@style/ExportSettingsTheme"/>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app.revanced.manager.flutter
import android.app.Activity
import android.content.Intent
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.TransparencyMode
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import java.io.Serializable
Expand Down Expand Up @@ -37,4 +38,8 @@ class ExportSettingsActivity : FlutterActivity() {
override fun getDartEntrypointFunctionName(): String {
return "mainExportSettings"
}

override fun getTransparencyMode(): TransparencyMode {
return TransparencyMode.transparent
}
}
6 changes: 6 additions & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>

<style name="ExportSettingsTheme" parent="android:Theme.Light.NoTitleBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#52000000</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
6 changes: 3 additions & 3 deletions assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@
"managerContributors": "Manager contributors"
},
"exportSettingsView": {
"widgetTitle": "Export settings",
"description": "Would you like to export your settings to the latest version of ReVanced Manager?",
"exportButton": "Export",
"widgetTitle": "Import settings",
"description": "Would you like to import your settings to the previous version of ReVanced Manager?",
"exportButton": "Import",
"dismissButton": "No thanks"
}
}
35 changes: 16 additions & 19 deletions lib/ui/views/export_settings/export_settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@ class ExportSettingsView extends StatelessWidget {

@override
Widget build(BuildContext context) {
_exportSettingsViewModel.init(context);
return Material(
child: AlertDialog(
title: I18nText('exportSettingsView.widgetTitle'),
content: I18nText('exportSettingsView.description'),
icon: const Icon(Icons.update),
actions: <Widget> [
CustomMaterialButton(
isFilled: false,
label: I18nText('exportSettingsView.dismissButton'),
onPressed: _exportSettingsViewModel.deny,
),
CustomMaterialButton(
label: I18nText('exportSettingsView.exportButton'),
onPressed: () async {
await _exportSettingsViewModel.accept();
},
),
],
return AlertDialog(
title: I18nText('exportSettingsView.widgetTitle'),
content: I18nText('exportSettingsView.description'),
icon: const Icon(Icons.update),
actions: <Widget> [
CustomMaterialButton(
isFilled: false,
label: I18nText('exportSettingsView.dismissButton'),
onPressed: _exportSettingsViewModel.deny,
),
CustomMaterialButton(
label: I18nText('exportSettingsView.exportButton'),
onPressed: () async {
await _exportSettingsViewModel.accept();
},
),
],
);
}
}
13 changes: 0 additions & 13 deletions lib/ui/views/export_settings/export_settings_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@ class ExportSettingsViewModel extends BaseViewModel {
final _channel = const MethodChannel('app.revanced.manager.flutter/settings');
final ManagerAPI _managerAPI = locator<ManagerAPI>();

void init(BuildContext context) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
systemNavigationBarIconBrightness:
DynamicTheme.of(context)!.theme.brightness == Brightness.light
? Brightness.dark
: Brightness.light,
),
);
}

Future<void> accept() async {
final externalDir = await getExternalStorageDirectory();

Expand Down

0 comments on commit 72ae132

Please sign in to comment.