1 /* 2 * Copyright (C) 2021 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.activityresolver; 18 19 import android.content.Intent; 20 import android.os.Bundle; 21 import android.view.LayoutInflater; 22 import android.view.View; 23 import android.view.ViewGroup; 24 import android.widget.Button; 25 26 import androidx.annotation.NonNull; 27 import androidx.annotation.Nullable; 28 import androidx.fragment.app.Fragment; 29 30 import com.google.android.car.kitchensink.R; 31 32 /** 33 * This fragment triggers the activity resolver by sending an intent handled by three test 34 * activities. 35 */ 36 public final class ActivityResolverFragment extends Fragment { 37 38 private static final String ACTIVITY_RESOLVER_INTENT = 39 "com.google.android.car.kitchensink.activityresolver.TRIGGER_ACTIVITY_RESOLVER"; 40 41 @Nullable 42 @Override onCreateView(@onNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)43 public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, 44 @Nullable Bundle savedInstanceState) { 45 View view = inflater.inflate(R.layout.activity_resolver_fragment, container, false); 46 Button button = view.requireViewById(R.id.trigger_activity_resolver); 47 button.setOnClickListener(v -> startActivity(new Intent(ACTIVITY_RESOLVER_INTENT))); 48 return view; 49 } 50 } 51