Android Samples
Révision | a4a0dedb5749a26da682f585099c0c70d491e5a7 (tree) |
---|---|
l'heure | 2013-10-28 16:23:31 |
Auteur | Masahiko, SAWAI <say@user...> |
Commiter | Masahiko, SAWAI |
Added v7-appcompat-actionbar example projects.
@@ -0,0 +1,28 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<manifest | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + package="com.example.hello.android.appcompat_actionbar_hello" | |
5 | + android:versionCode="1" | |
6 | + android:versionName="1.0" | |
7 | +> | |
8 | + <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" /> | |
9 | + | |
10 | + <application | |
11 | + android:label="@string/app_name" | |
12 | + android:theme="@style/Theme.AppCompat.Light" | |
13 | + > | |
14 | + <activity | |
15 | + android:name="MainActivity" | |
16 | + android:label="@string/app_name" | |
17 | + > | |
18 | + <intent-filter> | |
19 | + <action android:name="android.intent.action.MAIN" /> | |
20 | + <category android:name="android.intent.category.LAUNCHER" /> | |
21 | + </intent-filter> | |
22 | + </activity> | |
23 | + </application> | |
24 | + | |
25 | + <!-- | |
26 | + <uses-permission android:name="android.permission.INTERNET" /> | |
27 | + --> | |
28 | +</manifest> |
@@ -0,0 +1,47 @@ | ||
1 | +RELEASE_PROFILE=android-hello | |
2 | + | |
3 | +all : package | |
4 | + | |
5 | +#################### build | |
6 | + | |
7 | +compile : | |
8 | + mvn $@ | |
9 | + | |
10 | +gen : | |
11 | + mvn android:generate-sources | |
12 | + | |
13 | +package : | |
14 | + mvn $@ | |
15 | + | |
16 | +release : | |
17 | + mvn clean && mvn -P$(RELEASE_PROFILE) package | |
18 | + | |
19 | +install : | |
20 | + mvn $@ | |
21 | + | |
22 | +deploy : | |
23 | + mvn package android:deploy | |
24 | + | |
25 | +undeploy : | |
26 | + mvn android:undeploy | |
27 | + | |
28 | +rebuild : | |
29 | + mvn clean package | |
30 | + | |
31 | +redeploy : | |
32 | + mvn clean package android:deploy | |
33 | + | |
34 | + | |
35 | +#################### emulator | |
36 | +start : | |
37 | + mvn android:emulator-start | |
38 | + | |
39 | +stop : | |
40 | + mvn android:emulator-stop | |
41 | + | |
42 | +#################### project | |
43 | +dist : | |
44 | + mvn assembly:assembly | |
45 | + | |
46 | +clean : | |
47 | + mvn $@ |
@@ -0,0 +1,47 @@ | ||
1 | +! appcompat-actionbar-hello(API Level 7) | |
2 | + | |
3 | +v7 appcompat library を使って ActionBar を使うサンプル。 | |
4 | + | |
5 | + | |
6 | +!! maven プロジェクトの設定 | |
7 | + | |
8 | +* android-maven-plugin の platform は 14 以降に設定 | |
9 | +* dependency の Android SDK のバージョンを Android 2.1 以降に設定 | |
10 | +* dependency に type が apklib の compatibility-v7-appcompat を追加 | |
11 | +* dependency に type が jar の compatibility-v7-appcompat を追加 | |
12 | +* dependency に type が jar の compatibility-v4 を追加 | |
13 | + | |
14 | + | |
15 | +!! 手順 | |
16 | + | |
17 | +使い方は ActionBar 標準のものと同じ。 | |
18 | + | |
19 | +AppCompat ActionBar では以下のクラスを使うことになる。 | |
20 | +* android.support.v7.app.ActionBarActivity | |
21 | + | |
22 | +テーマはAppCompatの提供するものをベースとする必要がある。 | |
23 | +* Theme.AppCompat | |
24 | +* Theme.AppCompat.Light | |
25 | +* Theme.AppCompat.Light.DarkActionBar | |
26 | + | |
27 | +メニューをXMLで定義する場合には、アクションアイテムをつかうには、 | |
28 | +android:showAsAction の代わりにアプリケーションの名前空間を定義して | |
29 | + myapp:showAsAction などと指定する必要がある。 | |
30 | + | |
31 | + | |
32 | +!! ビルドターゲット | |
33 | + | |
34 | +http://maven-android-plugin-m2site.googlecode.com/svn/plugin-info.html | |
35 | + | |
36 | +* mvn compile - アプリケーションのコンパイル | |
37 | +* mvn package - apk の作成 | |
38 | +* mvn clean - ビルドファイルの削除 | |
39 | +* mvn install - maven の local リポジトリにインストール | |
40 | + | |
41 | +* mvn android:deploy - エミュレータやデバイスにインストール | |
42 | +* mvn android:generate-sources | |
43 | + | |
44 | +* mvn install - アプリケーションのインストール | |
45 | +* mvn uninstall - アプリケーションのアンインストール | |
46 | + | |
47 | + |
@@ -0,0 +1,168 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<project | |
3 | + xmlns="http://maven.apache.org/POM/4.0.0" | |
4 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
5 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" | |
6 | +> | |
7 | + <modelVersion>4.0.0</modelVersion> | |
8 | + <groupId>com.example.hello</groupId> | |
9 | + <artifactId>appcompat-actionbar-hello</artifactId> | |
10 | + <packaging>apk</packaging> | |
11 | + <version>1.0.0</version> | |
12 | + <name>ActionBar AppCompat : Hello</name> | |
13 | + | |
14 | + <parent> | |
15 | + <groupId>com.example.hello</groupId> | |
16 | + <artifactId>android-samples</artifactId> | |
17 | + <version>1.0.0</version> | |
18 | + </parent> | |
19 | + | |
20 | + <dependencies> | |
21 | + | |
22 | + <dependency> | |
23 | + <groupId>android</groupId> | |
24 | + <artifactId>android</artifactId> | |
25 | + <version>2.1_r3</version> | |
26 | + <!-- | |
27 | + <version>1.5_r3</version> | |
28 | + <version>1.5_r4</version> | |
29 | + <version>1.6_r2</version> | |
30 | + <version>2.1.2</version> | |
31 | + <version>2.1_r1</version> | |
32 | + <version>2.2.1</version> | |
33 | + <version>2.3.1</version> | |
34 | + <version>2.3.3</version> | |
35 | + <version>4.0.1.2</version> | |
36 | + --> | |
37 | + <scope>provided</scope> | |
38 | + </dependency> | |
39 | + | |
40 | + <dependency> | |
41 | + <groupId>android.support</groupId> | |
42 | + <artifactId>compatibility-v4</artifactId> | |
43 | + <version>18</version> | |
44 | + <scope>compile</scope> | |
45 | + </dependency> | |
46 | + | |
47 | + <dependency> | |
48 | + <groupId>android.support</groupId> | |
49 | + <artifactId>compatibility-v7-appcompat</artifactId> | |
50 | + <version>18</version> | |
51 | + <type>apklib</type> | |
52 | + </dependency> | |
53 | + | |
54 | + <dependency> | |
55 | + <groupId>android.support</groupId> | |
56 | + <artifactId>compatibility-v7-appcompat</artifactId> | |
57 | + <version>18</version> | |
58 | + <scope>compile</scope> | |
59 | + </dependency> | |
60 | + | |
61 | + <dependency> | |
62 | + <groupId>junit</groupId> | |
63 | + <artifactId>junit</artifactId> | |
64 | + <scope>test</scope> | |
65 | + </dependency> | |
66 | + </dependencies> | |
67 | + | |
68 | + <build> | |
69 | + <sourceDirectory>src</sourceDirectory> | |
70 | + | |
71 | + <plugins> | |
72 | + <plugin> | |
73 | + <groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
74 | + <artifactId>android-maven-plugin</artifactId> | |
75 | + <configuration> | |
76 | + <sdk> | |
77 | + <path>${env.ANDROID_HOME}</path> | |
78 | + <!-- <path>C:/Java/android-sdk</path> --> | |
79 | + <platform>14</platform> | |
80 | + </sdk> | |
81 | + <proguard> | |
82 | + <skip>true</skip> | |
83 | + <config>proguard.conf</config> | |
84 | + </proguard> | |
85 | + <extractDuplicates>true</extractDuplicates> | |
86 | + </configuration> | |
87 | + <extensions>true</extensions> | |
88 | + </plugin> | |
89 | + | |
90 | + <!-- mvn compile --> | |
91 | + <plugin> | |
92 | + <groupId>org.apache.maven.plugins</groupId> | |
93 | + <artifactId>maven-compiler-plugin</artifactId> | |
94 | + <configuration> | |
95 | + <source>1.5</source> | |
96 | + <target>1.5</target> | |
97 | + <encoding>UTF-8</encoding> | |
98 | + </configuration> | |
99 | + </plugin> | |
100 | + | |
101 | + <!-- mvn assembly:assembly --> | |
102 | + <plugin> | |
103 | + <groupId>org.apache.maven.plugins</groupId> | |
104 | + <artifactId>maven-assembly-plugin</artifactId> | |
105 | + <configuration> | |
106 | + <descriptorRefs> | |
107 | + <!-- | |
108 | + <descriptorRef>jar-with-dependencies</descriptorRef> | |
109 | + <descriptorRef>bin</descriptorRef> | |
110 | + <descriptorRef>src</descriptorRef> | |
111 | + --> | |
112 | + <descriptorRef>project</descriptorRef> | |
113 | + </descriptorRefs> | |
114 | + </configuration> | |
115 | + </plugin> | |
116 | + | |
117 | + <!-- mvn resources:resources --> | |
118 | + <plugin> | |
119 | + <groupId>org.apache.maven.plugins</groupId> | |
120 | + <artifactId>maven-resources-plugin</artifactId> | |
121 | + <configuration> | |
122 | + <encoding>UTF-8</encoding> | |
123 | + </configuration> | |
124 | + </plugin> | |
125 | + | |
126 | + <!-- mvn site --> | |
127 | + <plugin> | |
128 | + <groupId>org.apache.maven.plugins</groupId> | |
129 | + <artifactId>maven-site-plugin</artifactId> | |
130 | + <configuration> | |
131 | + <locales>en</locales> | |
132 | + <inputEncoding>UTF-8</inputEncoding> | |
133 | + <outputEncoding>UTF-8</outputEncoding> | |
134 | + | |
135 | + <reportPlugins> | |
136 | + <plugin> | |
137 | + <groupId>org.apache.maven.plugins</groupId> | |
138 | + <artifactId>maven-project-info-reports-plugin</artifactId> | |
139 | + </plugin> | |
140 | + | |
141 | + <!-- mvn javadoc:javadoc --> | |
142 | + <plugin> | |
143 | + <groupId>org.apache.maven.plugins</groupId> | |
144 | + <artifactId>maven-javadoc-plugin</artifactId> | |
145 | + <configuration> | |
146 | + <charset>utf-8</charset> | |
147 | + </configuration> | |
148 | + </plugin> | |
149 | + </reportPlugins> | |
150 | + </configuration> | |
151 | + </plugin> | |
152 | + | |
153 | + </plugins> | |
154 | + | |
155 | + <!-- mvn resources:resources --> | |
156 | + <resources> | |
157 | + <resource> | |
158 | + <directory>res</directory> | |
159 | + <filtering>false</filtering> | |
160 | + <includes> | |
161 | + <include>**/*.properties</include> | |
162 | + </includes> | |
163 | + </resource> | |
164 | + </resources> | |
165 | + </build> | |
166 | + | |
167 | + | |
168 | +</project> |
@@ -0,0 +1,16 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + android:orientation="vertical" | |
5 | + android:layout_width="fill_parent" | |
6 | + android:layout_height="fill_parent" | |
7 | +> | |
8 | + <TextView | |
9 | + android:layout_width="fill_parent" | |
10 | + android:layout_height="fill_parent" | |
11 | + android:gravity="center" | |
12 | + android:text="@string/hello" | |
13 | + android:textSize="24sp" | |
14 | + /> | |
15 | +</LinearLayout> | |
16 | + |
@@ -0,0 +1,54 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<menu | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + xmlns:actionbarappcompat="http://schemas.android.com/apk/res-auto" | |
5 | +> | |
6 | + <!-- | |
7 | + showAsAction | |
8 | + - ifRoom | |
9 | + - always | |
10 | + - never | |
11 | + - withText | |
12 | + - collapseActionView (API Level 14) | |
13 | + --> | |
14 | + <item | |
15 | + android:id="@+id/add_menuitem" | |
16 | + android:title="@string/add" | |
17 | + android:icon="@android:drawable/ic_menu_add" | |
18 | + android:numericShortcut="1" | |
19 | + android:alphabeticShortcut="a" | |
20 | + actionbarappcompat:showAsAction="always|withText" | |
21 | + /> | |
22 | + <item | |
23 | + android:id="@+id/edit_menuitem" | |
24 | + android:title="@string/edit" | |
25 | + android:icon="@android:drawable/ic_menu_edit" | |
26 | + android:numericShortcut="2" | |
27 | + android:alphabeticShortcut="e" | |
28 | + actionbarappcompat:showAsAction="ifRoom|withText" | |
29 | + /> | |
30 | + <item | |
31 | + android:id="@+id/delete_menuitem" | |
32 | + android:title="@string/delete" | |
33 | + android:icon="@android:drawable/ic_menu_delete" | |
34 | + android:numericShortcut="3" | |
35 | + android:alphabeticShortcut="d" | |
36 | + actionbarappcompat:showAsAction="ifRoom" | |
37 | + /> | |
38 | + <item | |
39 | + android:id="@+id/preferences_menuitem" | |
40 | + android:title="@string/preferences" | |
41 | + android:icon="@android:drawable/ic_menu_preferences" | |
42 | + android:numericShortcut="8" | |
43 | + android:alphabeticShortcut="p" | |
44 | + actionbarappcompat:showAsAction="never" | |
45 | + /> | |
46 | + <item | |
47 | + android:id="@+id/quit_menuitem" | |
48 | + android:title="@string/quit" | |
49 | + android:icon="@android:drawable/ic_menu_close_clear_cancel" | |
50 | + android:numericShortcut="9" | |
51 | + android:alphabeticShortcut="q" | |
52 | + actionbarappcompat:showAsAction="never" | |
53 | + /> | |
54 | +</menu> | |
\ No newline at end of file |
@@ -0,0 +1,13 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<resources> | |
3 | + <string name="app_name">AppCompat ActionBar</string> | |
4 | + <string name="hello">ActionBar AppCompat : Hello</string> | |
5 | + | |
6 | + <!-- menu item --> | |
7 | + <string name="add">Add</string> | |
8 | + <string name="edit">Edit</string> | |
9 | + <string name="delete">Delete</string> | |
10 | + <string name="preferences">Preferences</string> | |
11 | + <string name="quit">Quit</string> | |
12 | + | |
13 | +</resources> |
@@ -0,0 +1,48 @@ | ||
1 | +/* | |
2 | + * The MIT License | |
3 | + * | |
4 | + * Copyright 2013 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 com.example.hello.android.appcompat_actionbar_hello; | |
25 | + | |
26 | +import android.os.Bundle; | |
27 | +import android.support.v7.app.ActionBarActivity; | |
28 | +import android.view.Menu; | |
29 | +import android.view.MenuInflater; | |
30 | + | |
31 | +public class MainActivity extends ActionBarActivity | |
32 | +{ | |
33 | + | |
34 | + @Override | |
35 | + protected void onCreate(Bundle savedInstanceState) | |
36 | + { | |
37 | + super.onCreate(savedInstanceState); | |
38 | + setContentView(R.layout.main_activity); | |
39 | + } | |
40 | + | |
41 | + @Override | |
42 | + public boolean onCreateOptionsMenu(Menu menu) | |
43 | + { | |
44 | + MenuInflater menuInflater = getMenuInflater(); | |
45 | + menuInflater.inflate(R.menu.main_activity_option_menu, menu); | |
46 | + return true; | |
47 | + } | |
48 | +} |
@@ -0,0 +1,33 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<manifest | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + package="com.example.hello.android.appcompat_actionbar_split" | |
5 | + android:versionCode="1" | |
6 | + android:versionName="1.0" | |
7 | +> | |
8 | + <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" /> | |
9 | + | |
10 | + <application | |
11 | + android:label="@string/app_name" | |
12 | + android:theme="@style/Theme.AppCompat.Light" | |
13 | + > | |
14 | + <activity | |
15 | + android:name="MainActivity" | |
16 | + android:label="@string/app_name" | |
17 | + android:uiOptions="splitActionBarWhenNarrow" | |
18 | + > | |
19 | + <intent-filter> | |
20 | + <action android:name="android.intent.action.MAIN" /> | |
21 | + <category android:name="android.intent.category.LAUNCHER" /> | |
22 | + </intent-filter> | |
23 | + <meta-data | |
24 | + android:name="android.support.UI_OPTIONS" | |
25 | + android:value="splitActionBarWhenNarrow" | |
26 | + /> | |
27 | + </activity> | |
28 | + </application> | |
29 | + | |
30 | + <!-- | |
31 | + <uses-permission android:name="android.permission.INTERNET" /> | |
32 | + --> | |
33 | +</manifest> |
@@ -0,0 +1,47 @@ | ||
1 | +RELEASE_PROFILE=android-hello | |
2 | + | |
3 | +all : package | |
4 | + | |
5 | +#################### build | |
6 | + | |
7 | +compile : | |
8 | + mvn $@ | |
9 | + | |
10 | +gen : | |
11 | + mvn android:generate-sources | |
12 | + | |
13 | +package : | |
14 | + mvn $@ | |
15 | + | |
16 | +release : | |
17 | + mvn clean && mvn -P$(RELEASE_PROFILE) package | |
18 | + | |
19 | +install : | |
20 | + mvn $@ | |
21 | + | |
22 | +deploy : | |
23 | + mvn package android:deploy | |
24 | + | |
25 | +undeploy : | |
26 | + mvn android:undeploy | |
27 | + | |
28 | +rebuild : | |
29 | + mvn clean package | |
30 | + | |
31 | +redeploy : | |
32 | + mvn clean package android:deploy | |
33 | + | |
34 | + | |
35 | +#################### emulator | |
36 | +start : | |
37 | + mvn android:emulator-start | |
38 | + | |
39 | +stop : | |
40 | + mvn android:emulator-stop | |
41 | + | |
42 | +#################### project | |
43 | +dist : | |
44 | + mvn assembly:assembly | |
45 | + | |
46 | +clean : | |
47 | + mvn $@ |
@@ -0,0 +1,52 @@ | ||
1 | +! appcompat-actionbar-split(API Level 7) | |
2 | + | |
3 | +v7 appcompat library を使って ActionBar を使うサンプル。 | |
4 | +アクションバーをスプリットアクションバーにする。 | |
5 | + | |
6 | + | |
7 | +!! maven プロジェクトの設定 | |
8 | + | |
9 | +* appcompat-actionbar-hello と同様。 | |
10 | + | |
11 | + | |
12 | +!! 手順 | |
13 | + | |
14 | +スプリットアクションバーにする手順。 | |
15 | +通常は以下の両方を設定しておけばよい。 | |
16 | + | |
17 | +!!! Android 4.0 以降 | |
18 | + | |
19 | +AndroidManifest.xml の application 要素または activity 要素に | |
20 | +以下の属性を設定する。 | |
21 | + | |
22 | + android:uiOptions="splitActionBarWhenNarrow" | |
23 | + | |
24 | +!!! Android 2.3 以前 | |
25 | + | |
26 | +AndroidManifest.xml の application 要素または activity 要素の | |
27 | +子要素として以下の要素を追加する。 | |
28 | + | |
29 | +<meta-data android:name="android.support.UI_OPTIONS" android:value="splitActionBarWhenNarrow" /> | |
30 | + | |
31 | + | |
32 | +メニューをXMLで定義する場合には、アクションアイテムをつかうには、 | |
33 | +android:showAsAction の代わりにアプリケーションの名前空間を定義して | |
34 | + myapp:showAsAction などと指定する必要がある。 | |
35 | + | |
36 | + | |
37 | +!! ビルドターゲット | |
38 | + | |
39 | +http://maven-android-plugin-m2site.googlecode.com/svn/plugin-info.html | |
40 | + | |
41 | +* mvn compile - アプリケーションのコンパイル | |
42 | +* mvn package - apk の作成 | |
43 | +* mvn clean - ビルドファイルの削除 | |
44 | +* mvn install - maven の local リポジトリにインストール | |
45 | + | |
46 | +* mvn android:deploy - エミュレータやデバイスにインストール | |
47 | +* mvn android:generate-sources | |
48 | + | |
49 | +* mvn install - アプリケーションのインストール | |
50 | +* mvn uninstall - アプリケーションのアンインストール | |
51 | + | |
52 | + |
@@ -0,0 +1,168 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<project | |
3 | + xmlns="http://maven.apache.org/POM/4.0.0" | |
4 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
5 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" | |
6 | +> | |
7 | + <modelVersion>4.0.0</modelVersion> | |
8 | + <groupId>com.example.hello</groupId> | |
9 | + <artifactId>appcompat-actionbar-split</artifactId> | |
10 | + <packaging>apk</packaging> | |
11 | + <version>1.0.0</version> | |
12 | + <name>ActionBar AppCompat : Split</name> | |
13 | + | |
14 | + <parent> | |
15 | + <groupId>com.example.hello</groupId> | |
16 | + <artifactId>android-samples</artifactId> | |
17 | + <version>1.0.0</version> | |
18 | + </parent> | |
19 | + | |
20 | + <dependencies> | |
21 | + | |
22 | + <dependency> | |
23 | + <groupId>android</groupId> | |
24 | + <artifactId>android</artifactId> | |
25 | + <version>2.1_r3</version> | |
26 | + <!-- | |
27 | + <version>1.5_r3</version> | |
28 | + <version>1.5_r4</version> | |
29 | + <version>1.6_r2</version> | |
30 | + <version>2.1.2</version> | |
31 | + <version>2.1_r1</version> | |
32 | + <version>2.2.1</version> | |
33 | + <version>2.3.1</version> | |
34 | + <version>2.3.3</version> | |
35 | + <version>4.0.1.2</version> | |
36 | + --> | |
37 | + <scope>provided</scope> | |
38 | + </dependency> | |
39 | + | |
40 | + <dependency> | |
41 | + <groupId>android.support</groupId> | |
42 | + <artifactId>compatibility-v4</artifactId> | |
43 | + <version>18</version> | |
44 | + <scope>compile</scope> | |
45 | + </dependency> | |
46 | + | |
47 | + <dependency> | |
48 | + <groupId>android.support</groupId> | |
49 | + <artifactId>compatibility-v7-appcompat</artifactId> | |
50 | + <version>18</version> | |
51 | + <type>apklib</type> | |
52 | + </dependency> | |
53 | + | |
54 | + <dependency> | |
55 | + <groupId>android.support</groupId> | |
56 | + <artifactId>compatibility-v7-appcompat</artifactId> | |
57 | + <version>18</version> | |
58 | + <scope>compile</scope> | |
59 | + </dependency> | |
60 | + | |
61 | + <dependency> | |
62 | + <groupId>junit</groupId> | |
63 | + <artifactId>junit</artifactId> | |
64 | + <scope>test</scope> | |
65 | + </dependency> | |
66 | + </dependencies> | |
67 | + | |
68 | + <build> | |
69 | + <sourceDirectory>src</sourceDirectory> | |
70 | + | |
71 | + <plugins> | |
72 | + <plugin> | |
73 | + <groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
74 | + <artifactId>android-maven-plugin</artifactId> | |
75 | + <configuration> | |
76 | + <sdk> | |
77 | + <path>${env.ANDROID_HOME}</path> | |
78 | + <!-- <path>C:/Java/android-sdk</path> --> | |
79 | + <platform>14</platform> | |
80 | + </sdk> | |
81 | + <proguard> | |
82 | + <skip>true</skip> | |
83 | + <config>proguard.conf</config> | |
84 | + </proguard> | |
85 | + <extractDuplicates>true</extractDuplicates> | |
86 | + </configuration> | |
87 | + <extensions>true</extensions> | |
88 | + </plugin> | |
89 | + | |
90 | + <!-- mvn compile --> | |
91 | + <plugin> | |
92 | + <groupId>org.apache.maven.plugins</groupId> | |
93 | + <artifactId>maven-compiler-plugin</artifactId> | |
94 | + <configuration> | |
95 | + <source>1.5</source> | |
96 | + <target>1.5</target> | |
97 | + <encoding>UTF-8</encoding> | |
98 | + </configuration> | |
99 | + </plugin> | |
100 | + | |
101 | + <!-- mvn assembly:assembly --> | |
102 | + <plugin> | |
103 | + <groupId>org.apache.maven.plugins</groupId> | |
104 | + <artifactId>maven-assembly-plugin</artifactId> | |
105 | + <configuration> | |
106 | + <descriptorRefs> | |
107 | + <!-- | |
108 | + <descriptorRef>jar-with-dependencies</descriptorRef> | |
109 | + <descriptorRef>bin</descriptorRef> | |
110 | + <descriptorRef>src</descriptorRef> | |
111 | + --> | |
112 | + <descriptorRef>project</descriptorRef> | |
113 | + </descriptorRefs> | |
114 | + </configuration> | |
115 | + </plugin> | |
116 | + | |
117 | + <!-- mvn resources:resources --> | |
118 | + <plugin> | |
119 | + <groupId>org.apache.maven.plugins</groupId> | |
120 | + <artifactId>maven-resources-plugin</artifactId> | |
121 | + <configuration> | |
122 | + <encoding>UTF-8</encoding> | |
123 | + </configuration> | |
124 | + </plugin> | |
125 | + | |
126 | + <!-- mvn site --> | |
127 | + <plugin> | |
128 | + <groupId>org.apache.maven.plugins</groupId> | |
129 | + <artifactId>maven-site-plugin</artifactId> | |
130 | + <configuration> | |
131 | + <locales>en</locales> | |
132 | + <inputEncoding>UTF-8</inputEncoding> | |
133 | + <outputEncoding>UTF-8</outputEncoding> | |
134 | + | |
135 | + <reportPlugins> | |
136 | + <plugin> | |
137 | + <groupId>org.apache.maven.plugins</groupId> | |
138 | + <artifactId>maven-project-info-reports-plugin</artifactId> | |
139 | + </plugin> | |
140 | + | |
141 | + <!-- mvn javadoc:javadoc --> | |
142 | + <plugin> | |
143 | + <groupId>org.apache.maven.plugins</groupId> | |
144 | + <artifactId>maven-javadoc-plugin</artifactId> | |
145 | + <configuration> | |
146 | + <charset>utf-8</charset> | |
147 | + </configuration> | |
148 | + </plugin> | |
149 | + </reportPlugins> | |
150 | + </configuration> | |
151 | + </plugin> | |
152 | + | |
153 | + </plugins> | |
154 | + | |
155 | + <!-- mvn resources:resources --> | |
156 | + <resources> | |
157 | + <resource> | |
158 | + <directory>res</directory> | |
159 | + <filtering>false</filtering> | |
160 | + <includes> | |
161 | + <include>**/*.properties</include> | |
162 | + </includes> | |
163 | + </resource> | |
164 | + </resources> | |
165 | + </build> | |
166 | + | |
167 | + | |
168 | +</project> |
@@ -0,0 +1,16 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + android:orientation="vertical" | |
5 | + android:layout_width="fill_parent" | |
6 | + android:layout_height="fill_parent" | |
7 | +> | |
8 | + <TextView | |
9 | + android:layout_width="fill_parent" | |
10 | + android:layout_height="fill_parent" | |
11 | + android:gravity="center" | |
12 | + android:text="@string/hello" | |
13 | + android:textSize="24sp" | |
14 | + /> | |
15 | +</LinearLayout> | |
16 | + |
@@ -0,0 +1,54 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<menu | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + xmlns:actionbarappcompat="http://schemas.android.com/apk/res-auto" | |
5 | +> | |
6 | + <!-- | |
7 | + showAsAction | |
8 | + - ifRoom | |
9 | + - always | |
10 | + - never | |
11 | + - withText | |
12 | + - collapseActionView (API Level 14) | |
13 | + --> | |
14 | + <item | |
15 | + android:id="@+id/add_menuitem" | |
16 | + android:title="@string/add" | |
17 | + android:icon="@android:drawable/ic_menu_add" | |
18 | + android:numericShortcut="1" | |
19 | + android:alphabeticShortcut="a" | |
20 | + actionbarappcompat:showAsAction="always|withText" | |
21 | + /> | |
22 | + <item | |
23 | + android:id="@+id/edit_menuitem" | |
24 | + android:title="@string/edit" | |
25 | + android:icon="@android:drawable/ic_menu_edit" | |
26 | + android:numericShortcut="2" | |
27 | + android:alphabeticShortcut="e" | |
28 | + actionbarappcompat:showAsAction="ifRoom|withText" | |
29 | + /> | |
30 | + <item | |
31 | + android:id="@+id/delete_menuitem" | |
32 | + android:title="@string/delete" | |
33 | + android:icon="@android:drawable/ic_menu_delete" | |
34 | + android:numericShortcut="3" | |
35 | + android:alphabeticShortcut="d" | |
36 | + actionbarappcompat:showAsAction="ifRoom" | |
37 | + /> | |
38 | + <item | |
39 | + android:id="@+id/preferences_menuitem" | |
40 | + android:title="@string/preferences" | |
41 | + android:icon="@android:drawable/ic_menu_preferences" | |
42 | + android:numericShortcut="8" | |
43 | + android:alphabeticShortcut="p" | |
44 | + actionbarappcompat:showAsAction="never" | |
45 | + /> | |
46 | + <item | |
47 | + android:id="@+id/quit_menuitem" | |
48 | + android:title="@string/quit" | |
49 | + android:icon="@android:drawable/ic_menu_close_clear_cancel" | |
50 | + android:numericShortcut="9" | |
51 | + android:alphabeticShortcut="q" | |
52 | + actionbarappcompat:showAsAction="never" | |
53 | + /> | |
54 | +</menu> | |
\ No newline at end of file |
@@ -0,0 +1,13 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<resources> | |
3 | + <string name="app_name">AppCompat Split ActionBar</string> | |
4 | + <string name="hello">ActionBar AppCompat : Split</string> | |
5 | + | |
6 | + <!-- menu item --> | |
7 | + <string name="add">Add</string> | |
8 | + <string name="edit">Edit</string> | |
9 | + <string name="delete">Delete</string> | |
10 | + <string name="preferences">Preferences</string> | |
11 | + <string name="quit">Quit</string> | |
12 | + | |
13 | +</resources> |
@@ -0,0 +1,48 @@ | ||
1 | +/* | |
2 | + * The MIT License | |
3 | + * | |
4 | + * Copyright 2013 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 com.example.hello.android.appcompat_actionbar_split; | |
25 | + | |
26 | +import android.os.Bundle; | |
27 | +import android.support.v7.app.ActionBarActivity; | |
28 | +import android.view.Menu; | |
29 | +import android.view.MenuInflater; | |
30 | + | |
31 | +public class MainActivity extends ActionBarActivity | |
32 | +{ | |
33 | + | |
34 | + @Override | |
35 | + protected void onCreate(Bundle savedInstanceState) | |
36 | + { | |
37 | + super.onCreate(savedInstanceState); | |
38 | + setContentView(R.layout.main_activity); | |
39 | + } | |
40 | + | |
41 | + @Override | |
42 | + public boolean onCreateOptionsMenu(Menu menu) | |
43 | + { | |
44 | + MenuInflater menuInflater = getMenuInflater(); | |
45 | + menuInflater.inflate(R.menu.main_activity_option_menu, menu); | |
46 | + return true; | |
47 | + } | |
48 | +} |
@@ -37,6 +37,8 @@ | ||
37 | 37 | <module>actionmode-listview-in-fragment</module> |
38 | 38 | <module>android-app-hello</module> |
39 | 39 | <module>app-uuid-hello</module> |
40 | + <module>appcompat-actionbar-hello</module> | |
41 | + <module>appcompat-actionbar-split</module> | |
40 | 42 | <module>appwidget-gridview</module> |
41 | 43 | <module>appwidget-hello</module> |
42 | 44 | <module>appwidget-listview</module> |