Use Material3 colors for loading dialogs

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-10-04 12:02:57 +02:00
parent f189000edf
commit 2a2c01f094
No known key found for this signature in database
GPG key ID: 2585783189A62105
3 changed files with 9 additions and 13 deletions

View file

@ -29,7 +29,7 @@ import android.widget.ProgressBar;
import com.nextcloud.client.di.Injectable;
import com.owncloud.android.R;
import com.owncloud.android.utils.theme.ThemeColorUtils;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
import javax.inject.Inject;
@ -42,7 +42,7 @@ public class IndeterminateProgressDialog extends DialogFragment implements Injec
private static final String ARG_MESSAGE_ID = IndeterminateProgressDialog.class.getCanonicalName() + ".ARG_MESSAGE_ID";
private static final String ARG_CANCELABLE = IndeterminateProgressDialog.class.getCanonicalName() + ".ARG_CANCELABLE";
@Inject ThemeColorUtils themeColorUtils;
@Inject ViewThemeUtils viewThemeUtils;
/**
* Public factory method to get dialog instances.
@ -71,14 +71,9 @@ public class IndeterminateProgressDialog extends DialogFragment implements Injec
/// create indeterminate progress dialog
final ProgressDialog progressDialog = new ProgressDialog(getActivity(), R.style.ProgressDialogTheme);
progressDialog.setIndeterminate(true);
progressDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
ProgressBar v = progressDialog.findViewById(android.R.id.progress);
v.getIndeterminateDrawable().setColorFilter(themeColorUtils.primaryAccentColor(getContext()),
android.graphics.PorterDuff.Mode.MULTIPLY);
}
progressDialog.setOnShowListener(dialog -> {
ProgressBar v = progressDialog.findViewById(android.R.id.progress);
viewThemeUtils.platform.tintDrawable(requireContext(), v.getIndeterminateDrawable());
});
/// set message

View file

@ -31,6 +31,7 @@ import android.widget.TextView;
import com.nextcloud.client.di.Injectable;
import com.owncloud.android.R;
import com.owncloud.android.utils.theme.ThemeColorUtils;
import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
import javax.inject.Inject;
@ -39,7 +40,7 @@ import androidx.fragment.app.DialogFragment;
public class LoadingDialog extends DialogFragment implements Injectable {
@Inject ThemeColorUtils themeColorUtils;
@Inject ViewThemeUtils viewThemeUtils;
private String mMessage;
@Override
@ -66,8 +67,7 @@ public class LoadingDialog extends DialogFragment implements Injectable {
// set progress wheel color
ProgressBar progressBar = v.findViewById(R.id.loadingBar);
progressBar.getIndeterminateDrawable().setColorFilter(themeColorUtils.primaryAccentColor(getContext()),
PorterDuff.Mode.SRC_IN);
viewThemeUtils.platform.tintDrawable(requireContext(), progressBar.getIndeterminateDrawable());
return v;
}

View file

@ -168,6 +168,7 @@
<style name="ProgressDialogTheme" parent="ownCloud.Dialog">
<item name="colorAccent">@color/color_accent</item>
<item name="android:textColor">@color/login_text_color</item>
<item name="android:windowFrame">@color/transparent</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowTitleBackgroundStyle">@drawable/process_dialog_background</item>