• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Android Samples


Commit MetaInfo

Revisionf3e5a159edad107df0ca1ea82152da27ecfd30ad (tree)
Zeit2014-04-25 04:15:42
AutorMasahiko, SAWAI <say@user...>
CommiterMasahiko, SAWAI

Log Message

Added navigation-drawer-hello module

Ändern Zusammenfassung

Diff

--- /dev/null
+++ b/navigation-drawer-hello/AndroidManifest.xml
@@ -0,0 +1,27 @@
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.navigation_drawer_hello"
5+ android:versionCode="1"
6+ android:versionName="1.0"
7+>
8+ <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19" />
9+
10+ <application
11+ android:label="@string/app_name"
12+ >
13+ <activity
14+ android:name="MainActivity"
15+ android:label="@string/app_name"
16+ >
17+ <intent-filter>
18+ <action android:name="android.intent.action.MAIN" />
19+ <category android:name="android.intent.category.LAUNCHER" />
20+ </intent-filter>
21+ </activity>
22+ </application>
23+
24+ <!--
25+ <uses-permission android:name="android.permission.INTERNET" />
26+ -->
27+</manifest>
--- /dev/null
+++ b/navigation-drawer-hello/Makefile
@@ -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 $@
--- /dev/null
+++ b/navigation-drawer-hello/README.txt
@@ -0,0 +1,39 @@
1+! navigation-drawer-hello
2+
3+v4 suport library を使って Navigation Drawer を使うサンプル。
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+* 以下のレイアウトをルート要素とするレイアウトファイルを作成
18+ * android.support.v4.widget.DrawerLayout
19+* DrawerLayout の直下に以下の2つの要素を順番に配置
20+ * メインの内容
21+ * Drawer の内容
22+
23+
24+!! ビルドターゲット
25+
26+http://maven-android-plugin-m2site.googlecode.com/svn/plugin-info.html
27+
28+* mvn compile - アプリケーションのコンパイル
29+* mvn package - apk の作成
30+* mvn clean - ビルドファイルの削除
31+* mvn install - maven の local リポジトリにインストール
32+
33+* mvn android:deploy - エミュレータやデバイスにインストール
34+* mvn android:generate-sources
35+
36+* mvn install - アプリケーションのインストール
37+* mvn uninstall - アプリケーションのアンインストール
38+
39+
--- /dev/null
+++ b/navigation-drawer-hello/pom.xml
@@ -0,0 +1,147 @@
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>navigation-drawer-hello</artifactId>
10+ <packaging>apk</packaging>
11+ <version>1.0.0</version>
12+ <name>Navigatino Drawer : 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+ <scope>compile</scope>
44+ </dependency>
45+
46+ <dependency>
47+ <groupId>junit</groupId>
48+ <artifactId>junit</artifactId>
49+ <scope>test</scope>
50+ </dependency>
51+ </dependencies>
52+
53+ <build>
54+ <sourceDirectory>src</sourceDirectory>
55+
56+ <plugins>
57+ <plugin>
58+ <groupId>com.jayway.maven.plugins.android.generation2</groupId>
59+ <artifactId>android-maven-plugin</artifactId>
60+ <configuration>
61+ <sdk>
62+ <!--<path>${env.ANDROID_HOME}</path>-->
63+ <platform>14</platform>
64+ </sdk>
65+ </configuration>
66+ <extensions>true</extensions>
67+ </plugin>
68+
69+ <!-- mvn compile -->
70+ <plugin>
71+ <groupId>org.apache.maven.plugins</groupId>
72+ <artifactId>maven-compiler-plugin</artifactId>
73+ <configuration>
74+ <source>1.5</source>
75+ <target>1.5</target>
76+ <encoding>UTF-8</encoding>
77+ </configuration>
78+ </plugin>
79+
80+ <!-- mvn assembly:assembly -->
81+ <plugin>
82+ <groupId>org.apache.maven.plugins</groupId>
83+ <artifactId>maven-assembly-plugin</artifactId>
84+ <configuration>
85+ <descriptorRefs>
86+ <!--
87+ <descriptorRef>jar-with-dependencies</descriptorRef>
88+ <descriptorRef>bin</descriptorRef>
89+ <descriptorRef>src</descriptorRef>
90+ -->
91+ <descriptorRef>project</descriptorRef>
92+ </descriptorRefs>
93+ </configuration>
94+ </plugin>
95+
96+ <!-- mvn resources:resources -->
97+ <plugin>
98+ <groupId>org.apache.maven.plugins</groupId>
99+ <artifactId>maven-resources-plugin</artifactId>
100+ <configuration>
101+ <encoding>UTF-8</encoding>
102+ </configuration>
103+ </plugin>
104+
105+ <!-- mvn site -->
106+ <plugin>
107+ <groupId>org.apache.maven.plugins</groupId>
108+ <artifactId>maven-site-plugin</artifactId>
109+ <configuration>
110+ <locales>en</locales>
111+ <inputEncoding>UTF-8</inputEncoding>
112+ <outputEncoding>UTF-8</outputEncoding>
113+
114+ <reportPlugins>
115+ <plugin>
116+ <groupId>org.apache.maven.plugins</groupId>
117+ <artifactId>maven-project-info-reports-plugin</artifactId>
118+ </plugin>
119+
120+ <!-- mvn javadoc:javadoc -->
121+ <plugin>
122+ <groupId>org.apache.maven.plugins</groupId>
123+ <artifactId>maven-javadoc-plugin</artifactId>
124+ <configuration>
125+ <charset>utf-8</charset>
126+ </configuration>
127+ </plugin>
128+ </reportPlugins>
129+ </configuration>
130+ </plugin>
131+
132+ </plugins>
133+
134+ <!-- mvn resources:resources -->
135+ <resources>
136+ <resource>
137+ <directory>res</directory>
138+ <filtering>false</filtering>
139+ <includes>
140+ <include>**/*.properties</include>
141+ </includes>
142+ </resource>
143+ </resources>
144+ </build>
145+
146+
147+</project>
--- /dev/null
+++ b/navigation-drawer-hello/res/layout/main_activity.xml
@@ -0,0 +1,40 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<android.support.v4.widget.DrawerLayout
3+ xmlns:android="http://schemas.android.com/apk/res/android"
4+ android:id="@+id/drawer_layout"
5+ android:layout_width="fill_parent"
6+ android:layout_height="fill_parent"
7+>
8+ <!-- main contents -->
9+ <LinearLayout
10+ android:orientation="vertical"
11+ android:layout_width="fill_parent"
12+ android:layout_height="fill_parent"
13+ >
14+ <TextView
15+ android:layout_width="fill_parent"
16+ android:layout_height="fill_parent"
17+ android:gravity="center"
18+ android:text="@string/main"
19+ android:textSize="24sp"
20+ />
21+ </LinearLayout>
22+
23+ <!-- navigation drawer contents -->
24+ <LinearLayout
25+ android:orientation="vertical"
26+ android:layout_width="fill_parent"
27+ android:layout_height="fill_parent"
28+ android:layout_gravity="left"
29+ android:background="#6333"
30+ >
31+ <TextView
32+ android:layout_width="fill_parent"
33+ android:layout_height="fill_parent"
34+ android:gravity="center"
35+ android:text="@string/navigation_drawer"
36+ android:textSize="18sp"
37+ />
38+ </LinearLayout>
39+
40+</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
--- /dev/null
+++ b/navigation-drawer-hello/res/values/strings.xml
@@ -0,0 +1,8 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<resources>
3+ <string name="app_name">Navigation Drawer</string>
4+
5+ <string name="main">Main Contents</string>
6+ <string name="navigation_drawer">Navigatino Drawer</string>
7+
8+</resources>
--- /dev/null
+++ b/navigation-drawer-hello/src/com/example/hello/android/navigation_drawer_hello/MainActivity.java
@@ -0,0 +1,38 @@
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.navigation_drawer_hello;
25+
26+import android.app.Activity;
27+import android.os.Bundle;
28+
29+public class MainActivity extends Activity
30+{
31+
32+ @Override
33+ protected void onCreate(Bundle savedInstanceState)
34+ {
35+ super.onCreate(savedInstanceState);
36+ setContentView(R.layout.main_activity);
37+ }
38+}