/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. package com.googlecode.eyesfree.keyboardtutor;
  17. import android.app.Activity;
  18. import android.content.Intent;
  19. import android.content.pm.PackageInfo;
  20. import android.content.pm.PackageManager.NameNotFoundException;
  21. import android.net.Uri;
  22. import android.os.Bundle;
  23. import android.util.Log;
  24. import android.view.View;
  25. import android.view.View.OnClickListener;
  26. import android.widget.Button;
  27. import android.widget.TextView;
  28. /**
  29. * This activity displays information on the name of the application, the current version,
  30. * and links to Google's tos and privacy policy.
  31. * @author clsimon@google.com (Cheryl Simon)
  32. *
  33. */
  34. public class AboutActivity extends Activity {
  35. @Override
  36. public void onCreate(Bundle savedInstanceState) {
  37. super.onCreate(savedInstanceState);
  38. setContentView(R.layout.about_page);
  39. Button privacyPolicyButton = (Button)findViewById(R.id.privacy_policy_button);
  40. privacyPolicyButton.setOnClickListener(new OnClickListener() {
  41. @Override
  42. public void onClick(View v) {
  43. Intent intent = new Intent(
  44. Intent.ACTION_VIEW,
  45. Uri.parse("http://m.google.com/privacy"));
  46. startActivity(intent);
  47. }
  48. });
  49. Button tosButton = (Button)findViewById(R.id.terms_of_service_button);
  50. tosButton.setOnClickListener(new OnClickListener() {
  51. @Override
  52. public void onClick(View v) {
  53. Intent intent = new Intent(
  54. Intent.ACTION_VIEW,
  55. Uri.parse("http://m.google.com/tos"));
  56. startActivity(intent);
  57. }
  58. });
  59. try {
  60. PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
  61. String versionName = packageInfo.versionName;
  62. TextView version = (TextView)findViewById(R.id.version_text);
  63. version.setText(getString(R.string.version_name, versionName));
  64. } catch (NameNotFoundException e) {
  65. Log.d("AboutActivity", "Couldn't find package name.", e);
  66. }
  67. }
  68. }