Merge pull request #2298 from nextcloud/feature/branding-notes-app

Feature Use Branding Util
This commit is contained in:
Tobias Kaminsky 2024-12-13 10:57:44 +01:00 committed by GitHub
commit 54bc2c7d9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 199 additions and 80 deletions

View file

@ -15,11 +15,16 @@ import static androidx.preference.PreferenceManager.getDefaultSharedPreferences;
import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatDelegate;
import com.nextcloud.android.sso.FilesAppTypeRegistry;
import com.nextcloud.android.sso.model.FilesAppType;
import it.niedermann.owncloud.notes.branding.BrandingUtil;
import it.niedermann.owncloud.notes.preferences.DarkModeSetting;
public class NotesApplication extends Application {
@ -31,6 +36,7 @@ public class NotesApplication extends Application {
private static long lastInteraction = 0;
private static String PREF_KEY_THEME;
private static boolean isGridViewEnabled = false;
private static BrandingUtil brandingUtil;
@Override
public void onCreate() {
@ -40,9 +46,26 @@ public class NotesApplication extends Application {
lockedPreference = prefs.getBoolean(getString(R.string.pref_key_lock), false);
isGridViewEnabled = getDefaultSharedPreferences(this).getBoolean(getString(R.string.pref_key_gridview), false);
super.onCreate();
brandingUtil = BrandingUtil.getInstance(this);
if (BuildConfig.DEBUG) {
WebView.setWebContentsDebuggingEnabled(true);
}
registerFilesAppType();
}
private void registerFilesAppType() {
String packageId = getResources().getString(R.string.package_id);
String accountType = getResources().getString(R.string.account_type);
if (TextUtils.isEmpty(packageId) || TextUtils.isEmpty(accountType)) {
return;
}
FilesAppTypeRegistry.getInstance().init(new FilesAppType(packageId, accountType, FilesAppType.Type.PROD));
}
public static BrandingUtil brandingUtil() {
return brandingUtil;
}
public static void setAppTheme(DarkModeSetting setting) {

View file

@ -27,6 +27,7 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.branding.BrandedDialogFragment;
import it.niedermann.owncloud.notes.databinding.DialogChooseAccountBinding;
@ -80,11 +81,11 @@ public class AccountPickerDialogFragment extends BrandedDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final var dialogBuilder = new MaterialAlertDialogBuilder(requireActivity())
final MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.simple_move)
.setNegativeButton(android.R.string.cancel, null);
if (targetAccounts.size() > 0) {
if (!targetAccounts.isEmpty()) {
final var binding = DialogChooseAccountBinding.inflate(LayoutInflater.from(requireContext()));
final var adapter = new AccountChooserAdapter(targetAccounts, (account -> {
accountPickerListener.onAccountPicked(account);
@ -96,6 +97,8 @@ public class AccountPickerDialogFragment extends BrandedDialogFragment {
dialogBuilder.setMessage(getString(R.string.no_other_accounts));
}
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(requireContext(), dialogBuilder);
return dialogBuilder.create();
}

View file

@ -7,6 +7,7 @@
*/
package it.niedermann.owncloud.notes.accountswitcher;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
@ -21,6 +22,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.branding.BrandedDialogFragment;
import it.niedermann.owncloud.notes.branding.BrandingUtil;
@ -107,9 +109,12 @@ public class AccountSwitcherDialog extends BrandedDialogFragment {
dismiss();
});
return new MaterialAlertDialogBuilder(requireContext())
.setView(binding.getRoot())
.create();
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireContext())
.setView(binding.getRoot());
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(requireContext(), builder);
return builder.create();
}
public static DialogFragment newInstance(long currentAccountId) {

View file

@ -6,45 +6,51 @@
*/
package it.niedermann.owncloud.notes.branding;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceViewHolder;
import androidx.preference.SwitchPreference;
import androidx.preference.SwitchPreferenceCompat;
public class BrandedSwitchPreference extends SwitchPreference implements Branded {
import com.google.android.material.materialswitch.MaterialSwitch;
import it.niedermann.owncloud.notes.R;
public class BrandedSwitchPreference extends SwitchPreferenceCompat implements Branded {
@ColorInt
private Integer mainColor = null;
@SuppressLint("UseSwitchCompatOrMaterialCode")
@Nullable
private Switch switchView;
private MaterialSwitch switchView;
public BrandedSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setWidgetLayoutResource(R.layout.preference_switch);
}
public BrandedSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setWidgetLayoutResource(R.layout.preference_switch);
}
public BrandedSwitchPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setWidgetLayoutResource(R.layout.preference_switch);
}
public BrandedSwitchPreference(Context context) {
super(context);
setWidgetLayoutResource(R.layout.preference_switch);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
if (holder.itemView instanceof ViewGroup) {
@ -65,7 +71,7 @@ public class BrandedSwitchPreference extends SwitchPreference implements Branded
private void applyBrand() {
if (switchView != null) {
final var util = BrandingUtil.of(mainColor, getContext());
util.platform.colorSwitch(switchView);
util.material.colorMaterialSwitch(switchView);
}
}
@ -76,19 +82,19 @@ public class BrandedSwitchPreference extends SwitchPreference implements Branded
* @return A Switch class or null
* @see <a href="https://gist.github.com/marchold/45e22839eb94aa14dfb5">Source</a>
*/
private Switch findSwitchWidget(View view) {
if (view instanceof Switch) {
return (Switch) view;
private MaterialSwitch findSwitchWidget(View view) {
if (view instanceof MaterialSwitch) {
return (MaterialSwitch) view;
}
if (view instanceof ViewGroup viewGroup) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
final var child = viewGroup.getChildAt(i);
if (child instanceof ViewGroup) {
@SuppressLint("UseSwitchCompatOrMaterialCode") final var result = findSwitchWidget(child);
final var result = findSwitchWidget(child);
if (result != null) return result;
}
if (child instanceof Switch) {
return (Switch) child;
if (child instanceof MaterialSwitch) {
return (MaterialSwitch) child;
}
}
}

View file

@ -54,6 +54,14 @@ public class BrandingUtil extends ViewThemeUtilsBase {
this.notes = new NotesViewThemeUtils(schemes);
}
public static BrandingUtil getInstance(@NonNull Context context) {
int color = BrandingUtil.readBrandMainColor(context);
return new BrandingUtil(
MaterialSchemes.Companion.fromColor(color),
new com.nextcloud.android.common.ui.color.ColorUtil(context)
);
}
public static BrandingUtil of(@ColorInt int color, @NonNull Context context) {
return CACHE.computeIfAbsent(color, c -> new BrandingUtil(
MaterialSchemes.Companion.fromColor(c),

View file

@ -7,15 +7,14 @@
package it.niedermann.owncloud.notes.branding;
import android.content.Context;
import android.content.DialogInterface;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.NotesApplication;
public class DeleteAlertDialogBuilder extends MaterialAlertDialogBuilder {
@ -35,9 +34,12 @@ public class DeleteAlertDialogBuilder extends MaterialAlertDialogBuilder {
}
public void applyBrand() {
final var positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (positiveButton != null) {
positiveButton.setTextColor(ContextCompat.getColor(getContext(), R.color.danger));
if (dialog.getButton(AlertDialog.BUTTON_POSITIVE) instanceof MaterialButton positiveButton) {
NotesApplication.brandingUtil().material.colorMaterialButtonPrimaryTonal(positiveButton);
}
if (dialog.getButton(AlertDialog.BUTTON_NEGATIVE) instanceof MaterialButton negativeButton) {
NotesApplication.brandingUtil().material.colorMaterialButtonPrimaryBorderless(negativeButton);
}
}
}

View file

@ -24,6 +24,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.branding.BrandedDialogFragment;
import it.niedermann.owncloud.notes.branding.BrandingUtil;
@ -155,13 +156,16 @@ public class CategoryDialogFragment extends BrandedDialogFragment {
}
});
return new MaterialAlertDialogBuilder(requireContext())
final MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.change_category_title)
.setView(dialogView)
.setCancelable(true)
.setPositiveButton(R.string.action_edit_save, (dialog, which) -> listener.onCategoryChosen(editCategory.getText().toString()))
.setNegativeButton(R.string.simple_cancel, null)
.create();
.setNegativeButton(R.string.simple_cancel, null);
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(requireContext(), alertDialogBuilder);
return alertDialogBuilder.create();
}
@Override

View file

@ -17,6 +17,7 @@ import androidx.fragment.app.DialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.branding.BrandedDialogFragment;
import it.niedermann.owncloud.notes.branding.BrandingUtil;
@ -59,13 +60,16 @@ public class EditTitleDialogFragment extends BrandedDialogFragment {
binding.title.setText(oldTitle);
}
return new MaterialAlertDialogBuilder(requireContext())
final MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.change_note_title)
.setView(dialogView)
.setCancelable(true)
.setPositiveButton(R.string.action_edit_save, (dialog, which) -> listener.onTitleEdited(binding.title.getText().toString()))
.setNegativeButton(R.string.simple_cancel, null)
.create();
.setNegativeButton(R.string.simple_cancel, null);
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(requireContext(), alertDialogBuilder);
return alertDialogBuilder.create();
}
@Override

View file

@ -19,6 +19,7 @@ import java.util.Collections;
import it.niedermann.android.util.ClipboardUtil;
import it.niedermann.nextcloud.exception.ExceptionUtil;
import it.niedermann.owncloud.notes.BuildConfig;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.databinding.ActivityExceptionBinding;
import it.niedermann.owncloud.notes.exception.tips.TipsAdapter;
@ -53,6 +54,11 @@ public class ExceptionActivity extends AppCompatActivity {
binding.copy.setOnClickListener((v) -> ClipboardUtil.copyToClipboard(this, getString(R.string.simple_exception), "```\n" + debugInfos + "\n```"));
binding.close.setOnClickListener((v) -> finish());
NotesApplication.brandingUtil().platform.themeStatusBar(this);
NotesApplication.brandingUtil().material.themeToolbar(binding.toolbar);
NotesApplication.brandingUtil().material.colorMaterialButtonPrimaryBorderless(binding.close);
NotesApplication.brandingUtil().material.colorMaterialButtonPrimaryFilled(binding.copy);
adapter.setThrowables(Collections.singletonList(throwable));
}

View file

@ -22,6 +22,7 @@ import java.util.ArrayList;
import it.niedermann.android.util.ClipboardUtil;
import it.niedermann.nextcloud.exception.ExceptionUtil;
import it.niedermann.owncloud.notes.BuildConfig;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.databinding.DialogExceptionBinding;
import it.niedermann.owncloud.notes.exception.tips.TipsAdapter;
@ -69,12 +70,15 @@ public class ExceptionDialogFragment extends AppCompatDialogFragment {
adapter.setThrowables(throwables);
return new MaterialAlertDialogBuilder(requireActivity())
final MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(requireActivity())
.setView(binding.getRoot())
.setTitle(R.string.error_dialog_title)
.setPositiveButton(android.R.string.copy, (a, b) -> ClipboardUtil.copyToClipboard(requireContext(), getString(R.string.simple_exception), "```\n" + debugInfos + "\n```"))
.setNegativeButton(R.string.simple_close, null)
.create();
.setNegativeButton(R.string.simple_close, null);
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(requireContext(), alertDialogBuilder);
return alertDialogBuilder.create();
}
public static DialogFragment newInstance(ArrayList<Throwable> exceptions) {

View file

@ -71,6 +71,7 @@ import java.util.stream.Collectors;
import it.niedermann.android.util.ColorUtil;
import it.niedermann.owncloud.notes.LockedActivity;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.accountpicker.AccountPickerListener;
import it.niedermann.owncloud.notes.accountswitcher.AccountSwitcherDialog;
@ -179,37 +180,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
runOnUiThread(() -> mainViewModel.postCurrentAccount(account));
} catch (NextcloudFilesAppAccountNotFoundException e) {
// Verbose log output for https://github.com/nextcloud/notes-android/issues/1256
runOnUiThread(() -> new MaterialAlertDialogBuilder(this)
.setTitle(NextcloudFilesAppAccountNotFoundException.class.getSimpleName())
.setMessage(R.string.backup)
.setPositiveButton(R.string.simple_backup, (a, b) -> executor.submit(() -> {
final var modifiedNotes = new LinkedList<Note>();
for (final var account : mainViewModel.getAccounts()) {
modifiedNotes.addAll(mainViewModel.getLocalModifiedNotes(account.getId()));
}
if (modifiedNotes.size() == 1) {
final var note = modifiedNotes.get(0);
ShareUtil.openShareDialog(this, note.getTitle(), note.getContent());
} else {
ShareUtil.openShareDialog(this,
getResources().getQuantityString(R.plurals.share_multiple, modifiedNotes.size(), modifiedNotes.size()),
mainViewModel.collectNoteContents(modifiedNotes.stream().map(Note::getId).collect(Collectors.toList())));
}
}))
.setNegativeButton(R.string.simple_error, (a, b) -> {
final var ssoPreferences = AccountImporter.getSharedPreferences(getApplicationContext());
final var ssoPreferencesString = new StringBuilder()
.append("Current SSO account: ").append(ssoPreferences.getString("PREF_CURRENT_ACCOUNT_STRING", null)).append("\n")
.append("\n")
.append("SSO SharedPreferences: ").append("\n");
for (final var entry : ssoPreferences.getAll().entrySet()) {
ssoPreferencesString.append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
}
ssoPreferencesString.append("\n")
.append("Available accounts in DB: ").append(TextUtils.join(", ", mainViewModel.getAccounts().stream().map(Account::getAccountName).collect(Collectors.toList())));
runOnUiThread(() -> ExceptionDialogFragment.newInstance(new RuntimeException(e.getMessage(), new RuntimeException(ssoPreferencesString.toString(), e))).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName()));
})
.show());
runOnUiThread(() -> showAppAccountNotFoundAlertDialog(e));
} catch (NoCurrentAccountSelectedException e) {
runOnUiThread(() -> ExceptionDialogFragment.newInstance(e).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName()));
}
@ -354,6 +325,43 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
});
}
private void showAppAccountNotFoundAlertDialog(NextcloudFilesAppAccountNotFoundException e) {
final MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(this)
.setTitle(NextcloudFilesAppAccountNotFoundException.class.getSimpleName())
.setMessage(R.string.backup)
.setPositiveButton(R.string.simple_backup, (a, b) -> executor.submit(() -> {
final var modifiedNotes = new LinkedList<Note>();
for (final var account : mainViewModel.getAccounts()) {
modifiedNotes.addAll(mainViewModel.getLocalModifiedNotes(account.getId()));
}
if (modifiedNotes.size() == 1) {
final var note = modifiedNotes.get(0);
ShareUtil.openShareDialog(this, note.getTitle(), note.getContent());
} else {
ShareUtil.openShareDialog(this,
getResources().getQuantityString(R.plurals.share_multiple, modifiedNotes.size(), modifiedNotes.size()),
mainViewModel.collectNoteContents(modifiedNotes.stream().map(Note::getId).collect(Collectors.toList())));
}
}))
.setNegativeButton(R.string.simple_error, (a, b) -> {
final var ssoPreferences = AccountImporter.getSharedPreferences(getApplicationContext());
final var ssoPreferencesString = new StringBuilder()
.append("Current SSO account: ").append(ssoPreferences.getString("PREF_CURRENT_ACCOUNT_STRING", null)).append("\n")
.append("\n")
.append("SSO SharedPreferences: ").append("\n");
for (final var entry : ssoPreferences.getAll().entrySet()) {
ssoPreferencesString.append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
}
ssoPreferencesString.append("\n")
.append("Available accounts in DB: ").append(TextUtils.join(", ", mainViewModel.getAccounts().stream().map(Account::getAccountName).collect(Collectors.toList())));
runOnUiThread(() -> ExceptionDialogFragment.newInstance(new RuntimeException(e.getMessage(), new RuntimeException(ssoPreferencesString.toString(), e))).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName()));
});
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(this, alertDialogBuilder);
alertDialogBuilder.show();
}
@Override
protected void onResume() {
final var accountLiveData = mainViewModel.getCurrentAccount();

View file

@ -28,6 +28,7 @@ import java.util.concurrent.Executors;
import java.util.function.Function;
import it.niedermann.owncloud.notes.LockedActivity;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.branding.BrandingUtil;
import it.niedermann.owncloud.notes.branding.DeleteAlertDialogBuilder;
@ -94,12 +95,7 @@ public class ManageAccountsActivity extends LockedActivity implements IManageAcc
public void onSuccess(Long unsynchronizedChangesCount) {
runOnUiThread(() -> {
if (unsynchronizedChangesCount > 0) {
new DeleteAlertDialogBuilder(ManageAccountsActivity.this)
.setTitle(getString(R.string.remove_account, accountToDelete.getUserName()))
.setMessage(getResources().getQuantityString(R.plurals.remove_account_message, (int) unsynchronizedChangesCount.longValue(), accountToDelete.getAccountName(), unsynchronizedChangesCount))
.setNeutralButton(android.R.string.cancel, null)
.setPositiveButton(R.string.simple_remove, (d, l) -> viewModel.deleteAccount(accountToDelete, ManageAccountsActivity.this))
.show();
showRemoveAccountAlertDialog(accountToDelete, unsynchronizedChangesCount);
} else {
viewModel.deleteAccount(accountToDelete, ManageAccountsActivity.this);
}
@ -113,6 +109,18 @@ public class ManageAccountsActivity extends LockedActivity implements IManageAcc
});
}
private void showRemoveAccountAlertDialog(@NonNull Account accountToDelete, Long unsynchronizedChangesCount) {
final MaterialAlertDialogBuilder alertDialogBuilder = new DeleteAlertDialogBuilder(ManageAccountsActivity.this)
.setTitle(getString(R.string.remove_account, accountToDelete.getUserName()))
.setMessage(getResources().getQuantityString(R.plurals.remove_account_message, (int) unsynchronizedChangesCount.longValue(), accountToDelete.getAccountName(), unsynchronizedChangesCount))
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(R.string.simple_remove, (d, l) -> viewModel.deleteAccount(accountToDelete, ManageAccountsActivity.this));
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(this, alertDialogBuilder);
alertDialogBuilder.show();
}
public void onChangeNotesPath(@NonNull Account localAccount) {
changeAccountSetting(localAccount,
R.string.settings_notes_path,
@ -146,7 +154,7 @@ public class ManageAccountsActivity extends LockedActivity implements IManageAcc
binding.inputWrapper.setHint(title);
final var dialog = new MaterialAlertDialogBuilder(this)
final MaterialAlertDialogBuilder alertDialogBuilder = new MaterialAlertDialogBuilder(this)
.setTitle(title)
.setMessage(message)
.setView(binding.getRoot())
@ -176,8 +184,13 @@ public class ManageAccountsActivity extends LockedActivity implements IManageAcc
ExceptionDialogFragment.newInstance(e).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName());
}
});
})
.show();
});
NotesApplication.brandingUtil().dialog.colorMaterialAlertDialogBackground(this, alertDialogBuilder);
var dialog = alertDialogBuilder.create();
alertDialogBuilder.show();
try {
repository.getServerSettings(AccountImporter.getSingleSignOnAccount(this, localAccount.getAccountName()), getPreferredApiVersion(localAccount.getApiVersion()))
.enqueue(new Callback<>() {

View file

@ -18,14 +18,13 @@ import it.niedermann.owncloud.notes.databinding.ActivityPreferencesBinding;
public class PreferencesActivity extends LockedActivity {
private PreferencesViewModel viewModel;
private ActivityPreferencesBinding binding;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewModel = new ViewModelProvider(this).get(PreferencesViewModel.class);
PreferencesViewModel viewModel = new ViewModelProvider(this).get(PreferencesViewModel.class);
viewModel.resultCode$.observe(this, this::setResult);
binding = ActivityPreferencesBinding.inflate(getLayoutInflater());

View file

@ -81,7 +81,7 @@
android:orientation="horizontal"
android:weightSum="1.0">
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/close"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
@ -90,7 +90,7 @@
android:text="@string/simple_close"
android:textColor="@color/defaultBrand" />
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/copy"
style="@style/Widget.Material3.Button"
android:layout_width="wrap_content"

View file

@ -101,6 +101,7 @@
android:contentDescription="@null"
android:focusable="false"
android:scaleType="center"
app:tint="@color/fg_default"
app:srcCompat="@drawable/ic_person_add_grey600_24dp" />
<TextView
@ -131,6 +132,7 @@
android:contentDescription="@null"
android:focusable="false"
android:scaleType="center"
app:tint="@color/fg_default"
app:srcCompat="@drawable/ic_settings_grey600_24dp" />
<TextView

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: 2024 Alper Ozturk <alper.ozturk@nextcloud.com>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<com.google.android.material.materialswitch.MaterialSwitch
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"
android:background="@null" />

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: 2024 Alper Ozturk <alper.ozturk@nextcloud.com>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<resources>
<string name="package_id" translatable="false"></string>
<string name="account_type" translatable="false"></string>
</resources>

View file

@ -7,7 +7,7 @@
~ SPDX-FileCopyrightText: 2022 Kévin Cocchi <kevin.cocchi@gmail.com>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<style name="BaseTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/primary</item>
@ -86,7 +86,8 @@
<style name="PreferencesAlertDialogTheme" parent="MaterialAlertDialogTheme">
<!-- https://m3.material.io/components/dialogs/specs#6771d107-624e-47cc-b6d8-2b7b620ba2f1 -->
<item name="dialogCornerRadius">28dp</item>
<item name="android:background">?attr/colorSurface</item>
<item name="android:background">@color/primary</item>
<item name="android:textColor">@color/fg_default</item>
</style>
<style name="buttonStyle" parent="Widget.Material3.Button.TextButton.Dialog">
@ -98,4 +99,9 @@
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
<style name="Preference.SwitchPreferenceCompat" parent="@style/Preference.SwitchPreferenceCompat.Material"
tools:ignore="ResourceCycle">
<item name="widgetLayout">@layout/preference_switch</item>
</style>
</resources>