Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7163eda1 authored by Anton Potapov's avatar Anton Potapov
Browse files

Add root small screen capture record view model.

This will be a root view model for the screen recording on a small screen. It will orchestrate the bottom floating window state and start/stop the recording.

Flag: com.android.systemui.new_screen_record_toolbar
Test: passes presubmits
Bug: 428686600
Change-Id: Id26db1160442541180a415a39fca871f71f8cef2
parent c4f3054c
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -137,12 +137,9 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
            new ScreenCaptureActivityIntentParameters(ScreenCaptureType.RECORD, false, null, null,
                    UserHandle.CURRENT, 0
            ).fillIntent(intent);
            mActivityStarter.postQSRunnableDismissingKeyguard(new Runnable() {
                @Override
                public void run() {
                    mActivityStarter.startActivity(intent, true);
                }
            });
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            mActivityStarter.postQSRunnableDismissingKeyguard(
                    () -> mActivityStarter.startActivity(intent, true));
        } else {
            // TODO(b/409330121): call mController.onScreenRecordQsTileClick() instead.
            handleClick(() -> showDialog(expandable));
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.
 */

package com.android.systemui.screencapture.record.smallscreen.ui.compose

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

@Composable fun RecordDetailsAppSelector(modifier: Modifier = Modifier) {}
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.
 */

package com.android.systemui.screencapture.record.smallscreen.ui.compose

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

@Composable fun RecordDetailsMarkupColorSelector(modifier: Modifier = Modifier) {}
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.
 */

package com.android.systemui.screencapture.record.smallscreen.ui.compose

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

@Composable fun RecordDetailsSettings(modifier: Modifier = Modifier) {}
+56 −3
Original line number Diff line number Diff line
@@ -16,15 +16,68 @@

package com.android.systemui.screencapture.record.smallscreen.ui.compose

import androidx.compose.material3.Text
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.android.systemui.lifecycle.rememberViewModel
import com.android.systemui.screencapture.common.ui.compose.ScreenCaptureContent
import com.android.systemui.screencapture.record.smallscreen.ui.viewmodel.RecordDetailsPopupType
import com.android.systemui.screencapture.record.smallscreen.ui.viewmodel.SmallScreenCaptureRecordViewModel
import javax.inject.Inject

class SmallScreenCaptureRecordContent @Inject constructor() : ScreenCaptureContent {
class SmallScreenCaptureRecordContent
@Inject
constructor(private val viewModelFactory: SmallScreenCaptureRecordViewModel.Factory) :
    ScreenCaptureContent {

    @Composable
    override fun Content() {
        Text("Not yet implemented")
        val viewModel =
            rememberViewModel("SmallScreenCaptureRecordContent#viewModel") {
                viewModelFactory.create()
            }

        Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
            Surface(color = MaterialTheme.colorScheme.surface) {
                // TODO: implement toolbar
            }
            Surface(
                color = MaterialTheme.colorScheme.surface,
                shape = RoundedCornerShape(28.dp),
                modifier =
                    Modifier.animateContentSize()
                        .widthIn(max = 352.dp)
                        .padding(start = 30.dp, end = 30.dp),
            ) {
                AnimatedContent(
                    targetState = viewModel.detailsPopup,
                    contentAlignment = Alignment.Center,
                    transitionSpec = { fadeIn() togetherWith fadeOut() },
                ) { currentPopup ->
                    when (currentPopup) {
                        RecordDetailsPopupType.Empty -> {
                            /* show nothing */
                        }
                        RecordDetailsPopupType.Settings -> RecordDetailsSettings()
                        RecordDetailsPopupType.AppSelector -> RecordDetailsAppSelector()
                        RecordDetailsPopupType.MarkupColorSelector ->
                            RecordDetailsMarkupColorSelector()
                    }
                }
            }
        }
    }
}
Loading