AboutActivity.java
Go to the documentation of this file.
1 /*
2  * Copyright 2016 Intermodalics All Rights Reserved.
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 eu.intermodalics.tango_ros_streamer.activities;
18 
19 import android.content.Intent;
20 import android.content.pm.PackageInfo;
21 import android.content.pm.PackageManager;
22 import android.net.Uri;
23 import android.os.Bundle;
24 import android.support.v7.app.AppCompatActivity;
25 import android.support.v7.widget.Toolbar;
26 import android.text.method.LinkMovementMethod;
27 import android.util.Log;
28 import android.view.View;
29 import android.widget.Button;
30 import android.widget.ImageButton;
31 import android.widget.TextView;
32 
34 
35 public class AboutActivity extends AppCompatActivity {
36  private static final String TAG = AboutActivity.class.getSimpleName();
37  @Override
38  protected void onCreate(Bundle savedInstanceState) {
39  super.onCreate(savedInstanceState);
40  setContentView(R.layout.about_activity);
41  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
42  setSupportActionBar(toolbar);
43 
44  // Make links in text views clickable.
45  TextView textViewRosjava = (TextView) findViewById(R.id.text_rosjava_about);
46  textViewRosjava.setMovementMethod(LinkMovementMethod.getInstance());
47 
48  TextView textViewVersion = (TextView) findViewById(R.id.text_version);
49  try {
50  PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
51  textViewVersion.setText(packageInfo.versionName);
52  } catch (PackageManager.NameNotFoundException ex) {
53  Log.e(TAG, ex.getMessage());
54  }
55 
56  Button onlineDocButton = (Button) findViewById(R.id.online_doc_about);
57  onlineDocButton.setOnClickListener(new View.OnClickListener() {
58  @Override
59  public void onClick(View view) {
60  Uri uri = Uri.parse(getString(R.string.wiki_address));
61  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
62  startActivity(intent);
63  }
64  });
65 
66  Button rateAppButton = (Button) findViewById(R.id.rate_app_about);
67  rateAppButton.setOnClickListener(new View.OnClickListener() {
68  @Override
69  public void onClick(View view) {
71  }
72  });
73 
74  Button githubButton = (Button) findViewById(R.id.source_code_about);
75  githubButton.setOnClickListener(new View.OnClickListener() {
76  @Override
77  public void onClick(View view) {
78  Uri uri = Uri.parse(getString(R.string.github_address));
79  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
80  startActivity(intent);
81  }
82  });
83 
84  ImageButton intermodalicsWebsiteButton = (ImageButton) findViewById(R.id.logo_intermodalics_about);
85  intermodalicsWebsiteButton.setOnClickListener(new View.OnClickListener() {
86  @Override
87  public void onClick(View view) {
88  Uri uri = Uri.parse(getString(R.string.intermodalics_website_address));
89  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
90  startActivity(intent);
91  }
92  });
93 
94  ImageButton ekumenWebsiteButton = (ImageButton) findViewById(R.id.logo_ekumen_about);
95  ekumenWebsiteButton.setOnClickListener(new View.OnClickListener() {
96  @Override
97  public void onClick(View view) {
98  Uri uri = Uri.parse(getString(R.string.ekumen_website_address));
99  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
100  startActivity(intent);
101  }
102  });
103 
104  ImageButton tangoWebsiteButton = (ImageButton) findViewById(R.id.logo_tango_about);
105  tangoWebsiteButton.setOnClickListener(new View.OnClickListener() {
106  @Override
107  public void onClick(View view) {
108  Uri uri = Uri.parse(getString(R.string.tango_website_address));
109  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
110  startActivity(intent);
111  }
112  });
113 
114  ImageButton rosWebsiteButton = (ImageButton) findViewById(R.id.logo_ros_about);
115  rosWebsiteButton.setOnClickListener(new View.OnClickListener() {
116  @Override
117  public void onClick(View view) {
118  Uri uri = Uri.parse(getString(R.string.ros_website_address));
119  Intent intent = new Intent(Intent.ACTION_VIEW, uri);
120  startActivity(intent);
121  }
122  });
123  }
124 
125  private void startRateAppActivity() {
126  Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + this.getPackageName()));
127  this.startActivity(intent);
128  }
129 }


TangoRosStreamer
Author(s):
autogenerated on Mon Jun 10 2019 15:37:54