修订版 | 86942491d1f6466c11187bd01cfca6b35611c2f8 (tree) |
---|---|
时间 | 2014-09-16 13:52:40 |
作者 | Masahiko, SAWAI <say@user...> |
Commiter | Masahiko, SAWAI |
Changed application name "android.R" to ".R"
@@ -30,9 +30,10 @@ | ||
30 | 30 | android:label="@string/preferences_title" |
31 | 31 | /> |
32 | 32 | |
33 | - <activity android:name=".AboutAppActivity" | |
34 | - android:label="@string/about_app_title" | |
35 | - /> | |
33 | + <!-- About App Activities --> | |
34 | + <activity android:name=".about.AppVersionActivity" /> | |
35 | + <activity android:name=".about.AppStoreActivity" /> | |
36 | + <activity android:name=".about.AppManagementActivity" /> | |
36 | 37 | |
37 | 38 | <activity android:name=".string.StringViewerActivity" |
38 | 39 | android:label="@string/string_viewer_title" |
@@ -9,7 +9,7 @@ | ||
9 | 9 | <artifactId>android-R</artifactId> |
10 | 10 | <packaging>apk</packaging> |
11 | 11 | <version>1.1.06</version> |
12 | - <name>android.R</name> | |
12 | + <name>.R</name> | |
13 | 13 | <url>http://www.example.com/</url> |
14 | 14 | |
15 | 15 | <dependencies> |
@@ -1,32 +1,33 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | +<FrameLayout | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | 4 | android:layout_width="fill_parent" |
4 | 5 | android:layout_height="fill_parent" |
5 | - android:paddingTop="@dimen/about_app_paddingTop" | |
6 | - android:paddingBottom="@dimen/about_app_paddingBottom" | |
7 | - android:paddingRight="@dimen/about_app_paddingRight" | |
8 | - android:paddingLeft="@dimen/about_app_paddingLeft" | |
6 | + android:paddingTop="@dimen/activity_paddingTop" | |
7 | + android:paddingBottom="@dimen/activity_paddingBottom" | |
8 | + android:paddingLeft="@dimen/activity_paddingLeft" | |
9 | + android:paddingRight="@dimen/activity_paddingRight" | |
9 | 10 | > |
10 | 11 | <LinearLayout |
11 | 12 | android:orientation="horizontal" |
12 | 13 | android:layout_width="wrap_content" |
13 | 14 | android:layout_height="fill_parent" |
14 | - android:layout_gravity="center_horizontal" | |
15 | + android:layout_gravity="center" | |
15 | 16 | > |
16 | 17 | <!-- app icon --> |
17 | 18 | <FrameLayout |
18 | 19 | android:layout_width="wrap_content" |
19 | 20 | android:layout_height="fill_parent" |
20 | 21 | android:layout_weight="0" |
21 | - android:layout_gravity="center_vertical" | |
22 | + android:layout_gravity="center_horizontal" | |
22 | 23 | android:padding="@dimen/about_app_icon_frame_padding" |
23 | 24 | > |
24 | - <include layout="@layout/about_app_icon" /> | |
25 | + <include layout="@layout/app_version_icon" /> | |
25 | 26 | </FrameLayout> |
26 | 27 | |
27 | - <!-- separator line --> | |
28 | + <!-- vertical line --> | |
28 | 29 | <View style="@style/vline" |
29 | - android:layout_margin="10dip" | |
30 | + android:layout_margin="10dip" | |
30 | 31 | /> |
31 | 32 | |
32 | 33 | <!-- app infomation --> |
@@ -34,12 +35,11 @@ | ||
34 | 35 | android:layout_width="wrap_content" |
35 | 36 | android:layout_height="fill_parent" |
36 | 37 | android:layout_weight="0" |
37 | - android:layout_gravity="center_vertical" | |
38 | + android:layout_gravity="center_horizontal" | |
38 | 39 | android:padding="@dimen/about_app_info_frame_padding" |
39 | 40 | > |
40 | - <include layout="@layout/about_app_info" /> | |
41 | + <include layout="@layout/app_version_info" /> | |
41 | 42 | </FrameLayout> |
42 | - | |
43 | 43 | </LinearLayout> |
44 | - | |
45 | 44 | </FrameLayout> |
45 | + |
@@ -3,10 +3,10 @@ | ||
3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | 4 | android:layout_width="fill_parent" |
5 | 5 | android:layout_height="fill_parent" |
6 | - android:paddingTop="@dimen/about_app_paddingTop" | |
7 | - android:paddingBottom="@dimen/about_app_paddingBottom" | |
8 | - android:paddingRight="@dimen/about_app_paddingRight" | |
9 | - android:paddingLeft="@dimen/about_app_paddingLeft" | |
6 | + android:paddingTop="@dimen/activity_paddingTop" | |
7 | + android:paddingBottom="@dimen/activity_paddingBottom" | |
8 | + android:paddingLeft="@dimen/activity_paddingLeft" | |
9 | + android:paddingRight="@dimen/activity_paddingRight" | |
10 | 10 | > |
11 | 11 | <LinearLayout |
12 | 12 | android:orientation="vertical" |
@@ -22,12 +22,13 @@ | ||
22 | 22 | android:layout_gravity="center_horizontal" |
23 | 23 | android:padding="@dimen/about_app_icon_frame_padding" |
24 | 24 | > |
25 | - <include layout="@layout/about_app_icon" /> | |
25 | + <include layout="@layout/app_version_icon" /> | |
26 | 26 | </FrameLayout> |
27 | 27 | |
28 | 28 | <!-- separator line --> |
29 | - <View style="@style/hline" | |
30 | - android:layout_margin="10dip" | |
29 | + <View | |
30 | + style="@style/hline" | |
31 | + android:layout_margin="10dip" | |
31 | 32 | /> |
32 | 33 | |
33 | 34 | <!-- app infomation --> |
@@ -38,7 +39,7 @@ | ||
38 | 39 | android:layout_gravity="center_horizontal" |
39 | 40 | android:padding="@dimen/about_app_info_frame_padding" |
40 | 41 | > |
41 | - <include layout="@layout/about_app_info" /> | |
42 | + <include layout="@layout/app_version_info" /> | |
42 | 43 | </FrameLayout> |
43 | 44 | </LinearLayout> |
44 | 45 | </FrameLayout> |
@@ -1,6 +1,5 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | -<LinearLayout | |
3 | - xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | 3 | android:orientation="vertical" |
5 | 4 | android:layout_width="wrap_content" |
6 | 5 | android:layout_height="wrap_content" |
@@ -11,6 +10,7 @@ | ||
11 | 10 | android:layout_height="wrap_content" |
12 | 11 | android:layout_margin="@dimen/about_app_info_item_margin" |
13 | 12 | android:layout_gravity="center" |
13 | + android:gravity="center" | |
14 | 14 | android:text="@string/app_name" |
15 | 15 | android:textSize="@dimen/about_app_name_textSize" |
16 | 16 | android:textColor="?android:textColorPrimary" |
@@ -50,22 +50,4 @@ | ||
50 | 50 | /> |
51 | 51 | </LinearLayout> |
52 | 52 | |
53 | - <Button | |
54 | - android:id="@+id/open_application_store_button" | |
55 | - android:layout_width="wrap_content" | |
56 | - android:layout_height="wrap_content" | |
57 | - android:layout_margin="@dimen/about_app_info_item_margin" | |
58 | - android:layout_gravity="center_horizontal" | |
59 | - android:text="@string/application_store" | |
60 | - /> | |
61 | - | |
62 | - <Button | |
63 | - android:id="@+id/open_application_management_button" | |
64 | - android:layout_width="wrap_content" | |
65 | - android:layout_height="wrap_content" | |
66 | - android:layout_margin="@dimen/about_app_info_item_margin" | |
67 | - android:layout_gravity="center_horizontal" | |
68 | - android:text="@string/application_management" | |
69 | - /> | |
70 | - | |
71 | 53 | </LinearLayout> |
\ No newline at end of file |
@@ -2,10 +2,17 @@ | ||
2 | 2 | <resources> |
3 | 3 | <string name="about_app_title">このアプリについて</string> |
4 | 4 | <string name="about_app_summary">このアプリケーションについての情報を表示</string> |
5 | + | |
6 | + <string name="application_version_title">バージョン情報</string> | |
7 | + <string name="application_version_summary">このアプリケーションのバージョン情報を表示します。</string> | |
8 | + <string name="application_store_title">アプリケーションストア</string> | |
9 | + <string name="application_store_summary">ストアにあるこのアプリケーションのページを表示します。</string> | |
10 | + <string name="application_management_title">アプリケーションの管理</string> | |
11 | + <string name="application_management_summary">このアプリケーションを管理する画面を表示します。</string> | |
12 | + | |
13 | + <!-- AppVersionActivity --> | |
5 | 14 | <string name="version">バージョン</string> |
6 | 15 | <string name="build_time">構築日時</string> |
7 | 16 | <string name="build_time_format">yyyyMMdd-kkmmss</string> |
8 | - <string name="application_store">アプリケーションストア</string> | |
9 | - <string name="application_management">アプリケーションの管理</string> | |
10 | - <string name="open">開く</string> | |
17 | + | |
11 | 18 | </resources> |
@@ -1,17 +1,12 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | - <dimen name="about_app_paddingTop">24dip</dimen> | |
4 | - <dimen name="about_app_paddingBottom">24dip</dimen> | |
5 | - <dimen name="about_app_paddingRight">24dip</dimen> | |
6 | - <dimen name="about_app_paddingLeft">24dip</dimen> | |
7 | - | |
8 | - <dimen name="about_app_icon_frame_padding">20dip</dimen> | |
9 | - <dimen name="about_app_info_frame_padding">20dip</dimen> | |
3 | + <dimen name="about_app_icon_frame_padding">32dip</dimen> | |
4 | + <dimen name="about_app_info_frame_padding">32dip</dimen> | |
10 | 5 | |
11 | 6 | <dimen name="about_app_info_item_margin">8dip</dimen> |
12 | 7 | |
13 | - <dimen name="about_app_name_textSize">48sp</dimen> | |
14 | - <dimen name="about_app_version_textSize">28sp</dimen> | |
8 | + <dimen name="about_app_name_textSize">32sp</dimen> | |
9 | + <dimen name="about_app_version_textSize">26sp</dimen> | |
15 | 10 | |
16 | 11 | <dimen name="about_app_label_textSize">18sp</dimen> |
17 | 12 | </resources> |
@@ -1,16 +1,11 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | - <dimen name="about_app_paddingTop">4dip</dimen> | |
4 | - <dimen name="about_app_paddingBottom">4dip</dimen> | |
5 | - <dimen name="about_app_paddingRight">4dip</dimen> | |
6 | - <dimen name="about_app_paddingLeft">4dip</dimen> | |
7 | - | |
8 | 3 | <dimen name="about_app_icon_frame_padding">8dip</dimen> |
9 | 4 | <dimen name="about_app_info_frame_padding">8dip</dimen> |
10 | 5 | |
11 | 6 | <dimen name="about_app_info_item_margin">4dip</dimen> |
12 | 7 | |
13 | - <dimen name="about_app_name_textSize">32sp</dimen> | |
8 | + <dimen name="about_app_name_textSize">24sp</dimen> | |
14 | 9 | <dimen name="about_app_version_textSize">18sp</dimen> |
15 | 10 | |
16 | 11 | <dimen name="about_app_label_textSize">14sp</dimen> |
@@ -1,17 +1,12 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | - <dimen name="about_app_paddingTop">48dip</dimen> | |
4 | - <dimen name="about_app_paddingBottom">48dip</dimen> | |
5 | - <dimen name="about_app_paddingRight">48dip</dimen> | |
6 | - <dimen name="about_app_paddingLeft">48dip</dimen> | |
7 | - | |
8 | - <dimen name="about_app_icon_frame_padding">30dip</dimen> | |
9 | - <dimen name="about_app_info_frame_padding">30dip</dimen> | |
3 | + <dimen name="about_app_icon_frame_padding">48dip</dimen> | |
4 | + <dimen name="about_app_info_frame_padding">48dip</dimen> | |
10 | 5 | |
11 | 6 | <dimen name="about_app_info_item_margin">12dip</dimen> |
12 | 7 | |
13 | - <dimen name="about_app_name_textSize">64sp</dimen> | |
14 | - <dimen name="about_app_version_textSize">36sp</dimen> | |
8 | + <dimen name="about_app_name_textSize">40sp</dimen> | |
9 | + <dimen name="about_app_version_textSize">32sp</dimen> | |
15 | 10 | |
16 | 11 | <dimen name="about_app_label_textSize">24sp</dimen> |
17 | 12 | </resources> |
@@ -1,17 +1,12 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | - <dimen name="about_app_paddingTop">4dip</dimen> | |
4 | - <dimen name="about_app_paddingBottom">4dip</dimen> | |
5 | - <dimen name="about_app_paddingRight">4dip</dimen> | |
6 | - <dimen name="about_app_paddingLeft">4dip</dimen> | |
7 | - | |
8 | - <dimen name="about_app_icon_frame_padding">10dip</dimen> | |
9 | - <dimen name="about_app_info_frame_padding">10dip</dimen> | |
3 | + <dimen name="about_app_icon_frame_padding">16dip</dimen> | |
4 | + <dimen name="about_app_info_frame_padding">16dip</dimen> | |
10 | 5 | |
11 | 6 | <dimen name="about_app_info_item_margin">4dip</dimen> |
12 | 7 | |
13 | - <dimen name="about_app_name_textSize">32sp</dimen> | |
8 | + <dimen name="about_app_name_textSize">24sp</dimen> | |
14 | 9 | <dimen name="about_app_version_textSize">20sp</dimen> |
15 | 10 | |
16 | - <dimen name="about_app_label_textSize">14sp</dimen> | |
11 | + <dimen name="about_app_label_textSize">16sp</dimen> | |
17 | 12 | </resources> |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <resources> |
3 | 3 | |
4 | - <string name="app_name">android.R</string> | |
4 | + <string name="app_name">.R</string> | |
5 | 5 | |
6 | 6 | <string name="drawable_viewer">Drawable</string> |
7 | 7 | <string name="drawable_viewer_title">android.R.drawable</string> |
@@ -2,10 +2,17 @@ | ||
2 | 2 | <resources> |
3 | 3 | <string name="about_app_title">About App</string> |
4 | 4 | <string name="about_app_summary">Infomation about this application</string> |
5 | + | |
6 | + <string name="application_version_title">Version Infomation</string> | |
7 | + <string name="application_version_summary">Show the version infomation about this application.</string> | |
8 | + <string name="application_store_title">Application Store</string> | |
9 | + <string name="application_store_summary">Open the page about this application in store.</string> | |
10 | + <string name="application_management_title">Application Management</string> | |
11 | + <string name="application_management_summary">Open the screen to manage this application.</string> | |
12 | + | |
13 | + <!-- AppVersionActivity --> | |
5 | 14 | <string name="version">Version</string> |
6 | 15 | <string name="build_time">Build Time</string> |
7 | 16 | <string name="build_time_format">yyyyMMdd-kkmmss</string> |
8 | - <string name="application_store">Application Store</string> | |
9 | - <string name="application_management">Application Management</string> | |
10 | - <string name="open">Open</string> | |
17 | + | |
11 | 18 | </resources> |
@@ -41,7 +41,7 @@ | ||
41 | 41 | <intent |
42 | 42 | android:action="android.intent.action.MAIN" |
43 | 43 | android:targetPackage="org.routine_work.android_r" |
44 | - android:targetClass="org.routine_work.android_r.AboutAppActivity" | |
44 | + android:targetClass="org.routine_work.android_r.about.AppVersionActivity" | |
45 | 45 | /> |
46 | 46 | </PreferenceScreen> |
47 | 47 | </PreferenceCategory> |
@@ -0,0 +1,100 @@ | ||
1 | +/* | |
2 | + * The MIT License | |
3 | + * | |
4 | + * Copyright 2011-2012 Masahiko, SAWAI <masahiko.sawai@gmail.com>. | |
5 | + * | |
6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | + * of this software and associated documentation files (the "Software"), to deal | |
8 | + * in the Software without restriction, including without limitation the rights | |
9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | + * copies of the Software, and to permit persons to whom the Software is | |
11 | + * furnished to do so, subject to the following conditions: | |
12 | + * | |
13 | + * The above copyright notice and this permission notice shall be included in | |
14 | + * all copies or substantial portions of the Software. | |
15 | + * | |
16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | + * THE SOFTWARE. | |
23 | + */ | |
24 | +package org.routine_work.android_r.about; | |
25 | + | |
26 | +import android.app.Activity; | |
27 | +import android.content.ActivityNotFoundException; | |
28 | +import android.content.Intent; | |
29 | +import android.net.Uri; | |
30 | +import android.os.Bundle; | |
31 | +import org.routine_work.utils.Log; | |
32 | + | |
33 | +/** | |
34 | + * | |
35 | + * @author Masahiko, SAWAI <masahiko.sawai@gmail.com> | |
36 | + */ | |
37 | +public class AppManagementActivity extends Activity | |
38 | +{ | |
39 | + | |
40 | + private static final String LOG_TAG = "simple-battery-logger"; | |
41 | + private Intent[] applicationManagementIntents; | |
42 | + | |
43 | + @Override | |
44 | + protected void onCreate(Bundle savedInstanceState) | |
45 | + { | |
46 | + super.onCreate(savedInstanceState); | |
47 | + finish(); | |
48 | + openApplicationManagement(); | |
49 | + } | |
50 | + | |
51 | + private void openApplicationManagement() | |
52 | + { | |
53 | + Intent[] intents = getApplicationManagementIntents(); | |
54 | + for (Intent intent : intents) | |
55 | + { | |
56 | + try | |
57 | + { | |
58 | + Log.i(LOG_TAG, "AppManagementActivity#openApplicationManagement() : intent => " + intent); | |
59 | + startActivity(intent); | |
60 | + break; | |
61 | + } | |
62 | + catch (ActivityNotFoundException e) | |
63 | + { | |
64 | + Log.i(LOG_TAG, "AppManagementActivity#openApplicationManagement() : startActivity(" + intent + ") failed."); | |
65 | + } | |
66 | + } | |
67 | + } | |
68 | + | |
69 | + private Intent[] getApplicationManagementIntents() | |
70 | + { | |
71 | + if (applicationManagementIntents == null) | |
72 | + { | |
73 | + // API Level 9 or later | |
74 | + Intent intent0 = new Intent(Intent.ACTION_VIEW); | |
75 | + intent0.setClassName("com.android.settings", | |
76 | + "com.android.settings.applications.InstalledAppDetails"); | |
77 | + intent0.setData(Uri.fromParts("package", getPackageName(), null)); | |
78 | + intent0.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
79 | + | |
80 | + // API Level 8 or earlier | |
81 | + Intent intent1 = new Intent(Intent.ACTION_VIEW); | |
82 | + intent1.setClassName("com.android.settings", | |
83 | + "com.android.settings.InstalledAppDetails"); | |
84 | + intent1.putExtra("pkg", getPackageName()); | |
85 | + intent1.putExtra("com.android.settings.ApplicationPkgName", | |
86 | + getPackageName()); | |
87 | + intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
88 | + | |
89 | + // API Level 3(not in use?) | |
90 | + Intent intent2 = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS); | |
91 | + intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
92 | + | |
93 | + applicationManagementIntents = new Intent[] | |
94 | + { | |
95 | + intent0, intent1, intent2, | |
96 | + }; | |
97 | + } | |
98 | + return applicationManagementIntents; | |
99 | + } | |
100 | +} |
@@ -0,0 +1,89 @@ | ||
1 | +/* | |
2 | + * The MIT License | |
3 | + * | |
4 | + * Copyright 2011-2012 Masahiko, SAWAI <masahiko.sawai@gmail.com>. | |
5 | + * | |
6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | + * of this software and associated documentation files (the "Software"), to deal | |
8 | + * in the Software without restriction, including without limitation the rights | |
9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | + * copies of the Software, and to permit persons to whom the Software is | |
11 | + * furnished to do so, subject to the following conditions: | |
12 | + * | |
13 | + * The above copyright notice and this permission notice shall be included in | |
14 | + * all copies or substantial portions of the Software. | |
15 | + * | |
16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | + * THE SOFTWARE. | |
23 | + */ | |
24 | +package org.routine_work.android_r.about; | |
25 | + | |
26 | +import android.app.Activity; | |
27 | +import android.content.ActivityNotFoundException; | |
28 | +import android.content.Intent; | |
29 | +import android.net.Uri; | |
30 | +import android.os.Bundle; | |
31 | +import org.routine_work.utils.Log; | |
32 | + | |
33 | +/** | |
34 | + * | |
35 | + * @author Masahiko, SAWAI <masahiko.sawai@gmail.com> | |
36 | + */ | |
37 | +public class AppStoreActivity extends Activity | |
38 | +{ | |
39 | + | |
40 | + private static final String LOG_TAG = "simple-battery-logger"; | |
41 | + private Intent[] applicationStoreIntents; | |
42 | + | |
43 | + @Override | |
44 | + protected void onCreate(Bundle savedInstanceState) | |
45 | + { | |
46 | + super.onCreate(savedInstanceState); | |
47 | + finish(); | |
48 | + openApplicationStore(); | |
49 | + } | |
50 | + | |
51 | + private void openApplicationStore() | |
52 | + { | |
53 | + Intent[] intents = getApplicationStoreIntents(); | |
54 | + for (Intent intent : intents) | |
55 | + { | |
56 | + try | |
57 | + { | |
58 | + Log.d(LOG_TAG, "AppStoreActivity#openApplicationStore() : intent => " + intent); | |
59 | + startActivity(intent); | |
60 | + break; | |
61 | + } | |
62 | + catch (ActivityNotFoundException e) | |
63 | + { | |
64 | + Log.d(LOG_TAG, "AppStoreActivity#openApplicationStore() : startActivity(" + intent + ") failed."); | |
65 | + } | |
66 | + } | |
67 | + } | |
68 | + | |
69 | + private Intent[] getApplicationStoreIntents() | |
70 | + { | |
71 | + if (applicationStoreIntents == null) | |
72 | + { | |
73 | + String marketUri = String.format("market://details?id=%s", getPackageName()); | |
74 | + Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(marketUri)); | |
75 | + marketIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
76 | + | |
77 | + // For which market app (play app) is not installed. | |
78 | + String playStoreUri = String.format("https://play.google.com/store/apps/details?id=%s", getPackageName()); | |
79 | + Intent httpPlayStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreUri)); | |
80 | + httpPlayStoreIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
81 | + | |
82 | + applicationStoreIntents = new Intent[] | |
83 | + { | |
84 | + marketIntent, httpPlayStoreIntent, | |
85 | + }; | |
86 | + } | |
87 | + return applicationStoreIntents; | |
88 | + } | |
89 | +} |
@@ -21,28 +21,25 @@ | ||
21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 | * THE SOFTWARE. |
23 | 23 | */ |
24 | -package org.routine_work.android_r; | |
24 | +package org.routine_work.android_r.about; | |
25 | 25 | |
26 | 26 | import android.app.Activity; |
27 | -import android.content.ActivityNotFoundException; | |
28 | -import android.content.Intent; | |
29 | 27 | import android.content.pm.PackageInfo; |
30 | 28 | import android.content.pm.PackageManager; |
31 | 29 | import android.content.pm.PackageManager.NameNotFoundException; |
32 | -import android.net.Uri; | |
33 | 30 | import android.os.Bundle; |
34 | 31 | import android.text.format.DateFormat; |
35 | 32 | import android.view.Menu; |
36 | 33 | import android.view.MenuInflater; |
37 | 34 | import android.view.MenuItem; |
38 | -import android.view.View; | |
39 | -import android.widget.Button; | |
40 | 35 | import android.widget.TextView; |
41 | 36 | import java.io.FileInputStream; |
42 | 37 | import java.io.IOException; |
43 | 38 | import java.util.Date; |
44 | 39 | import java.util.zip.ZipEntry; |
45 | 40 | import java.util.zip.ZipInputStream; |
41 | +import org.routine_work.android_r.DashboardActivity; | |
42 | +import org.routine_work.android_r.R; | |
46 | 43 | import org.routine_work.utils.Log; |
47 | 44 | import org.routine_work.utils.SystemResourceUtils; |
48 | 45 |
@@ -50,25 +47,16 @@ import org.routine_work.utils.SystemResourceUtils; | ||
50 | 47 | * |
51 | 48 | * @author Masahiko, SAWAI <masahiko.sawai@gmail.com> |
52 | 49 | */ |
53 | -public class AboutAppActivity extends Activity | |
54 | - implements View.OnClickListener | |
50 | +public class AppVersionActivity extends Activity | |
55 | 51 | { |
56 | 52 | |
57 | - private static final String LOG_TAG = "android.R"; | |
58 | - private Intent[] applicationManagementIntents; | |
59 | - private Intent[] applicationStoreIntents; | |
53 | + private static final String LOG_TAG = "simple-battery-logger"; | |
60 | 54 | |
61 | 55 | @Override |
62 | 56 | protected void onCreate(Bundle savedInstanceState) |
63 | 57 | { |
64 | 58 | super.onCreate(savedInstanceState); |
65 | - setContentView(R.layout.about_app_activity); | |
66 | - | |
67 | - // init buttons | |
68 | - Button openApplicationStoreButton = (Button) findViewById(R.id.open_application_store_button); | |
69 | - openApplicationStoreButton.setOnClickListener(this); | |
70 | - Button openApplicationManagementButton = (Button) findViewById(R.id.open_application_management_button); | |
71 | - openApplicationManagementButton.setOnClickListener(this); | |
59 | + setContentView(R.layout.app_version_activity); | |
72 | 60 | |
73 | 61 | // init package build time |
74 | 62 | Date buildTime = getPackageBuildTime(); |
@@ -133,113 +121,6 @@ public class AboutAppActivity extends Activity | ||
133 | 121 | return result; |
134 | 122 | } |
135 | 123 | |
136 | - @Override | |
137 | - public void onClick(View view) | |
138 | - { | |
139 | - int id = view.getId(); | |
140 | - switch (id) | |
141 | - { | |
142 | - case R.id.open_application_store_button: | |
143 | - openApplicationStore(); | |
144 | - break; | |
145 | - case R.id.open_application_management_button: | |
146 | - openApplicationManagement(); | |
147 | - break; | |
148 | - default: | |
149 | - throw new AssertionError(); | |
150 | - } | |
151 | - } | |
152 | - | |
153 | - private void openApplicationStore() | |
154 | - { | |
155 | - Intent[] intents = getApplicationStoreIntents(); | |
156 | - for (Intent intent : intents) | |
157 | - { | |
158 | - try | |
159 | - { | |
160 | - Log.i(LOG_TAG, "AboutAppActivity#openApplicationStore() : intent => " + intent); | |
161 | - startActivity(intent); | |
162 | - break; | |
163 | - } | |
164 | - catch (ActivityNotFoundException e) | |
165 | - { | |
166 | - Log.i(LOG_TAG, "AboutAppActivity#openApplicationStore() : startActivity(" + intent + ") failed."); | |
167 | - } | |
168 | - } | |
169 | - | |
170 | - } | |
171 | - | |
172 | - private void openApplicationManagement() | |
173 | - { | |
174 | - Intent[] intents = getApplicationManagementIntents(); | |
175 | - for (Intent intent : intents) | |
176 | - { | |
177 | - try | |
178 | - { | |
179 | - Log.i(LOG_TAG, "open application management : intent => " + intent); | |
180 | - startActivity(intent); | |
181 | - break; | |
182 | - } | |
183 | - catch (ActivityNotFoundException e) | |
184 | - { | |
185 | - Log.i(LOG_TAG, "open application management : startActivity(" + intent + ") failed."); | |
186 | - } | |
187 | - } | |
188 | - } | |
189 | - | |
190 | - private Intent[] getApplicationStoreIntents() | |
191 | - { | |
192 | - if (applicationStoreIntents == null) | |
193 | - { | |
194 | - String marketUri = String.format("market://details?id=%s", getPackageName()); | |
195 | - Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(marketUri)); | |
196 | - marketIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
197 | - | |
198 | - // For which market app (play app) is not installed. | |
199 | - String playStoreUri = String.format("https://play.google.com/store/apps/details?id=%s", getPackageName()); | |
200 | - Intent httpPlayStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreUri)); | |
201 | - httpPlayStoreIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
202 | - | |
203 | - applicationStoreIntents = new Intent[] | |
204 | - { | |
205 | - marketIntent, httpPlayStoreIntent, | |
206 | - }; | |
207 | - } | |
208 | - return applicationStoreIntents; | |
209 | - } | |
210 | - | |
211 | - private Intent[] getApplicationManagementIntents() | |
212 | - { | |
213 | - if (applicationManagementIntents == null) | |
214 | - { | |
215 | - // API Level 9 or later | |
216 | - Intent intent0 = new Intent(Intent.ACTION_VIEW); | |
217 | - intent0.setClassName("com.android.settings", | |
218 | - "com.android.settings.applications.InstalledAppDetails"); | |
219 | - intent0.setData(Uri.fromParts("package", getPackageName(), null)); | |
220 | - intent0.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
221 | - | |
222 | - // API Level 8 or earlier | |
223 | - Intent intent1 = new Intent(Intent.ACTION_VIEW); | |
224 | - intent1.setClassName("com.android.settings", | |
225 | - "com.android.settings.InstalledAppDetails"); | |
226 | - intent1.putExtra("pkg", getPackageName()); | |
227 | - intent1.putExtra("com.android.settings.ApplicationPkgName", | |
228 | - getPackageName()); | |
229 | - intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
230 | - | |
231 | - // API Level 3(not in use?) | |
232 | - Intent intent2 = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS); | |
233 | - intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
234 | - | |
235 | - applicationManagementIntents = new Intent[] | |
236 | - { | |
237 | - intent0, intent1, intent2, | |
238 | - }; | |
239 | - } | |
240 | - return applicationManagementIntents; | |
241 | - } | |
242 | - | |
243 | 124 | private Date getPackageBuildTime() |
244 | 125 | { |
245 | 126 | final String targetFileName = "classes.dex"; |