• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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  *      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 package com.android.virtualization.terminal
17 
18 import android.os.Bundle
19 import androidx.appcompat.app.AppCompatActivity
20 import androidx.recyclerview.widget.LinearLayoutManager
21 import androidx.recyclerview.widget.RecyclerView
22 import com.android.system.virtualmachine.flags.Flags
23 import com.google.android.material.appbar.MaterialToolbar
24 
25 class SettingsActivity : AppCompatActivity() {
26 
onCreatenull27     override fun onCreate(savedInstanceState: Bundle?) {
28         super.onCreate(savedInstanceState)
29         setContentView(R.layout.settings_activity)
30 
31         val toolbar: MaterialToolbar = findViewById(R.id.settings_toolbar)
32         setSupportActionBar(toolbar)
33         var settingsItems = mutableListOf<SettingsItem>()
34         if (!Flags.terminalStorageBalloon()) {
35             settingsItems.add(
36                 SettingsItem(
37                     resources.getString(R.string.settings_disk_resize_title),
38                     resources.getString(R.string.settings_disk_resize_sub_title),
39                     R.drawable.baseline_storage_24,
40                     SettingsItemEnum.DiskResize,
41                 )
42             )
43         }
44         settingsItems.add(
45             SettingsItem(
46                 resources.getString(R.string.settings_port_forwarding_title),
47                 resources.getString(R.string.settings_port_forwarding_sub_title),
48                 R.drawable.baseline_call_missed_outgoing_24,
49                 SettingsItemEnum.PortForwarding,
50             )
51         )
52         settingsItems.add(
53             SettingsItem(
54                 resources.getString(R.string.settings_recovery_title),
55                 resources.getString(R.string.settings_recovery_sub_title),
56                 R.drawable.baseline_settings_backup_restore_24,
57                 SettingsItemEnum.Recovery,
58             )
59         )
60 
61         val settingsListItemAdapter = SettingsItemAdapter(settingsItems)
62 
63         val recyclerView: RecyclerView = findViewById(R.id.settings_list_recycler_view)
64         recyclerView.layoutManager = LinearLayoutManager(this)
65         recyclerView.adapter = settingsListItemAdapter
66     }
67 }
68