Merge "Use ActivityStarter to start Settings activity" into tm-qpr-dev am: b6ba2dcfde
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19755360 Change-Id: I7f58de548674936fd854c644755a398c9912ed0f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -52,6 +52,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
|||||||
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
||||||
import com.android.settingslib.media.MediaOutputConstants;
|
import com.android.settingslib.media.MediaOutputConstants;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
import com.android.systemui.plugins.ActivityStarter;
|
||||||
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
import com.android.systemui.statusbar.phone.SystemUIDialog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -69,6 +70,7 @@ public class VolumePanelDialog extends SystemUIDialog implements LifecycleOwner
|
|||||||
private static final int DURATION_SLICE_BINDING_TIMEOUT_MS = 200;
|
private static final int DURATION_SLICE_BINDING_TIMEOUT_MS = 200;
|
||||||
private static final int DEFAULT_SLICE_SIZE = 4;
|
private static final int DEFAULT_SLICE_SIZE = 4;
|
||||||
|
|
||||||
|
private final ActivityStarter mActivityStarter;
|
||||||
private RecyclerView mVolumePanelSlices;
|
private RecyclerView mVolumePanelSlices;
|
||||||
private VolumePanelSlicesAdapter mVolumePanelSlicesAdapter;
|
private VolumePanelSlicesAdapter mVolumePanelSlicesAdapter;
|
||||||
private final LifecycleRegistry mLifecycleRegistry;
|
private final LifecycleRegistry mLifecycleRegistry;
|
||||||
@@ -78,8 +80,10 @@ public class VolumePanelDialog extends SystemUIDialog implements LifecycleOwner
|
|||||||
private boolean mSlicesReadyToLoad;
|
private boolean mSlicesReadyToLoad;
|
||||||
private LocalBluetoothProfileManager mProfileManager;
|
private LocalBluetoothProfileManager mProfileManager;
|
||||||
|
|
||||||
public VolumePanelDialog(Context context, boolean aboveStatusBar) {
|
public VolumePanelDialog(Context context,
|
||||||
|
ActivityStarter activityStarter, boolean aboveStatusBar) {
|
||||||
super(context);
|
super(context);
|
||||||
|
mActivityStarter = activityStarter;
|
||||||
mLifecycleRegistry = new LifecycleRegistry(this);
|
mLifecycleRegistry = new LifecycleRegistry(this);
|
||||||
if (!aboveStatusBar) {
|
if (!aboveStatusBar) {
|
||||||
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
|
||||||
@@ -100,9 +104,11 @@ public class VolumePanelDialog extends SystemUIDialog implements LifecycleOwner
|
|||||||
doneButton.setOnClickListener(v -> dismiss());
|
doneButton.setOnClickListener(v -> dismiss());
|
||||||
Button settingsButton = dialogView.findViewById(R.id.settings_button);
|
Button settingsButton = dialogView.findViewById(R.id.settings_button);
|
||||||
settingsButton.setOnClickListener(v -> {
|
settingsButton.setOnClickListener(v -> {
|
||||||
getContext().startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS).addFlags(
|
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK));
|
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
||||||
|
Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mActivityStarter.startActivity(intent, /* dismissShade= */ true);
|
||||||
});
|
});
|
||||||
|
|
||||||
LocalBluetoothManager localBluetoothManager = LocalBluetoothManager.getInstance(
|
LocalBluetoothManager localBluetoothManager = LocalBluetoothManager.getInstance(
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.util.Log
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import com.android.systemui.animation.DialogLaunchAnimator
|
import com.android.systemui.animation.DialogLaunchAnimator
|
||||||
import com.android.systemui.dagger.SysUISingleton
|
import com.android.systemui.dagger.SysUISingleton
|
||||||
|
import com.android.systemui.plugins.ActivityStarter
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val TAG = "VolumePanelFactory"
|
private const val TAG = "VolumePanelFactory"
|
||||||
@@ -33,6 +34,7 @@ private val DEBUG = Log.isLoggable(TAG, Log.DEBUG)
|
|||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
class VolumePanelFactory @Inject constructor(
|
class VolumePanelFactory @Inject constructor(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
|
private val activityStarter: ActivityStarter,
|
||||||
private val dialogLaunchAnimator: DialogLaunchAnimator
|
private val dialogLaunchAnimator: DialogLaunchAnimator
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -45,7 +47,7 @@ class VolumePanelFactory @Inject constructor(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val dialog = VolumePanelDialog(context, aboveStatusBar)
|
val dialog = VolumePanelDialog(context, activityStarter, aboveStatusBar)
|
||||||
volumePanelDialog = dialog
|
volumePanelDialog = dialog
|
||||||
|
|
||||||
// Show the dialog.
|
// Show the dialog.
|
||||||
|
|||||||
Reference in New Issue
Block a user