blob: 3fdc5a8e92025ba1c5c16c9f027aebe15a4a40b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.libreoffice.impressremote;
import java.text.MessageFormat;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
public class AboutDialogBuilder extends AlertDialog.Builder {
private TextView mVersionLabel;
public AboutDialogBuilder(Context aContext) {
super(aContext);
LayoutInflater aInflater = (LayoutInflater) aContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View aLayout = aInflater.inflate(R.layout.dialog_about, null);
setView(aLayout);
// setTitle(R.string.about);
setPositiveButton(
aContext.getResources().getString(R.string.about_close),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
mVersionLabel = (TextView) aLayout.findViewById(R.id.about_version);
try {
PackageInfo aInfo = aContext.getPackageManager().getPackageInfo(
aContext.getPackageName(), 0);
String aVersionString = MessageFormat.format(
aContext.getResources().getString(
R.string.about_versionstring),
aInfo.versionName, aInfo.versionCode);
mVersionLabel.setText(aVersionString);
} catch (NameNotFoundException e) {
// Cannot logically happen
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|