Skip to content

Commit

Permalink
Recorder: Rework the settings dialog
Browse files Browse the repository at this point in the history
Change-Id: I010f19aa25180804ac2b29bff9956564b185cc7f
  • Loading branch information
SebaUbuntu committed Feb 24, 2024
1 parent 8eb0ae2 commit 829dca7
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android_app {
static_libs: [
// DO NOT EDIT THIS SECTION MANUALLY
"androidx.appcompat_appcompat",
"com.google.android.material_material",
"Recorder_com.google.android.material_material",
"androidx-constraintlayout_constraintlayout",
],

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ android {

dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
}

Expand All @@ -69,7 +69,7 @@ configure<GenerateBpPluginExtension> {
when {
module.group.startsWith("androidx") -> true
module.group.startsWith("org.jetbrains") -> true
module.group == "com.google.android.material" -> true
module.group == "com.google.errorprone" -> true
module.group == "com.google.guava" -> true
else -> false
}
Expand Down
66 changes: 66 additions & 0 deletions app/libs/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// SPDX-FileCopyrightText: 2024 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//

// DO NOT EDIT THIS FILE MANUALLY

android_library_import {
name: "Recorder_com.google.android.material_material-nodeps",
aars: ["com/google/android/material/material/1.9.0/material-1.9.0.aar"],
sdk_version: "34",
min_sdk_version: "14",
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
static_libs: [
"androidx-constraintlayout_constraintlayout",
"androidx.annotation_annotation",
"androidx.annotation_annotation-experimental",
"androidx.appcompat_appcompat",
"androidx.cardview_cardview",
"androidx.coordinatorlayout_coordinatorlayout",
"androidx.core_core",
"androidx.drawerlayout_drawerlayout",
"androidx.dynamicanimation_dynamicanimation",
"androidx.fragment_fragment",
"androidx.lifecycle_lifecycle-runtime",
"androidx.recyclerview_recyclerview",
"androidx.transition_transition",
"androidx.vectordrawable_vectordrawable",
"androidx.viewpager2_viewpager2",
"error_prone_annotations",
],
}

android_library {
name: "Recorder_com.google.android.material_material",
sdk_version: "34",
min_sdk_version: "14",
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
manifest: "com/google/android/material/material/1.9.0/AndroidManifest.xml",
static_libs: [
"Recorder_com.google.android.material_material-nodeps",
"androidx-constraintlayout_constraintlayout",
"androidx.annotation_annotation",
"androidx.annotation_annotation-experimental",
"androidx.appcompat_appcompat",
"androidx.cardview_cardview",
"androidx.coordinatorlayout_coordinatorlayout",
"androidx.core_core",
"androidx.drawerlayout_drawerlayout",
"androidx.dynamicanimation_dynamicanimation",
"androidx.fragment_fragment",
"androidx.lifecycle_lifecycle-runtime",
"androidx.recyclerview_recyclerview",
"androidx.transition_transition",
"androidx.vectordrawable_vectordrawable",
"androidx.viewpager2_viewpager2",
"error_prone_annotations",
],
java_version: "1.7",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.material" >

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="33" />

<application />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2015-2024 The Android Open Source Project

SPDX-License-Identifier: Apache-2.0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2015-2024 The Android Open Source Project

SPDX-License-Identifier: Apache-2.0
10 changes: 5 additions & 5 deletions app/src/main/java/org/lineageos/recorder/DialogActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SwitchCompat;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.materialswitch.MaterialSwitch;

import org.lineageos.recorder.utils.PermissionManager;
import org.lineageos.recorder.utils.PreferencesManager;
Expand All @@ -33,7 +33,7 @@ public class DialogActivity extends AppCompatActivity {

private PermissionManager mPermissionManager;
private PreferencesManager mPreferences;
private SwitchCompat mLocationSwitch;
private MaterialSwitch mLocationSwitch;

@Override
protected void onCreate(@Nullable Bundle savedInstance) {
Expand All @@ -57,7 +57,7 @@ protected void onCreate(@Nullable Bundle savedInstance) {
if (mLocationSwitch != null) {
setupLocationSwitch(mLocationSwitch, isRecording);
}
final SwitchCompat highQualitySwitch = dialog.findViewById(
final MaterialSwitch highQualitySwitch = dialog.findViewById(
R.id.dialog_content_settings_high_quality_switch);
if (highQualitySwitch != null) {
setupHighQualitySwitch(highQualitySwitch, isRecording);
Expand Down Expand Up @@ -89,7 +89,7 @@ public void finish() {
overridePendingTransition(0, android.R.anim.fade_out);
}

private void setupLocationSwitch(@NonNull SwitchCompat locationSwitch,
private void setupLocationSwitch(@NonNull MaterialSwitch locationSwitch,
boolean isRecording) {
final boolean tagWithLocation;
if (mPreferences.getTagWithLocation()) {
Expand Down Expand Up @@ -123,7 +123,7 @@ private void setupLocationSwitch(@NonNull SwitchCompat locationSwitch,
}
}

private void setupHighQualitySwitch(@NonNull SwitchCompat highQualitySwitch,
private void setupHighQualitySwitch(@NonNull MaterialSwitch highQualitySwitch,
boolean isRecording) {
final boolean highQuality = mPreferences.getRecordInHighQuality();
highQualitySwitch.setChecked(highQuality);
Expand Down
12 changes: 5 additions & 7 deletions app/src/main/res/layout/dialog_content_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?dialogPreferredPadding"
android:paddingEnd="?dialogPreferredPadding"
android:paddingBottom="?dialogPreferredPadding"
android:padding="?dialogPreferredPadding"
android:orientation="vertical">

<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/dialog_content_settings_location_switch"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_height="wrap_content"
android:text="@string/settings_location_message" />

<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/dialog_content_settings_high_quality_switch"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_height="wrap_content"
android:text="@string/settings_quality_high" />

</LinearLayout>

0 comments on commit 829dca7

Please sign in to comment.