diff --git a/AndroidTutorial4_1Update.md b/AndroidTutorial4_1Update.md new file mode 100755 index 0000000..c58e904 --- /dev/null +++ b/AndroidTutorial4_1Update.md @@ -0,0 +1,166 @@ +# 錯誤修正:4-1 使用照相機與麥克風 + +這一章加入的照相與錄音功能,把照片與錄音檔案名稱儲存在同一個欄位。在完成這一章的內容後依照下列的步驟修正錯誤: + +1. 開啟「Item.java」,加入下列的欄位與方法宣告: + + // 錄音檔案名稱 + private String recFileName; + + public String getRecFileName() { + return recFileName; + } + + public void setRecFileName(String recFileName) { + this.recFileName = recFileName; + } + +2. 同樣在「Item.java」,為建構子加入錄音檔案名稱參數: + + // 錄音檔案名稱參數:String recFileName + public Item(long id, long datetime, Colors color, String title, + String content, String fileName, String recFileName, + double latitude, double longitude, long lastModify) { + this.id = id; + this.datetime = datetime; + this.color = color; + this.title = title; + this.content = content; + this.fileName = fileName; + // 錄音檔案名稱 + this.recFileName = recFileName; + this.latitude = latitude; + this.longitude = longitude; + this.lastModify = lastModify; + } + +3. 開啟「ItemDAO.java」,加入與修改下列的欄位宣告: + + ... + // 錄音檔案名稱 + public static final String RECFILENAME_COLUMN = "recfilename"; + ... + // 在「FILENAME_COLUMN」下方加入錄音檔案名稱欄位 + public static final String CREATE_TABLE = + "CREATE TABLE " + TABLE_NAME + " (" + + ... + FILENAME_COLUMN + " TEXT, " + + RECFILENAME_COLUMN + " TEXT, " + // 增加錄音檔案名稱 + ..."; + +4. 同樣在「ItemDAO.java」,修改「insert」方法: + + public Item insert(Item item) { + ContentValues cv = new ContentValues(); + ... + cv.put(FILENAME_COLUMN, item.getFileName()); + // 錄音檔案名稱 + cv.put(RECFILENAME_COLUMN, item.getRecFileName()); + ... + } + +5. 同樣在「ItemDAO.java」,修改「update」方法: + + public boolean update(Item item) { + ContentValues cv = new ContentValues(); + + ... + cv.put(FILENAME_COLUMN, item.getFileName()); + // 錄音檔案名稱 + cv.put(RECFILENAME_COLUMN, item.getRecFileName()); + ... + } + +6. 同樣在「ItemDAO.java」,修改「getRecord」方法: + + public Item getRecord(Cursor cursor) { + ... + result.setFileName(cursor.getString(5)); + // 錄音檔案名稱 + result.setRecFileName(cursor.getString(6)); + // 後續的編號都要加一 + result.setLatitude(cursor.getDouble(7)); + ... + } + +7. 同樣在「ItemDAO.java」,修改「sample」方法: + + public void sample() { + // 增加錄音檔案名稱參數「""」 + Item item = new Item(0, new Date().getTime(), Colors.RED, "關於Android Tutorial的事情.", "Hello content", "", "", 0, 0, 0); + Item item2 = new Item(0, new Date().getTime(), Colors.BLUE, "一隻非常可愛的小狗狗!", "她的名字叫「大熱狗」,又叫\n作「奶嘴」,是一隻非常可愛\n的小狗。", "", "", 25.04719, 121.516981, 0); + Item item3 = new Item(0, new Date().getTime(), Colors.GREEN, "一首非常好聽的音樂!", "Hello content", "", "", 0, 0, 0); + Item item4 = new Item(0, new Date().getTime(), Colors.ORANGE, "儲存在資料庫的資料", "Hello content", "", "", 0, 0, 0); + + ... + } + +8. 開啟「MyDBHelper.java」,增加資料庫版本編號: + + // 資料庫版本,資料結構改變的時候要更改這個數字,通常是加一 + public static final int VERSION = 2; + +9. 開啟「ItemActivity.java」,增加錄音檔案名稱欄位變數: + + // 錄音檔案名稱 + private String recFileName; + +10. 同樣在「ItemActivity.java」,增加取得錄音檔案名稱的方法: + + private File configRecFileName(String prefix, String extension) { + // 如果記事資料已經有檔案名稱 + if (item.getRecFileName() != null && item.getRecFileName().length() > 0) { + recFileName = item.getRecFileName(); + } + // 產生檔案名稱 + else { + recFileName = FileUtil.getUniqueFileName(); + } + + return new File(FileUtil.getExternalStorageDir(FileUtil.APP_DIR), + prefix + recFileName + extension); + } + +11. 同樣在「ItemActivity.java」,修改啟動錄音元件的方法: + + public void clickFunction(View view) { + int id = view.getId(); + + switch (id) { + ... + case R.id.record_sound: + // 修改呼叫方法的名稱為「configRecFileName」 + final File recordFile = configRecFileName("R", ".mp3"); + + if (recordFile.exists()) { + ... + } + // 如果沒有錄音檔,啟動錄音元件 + else { + goToRecord(recordFile); + } + + break; + ... + } + + } + +12. 同樣在「ItemActivity.java」,找到「onActivityResult」方法,修改設定錄音檔案名稱呼叫的方法: + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (resultCode == Activity.RESULT_OK) { + switch (requestCode) { + ... + case START_RECORD: + // 修改設定錄音檔案名稱 + item.setRecFileName(recFileName); + break; + ... + } + } + } + + +完成全部的修改以後執行應用程式,測試同一個記事資料照相與錄音的功能。 diff --git a/AndroidTutorial5_Migrate.md b/AndroidTutorial5_Migrate.md new file mode 100755 index 0000000..294e6da --- /dev/null +++ b/AndroidTutorial5_Migrate.md @@ -0,0 +1,81 @@ +#從Eclipse ADT轉移到Android Studio +CodeDate的Android Studio系列專欄,在連載的中途發表Android 5 Lollipop,還有全新的開發工具Android Studio。因為版本與開發工具的變化非常大,因此決定把系列專欄昇級為Android 5與Android Studio,專欄與範例程式專案在2015/03/02同步更新。 + +因為之前的範例程式專案採用Eclipse ADT,如果你已經依照之前的專欄撰寫應用程式,可以考慮將它轉移到Android Studio,再繼續依照後續的專欄學習全新的Android Studio。 + +依照下列的步驟執行轉移的工作: + +1. 依照的說明,安裝好Android Studio開發環境。 +2. 啟動Android Studio,選擇「Import project(Eclipse ADT, Gradle, etc.)」: + + ![](https://github.com/macdidi5/AndroidTutorial/blob/master/images/migrate/AndroidTutorial5_migrate_01.png) + +3. 選擇使用Eclipse ADT開發的Android應用程式專案: + + ![](https://github.com/macdidi5/AndroidTutorial/blob/master/images/migrate/AndroidTutorial5_migrate_02.png) + +4. 選擇轉移後的專案儲存位置,選擇「Next」: + + ![](https://github.com/macdidi5/AndroidTutorial/blob/master/images/migrate/AndroidTutorial5_migrate_03.png) + +5. 選擇「Finish」: + + ![](https://github.com/macdidi5/AndroidTutorial/blob/master/images/migrate/AndroidTutorial5_migrate_04.png) + +6. 等候Android Studio完成轉換工作並開啟專案後,你會發現專案有一些錯誤。開啟「MyAndroidTutorial -> app -> build.gradle」,參考下面的內容,修改並儲存這個檔案(注意applicationId的設定,必須參考你實際的專案修正): + + apply plugin: 'com.android.application' + + android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "net.macdidi.myandroidtutorial" + minSdkVersion 15 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + } + + dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' + } + +7. 開啟「MyAndroidTutorial -> app -> src -> main -> AndroidManifest.xml」,參考下面的內容,修改並儲存這個檔案(移除SDK與版本設定): + + + + + + + + + + + + + + +8. 選擇「Try Again」: + + ![](https://github.com/macdidi5/AndroidTutorial/blob/master/images/migrate/AndroidTutorial5_migrate_05.png) + +9. 選擇「Yes」讓Android Studio關閉與重新啟動專案: + + ![](https://github.com/macdidi5/AndroidTutorial/blob/master/images/migrate/AndroidTutorial5_migrate_06.png) + +10. 接下來就可以依照專欄的內容,使用Android Studio開發工具繼續學習。 diff --git a/README.md b/README.md index baf8deb..8327779 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,42 @@ -#AndroidTutorial +#Android Tutorial + +### 2015/10/22:Android Tutorial系列專欄已經更新為Android 6,於2015/10/22開始連載,每週一篇,第一篇專欄 [http://www.codedata.com.tw/mobile/android-6-tutorial-1-1/](http://www.codedata.com.tw/mobile/android-6-tutorial-1-1/) 。GitHub在 [https://github.com/macdidi5/Android-6-Tutorial](https://github.com/macdidi5/Android-6-Tutorial) 。 + +### 2015/03/02:專欄與範例程式改為Android 5與Android Studio +### 需要從Eclipse ADT專案轉移到Android Studio,請參考AndroidTutorial5_Migrate.md文件的說明 你對「Tutorial」有什麼樣的感覺?每一種技術的Tutorial都告訴你這是學習的開始,不過最後好像都會變成折磨的開始。或許可以找出一種方式,讓Tutorial變成大家會很想要點它的超連結! 要認識一種開發技術,每個人選擇的方式都會不太一樣,如果再加上只能使用非常簡短的時間,你會選擇哪一種方式呢?我的決定是選一個Android APP! -這個Android APP會在短短六小時的課程內容,帶領你認識大部份Android APP開發時會遇到的主題,從APP的規劃開始,畫面、互動、資料庫、多媒體、檔案、服務、通知、位置、地圖還有小工具,這些就是你會學到的東西。 +這個Android APP會在六小時的課程內容,帶領你認識大部份Android APP開發時會遇到的主題,從APP的規劃開始,畫面、互動、資料庫、多媒體、檔案、服務、通知、位置、地圖還有小工具,這些就是你會學到的東西。 * Android Tutorial 第一堂 - * [西遊記裡的那隻潑猴](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-1-sunwukong/) - * [準備Android開發環境](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-2-android-sdk/) - * [開始設計Android應用程式](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-3-app-project/) - * [開發Android應用程式的準備工作](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-4-before-developing-an-app/) + * [(1)西遊記裡的那隻潑猴](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-1-sunwukong/) + * [(2)準備Android Studio開發環境](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-2-android-sdk/) + * [(3)開始設計Android應用程式](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-3-app-project/) + * [(4)開發Android應用程式的準備工作](http://www.codedata.com.tw/mobile/android-tutorial-the-1st-class-4-before-developing-an-app/) * Android Tutorial 第二堂 - * [建立應用程式需要的資源](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-1-res/) - * [設計應用程式使用者介面](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-2-ui/) - * [應用程式與使用者的互動](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-3-interaction/) - * 建立與使用Activity元件 + * [(1)建立應用程式需要的資源](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-1-res/) + * [(2)設計應用程式使用者介面](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-2-ui/) + * [(3)應用程式與使用者的互動](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-3-interaction/) + * [(4)建立與使用Activity元件](http://www.codedata.com.tw/mobile/android-tutorial-the-2nd-class-4-activity/) * Android Tutorial 第三堂 - * 為ListView元件建立自定畫面 - * 儲存與讀取應用程式資訊 - * 使用Android內建的SQLite資料庫 - * 存取Android檔案系統 + * [(1)為ListView元件建立自定畫面](http://www.codedata.com.tw/mobile/android-tutorial-the-3rd-class-1-listview/) + * [(2)儲存與讀取應用程式資訊](http://www.codedata.com.tw/mobile/android-tutorial-the-3rd-class-2-preference) + * [(3)使用Android內建的SQLite資料庫](http://www.codedata.com.tw/mobile/android-tutorial-the-3rd-class-3-sqlite/) * Android Tutorial 第四堂 - * 使用照相機與麥克風 + * [(1)使用照相機與麥克風](http://www.codedata.com.tw/mobile/android-tutorial-the-4th-class-1-camera-microphone/) + * [(2)設計地圖應用程式 - Google Maps Android API v2](http://www.codedata.com.tw/mobile/android-tutorial-the-4th-class-google-maps-android-api-v2/) + * [(3)讀取裝置目前的位置 - Google Services Location](http://www.codedata.com.tw/mobile/android-tutorial-the-4th-class-3-google-services-location/) +* Android Tutorial 第五堂 + * [(1) 建立廣播接收元件 - BroadcastReceiver](http://www.codedata.com.tw/mobile/android-tutorial-the-5th-class-1-broadcastreceiver-alarmmanager/) + * [(2) 系統通知服務 - Notification](http://www.codedata.com.tw/mobile/android-tutorial-the-5th-class-2-notification/) + * [(3) 設計小工具元件 - AppWidget](http://www.codedata.com.tw/mobile/android-tutorial-the-5th-class-3-appwidget/) +* Android Tutorial 第六堂 + * [(1) Material Design - Theme與Transition](http://www.codedata.com.tw/mobile/android-tutorial-the-6th-class-material-design-theme-transition/) + * [(2) Material Design - RecylerView](http://www.codedata.com.tw/mobile/android-tutorial-the-6th-class-2-material-design-recylerview/) + * [(3) Material Design - Shared Element與自定動畫效果](http://www.codedata.com.tw/mobile/android-tutorial-the-6th-class-material-design-shared-element/) =============== http://www.codedata.com.tw/author/michael diff --git a/examples/0201/MyAndroidTutorial/.classpath b/examples/0201/MyAndroidTutorial/.classpath deleted file mode 100644 index 7bc01d9..0000000 --- a/examples/0201/MyAndroidTutorial/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/examples/0201/MyAndroidTutorial/.gitignore b/examples/0201/MyAndroidTutorial/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/examples/0201/MyAndroidTutorial/.idea/.name b/examples/0201/MyAndroidTutorial/.idea/.name new file mode 100644 index 0000000..5bb7a85 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/.name @@ -0,0 +1 @@ +MyAndroidTutorial \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/.idea/compiler.xml b/examples/0201/MyAndroidTutorial/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/examples/0201/MyAndroidTutorial/.idea/copyright/profiles_settings.xml b/examples/0201/MyAndroidTutorial/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/.idea/encodings.xml b/examples/0201/MyAndroidTutorial/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/0201/MyAndroidTutorial/.idea/gradle.xml b/examples/0201/MyAndroidTutorial/.idea/gradle.xml new file mode 100644 index 0000000..fe865d3 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/.idea/misc.xml b/examples/0201/MyAndroidTutorial/.idea/misc.xml new file mode 100644 index 0000000..9076de5 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/.idea/modules.xml b/examples/0201/MyAndroidTutorial/.idea/modules.xml new file mode 100644 index 0000000..327df67 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/.idea/scopes/scope_settings.xml b/examples/0201/MyAndroidTutorial/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/.idea/vcs.xml b/examples/0201/MyAndroidTutorial/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/examples/0201/MyAndroidTutorial/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/.project b/examples/0201/MyAndroidTutorial/.project deleted file mode 100644 index b1de407..0000000 --- a/examples/0201/MyAndroidTutorial/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - MyAndroidTutorial - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/examples/0201/MyAndroidTutorial/AndroidManifest.xml b/examples/0201/MyAndroidTutorial/AndroidManifest.xml deleted file mode 100644 index 470193a..0000000 --- a/examples/0201/MyAndroidTutorial/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/0201/MyAndroidTutorial/MyAndroidTutorial.iml b/examples/0201/MyAndroidTutorial/MyAndroidTutorial.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/MyAndroidTutorial.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/app/.gitignore b/examples/0201/MyAndroidTutorial/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/examples/0201/MyAndroidTutorial/app/app.iml b/examples/0201/MyAndroidTutorial/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/app/build.gradle b/examples/0201/MyAndroidTutorial/app/build.gradle new file mode 100644 index 0000000..b09f064 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "net.macdidi.myandroidtutorial" + minSdkVersion 15 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' +} diff --git a/examples/0201/MyAndroidTutorial/app/proguard-rules.pro b/examples/0201/MyAndroidTutorial/app/proguard-rules.pro new file mode 100644 index 0000000..b5fa7ec --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/macdidi5/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/examples/0201/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java b/examples/0201/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java new file mode 100644 index 0000000..2cb214e --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java @@ -0,0 +1,13 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/app/src/main/AndroidManifest.xml b/examples/0201/MyAndroidTutorial/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c325305 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0201/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java new file mode 100644 index 0000000..ba500a4 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java @@ -0,0 +1,24 @@ +package net.macdidi.myandroidtutorial; + +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.view.Menu; + + +public class MainActivity extends ActionBarActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + +} diff --git a/examples/0201/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/examples/0201/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/examples/0201/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/examples/0201/MyAndroidTutorial/res/drawable/alarm_icon.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable/alarm_icon.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png diff --git a/examples/0201/MyAndroidTutorial/res/drawable/location_icon.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable/location_icon.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png diff --git a/examples/0201/MyAndroidTutorial/res/drawable/record_sound_icon.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable/record_sound_icon.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml new file mode 100644 index 0000000..51d1e84 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/res/drawable/select_color_icon.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable/select_color_icon.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png diff --git a/examples/0201/MyAndroidTutorial/res/drawable/take_picture_icon.png b/examples/0201/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png similarity index 100% rename from examples/0201/MyAndroidTutorial/res/drawable/take_picture_icon.png rename to examples/0201/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..dafb0f1 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..7e74561 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/values-en/strings.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/values-en/strings.xml new file mode 100644 index 0000000..c532533 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/values-en/strings.xml @@ -0,0 +1,12 @@ + + + + MyAndroidTutorial + Hello world! + Settings + + Title + Enter title + Content + Enter content + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/values/colors.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..8d8f719 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #CCCCCC + #AAAAAA + #DD999999 + \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/values/dimens.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..75e4541 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/values/dimens.xml @@ -0,0 +1,8 @@ + + + 16dp + 16dp + + 6dp + 24sp + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/values/strings.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..d07b4bc --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/values/strings.xml @@ -0,0 +1,12 @@ + + + + MyAndroidTutorial + Hello world! + Settings + + 標題 + 輸入標題 + 內容 + 輸入內容 + diff --git a/examples/0201/MyAndroidTutorial/app/src/main/res/values/styles.xml b/examples/0201/MyAndroidTutorial/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/examples/0201/MyAndroidTutorial/bin/AndroidManifest.xml b/examples/0201/MyAndroidTutorial/bin/AndroidManifest.xml deleted file mode 100644 index 470193a..0000000 --- a/examples/0201/MyAndroidTutorial/bin/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/0201/MyAndroidTutorial/bin/MyAndroidTutorial.apk b/examples/0201/MyAndroidTutorial/bin/MyAndroidTutorial.apk deleted file mode 100644 index c207fad..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/MyAndroidTutorial.apk and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes.dex b/examples/0201/MyAndroidTutorial/bin/classes.dex deleted file mode 100644 index 05ee105..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes.dex and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class deleted file mode 100644 index 30f5623..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class deleted file mode 100644 index ebf86cf..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class deleted file mode 100644 index 9d83559..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class deleted file mode 100644 index 10fa364..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class deleted file mode 100644 index fef097c..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class deleted file mode 100644 index ed9bcd0..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class deleted file mode 100644 index be68360..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class deleted file mode 100644 index 6b84f81..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class deleted file mode 100644 index a5baaf9..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class deleted file mode 100644 index 3fd356f..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class deleted file mode 100644 index 5833285..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class b/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class deleted file mode 100644 index 3be8276..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar b/examples/0201/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar deleted file mode 100644 index 80a2884..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/jarlist.cache b/examples/0201/MyAndroidTutorial/bin/jarlist.cache deleted file mode 100644 index 0565465..0000000 --- a/examples/0201/MyAndroidTutorial/bin/jarlist.cache +++ /dev/null @@ -1,3 +0,0 @@ -# cache for current jar dependency. DO NOT EDIT. -# format is -# Encoding is UTF-8 diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png deleted file mode 100644 index bcfa058..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 85848ff..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 916901e..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png deleted file mode 100644 index ebeae27..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png deleted file mode 100644 index 6897a97..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png deleted file mode 100644 index 6fe2060..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png deleted file mode 100644 index 4270ec5..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png b/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png deleted file mode 100644 index c812e2f..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/bin/resources.ap_ b/examples/0201/MyAndroidTutorial/bin/resources.ap_ deleted file mode 100644 index 39f817a..0000000 Binary files a/examples/0201/MyAndroidTutorial/bin/resources.ap_ and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/build.gradle b/examples/0201/MyAndroidTutorial/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/examples/0201/MyAndroidTutorial/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/examples/0201/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java b/examples/0201/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java deleted file mode 100644 index 5d44ea9..0000000 --- a/examples/0201/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java +++ /dev/null @@ -1,6 +0,0 @@ -/** Automatically generated file. DO NOT MODIFY */ -package net.macdidi.myandroidtutorial; - -public final class BuildConfig { - public final static boolean DEBUG = true; -} \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java b/examples/0201/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java deleted file mode 100644 index d7fa44c..0000000 --- a/examples/0201/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java +++ /dev/null @@ -1,83 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package net.macdidi.myandroidtutorial; - -public final class R { - public static final class attr { - } - public static final class color { - public static final int divider_color=0x7f040002; - public static final int grey=0x7f040001; - public static final int light_grey=0x7f040000; - } - public static final class dimen { - public static final int default_padding=0x7f050000; - public static final int title_txt_size=0x7f050001; - } - public static final class drawable { - public static final int alarm_icon=0x7f020000; - public static final int ic_launcher=0x7f020001; - public static final int location_icon=0x7f020002; - public static final int record_sound_icon=0x7f020003; - public static final int retangle_drawable=0x7f020004; - public static final int select_color_icon=0x7f020005; - public static final int take_picture_icon=0x7f020006; - } - public static final class id { - public static final int add_item=0x7f090001; - public static final int delete_item=0x7f090003; - public static final int facebook_item=0x7f090006; - public static final int googleplus_item=0x7f090005; - public static final int revert_item=0x7f090002; - public static final int search_item=0x7f090000; - public static final int share_item=0x7f090004; - } - public static final class layout { - public static final int activity_main=0x7f030000; - } - public static final class menu { - public static final int main_menu=0x7f080000; - } - public static final class string { - public static final int app_name=0x7f060000; - public static final int content=0x7f060005; - public static final int enter_content=0x7f060006; - public static final int enter_title=0x7f060004; - public static final int hello_world=0x7f060002; - public static final int title=0x7f060003; - public static final int title_activity_main=0x7f060001; - } - public static final class style { - /** - Base application theme, dependent on API level. This theme is replaced - by AppBaseTheme from res/values-vXX/styles.xml on newer devices. - - - Theme customizations available in newer API levels can go in - res/values-vXX/styles.xml, while customizations related to - backward-compatibility can go here. - - - Base application theme for API 11+. This theme completely replaces - AppBaseTheme from res/values/styles.xml on API 11+ devices. - - API 11 theme customizations can go here. - - Base application theme for API 14+. This theme completely replaces - AppBaseTheme from BOTH res/values/styles.xml and - res/values-v11/styles.xml on API 14+ devices. - - API 14 theme customizations can go here. - */ - public static final int AppBaseTheme=0x7f070000; - /** Application theme. - All customizations that are NOT specific to a particular API-level can go here. - */ - public static final int AppTheme=0x7f070001; - } -} diff --git a/examples/0201/MyAndroidTutorial/gradle.properties b/examples/0201/MyAndroidTutorial/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/examples/0201/MyAndroidTutorial/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar b/examples/0201/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/examples/0201/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/0201/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties b/examples/0201/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/examples/0201/MyAndroidTutorial/gradlew b/examples/0201/MyAndroidTutorial/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/examples/0201/MyAndroidTutorial/gradlew.bat b/examples/0201/MyAndroidTutorial/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/examples/0201/MyAndroidTutorial/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/0201/MyAndroidTutorial/libs/android-support-v4.jar b/examples/0201/MyAndroidTutorial/libs/android-support-v4.jar deleted file mode 100644 index 187bdf4..0000000 Binary files a/examples/0201/MyAndroidTutorial/libs/android-support-v4.jar and /dev/null differ diff --git a/examples/0201/MyAndroidTutorial/proguard-project.txt b/examples/0201/MyAndroidTutorial/proguard-project.txt deleted file mode 100644 index f2fe155..0000000 --- a/examples/0201/MyAndroidTutorial/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/examples/0201/MyAndroidTutorial/project.properties b/examples/0201/MyAndroidTutorial/project.properties deleted file mode 100644 index 4ab1256..0000000 --- a/examples/0201/MyAndroidTutorial/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-19 diff --git a/examples/0201/MyAndroidTutorial/res/drawable/retangle_drawable.xml b/examples/0201/MyAndroidTutorial/res/drawable/retangle_drawable.xml deleted file mode 100644 index e195342..0000000 --- a/examples/0201/MyAndroidTutorial/res/drawable/retangle_drawable.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/res/layout/activity_main.xml b/examples/0201/MyAndroidTutorial/res/layout/activity_main.xml deleted file mode 100644 index 52ef000..0000000 --- a/examples/0201/MyAndroidTutorial/res/layout/activity_main.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/res/menu/main_menu.xml b/examples/0201/MyAndroidTutorial/res/menu/main_menu.xml deleted file mode 100644 index 4bfad8e..0000000 --- a/examples/0201/MyAndroidTutorial/res/menu/main_menu.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/0201/MyAndroidTutorial/res/values-en/strings.xml b/examples/0201/MyAndroidTutorial/res/values-en/strings.xml deleted file mode 100644 index 34f4fed..0000000 --- a/examples/0201/MyAndroidTutorial/res/values-en/strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - MyAndroidTutorial - MainActivity - Hello world! - - Title - Enter title - Content - Enter content - - diff --git a/examples/0201/MyAndroidTutorial/res/values-v11/styles.xml b/examples/0201/MyAndroidTutorial/res/values-v11/styles.xml deleted file mode 100644 index 3c02242..0000000 --- a/examples/0201/MyAndroidTutorial/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/examples/0201/MyAndroidTutorial/res/values-v14/styles.xml b/examples/0201/MyAndroidTutorial/res/values-v14/styles.xml deleted file mode 100644 index a91fd03..0000000 --- a/examples/0201/MyAndroidTutorial/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/0201/MyAndroidTutorial/res/values/colors.xml b/examples/0201/MyAndroidTutorial/res/values/colors.xml deleted file mode 100644 index c7b5d95..0000000 --- a/examples/0201/MyAndroidTutorial/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #CCCCCC - #AAAAAA - #DDCCCCCC - diff --git a/examples/0201/MyAndroidTutorial/res/values/dimens.xml b/examples/0201/MyAndroidTutorial/res/values/dimens.xml deleted file mode 100644 index fb03071..0000000 --- a/examples/0201/MyAndroidTutorial/res/values/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 6dp - 2dp - 24sp - diff --git a/examples/0201/MyAndroidTutorial/res/values/strings.xml b/examples/0201/MyAndroidTutorial/res/values/strings.xml deleted file mode 100644 index b879ab4..0000000 --- a/examples/0201/MyAndroidTutorial/res/values/strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - MyAndroidTutorial - MainActivity - Hello world! - - 標題 - 輸入標題 - 內容 - 輸入內容 - - diff --git a/examples/0201/MyAndroidTutorial/res/values/styles.xml b/examples/0201/MyAndroidTutorial/res/values/styles.xml deleted file mode 100644 index 6ce89c7..0000000 --- a/examples/0201/MyAndroidTutorial/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/examples/0201/MyAndroidTutorial/settings.gradle b/examples/0201/MyAndroidTutorial/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/examples/0201/MyAndroidTutorial/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/examples/0201/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0201/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java deleted file mode 100644 index d15f032..0000000 --- a/examples/0201/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.macdidi.myandroidtutorial; - -import android.app.Activity; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuInflater; - -public class MainActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - } - - // 載入選單資源 - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater menuInflater = getMenuInflater(); - menuInflater.inflate(R.menu.main_menu, menu); - return true; - } -} diff --git a/examples/0202/MyAndroidTutorial/.classpath b/examples/0202/MyAndroidTutorial/.classpath deleted file mode 100644 index 7bc01d9..0000000 --- a/examples/0202/MyAndroidTutorial/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/examples/0202/MyAndroidTutorial/.gitignore b/examples/0202/MyAndroidTutorial/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/examples/0202/MyAndroidTutorial/.idea/.name b/examples/0202/MyAndroidTutorial/.idea/.name new file mode 100644 index 0000000..5bb7a85 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/.name @@ -0,0 +1 @@ +MyAndroidTutorial \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/.idea/compiler.xml b/examples/0202/MyAndroidTutorial/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/examples/0202/MyAndroidTutorial/.idea/copyright/profiles_settings.xml b/examples/0202/MyAndroidTutorial/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/.idea/encodings.xml b/examples/0202/MyAndroidTutorial/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/0202/MyAndroidTutorial/.idea/gradle.xml b/examples/0202/MyAndroidTutorial/.idea/gradle.xml new file mode 100644 index 0000000..fe865d3 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/.idea/misc.xml b/examples/0202/MyAndroidTutorial/.idea/misc.xml new file mode 100644 index 0000000..9076de5 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/.idea/modules.xml b/examples/0202/MyAndroidTutorial/.idea/modules.xml new file mode 100644 index 0000000..327df67 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/.idea/scopes/scope_settings.xml b/examples/0202/MyAndroidTutorial/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/.idea/vcs.xml b/examples/0202/MyAndroidTutorial/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/examples/0202/MyAndroidTutorial/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/.project b/examples/0202/MyAndroidTutorial/.project deleted file mode 100644 index b1de407..0000000 --- a/examples/0202/MyAndroidTutorial/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - MyAndroidTutorial - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/examples/0202/MyAndroidTutorial/AndroidManifest.xml b/examples/0202/MyAndroidTutorial/AndroidManifest.xml deleted file mode 100644 index 470193a..0000000 --- a/examples/0202/MyAndroidTutorial/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/0202/MyAndroidTutorial/MyAndroidTutorial.iml b/examples/0202/MyAndroidTutorial/MyAndroidTutorial.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/MyAndroidTutorial.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/app/.gitignore b/examples/0202/MyAndroidTutorial/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/examples/0202/MyAndroidTutorial/app/app.iml b/examples/0202/MyAndroidTutorial/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/app/build.gradle b/examples/0202/MyAndroidTutorial/app/build.gradle new file mode 100644 index 0000000..b09f064 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "net.macdidi.myandroidtutorial" + minSdkVersion 15 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' +} diff --git a/examples/0202/MyAndroidTutorial/app/proguard-rules.pro b/examples/0202/MyAndroidTutorial/app/proguard-rules.pro new file mode 100644 index 0000000..b5fa7ec --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/macdidi5/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/examples/0202/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java b/examples/0202/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java new file mode 100644 index 0000000..2cb214e --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java @@ -0,0 +1,13 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/app/src/main/AndroidManifest.xml b/examples/0202/MyAndroidTutorial/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c325305 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0202/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java new file mode 100644 index 0000000..987d676 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java @@ -0,0 +1,34 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +public class MainActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // 為ListView元件設定三筆資料 + String[] data = { + "關於Android Tutorial的事情", + "一隻非常可愛的小狗狗!", + "一首非常好聽的音樂!"}; + int layoutId = android.R.layout.simple_list_item_1; + ArrayAdapter adapter = + new ArrayAdapter(this, layoutId, data); + ListView item_list = (ListView) findViewById(R.id.item_list); + item_list.setAdapter(adapter); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + +} \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/examples/0202/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/examples/0202/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/examples/0202/MyAndroidTutorial/res/drawable/alarm_icon.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable/alarm_icon.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png diff --git a/examples/0202/MyAndroidTutorial/res/drawable/location_icon.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable/location_icon.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png diff --git a/examples/0202/MyAndroidTutorial/res/drawable/record_sound_icon.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable/record_sound_icon.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml new file mode 100644 index 0000000..51d1e84 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/res/drawable/select_color_icon.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable/select_color_icon.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png diff --git a/examples/0202/MyAndroidTutorial/res/drawable/take_picture_icon.png b/examples/0202/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png similarity index 100% rename from examples/0202/MyAndroidTutorial/res/drawable/take_picture_icon.png rename to examples/0202/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..2adcfdd --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..7e74561 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/values-en/strings.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/values-en/strings.xml new file mode 100644 index 0000000..c532533 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/values-en/strings.xml @@ -0,0 +1,12 @@ + + + + MyAndroidTutorial + Hello world! + Settings + + Title + Enter title + Content + Enter content + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/values/colors.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..8d8f719 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #CCCCCC + #AAAAAA + #DD999999 + \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/values/dimens.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..02898ec --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/values/dimens.xml @@ -0,0 +1,9 @@ + + + 16dp + 16dp + + 6dp + 24sp + 2dp + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/values/strings.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..d07b4bc --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/values/strings.xml @@ -0,0 +1,12 @@ + + + + MyAndroidTutorial + Hello world! + Settings + + 標題 + 輸入標題 + 內容 + 輸入內容 + diff --git a/examples/0202/MyAndroidTutorial/app/src/main/res/values/styles.xml b/examples/0202/MyAndroidTutorial/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/examples/0202/MyAndroidTutorial/bin/AndroidManifest.xml b/examples/0202/MyAndroidTutorial/bin/AndroidManifest.xml deleted file mode 100644 index 470193a..0000000 --- a/examples/0202/MyAndroidTutorial/bin/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/0202/MyAndroidTutorial/bin/MyAndroidTutorial.apk b/examples/0202/MyAndroidTutorial/bin/MyAndroidTutorial.apk deleted file mode 100644 index 87f53e6..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/MyAndroidTutorial.apk and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes.dex b/examples/0202/MyAndroidTutorial/bin/classes.dex deleted file mode 100644 index a5f9d50..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes.dex and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class deleted file mode 100644 index 30f5623..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class deleted file mode 100644 index ba61e55..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class deleted file mode 100644 index 9d83559..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class deleted file mode 100644 index 10fa364..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class deleted file mode 100644 index 9361e88..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class deleted file mode 100644 index cef044a..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class deleted file mode 100644 index 52cc877..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class deleted file mode 100644 index 7314cb4..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class deleted file mode 100644 index c5a6690..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class deleted file mode 100644 index 2780c96..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class deleted file mode 100644 index 262d556..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class b/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class deleted file mode 100644 index 3be8276..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar b/examples/0202/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar deleted file mode 100644 index 80a2884..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/jarlist.cache b/examples/0202/MyAndroidTutorial/bin/jarlist.cache deleted file mode 100644 index 0565465..0000000 --- a/examples/0202/MyAndroidTutorial/bin/jarlist.cache +++ /dev/null @@ -1,3 +0,0 @@ -# cache for current jar dependency. DO NOT EDIT. -# format is -# Encoding is UTF-8 diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png deleted file mode 100644 index bcfa058..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 85848ff..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 916901e..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png deleted file mode 100644 index ebeae27..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png deleted file mode 100644 index 6897a97..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png deleted file mode 100644 index 6fe2060..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png deleted file mode 100644 index 4270ec5..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png b/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png deleted file mode 100644 index c812e2f..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/bin/resources.ap_ b/examples/0202/MyAndroidTutorial/bin/resources.ap_ deleted file mode 100644 index e948dbb..0000000 Binary files a/examples/0202/MyAndroidTutorial/bin/resources.ap_ and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/build.gradle b/examples/0202/MyAndroidTutorial/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/examples/0202/MyAndroidTutorial/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/examples/0202/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java b/examples/0202/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java deleted file mode 100644 index 5d44ea9..0000000 --- a/examples/0202/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java +++ /dev/null @@ -1,6 +0,0 @@ -/** Automatically generated file. DO NOT MODIFY */ -package net.macdidi.myandroidtutorial; - -public final class BuildConfig { - public final static boolean DEBUG = true; -} \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java b/examples/0202/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java deleted file mode 100644 index 8d56545..0000000 --- a/examples/0202/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java +++ /dev/null @@ -1,85 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package net.macdidi.myandroidtutorial; - -public final class R { - public static final class attr { - } - public static final class color { - public static final int divider_color=0x7f040002; - public static final int grey=0x7f040001; - public static final int light_grey=0x7f040000; - } - public static final class dimen { - public static final int default_margin=0x7f050001; - public static final int default_padding=0x7f050000; - public static final int title_txt_size=0x7f050002; - } - public static final class drawable { - public static final int alarm_icon=0x7f020000; - public static final int ic_launcher=0x7f020001; - public static final int location_icon=0x7f020002; - public static final int record_sound_icon=0x7f020003; - public static final int retangle_drawable=0x7f020004; - public static final int select_color_icon=0x7f020005; - public static final int take_picture_icon=0x7f020006; - } - public static final class id { - public static final int add_item=0x7f090002; - public static final int delete_item=0x7f090004; - public static final int facebook_item=0x7f090007; - public static final int googleplus_item=0x7f090006; - public static final int item_list=0x7f090000; - public static final int revert_item=0x7f090003; - public static final int search_item=0x7f090001; - public static final int share_item=0x7f090005; - } - public static final class layout { - public static final int activity_main=0x7f030000; - } - public static final class menu { - public static final int main_menu=0x7f080000; - } - public static final class string { - public static final int app_name=0x7f060000; - public static final int content=0x7f060005; - public static final int enter_content=0x7f060006; - public static final int enter_title=0x7f060004; - public static final int hello_world=0x7f060002; - public static final int title=0x7f060003; - public static final int title_activity_main=0x7f060001; - } - public static final class style { - /** - Base application theme, dependent on API level. This theme is replaced - by AppBaseTheme from res/values-vXX/styles.xml on newer devices. - - - Theme customizations available in newer API levels can go in - res/values-vXX/styles.xml, while customizations related to - backward-compatibility can go here. - - - Base application theme for API 11+. This theme completely replaces - AppBaseTheme from res/values/styles.xml on API 11+ devices. - - API 11 theme customizations can go here. - - Base application theme for API 14+. This theme completely replaces - AppBaseTheme from BOTH res/values/styles.xml and - res/values-v11/styles.xml on API 14+ devices. - - API 14 theme customizations can go here. - */ - public static final int AppBaseTheme=0x7f070000; - /** Application theme. - All customizations that are NOT specific to a particular API-level can go here. - */ - public static final int AppTheme=0x7f070001; - } -} diff --git a/examples/0202/MyAndroidTutorial/gradle.properties b/examples/0202/MyAndroidTutorial/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/examples/0202/MyAndroidTutorial/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar b/examples/0202/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/examples/0202/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/0202/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties b/examples/0202/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/examples/0202/MyAndroidTutorial/gradlew b/examples/0202/MyAndroidTutorial/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/examples/0202/MyAndroidTutorial/gradlew.bat b/examples/0202/MyAndroidTutorial/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/examples/0202/MyAndroidTutorial/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/0202/MyAndroidTutorial/libs/android-support-v4.jar b/examples/0202/MyAndroidTutorial/libs/android-support-v4.jar deleted file mode 100644 index 187bdf4..0000000 Binary files a/examples/0202/MyAndroidTutorial/libs/android-support-v4.jar and /dev/null differ diff --git a/examples/0202/MyAndroidTutorial/proguard-project.txt b/examples/0202/MyAndroidTutorial/proguard-project.txt deleted file mode 100644 index f2fe155..0000000 --- a/examples/0202/MyAndroidTutorial/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/examples/0202/MyAndroidTutorial/project.properties b/examples/0202/MyAndroidTutorial/project.properties deleted file mode 100644 index 4ab1256..0000000 --- a/examples/0202/MyAndroidTutorial/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-19 diff --git a/examples/0202/MyAndroidTutorial/res/drawable/retangle_drawable.xml b/examples/0202/MyAndroidTutorial/res/drawable/retangle_drawable.xml deleted file mode 100644 index e195342..0000000 --- a/examples/0202/MyAndroidTutorial/res/drawable/retangle_drawable.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/res/layout/activity_main.xml b/examples/0202/MyAndroidTutorial/res/layout/activity_main.xml deleted file mode 100644 index d0b752c..0000000 --- a/examples/0202/MyAndroidTutorial/res/layout/activity_main.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - diff --git a/examples/0202/MyAndroidTutorial/res/menu/main_menu.xml b/examples/0202/MyAndroidTutorial/res/menu/main_menu.xml deleted file mode 100644 index 4bfad8e..0000000 --- a/examples/0202/MyAndroidTutorial/res/menu/main_menu.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/0202/MyAndroidTutorial/res/values-en/strings.xml b/examples/0202/MyAndroidTutorial/res/values-en/strings.xml deleted file mode 100644 index 34f4fed..0000000 --- a/examples/0202/MyAndroidTutorial/res/values-en/strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - MyAndroidTutorial - MainActivity - Hello world! - - Title - Enter title - Content - Enter content - - diff --git a/examples/0202/MyAndroidTutorial/res/values-v11/styles.xml b/examples/0202/MyAndroidTutorial/res/values-v11/styles.xml deleted file mode 100644 index 3c02242..0000000 --- a/examples/0202/MyAndroidTutorial/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/examples/0202/MyAndroidTutorial/res/values-v14/styles.xml b/examples/0202/MyAndroidTutorial/res/values-v14/styles.xml deleted file mode 100644 index a91fd03..0000000 --- a/examples/0202/MyAndroidTutorial/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/0202/MyAndroidTutorial/res/values/colors.xml b/examples/0202/MyAndroidTutorial/res/values/colors.xml deleted file mode 100644 index c7b5d95..0000000 --- a/examples/0202/MyAndroidTutorial/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #CCCCCC - #AAAAAA - #DDCCCCCC - diff --git a/examples/0202/MyAndroidTutorial/res/values/dimens.xml b/examples/0202/MyAndroidTutorial/res/values/dimens.xml deleted file mode 100644 index fb03071..0000000 --- a/examples/0202/MyAndroidTutorial/res/values/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 6dp - 2dp - 24sp - diff --git a/examples/0202/MyAndroidTutorial/res/values/strings.xml b/examples/0202/MyAndroidTutorial/res/values/strings.xml deleted file mode 100644 index b879ab4..0000000 --- a/examples/0202/MyAndroidTutorial/res/values/strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - MyAndroidTutorial - MainActivity - Hello world! - - 標題 - 輸入標題 - 內容 - 輸入內容 - - diff --git a/examples/0202/MyAndroidTutorial/res/values/styles.xml b/examples/0202/MyAndroidTutorial/res/values/styles.xml deleted file mode 100644 index 6ce89c7..0000000 --- a/examples/0202/MyAndroidTutorial/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/examples/0202/MyAndroidTutorial/settings.gradle b/examples/0202/MyAndroidTutorial/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/examples/0202/MyAndroidTutorial/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/examples/0202/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0202/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java deleted file mode 100644 index e83a859..0000000 --- a/examples/0202/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.macdidi.myandroidtutorial; - -import android.app.Activity; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuInflater; -import android.widget.ArrayAdapter; -import android.widget.ListView; - -public class MainActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - // 為ListView元件設定三筆資料 - String[] data = { - "關於Android Tutorial的事情", - "一隻非常可愛的小狗狗!", - "一首非常好聽的音樂!"}; - int layoutId = android.R.layout.simple_list_item_1; - ArrayAdapter adapter = - new ArrayAdapter(this, layoutId, data); - ListView item_list = (ListView)findViewById(R.id.item_list); - item_list.setAdapter(adapter); - } - - // 載入選單資源 - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater menuInflater = getMenuInflater(); - menuInflater.inflate(R.menu.main_menu, menu); - return true; - } -} diff --git a/examples/0203/MyAndroidTutorial/.classpath b/examples/0203/MyAndroidTutorial/.classpath deleted file mode 100644 index 7bc01d9..0000000 --- a/examples/0203/MyAndroidTutorial/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/examples/0203/MyAndroidTutorial/.gitignore b/examples/0203/MyAndroidTutorial/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/examples/0203/MyAndroidTutorial/.idea/.name b/examples/0203/MyAndroidTutorial/.idea/.name new file mode 100644 index 0000000..5bb7a85 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/.name @@ -0,0 +1 @@ +MyAndroidTutorial \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/.idea/compiler.xml b/examples/0203/MyAndroidTutorial/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/examples/0203/MyAndroidTutorial/.idea/copyright/profiles_settings.xml b/examples/0203/MyAndroidTutorial/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/.idea/encodings.xml b/examples/0203/MyAndroidTutorial/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/0203/MyAndroidTutorial/.idea/gradle.xml b/examples/0203/MyAndroidTutorial/.idea/gradle.xml new file mode 100644 index 0000000..fe865d3 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/.idea/misc.xml b/examples/0203/MyAndroidTutorial/.idea/misc.xml new file mode 100644 index 0000000..9076de5 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/.idea/modules.xml b/examples/0203/MyAndroidTutorial/.idea/modules.xml new file mode 100644 index 0000000..327df67 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/.idea/scopes/scope_settings.xml b/examples/0203/MyAndroidTutorial/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/.idea/vcs.xml b/examples/0203/MyAndroidTutorial/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/examples/0203/MyAndroidTutorial/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/.project b/examples/0203/MyAndroidTutorial/.project deleted file mode 100644 index b1de407..0000000 --- a/examples/0203/MyAndroidTutorial/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - MyAndroidTutorial - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/examples/0203/MyAndroidTutorial/AndroidManifest.xml b/examples/0203/MyAndroidTutorial/AndroidManifest.xml deleted file mode 100644 index 470193a..0000000 --- a/examples/0203/MyAndroidTutorial/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/0203/MyAndroidTutorial/MyAndroidTutorial.iml b/examples/0203/MyAndroidTutorial/MyAndroidTutorial.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/MyAndroidTutorial.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/app/.gitignore b/examples/0203/MyAndroidTutorial/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/examples/0203/MyAndroidTutorial/app/app.iml b/examples/0203/MyAndroidTutorial/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/app/build.gradle b/examples/0203/MyAndroidTutorial/app/build.gradle new file mode 100644 index 0000000..b09f064 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "net.macdidi.myandroidtutorial" + minSdkVersion 15 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' +} diff --git a/examples/0203/MyAndroidTutorial/app/proguard-rules.pro b/examples/0203/MyAndroidTutorial/app/proguard-rules.pro new file mode 100644 index 0000000..b5fa7ec --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/macdidi5/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/examples/0203/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java b/examples/0203/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java new file mode 100644 index 0000000..2cb214e --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java @@ -0,0 +1,13 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/app/src/main/AndroidManifest.xml b/examples/0203/MyAndroidTutorial/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c325305 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0203/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java new file mode 100644 index 0000000..9d263f9 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java @@ -0,0 +1,148 @@ +package net.macdidi.myandroidtutorial; + +import android.app.AlertDialog; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +public class MainActivity extends ActionBarActivity { + private ListView item_list; + private TextView show_app_name; + + private static final String[] data = { + "關於Android Tutorial的事情", + "一隻非常可愛的小狗狗!", + "一首非常好聽的音樂!"}; + private ArrayAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + processViews(); + processControllers(); + + int layoutId = android.R.layout.simple_list_item_1; + adapter = new ArrayAdapter(this, layoutId, data); + item_list.setAdapter(adapter); + } + + private void processViews() { + item_list = (ListView)findViewById(R.id.item_list); + show_app_name = (TextView) findViewById(R.id.show_app_name); + } + + private void processControllers() { + // 建立選單項目點擊監聽物件 + AdapterView.OnItemClickListener itemListener = new AdapterView.OnItemClickListener() { + // 第一個參數是使用者操作的ListView物件 + // 第二個參數是使用者選擇的項目 + // 第三個參數是使用者選擇的項目編號,第一個是0 + // 第四個參數在這裡沒有用途 + @Override + public void onItemClick(AdapterView parent, View view, + int position, long id) { + Toast.makeText(MainActivity.this, + data[position], Toast.LENGTH_LONG).show(); + } + }; + + // 註冊選單項目點擊監聽物件 + item_list.setOnItemClickListener(itemListener); + + // 建立選單項目長按監聽物件 + AdapterView.OnItemLongClickListener itemLongListener = new AdapterView.OnItemLongClickListener() { + // 第一個參數是使用者操作的ListView物件 + // 第二個參數是使用者選擇的項目 + // 第三個參數是使用者選擇的項目編號,第一個是0 + // 第四個參數在這裡沒有用途 + @Override + public boolean onItemLongClick(AdapterView parent, View view, + int position, long id) { + Toast.makeText(MainActivity.this, + "Long: " + data[position], Toast.LENGTH_LONG).show(); + return false; + } + }; + + // 註冊選單項目長按監聽物件 + item_list.setOnItemLongClickListener(itemLongListener); + + // 建立長按監聽物件 + View.OnLongClickListener listener = new View.OnLongClickListener() { + + @Override + public boolean onLongClick(View view) { + AlertDialog.Builder dialog = + new AlertDialog.Builder(MainActivity.this); + dialog.setTitle(R.string.app_name) + .setMessage(R.string.about) + .show(); + return false; + } + + }; + + // 註冊長按監聽物件 + show_app_name.setOnLongClickListener(listener); + } + + // 載入選單資源 + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.menu_main, menu); + return true; + } + + // 使用者選擇所有的選單項目都會呼叫這個方法 + public void clickMenuItem(MenuItem item) { + // 使用參數取得使用者選擇的選單項目元件編號 + int itemId = item.getItemId(); + + // 判斷該執行什麼工作,目前還沒有加入需要執行的工作 + switch (itemId) { + case R.id.search_item: + break; + case R.id.add_item: + break; + case R.id.revert_item: + break; + case R.id.delete_item: + break; + case R.id.googleplus_item: + break; + case R.id.facebook_item: + break; + } + + // 測試用的程式碼,完成測試後記得移除 + AlertDialog.Builder dialog = + new AlertDialog.Builder(MainActivity.this); + dialog.setTitle("MenuItem Test") + .setMessage(item.getTitle()) + .setIcon(item.getIcon()) + .show(); + } + + // 方法名稱與onClick的設定一樣,參數的型態是android.view.View + public void aboutApp(View view) { + // 顯示訊息框 + // Context:通常指定為「this」;如果在巢狀類別中使用,要加上這個Activity元件類別的名稱,例如「元件類別名稱.this」 + // String或int:設定顯示在訊息框裡面的訊息或文字資源 + // int:設定訊息框停留在畫面的時間,使用宣告在Toast類別中的變數,可以設定為「LENGTH_LONG」和「LENGTH_SHORT」 + Toast.makeText(this, R.string.app_name, Toast.LENGTH_LONG).show(); + } + +} + + diff --git a/examples/0203/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/examples/0203/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/examples/0203/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/examples/0203/MyAndroidTutorial/res/drawable/alarm_icon.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable/alarm_icon.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png diff --git a/examples/0203/MyAndroidTutorial/res/drawable/location_icon.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable/location_icon.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png diff --git a/examples/0203/MyAndroidTutorial/res/drawable/record_sound_icon.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable/record_sound_icon.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml new file mode 100644 index 0000000..51d1e84 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/res/drawable/select_color_icon.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable/select_color_icon.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png diff --git a/examples/0203/MyAndroidTutorial/res/drawable/take_picture_icon.png b/examples/0203/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png similarity index 100% rename from examples/0203/MyAndroidTutorial/res/drawable/take_picture_icon.png rename to examples/0203/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..121511b --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,30 @@ + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..024de57 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/values-en/strings.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/values-en/strings.xml new file mode 100644 index 0000000..c532533 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/values-en/strings.xml @@ -0,0 +1,12 @@ + + + + MyAndroidTutorial + Hello world! + Settings + + Title + Enter title + Content + Enter content + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/values/colors.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..8d8f719 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #CCCCCC + #AAAAAA + #DD999999 + \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/values/dimens.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..02898ec --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/values/dimens.xml @@ -0,0 +1,9 @@ + + + 16dp + 16dp + + 6dp + 24sp + 2dp + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/values/strings.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..31ebfd1 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/values/strings.xml @@ -0,0 +1,14 @@ + + + + MyAndroidTutorial + Hello world! + Settings + + 標題 + 輸入標題 + 內容 + 輸入內容 + + 這是Android Tutorial應用程式 + diff --git a/examples/0203/MyAndroidTutorial/app/src/main/res/values/styles.xml b/examples/0203/MyAndroidTutorial/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/examples/0203/MyAndroidTutorial/bin/AndroidManifest.xml b/examples/0203/MyAndroidTutorial/bin/AndroidManifest.xml deleted file mode 100644 index 470193a..0000000 --- a/examples/0203/MyAndroidTutorial/bin/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/examples/0203/MyAndroidTutorial/bin/MyAndroidTutorial.apk b/examples/0203/MyAndroidTutorial/bin/MyAndroidTutorial.apk deleted file mode 100644 index 550ab92..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/MyAndroidTutorial.apk and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes.dex b/examples/0203/MyAndroidTutorial/bin/classes.dex deleted file mode 100644 index 6cdeba1..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes.dex and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class deleted file mode 100644 index 30f5623..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/BuildConfig.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$1.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$1.class deleted file mode 100644 index 1a97015..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$1.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$2.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$2.class deleted file mode 100644 index 50556f9..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$2.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$3.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$3.class deleted file mode 100644 index b24751b..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity$3.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class deleted file mode 100644 index 813b51e..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/MainActivity.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class deleted file mode 100644 index 9d83559..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$attr.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class deleted file mode 100644 index 10fa364..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$color.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class deleted file mode 100644 index 9361e88..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$dimen.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class deleted file mode 100644 index cef044a..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$drawable.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class deleted file mode 100644 index cd5b83b..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$id.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class deleted file mode 100644 index a409dec..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$layout.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class deleted file mode 100644 index 365b3fa..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$menu.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class deleted file mode 100644 index bc3126f..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$string.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class deleted file mode 100644 index 3b98e1e..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R$style.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class b/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class deleted file mode 100644 index 3be8276..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/classes/net/macdidi/myandroidtutorial/R.class and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar b/examples/0203/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar deleted file mode 100644 index 80a2884..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/dexedLibs/android-support-v4-9b1d5d28bf7d59a4e392b3d4f78c1f13.jar and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/jarlist.cache b/examples/0203/MyAndroidTutorial/bin/jarlist.cache deleted file mode 100644 index 0565465..0000000 --- a/examples/0203/MyAndroidTutorial/bin/jarlist.cache +++ /dev/null @@ -1,3 +0,0 @@ -# cache for current jar dependency. DO NOT EDIT. -# format is -# Encoding is UTF-8 diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png deleted file mode 100644 index bcfa058..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 85848ff..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 916901e..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png deleted file mode 100644 index ebeae27..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/alarm_icon.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png deleted file mode 100644 index 6897a97..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/location_icon.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png deleted file mode 100644 index 6fe2060..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/record_sound_icon.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png deleted file mode 100644 index 4270ec5..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/select_color_icon.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png b/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png deleted file mode 100644 index c812e2f..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/res/crunch/drawable/take_picture_icon.png and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/bin/resources.ap_ b/examples/0203/MyAndroidTutorial/bin/resources.ap_ deleted file mode 100644 index a167be3..0000000 Binary files a/examples/0203/MyAndroidTutorial/bin/resources.ap_ and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/build.gradle b/examples/0203/MyAndroidTutorial/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/examples/0203/MyAndroidTutorial/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/examples/0203/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java b/examples/0203/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java deleted file mode 100644 index 5d44ea9..0000000 --- a/examples/0203/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/BuildConfig.java +++ /dev/null @@ -1,6 +0,0 @@ -/** Automatically generated file. DO NOT MODIFY */ -package net.macdidi.myandroidtutorial; - -public final class BuildConfig { - public final static boolean DEBUG = true; -} \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java b/examples/0203/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java deleted file mode 100644 index d0b06c5..0000000 --- a/examples/0203/MyAndroidTutorial/gen/net/macdidi/myandroidtutorial/R.java +++ /dev/null @@ -1,87 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package net.macdidi.myandroidtutorial; - -public final class R { - public static final class attr { - } - public static final class color { - public static final int divider_color=0x7f040002; - public static final int grey=0x7f040001; - public static final int light_grey=0x7f040000; - } - public static final class dimen { - public static final int default_margin=0x7f050001; - public static final int default_padding=0x7f050000; - public static final int title_txt_size=0x7f050002; - } - public static final class drawable { - public static final int alarm_icon=0x7f020000; - public static final int ic_launcher=0x7f020001; - public static final int location_icon=0x7f020002; - public static final int record_sound_icon=0x7f020003; - public static final int retangle_drawable=0x7f020004; - public static final int select_color_icon=0x7f020005; - public static final int take_picture_icon=0x7f020006; - } - public static final class id { - public static final int add_item=0x7f090003; - public static final int delete_item=0x7f090005; - public static final int facebook_item=0x7f090008; - public static final int googleplus_item=0x7f090007; - public static final int item_list=0x7f090000; - public static final int revert_item=0x7f090004; - public static final int search_item=0x7f090002; - public static final int share_item=0x7f090006; - public static final int show_app_name=0x7f090001; - } - public static final class layout { - public static final int activity_main=0x7f030000; - } - public static final class menu { - public static final int main_menu=0x7f080000; - } - public static final class string { - public static final int about=0x7f060006; - public static final int app_name=0x7f060000; - public static final int content=0x7f060004; - public static final int enter_content=0x7f060005; - public static final int enter_title=0x7f060003; - public static final int hello_world=0x7f060007; - public static final int title=0x7f060002; - public static final int title_activity_main=0x7f060001; - } - public static final class style { - /** - Base application theme, dependent on API level. This theme is replaced - by AppBaseTheme from res/values-vXX/styles.xml on newer devices. - - - Theme customizations available in newer API levels can go in - res/values-vXX/styles.xml, while customizations related to - backward-compatibility can go here. - - - Base application theme for API 11+. This theme completely replaces - AppBaseTheme from res/values/styles.xml on API 11+ devices. - - API 11 theme customizations can go here. - - Base application theme for API 14+. This theme completely replaces - AppBaseTheme from BOTH res/values/styles.xml and - res/values-v11/styles.xml on API 14+ devices. - - API 14 theme customizations can go here. - */ - public static final int AppBaseTheme=0x7f070000; - /** Application theme. - All customizations that are NOT specific to a particular API-level can go here. - */ - public static final int AppTheme=0x7f070001; - } -} diff --git a/examples/0203/MyAndroidTutorial/gradle.properties b/examples/0203/MyAndroidTutorial/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/examples/0203/MyAndroidTutorial/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar b/examples/0203/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/examples/0203/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/0203/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties b/examples/0203/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/examples/0203/MyAndroidTutorial/gradlew b/examples/0203/MyAndroidTutorial/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/examples/0203/MyAndroidTutorial/gradlew.bat b/examples/0203/MyAndroidTutorial/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/examples/0203/MyAndroidTutorial/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/examples/0203/MyAndroidTutorial/libs/android-support-v4.jar b/examples/0203/MyAndroidTutorial/libs/android-support-v4.jar deleted file mode 100644 index 187bdf4..0000000 Binary files a/examples/0203/MyAndroidTutorial/libs/android-support-v4.jar and /dev/null differ diff --git a/examples/0203/MyAndroidTutorial/proguard-project.txt b/examples/0203/MyAndroidTutorial/proguard-project.txt deleted file mode 100644 index f2fe155..0000000 --- a/examples/0203/MyAndroidTutorial/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/examples/0203/MyAndroidTutorial/project.properties b/examples/0203/MyAndroidTutorial/project.properties deleted file mode 100644 index 4ab1256..0000000 --- a/examples/0203/MyAndroidTutorial/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-19 diff --git a/examples/0203/MyAndroidTutorial/res/drawable/retangle_drawable.xml b/examples/0203/MyAndroidTutorial/res/drawable/retangle_drawable.xml deleted file mode 100644 index e195342..0000000 --- a/examples/0203/MyAndroidTutorial/res/drawable/retangle_drawable.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/res/layout/activity_main.xml b/examples/0203/MyAndroidTutorial/res/layout/activity_main.xml deleted file mode 100644 index 418c34b..0000000 --- a/examples/0203/MyAndroidTutorial/res/layout/activity_main.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - diff --git a/examples/0203/MyAndroidTutorial/res/menu/main_menu.xml b/examples/0203/MyAndroidTutorial/res/menu/main_menu.xml deleted file mode 100644 index 030587f..0000000 --- a/examples/0203/MyAndroidTutorial/res/menu/main_menu.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/0203/MyAndroidTutorial/res/values-en/strings.xml b/examples/0203/MyAndroidTutorial/res/values-en/strings.xml deleted file mode 100644 index 34f4fed..0000000 --- a/examples/0203/MyAndroidTutorial/res/values-en/strings.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - MyAndroidTutorial - MainActivity - Hello world! - - Title - Enter title - Content - Enter content - - diff --git a/examples/0203/MyAndroidTutorial/res/values-v11/styles.xml b/examples/0203/MyAndroidTutorial/res/values-v11/styles.xml deleted file mode 100644 index 3c02242..0000000 --- a/examples/0203/MyAndroidTutorial/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/examples/0203/MyAndroidTutorial/res/values-v14/styles.xml b/examples/0203/MyAndroidTutorial/res/values-v14/styles.xml deleted file mode 100644 index a91fd03..0000000 --- a/examples/0203/MyAndroidTutorial/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/examples/0203/MyAndroidTutorial/res/values/colors.xml b/examples/0203/MyAndroidTutorial/res/values/colors.xml deleted file mode 100644 index c7b5d95..0000000 --- a/examples/0203/MyAndroidTutorial/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #CCCCCC - #AAAAAA - #DDCCCCCC - diff --git a/examples/0203/MyAndroidTutorial/res/values/dimens.xml b/examples/0203/MyAndroidTutorial/res/values/dimens.xml deleted file mode 100644 index fb03071..0000000 --- a/examples/0203/MyAndroidTutorial/res/values/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 6dp - 2dp - 24sp - diff --git a/examples/0203/MyAndroidTutorial/res/values/strings.xml b/examples/0203/MyAndroidTutorial/res/values/strings.xml deleted file mode 100644 index 081492c..0000000 --- a/examples/0203/MyAndroidTutorial/res/values/strings.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - MyAndroidTutorial - MainActivity - - 標題 - 輸入標題 - 內容 - 輸入內容 - - 這是Android Tutorial應用程式 - - diff --git a/examples/0203/MyAndroidTutorial/res/values/styles.xml b/examples/0203/MyAndroidTutorial/res/values/styles.xml deleted file mode 100644 index 6ce89c7..0000000 --- a/examples/0203/MyAndroidTutorial/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/examples/0203/MyAndroidTutorial/settings.gradle b/examples/0203/MyAndroidTutorial/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/examples/0203/MyAndroidTutorial/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/examples/0203/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0203/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java deleted file mode 100644 index 153d0b9..0000000 --- a/examples/0203/MyAndroidTutorial/src/net/macdidi/myandroidtutorial/MainActivity.java +++ /dev/null @@ -1,149 +0,0 @@ -package net.macdidi.myandroidtutorial; - -import android.app.Activity; -import android.app.AlertDialog; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.View.OnLongClickListener; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.AdapterView.OnItemLongClickListener; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.TextView; -import android.widget.Toast; - -public class MainActivity extends Activity { - - private ListView item_list; - private TextView show_app_name; - - private static final String[] data = { - "關於Android Tutorial的事情", - "一隻非常可愛的小狗狗!", - "一首非常好聽的音樂!"}; - private ArrayAdapter adapter; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - processViews(); - processControllers(); - - int layoutId = android.R.layout.simple_list_item_1; - adapter = new ArrayAdapter(this, layoutId, data); - item_list.setAdapter(adapter); - } - - private void processViews() { - item_list = (ListView)findViewById(R.id.item_list); - show_app_name = (TextView) findViewById(R.id.show_app_name); - } - - private void processControllers() { - // 建立選單項目點擊監聽物件 - OnItemClickListener itemListener = new OnItemClickListener() { - // 第一個參數是使用者操作的ListView物件 - // 第二個參數是使用者選擇的項目 - // 第三個參數是使用者選擇的項目編號,第一個是0 - // 第四個參數在這裡沒有用途 - @Override - public void onItemClick(AdapterView parent, View view, - int position, long id) { - Toast.makeText(MainActivity.this, - data[position], Toast.LENGTH_LONG).show(); - } - }; - - // 註冊選單項目點擊監聽物件 - item_list.setOnItemClickListener(itemListener); - - // 建立選單項目長按監聽物件 - OnItemLongClickListener itemLongListener = new OnItemLongClickListener() { - // 第一個參數是使用者操作的ListView物件 - // 第二個參數是使用者選擇的項目 - // 第三個參數是使用者選擇的項目編號,第一個是0 - // 第四個參數在這裡沒有用途 - @Override - public boolean onItemLongClick(AdapterView parent, View view, - int position, long id) { - Toast.makeText(MainActivity.this, - "Long: " + data[position], Toast.LENGTH_LONG).show(); - return false; - } - }; - - // 註冊選單項目長按監聽物件 - item_list.setOnItemLongClickListener(itemLongListener); - - // 建立長按監聽物件 - OnLongClickListener listener = new OnLongClickListener() { - - @Override - public boolean onLongClick(View view) { - AlertDialog.Builder dialog = - new AlertDialog.Builder(MainActivity.this); - dialog.setTitle(R.string.app_name) - .setMessage(R.string.about) - .show(); - return false; - } - - }; - - // 註冊長按監聽物件 - show_app_name.setOnLongClickListener(listener); - } - - // 載入選單資源 - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater menuInflater = getMenuInflater(); - menuInflater.inflate(R.menu.main_menu, menu); - return true; - } - - // 使用者選擇所有的選單項目都會呼叫這個方法 - public void clickMenuItem(MenuItem item) { - // 使用參數取得使用者選擇的選單項目元件編號 - int itemId = item.getItemId(); - - // 判斷該執行什麼工作,目前還沒有加入需要執行的工作 - switch (itemId) { - case R.id.search_item: - break; - case R.id.add_item: - break; - case R.id.revert_item: - break; - case R.id.delete_item: - break; - case R.id.googleplus_item: - break; - case R.id.facebook_item: - break; - } - - // 測試用的程式碼,完成測試後記得移除 - AlertDialog.Builder dialog = - new AlertDialog.Builder(MainActivity.this); - dialog.setTitle("MenuItem Test") - .setMessage(item.getTitle()) - .setIcon(item.getIcon()) - .show(); - } - - // 方法名稱與onClick的設定一樣,參數的型態是android.view.View - public void aboutApp(View view) { - // 顯示訊息框 - // Context:通常指定為「this」;如果在巢狀類別中使用,要加上這個Activity元件類別的名稱,例如「元件類別名稱.this」 - // String或int:設定顯示在訊息框裡面的訊息或文字資源 - // int:設定訊息框停留在畫面的時間,使用宣告在Toast類別中的變數,可以設定為「LENGTH_LONG」和「LENGTH_SHORT」 - Toast.makeText(this, R.string.app_name, Toast.LENGTH_LONG).show(); - } -} diff --git a/examples/0204/MyAndroidTutorial/.classpath b/examples/0204/MyAndroidTutorial/.classpath deleted file mode 100644 index 7bc01d9..0000000 --- a/examples/0204/MyAndroidTutorial/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/examples/0204/MyAndroidTutorial/.gitignore b/examples/0204/MyAndroidTutorial/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/examples/0204/MyAndroidTutorial/.idea/.name b/examples/0204/MyAndroidTutorial/.idea/.name new file mode 100644 index 0000000..5bb7a85 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/.name @@ -0,0 +1 @@ +MyAndroidTutorial \ No newline at end of file diff --git a/examples/0204/MyAndroidTutorial/.idea/compiler.xml b/examples/0204/MyAndroidTutorial/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/examples/0204/MyAndroidTutorial/.idea/copyright/profiles_settings.xml b/examples/0204/MyAndroidTutorial/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/examples/0204/MyAndroidTutorial/.idea/encodings.xml b/examples/0204/MyAndroidTutorial/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/0204/MyAndroidTutorial/.idea/gradle.xml b/examples/0204/MyAndroidTutorial/.idea/gradle.xml new file mode 100644 index 0000000..fe865d3 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/.idea/misc.xml b/examples/0204/MyAndroidTutorial/.idea/misc.xml new file mode 100644 index 0000000..9076de5 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/.idea/modules.xml b/examples/0204/MyAndroidTutorial/.idea/modules.xml new file mode 100644 index 0000000..327df67 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/.idea/scopes/scope_settings.xml b/examples/0204/MyAndroidTutorial/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/examples/0204/MyAndroidTutorial/.idea/vcs.xml b/examples/0204/MyAndroidTutorial/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/examples/0204/MyAndroidTutorial/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/.project b/examples/0204/MyAndroidTutorial/.project deleted file mode 100644 index b1de407..0000000 --- a/examples/0204/MyAndroidTutorial/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - MyAndroidTutorial - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/examples/0204/MyAndroidTutorial/AndroidManifest.xml b/examples/0204/MyAndroidTutorial/AndroidManifest.xml deleted file mode 100644 index ebb0127..0000000 --- a/examples/0204/MyAndroidTutorial/AndroidManifest.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/0204/MyAndroidTutorial/MyAndroidTutorial.iml b/examples/0204/MyAndroidTutorial/MyAndroidTutorial.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/MyAndroidTutorial.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/app/.gitignore b/examples/0204/MyAndroidTutorial/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/examples/0204/MyAndroidTutorial/app/app.iml b/examples/0204/MyAndroidTutorial/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/app/build.gradle b/examples/0204/MyAndroidTutorial/app/build.gradle new file mode 100644 index 0000000..b09f064 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "net.macdidi.myandroidtutorial" + minSdkVersion 15 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' +} diff --git a/examples/0204/MyAndroidTutorial/app/proguard-rules.pro b/examples/0204/MyAndroidTutorial/app/proguard-rules.pro new file mode 100644 index 0000000..b5fa7ec --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/macdidi5/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/examples/0204/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java b/examples/0204/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java new file mode 100644 index 0000000..2cb214e --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/androidTest/java/net/macdidi/myandroidtutorial/ApplicationTest.java @@ -0,0 +1,13 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/examples/0204/MyAndroidTutorial/app/src/main/AndroidManifest.xml b/examples/0204/MyAndroidTutorial/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..47e0605 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/AboutActivity.java b/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/AboutActivity.java new file mode 100644 index 0000000..42dddeb --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/AboutActivity.java @@ -0,0 +1,24 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.view.Window; + +public class AboutActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + // 取消元件的應用程式標題 + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.activity_about); + } + + // 結束按鈕 + public void clickOk(View view) { + // 呼叫這個方法結束Activity元件 + finish(); + } + +} \ No newline at end of file diff --git a/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/ItemActivity.java b/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/ItemActivity.java new file mode 100644 index 0000000..7e6c457 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/ItemActivity.java @@ -0,0 +1,79 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.EditText; + +public class ItemActivity extends Activity { + + private EditText title_text, content_text; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_item); + + processViews(); + + // 取得Intent物件 + Intent intent = getIntent(); + // 讀取Action名稱 + String action = intent.getAction(); + + // 如果是修改記事 + if (action.equals("net.macdidi.myandroidtutorial.EDIT_ITEM")) { + // 接收與設定記事標題 + String titleText = intent.getStringExtra("titleText"); + title_text.setText(titleText); + } + } + + private void processViews() { + title_text = (EditText) findViewById(R.id.title_text); + content_text = (EditText) findViewById(R.id.content_text); + } + + // 點擊確定與取消按鈕都會呼叫這個方法 + public void onSubmit(View view) { + // 確定按鈕 + if (view.getId() == R.id.ok_teim) { + // 讀取使用者輸入的標題與內容 + String titleText = title_text.getText().toString(); + String contentText = content_text.getText().toString(); + + // 取得回傳資料用的Intent物件 + Intent result = getIntent(); + // 設定標題與內容 + result.putExtra("titleText", titleText); + result.putExtra("contentText", contentText); + + // 設定回應結果為確定 + setResult(Activity.RESULT_OK, result); + } + + // 結束 + finish(); + } + + // 以後需要擴充的功能 + public void clickFunction(View view) { + int id = view.getId(); + + switch (id) { + case R.id.take_picture: + break; + case R.id.record_sound: + break; + case R.id.set_location: + break; + case R.id.set_alarm: + break; + case R.id.select_color: + break; + } + + } + +} diff --git a/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java b/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java new file mode 100644 index 0000000..7ad657c --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/main/java/net/macdidi/myandroidtutorial/MainActivity.java @@ -0,0 +1,185 @@ +package net.macdidi.myandroidtutorial; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; + +public class MainActivity extends ActionBarActivity { + private ListView item_list; + private TextView show_app_name; + + // 換掉原來的字串陣列 + private ArrayList data = new ArrayList<>(); + private ArrayAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + processViews(); + processControllers(); + + // 加入範例資料 + data.add("關於Android Tutorial的事情"); + data.add("一隻非常可愛的小狗狗!"); + data.add("一首非常好聽的音樂!"); + + int layoutId = android.R.layout.simple_list_item_1; + adapter = new ArrayAdapter(this, layoutId, data); + item_list.setAdapter(adapter); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + // 如果被啟動的Activity元件傳回確定的結果 + if (resultCode == Activity.RESULT_OK) { + String titleText = data.getStringExtra("titleText"); + + // 如果是新增記事 + if (requestCode == 0) { + // 加入標題項目 + this.data.add(titleText); + // 通知資料已經改變,ListView元件才會重新顯示 + adapter.notifyDataSetChanged(); + } + // 如果是修改記事 + else if (requestCode == 1) { + // 讀取記事編號 + int position = data.getIntExtra("position", -1); + + if (position != -1) { + // 設定標題項目 + this.data.set(position, titleText); + // 通知資料已經改變,ListView元件才會重新顯示 + adapter.notifyDataSetChanged(); + } + } + } + } + + private void processViews() { + item_list = (ListView)findViewById(R.id.item_list); + show_app_name = (TextView) findViewById(R.id.show_app_name); + } + + private void processControllers() { + // 建立選單項目點擊監聽物件 + AdapterView.OnItemClickListener itemListener = new AdapterView.OnItemClickListener() { + + @Override + public void onItemClick(AdapterView parent, View view, + int position, long id) { + // 使用Action名稱建立啟動另一個Activity元件需要的Intent物件 + Intent intent = new Intent("net.macdidi.myandroidtutorial.EDIT_ITEM"); + + // 設定記事編號與標題 + intent.putExtra("position", position); + intent.putExtra("titleText", data.get(position)); + + // 呼叫「startActivityForResult」,第二個參數「1」表示執行修改 + startActivityForResult(intent, 1); + } + }; + + // 註冊選單項目點擊監聽物件 + item_list.setOnItemClickListener(itemListener); + + // 建立選單項目長按監聽物件 + AdapterView.OnItemLongClickListener itemLongListener = new AdapterView.OnItemLongClickListener() { + + @Override + public boolean onItemLongClick(AdapterView parent, View view, + int position, long id) { + // 換掉「data[position]」 + Toast.makeText(MainActivity.this, + "Long: " + data.get(position), Toast.LENGTH_LONG).show(); + return false; + } + }; + + // 註冊選單項目長按監聽物件 + item_list.setOnItemLongClickListener(itemLongListener); + + // 建立長按監聽物件 + View.OnLongClickListener listener = new View.OnLongClickListener() { + + @Override + public boolean onLongClick(View view) { + AlertDialog.Builder dialog = + new AlertDialog.Builder(MainActivity.this); + dialog.setTitle(R.string.app_name) + .setMessage(R.string.about) + .show(); + return false; + } + + }; + + // 註冊長按監聽物件 + show_app_name.setOnLongClickListener(listener); + } + + // 載入選單資源 + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.menu_main, menu); + return true; + } + + // 使用者選擇所有的選單項目都會呼叫這個方法 + public void clickMenuItem(MenuItem item) { + // 使用參數取得使用者選擇的選單項目元件編號 + int itemId = item.getItemId(); + + // 判斷該執行什麼工作,目前還沒有加入需要執行的工作 + switch (itemId) { + case R.id.search_item: + break; + // 使用者選擇新增選單項目 + case R.id.add_item: + // 使用Action名稱建立啟動另一個Activity元件需要的Intent物件 + Intent intent = new Intent("net.macdidi.myandroidtutorial.ADD_ITEM"); + // 呼叫「startActivityForResult」,,第二個參數「0」表示執行新增 + startActivityForResult(intent, 0); + break; + case R.id.revert_item: + break; + case R.id.delete_item: + break; + case R.id.googleplus_item: + break; + case R.id.facebook_item: + break; + } + + } + + // 方法名稱與onClick的設定一樣,參數的型態是android.view.View + public void aboutApp(View view) { + // 建立啟動另一個Activity元件需要的Intent物件 + // 建構式的第一個參數:「this」 + // 建構式的第二個參數:「Activity元件類別名稱.class」 + Intent intent = new Intent(this, AboutActivity.class); + // 呼叫「startActivity」,參數為一個建立好的Intent物件 + // 這行敘述執行以後,如果沒有任何錯誤,就會啟動指定的元件 + startActivity(intent); + } + +} + + diff --git a/examples/0204/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable-hdpi/ic_launcher.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/examples/0204/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable-mdpi/ic_launcher.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/examples/0204/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable-xhdpi/ic_launcher.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/examples/0204/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/examples/0204/MyAndroidTutorial/res/drawable/alarm_icon.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable/alarm_icon.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable/alarm_icon.png diff --git a/examples/0204/MyAndroidTutorial/res/drawable/location_icon.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable/location_icon.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable/location_icon.png diff --git a/examples/0204/MyAndroidTutorial/res/drawable/record_sound_icon.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable/record_sound_icon.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable/record_sound_icon.png diff --git a/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml new file mode 100644 index 0000000..51d1e84 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/retangle_drawable.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/examples/0204/MyAndroidTutorial/res/drawable/select_color_icon.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable/select_color_icon.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable/select_color_icon.png diff --git a/examples/0204/MyAndroidTutorial/res/drawable/take_picture_icon.png b/examples/0204/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png similarity index 100% rename from examples/0204/MyAndroidTutorial/res/drawable/take_picture_icon.png rename to examples/0204/MyAndroidTutorial/app/src/main/res/drawable/take_picture_icon.png diff --git a/examples/0204/MyAndroidTutorial/app/src/main/res/layout/activity_about.xml b/examples/0204/MyAndroidTutorial/app/src/main/res/layout/activity_about.xml new file mode 100644 index 0000000..8e78611 --- /dev/null +++ b/examples/0204/MyAndroidTutorial/app/src/main/res/layout/activity_about.xml @@ -0,0 +1,35 @@ + + + + + + +