1 /*
2  * Copyright (C) 2020 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.android.shell;
18 
19 import android.os.Bundle;
20 import android.view.Menu;
21 import android.view.MenuItem;
22 
23 import androidx.appcompat.app.AppCompatActivity;
24 import androidx.appcompat.widget.Toolbar;
25 
26 public class MainActivity extends AppCompatActivity {
27 
28     @Override
onCreate(Bundle savedInstanceState)29     protected void onCreate(Bundle savedInstanceState) {
30         super.onCreate(savedInstanceState);
31         setContentView(R.layout.activity_main);
32         Toolbar toolbar = findViewById(R.id.toolbar);
33         setSupportActionBar(toolbar);
34         System.exit(1);
35     }
36 
37     @Override
onCreateOptionsMenu(Menu menu)38     public boolean onCreateOptionsMenu(Menu menu) {
39         // Inflate the menu; this adds items to the action bar if it is present.
40         getMenuInflater().inflate(R.menu.menu_main, menu);
41         return true;
42     }
43 
44     @Override
onOptionsItemSelected(MenuItem item)45     public boolean onOptionsItemSelected(MenuItem item) {
46         // Handle action bar item clicks here. The action bar will
47         // automatically handle clicks on the Home/Up button, so long
48         // as you specify a parent activity in AndroidManifest.xml.
49         int id = item.getItemId();
50 
51         //noinspection SimplifiableIfStatement
52         if (id == R.id.action_settings) {
53             return true;
54         }
55 
56         return super.onOptionsItemSelected(item);
57     }
58 }
59