switch to alsa.omap3 module
[android_pandora.git] / apps / oi-filemanager / FileManager / src / org / openintents / filemanager / AboutDialog.java
1 /* \r
2  * Copyright (C) 2007-2011 OpenIntents.org\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *      http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 package org.openintents.filemanager;\r
18 \r
19 import org.openintents.intents.AboutMiniIntents;\r
20 import org.openintents.util.IntentUtils;\r
21 import org.openintents.util.VersionUtils;\r
22 \r
23 import android.app.Activity;\r
24 import android.content.Context;\r
25 import android.content.Intent;\r
26 \r
27 /**\r
28  * About dialog\r
29  *\r
30  * @version 2009-02-04\r
31  * @author Peli\r
32  *\r
33  */\r
34 public class AboutDialog extends DownloadAppDialog {\r
35         private static final String TAG = "About";\r
36         private static final boolean DEBUG_NO_OI_ABOUT = false;\r
37         \r
38         public AboutDialog(Context context) {\r
39                 super(context,\r
40                                 R.string.oi_distribution_aboutapp_not_available,\r
41                                 R.string.oi_distribution_aboutapp,\r
42                                 R.string.oi_distribution_aboutapp_package,\r
43                                 R.string.oi_distribution_aboutapp_website);\r
44 \r
45                 String version = VersionUtils.getVersionNumber(mContext);\r
46         String appname = VersionUtils.getApplicationName(mContext);\r
47         String appnameversion = mContext.getString(R.string.oi_distribution_name_and_version, appname, version);\r
48         \r
49         StringBuilder sb = new StringBuilder();\r
50         sb.append(appnameversion);\r
51         sb.append("\n\n");\r
52         sb.append(mMessageText);\r
53         setMessage(sb.toString());\r
54         }\r
55         \r
56         public static void showDialogOrStartActivity(Activity activity, int dialogId) {\r
57                 Intent intent = new Intent(AboutMiniIntents.ACTION_SHOW_ABOUT_DIALOG);\r
58                 intent.putExtra(AboutMiniIntents.EXTRA_PACKAGE_NAME, activity.getPackageName());\r
59                 \r
60                 if (IntentUtils.isIntentAvailable(activity, intent)) {\r
61                         activity.startActivity(intent);\r
62                 } else {\r
63                         activity.showDialog(dialogId);\r
64                 }\r
65         }\r
66 \r
67 }\r