1 /*
2  * Copyright 2018 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.example.androidx.webkit;
18 
19 import android.app.Activity;
20 import android.content.Context;
21 import android.content.Intent;
22 import android.os.Bundle;
23 
24 import androidx.appcompat.app.AppCompatActivity;
25 
26 import org.jspecify.annotations.Nullable;
27 
28 /**
29  * An {@link Activity} which lists features that make use of
30  * {@link androidx.webkit.ProcessGlobalConfig} to set up process global configuration prior to
31  * loading WebView.
32  */
33 public class ProcessGlobalConfigActivity extends AppCompatActivity {
34 
35     @Override
onCreate(@ullable Bundle savedInstanceState)36     protected void onCreate(@Nullable Bundle savedInstanceState) {
37         super.onCreate(savedInstanceState);
38         setContentView(R.layout.activity_main);
39         setTitle(R.string.process_global_config_activity_title);
40         WebkitHelpers.appendWebViewVersionToTitle(this);
41         final Context activityContext = this;
42         MenuListView listView = findViewById(R.id.top_level_list);
43         MenuListView.MenuItem[] menuItems = new MenuListView.MenuItem[] {
44                 new MenuListView.MenuItem(
45                         getResources().getString(R.string.data_directory_suffix_activity_title),
46                         new Intent(activityContext, DataDirectorySuffixActivity.class)),
47                 new MenuListView.MenuItem(
48                         getResources().getString(R.string.directory_base_path_activity_title),
49                         new Intent(activityContext, DirectoryBasePathsActivity.class)),
50         };
51         listView.setItems(menuItems);
52     }
53 }
54