mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Use Material3 colors for loading dialogs
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
f189000edf
commit
2a2c01f094
3 changed files with 9 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue