blob: 4ccaa93f6b9f87f8778bcd1671a599d68f0c109c [file] [log] [blame]
Tingting Wang902e02a2015-11-05 15:17:22 -08001/*
2 * Copyright (C) 2015 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 */
Gary Mai0a49afa2016-12-05 15:53:58 -080016package com.android.contacts.activities;
Tingting Wang902e02a2015-11-05 15:17:22 -080017
Gary Mai0a49afa2016-12-05 15:53:58 -080018import android.os.Bundle;
Wenyi Wangca4e1332016-11-17 15:22:32 -080019import android.support.v7.app.ActionBar;
20import android.support.v7.app.AppCompatActivity;
Tingting Wang902e02a2015-11-05 15:17:22 -080021import android.view.MenuItem;
22import android.webkit.WebView;
23
Gary Mai0a49afa2016-12-05 15:53:58 -080024import com.android.contacts.R;
25
Tingting Wang902e02a2015-11-05 15:17:22 -080026/**
27 * Displays the licenses for all open source libraries.
28 */
Wenyi Wangca4e1332016-11-17 15:22:32 -080029public class LicenseActivity extends AppCompatActivity {
Tingting Wang902e02a2015-11-05 15:17:22 -080030 private static final String LICENSE_FILE = "file:///android_asset/licenses.html";
31 private WebView mWebView;
32
33 @Override
34 protected void onCreate(Bundle savedInstanceState) {
35 super.onCreate(savedInstanceState);
36 setContentView(R.layout.licenses);
37 mWebView = (WebView) findViewById(R.id.webview);
38 mWebView.loadUrl(LICENSE_FILE);
Wenyi Wangca4e1332016-11-17 15:22:32 -080039 final ActionBar actionBar = getSupportActionBar();
Wenyi Wangcc3016e2015-12-30 16:54:05 -080040 if (actionBar != null) {
41 actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
42 }
Tingting Wang902e02a2015-11-05 15:17:22 -080043 }
44
45 @Override
46 protected void onDestroy() {
47 mWebView.destroy();
48 super.onDestroy();
49 }
50
51 @Override
52 public boolean onOptionsItemSelected(MenuItem item) {
53 if (item.getItemId() == android.R.id.home) {
54 finish();
55 return true;
56 }
57 return super.onOptionsItemSelected(item);
58 }
59}