1 /* 2 * Copyright 2024 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 * https://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.android.devicediagnostics.evaluated 18 19 import android.os.Bundle 20 import androidx.fragment.app.commit 21 import androidx.preference.Preference 22 import androidx.preference.PreferenceFragmentCompat 23 import com.android.devicediagnostics.ApplicationInterface 24 import com.android.devicediagnostics.R 25 import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity 26 27 class TouchTestIntroFragment() : PreferenceFragmentCompat() { constructornull28 fun constructor() {} 29 onCreatePreferencesnull30 override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { 31 setPreferencesFromResource(R.xml.preferences_evaluated_touch_test, rootKey) 32 findPreference<Preference>("continue")?.setOnPreferenceClickListener { 33 nextTestActivity(activity!!, TouchTestActivity::class.java.name) 34 true 35 } 36 } 37 } 38 39 class TouchTestIntroActivity : CollapsingToolbarBaseActivity() { onCreatenull40 override fun onCreate(savedInstanceState: Bundle?) { 41 super.onCreate(savedInstanceState) 42 setContentView(R.layout.activity_one_fragment) 43 setTitle(R.string.touch_test_title) 44 45 if (savedInstanceState == null) { 46 supportFragmentManager.commit { 47 setReorderingAllowed(true) 48 add(R.id.fragment_container_view, TouchTestIntroFragment()) 49 } 50 51 if (ApplicationInterface.app.isUsingScreenReader(this)) { 52 showAccessibilityDialog( 53 this, 54 R.string.touch_test_title, 55 R.string.visual_test_warning_summary 56 ) 57 } 58 } 59 } 60 } 61