1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-21 16:35:09 -05:00

AboutActivity: Read version name from package manager.

This commit is contained in:
Sebastian Kaspari 2015-04-05 14:10:31 +02:00
parent ff7cf2656b
commit 5891d90b24
3 changed files with 27 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/*
Yaaic - Yet Another Android IRC Client
Copyright 2009-2013 Sebastian Kaspari
Copyright 2009-2015 Sebastian Kaspari
This file is part of Yaaic.
@ -17,38 +17,50 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package org.yaaic.activity;
import org.yaaic.R;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import org.yaaic.R;
/**
* About activity
*
* @author Sebastian Kaspari <sebastian@yaaic.org>
*/
public class AboutActivity extends Activity
{
/**
* On activity getting created.
* "About" dialog activity.
*/
public class AboutActivity extends Activity {
private static final String TAG = "Yaaic/AboutActivity";
@Override
public void onCreate(Bundle savedInstanceState)
{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.about);
initializeVersionView();
initializeIrcView();
}
private void initializeVersionView() {
try {
TextView versionView = (TextView) findViewById(R.id.version);
versionView.setText(
getPackageManager().getPackageInfo(getPackageName(), 0).versionName
);
} catch (PackageManager.NameNotFoundException e) {
throw new AssertionError("Should not happen: Can't read application info of myself");
}
}
private void initializeIrcView() {
TextView ircLinkView = (TextView) findViewById(R.id.about_irclink);
ircLinkView.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -41,10 +41,10 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:textSize="16sp" />
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/app_version"
android:textSize="12sp" />
<TextView

View File

@ -2,7 +2,6 @@
<resources>
<string name="app_name" translatable="false">Yaaic</string>
<string name="app_full_name" translatable="false">Yet Another Android IRC Client</string>
<string name="app_version" translatable="false">1.1</string>
<string name="app_homepage" translatable="false">http://www.yaaic.org</string>
<string name="app_irc" translatable="false">irc://irc.epd-me.net/yaaic</string>
<string name="app_copyright" translatable="false">&#169; 2009-2015 Sebastian Kaspari</string>