PageRenderTime 27ms CodeModel.GetById 19ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/KeyboardTutor/src/com/googlecode/eyesfree/keyboardtutor/AboutActivity.java

http://eyes-free.googlecode.com/
Java | 79 lines | 47 code | 11 blank | 21 comment | 0 complexity | 96ca2598b207e4cd16ca4a6a8d59e201 MD5 | raw file
 1/*
 2 * Copyright (C) 2010 Google Inc.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 5 * use this file except in compliance with the License. You may obtain a copy of
 6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17
18package com.googlecode.eyesfree.keyboardtutor;
19
20import android.app.Activity;
21import android.content.Intent;
22import android.content.pm.PackageInfo;
23import android.content.pm.PackageManager.NameNotFoundException;
24import android.net.Uri;
25import android.os.Bundle;
26import android.util.Log;
27import android.view.View;
28import android.view.View.OnClickListener;
29import android.widget.Button;
30import android.widget.TextView;
31
32/**
33 * This activity displays information on the name of the application, the current version,
34 * and links to Google's tos and privacy policy.
35 * @author clsimon@google.com (Cheryl Simon)
36 *
37 */
38public class AboutActivity extends Activity {
39    
40    @Override
41    public void onCreate(Bundle savedInstanceState) {
42        super.onCreate(savedInstanceState);
43
44        setContentView(R.layout.about_page);        
45        
46        Button privacyPolicyButton = (Button)findViewById(R.id.privacy_policy_button);
47        privacyPolicyButton.setOnClickListener(new OnClickListener() {
48            @Override
49            public void onClick(View v) {
50                Intent intent = new Intent(
51                        Intent.ACTION_VIEW, 
52                        Uri.parse("http://m.google.com/privacy"));        
53                startActivity(intent);
54            }
55        });
56        
57        Button tosButton = (Button)findViewById(R.id.terms_of_service_button);
58        tosButton.setOnClickListener(new OnClickListener() {
59            @Override
60            public void onClick(View v) {
61                Intent intent = new Intent(
62                        Intent.ACTION_VIEW, 
63                        Uri.parse("http://m.google.com/tos"));        
64                startActivity(intent);
65            }
66        });
67        
68        try {
69            PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
70
71            String versionName = packageInfo.versionName;
72            
73            TextView version = (TextView)findViewById(R.id.version_text);
74            version.setText(getString(R.string.version_name, versionName));
75        } catch (NameNotFoundException e) {
76            Log.d("AboutActivity", "Couldn't find package name.", e);
77        }
78    }
79}