AboutActivity.java
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 Intermodalics All Rights Reserved.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 package eu.intermodalics.tango_ros_streamer.activities;
00018 
00019 import android.content.Intent;
00020 import android.content.pm.PackageInfo;
00021 import android.content.pm.PackageManager;
00022 import android.net.Uri;
00023 import android.os.Bundle;
00024 import android.support.v7.app.AppCompatActivity;
00025 import android.support.v7.widget.Toolbar;
00026 import android.text.method.LinkMovementMethod;
00027 import android.util.Log;
00028 import android.view.View;
00029 import android.widget.Button;
00030 import android.widget.ImageButton;
00031 import android.widget.TextView;
00032 
00033 import eu.intermodalics.tango_ros_streamer.R;
00034 
00035 public class AboutActivity extends AppCompatActivity {
00036     private static final String TAG = AboutActivity.class.getSimpleName();
00037     @Override
00038     protected void onCreate(Bundle savedInstanceState) {
00039         super.onCreate(savedInstanceState);
00040         setContentView(R.layout.about_activity);
00041         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
00042         setSupportActionBar(toolbar);
00043 
00044         // Make links in text views clickable.
00045         TextView textViewRosjava = (TextView) findViewById(R.id.text_rosjava_about);
00046         textViewRosjava.setMovementMethod(LinkMovementMethod.getInstance());
00047 
00048         TextView textViewVersion = (TextView) findViewById(R.id.text_version);
00049         try {
00050             PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
00051             textViewVersion.setText(packageInfo.versionName);
00052         } catch (PackageManager.NameNotFoundException ex) {
00053             Log.e(TAG, ex.getMessage());
00054         }
00055 
00056         Button onlineDocButton = (Button) findViewById(R.id.online_doc_about);
00057         onlineDocButton.setOnClickListener(new View.OnClickListener() {
00058             @Override
00059             public void onClick(View view) {
00060                 Uri uri = Uri.parse(getString(R.string.wiki_address));
00061                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00062                 startActivity(intent);
00063             }
00064         });
00065 
00066         Button rateAppButton = (Button) findViewById(R.id.rate_app_about);
00067         rateAppButton.setOnClickListener(new View.OnClickListener() {
00068             @Override
00069             public void onClick(View view) {
00070                 startRateAppActivity();
00071             }
00072         });
00073 
00074         Button githubButton = (Button) findViewById(R.id.source_code_about);
00075         githubButton.setOnClickListener(new View.OnClickListener() {
00076             @Override
00077             public void onClick(View view) {
00078                 Uri uri = Uri.parse(getString(R.string.github_address));
00079                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00080                 startActivity(intent);
00081             }
00082         });
00083 
00084         ImageButton intermodalicsWebsiteButton = (ImageButton) findViewById(R.id.logo_intermodalics_about);
00085         intermodalicsWebsiteButton.setOnClickListener(new View.OnClickListener() {
00086             @Override
00087             public void onClick(View view) {
00088                 Uri uri = Uri.parse(getString(R.string.intermodalics_website_address));
00089                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00090                 startActivity(intent);
00091             }
00092         });
00093 
00094         ImageButton ekumenWebsiteButton = (ImageButton) findViewById(R.id.logo_ekumen_about);
00095         ekumenWebsiteButton.setOnClickListener(new View.OnClickListener() {
00096             @Override
00097             public void onClick(View view) {
00098                 Uri uri = Uri.parse(getString(R.string.ekumen_website_address));
00099                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00100                 startActivity(intent);
00101             }
00102         });
00103 
00104         ImageButton tangoWebsiteButton = (ImageButton) findViewById(R.id.logo_tango_about);
00105         tangoWebsiteButton.setOnClickListener(new View.OnClickListener() {
00106             @Override
00107             public void onClick(View view) {
00108                 Uri uri = Uri.parse(getString(R.string.tango_website_address));
00109                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00110                 startActivity(intent);
00111             }
00112         });
00113 
00114         ImageButton rosWebsiteButton = (ImageButton) findViewById(R.id.logo_ros_about);
00115         rosWebsiteButton.setOnClickListener(new View.OnClickListener() {
00116             @Override
00117             public void onClick(View view) {
00118                 Uri uri = Uri.parse(getString(R.string.ros_website_address));
00119                 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
00120                 startActivity(intent);
00121             }
00122         });
00123     }
00124 
00125     private void startRateAppActivity() {
00126         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + this.getPackageName()));
00127         this.startActivity(intent);
00128     }
00129 }


TangoRosStreamer
Author(s):
autogenerated on Thu Jun 6 2019 19:49:57