1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.android.car.kitchensink.camera2;
18 
19 import android.content.Intent;
20 import android.os.Bundle;
21 import android.os.UserHandle;
22 import android.view.LayoutInflater;
23 import android.view.View;
24 import android.view.ViewGroup;
25 import android.widget.Button;
26 
27 import androidx.fragment.app.Fragment;
28 
29 import com.google.android.car.kitchensink.R;
30 
31 public class Camera2TestFragment extends Fragment {
32     private static final String TAG = "Camera2.KS";
33 
34     @Override
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle)35     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
36         View view = inflater.inflate(R.layout.camera2_test, container, false);
37         Button cameraUser0 = (Button) view.findViewById(R.id.camera2_system_user);
38         cameraUser0.setOnClickListener(new View.OnClickListener() {
39                 @Override
40                 public void onClick(View view) {
41                     Intent intent = new Intent(getContext(), CameraSystemActivity.class);
42                     getContext().startActivityAsUser(intent, UserHandle.SYSTEM);
43                 }
44             });
45         Button multiCameraPreview = (Button) view.findViewById(R.id.camera2_multi_camera_preview);
46         multiCameraPreview.setOnClickListener(new View.OnClickListener() {
47                 @Override
48                 public void onClick(View view) {
49                     Intent intent = new Intent(getContext(), MultiCameraPreviewActivity.class);
50                     getContext().startActivity(intent);
51                 }
52         });
53 
54         return view;
55     }
56 }
57