Update all
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>EnglishHelper</name>
|
||||
<comment>Project EnglishHelper created by Buildship.</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
2
.settings/org.eclipse.buildship.core.prefs
Normal file
@ -0,0 +1,2 @@
|
||||
connection.project.dir=
|
||||
eclipse.preferences.version=1
|
27
app/build.gradle
Executable file
@ -0,0 +1,27 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example.leeyuanair.englishhelper"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||
compile files('libs/apache-commons-net.jar')
|
||||
}
|
17
app/proguard-rules.pro
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\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 *;
|
||||
#}
|
@ -0,0 +1,13 @@
|
||||
package com.example.leeyuanair.englishhelper;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
46
app/src/main/AndroidManifest.xml
Executable file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.leeyuanair.englishhelper">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/appicon"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:screenOrientation="portrait">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".act_4selections.Act4Selection"
|
||||
android:label="@string/app_name" />
|
||||
<activity android:name=".act_allwords.ActAllVoca" />
|
||||
<activity android:name=".act_allwords.ActPieceVoca" />
|
||||
<activity android:name=".act_allwords.ActWordInfo" />
|
||||
<activity android:name=".ActSearchWord" />
|
||||
<activity android:name=".act_allwords.ActGrouping" />
|
||||
<activity android:name=".act_allwords.ActAddingGroup" />
|
||||
<activity android:name=".act_allwords.ActEditingGroup" />
|
||||
<activity android:name=".act_4selections.ActMultipleChoice" />
|
||||
<activity android:name=".act_4selections.Act4SelectionResult" />
|
||||
<activity android:name=".act_memory.ActMemorySetting" />
|
||||
<activity android:name=".act_memory.ActMemoryPractice" />
|
||||
<activity android:name=".act_memory.ActMemoryResult" />
|
||||
<activity android:name=".act_spelling.ActSpellingSetting" />
|
||||
<activity android:name=".act_spelling.ActSpellingExamine" />
|
||||
<activity android:name=".act_spelling.ActSpellingResult" />
|
||||
<activity android:name=".ActWordPackages" />
|
||||
<activity android:name=".ActListOfWordPackage">
|
||||
android:screenOrientation="portrait"
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
BIN
app/src/main/appicon-web.png
Executable file
After Width: | Height: | Size: 45 KiB |
1
app/src/main/assets/Test.txt
Executable file
@ -0,0 +1 @@
|
||||
123
|
2826
app/src/main/assets/Words.txt
Executable file
15
app/src/main/assets/word_packages.txt
Executable file
@ -0,0 +1,15 @@
|
||||
7
|
||||
水果系列 介紹了30種形形色色的水果 n
|
||||
apple banana cherry coconut date durian grape grapefruit guava honeydew-melon kiwi lemon lychee mango muskmelon olive orange papaya peach pear persimmon pineapple plum ponkan shaddock starfruit strawberry tangerine watermelon wax-apple
|
||||
健康系列 有關於身心健康的相關單字都在這裡 n
|
||||
health spirit diet sport fat disease symptom cold dizzy cough snivel tired exhausted spasm stomachache headache backache flu cardiopathy dermatosis
|
||||
情緒系列 人的喜怒哀樂的情感表現單字都在這裡 adj
|
||||
happy unhappy depressed excited angry scared bored surprised embarrassed joyful glad cheerful carefree sulky irate indignant furious sad grieved sorrowful plaintive mournful worried disappointed disheartened despondent downcast dejected dispirited frustrated delighted pleased merry relaxed
|
||||
景物描述系列 有關景物描述方面的形容都在這裡 adj
|
||||
wide broad beautiful glorious superb wonderful high spectacular towering smooth glossy silky coarse rough gloomy desolate hollow vague fuzzy transparent
|
||||
數學統計系列 運算、統計與其他數學字詞會在這裡出現 n
|
||||
mathematics statistics number add subtract multiply divide sum average square cube equation exponent fraction function logarithm proportion quotient remainder plus minus percent infinity algebra arithmetic calculation
|
||||
物理科學系列 力學、電學與機械等等物理上的名詞 n
|
||||
physics energy force power pressure temperature motor chain gear battery cable wire fuse switch cycle frequency system electricity microwave resistance tide friction
|
||||
天文科學系列 囊括了天文、星象與天體的字詞 n
|
||||
universe earth moon sun planet star comet satellite meteorite meteor atmosphere dwarf solar nebula vortex stardust supernova eclipse galaxy Quasar
|
@ -0,0 +1,99 @@
|
||||
package com.example.leeyuanair.englishhelper;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
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 com.example.leeyuanair.englishhelper.act_allwords.ActWordInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActListOfWordPackage extends AppCompatActivity implements ListView.OnItemClickListener {
|
||||
//Global Variables
|
||||
ArrayList<String> information;
|
||||
//TextView文字標籤元件
|
||||
TextView lblWordPackageExplanation;
|
||||
//ListView清單元件
|
||||
ListView lstWordPackage;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_list_of_word_package);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
//連結文字標籤元件
|
||||
lblWordPackageExplanation = (TextView) findViewById(R.id.lblWordPackageExplanation);
|
||||
lstWordPackage = (ListView) findViewById(R.id.lstWordPackage);
|
||||
lstWordPackage.setOnItemClickListener(this);
|
||||
//讀取上一層的資料
|
||||
int index = getIntent().getExtras().getInt("Index");
|
||||
setTitle("單字包裹 - " + MainActivity.WORD_PACKAGES_NAMES.get(index));
|
||||
//取得使用者所選的
|
||||
information = MainActivity.WORD_PACKAGES.get(MainActivity.WORD_PACKAGES_NAMES.get(index));
|
||||
ArrayAdapter<String> wordsArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
|
||||
lblWordPackageExplanation.setText(information.get(0));
|
||||
//逐次尋找該字資源並映到清單上
|
||||
int power, point_power;
|
||||
//設定詞性取得的優先權
|
||||
switch (information.get(1)) {
|
||||
case "n":
|
||||
power = 0;
|
||||
break;
|
||||
case "a":
|
||||
power = 1;
|
||||
break;
|
||||
case "v":
|
||||
power = 2;
|
||||
break;
|
||||
case "adv":
|
||||
power = 3;
|
||||
break;
|
||||
case "prep":
|
||||
power = 4;
|
||||
break;
|
||||
default:
|
||||
power = 0;
|
||||
break;
|
||||
}
|
||||
//pOS = Part Of Speech,字串陣列,表示儲存某單字的所有詞性中文意思
|
||||
String[] pOS;
|
||||
//循序取得資訊並存路wordsArrayAdapter裡
|
||||
for (int i = 2; i < information.size(); i++) {
|
||||
pOS = MainActivity.ALL_WORDS.get(information.get(i));
|
||||
point_power = power;
|
||||
while (pOS[point_power] == null || pOS[point_power].equals(""))
|
||||
point_power++;
|
||||
wordsArrayAdapter.add(information.get(i) +" "+ Number2pOS(point_power) + " " + pOS[point_power]);
|
||||
}
|
||||
lstWordPackage.setAdapter(wordsArrayAdapter);
|
||||
}
|
||||
//函式 - 數值轉詞性縮寫
|
||||
String Number2pOS(int number){
|
||||
switch (number){
|
||||
case 0: return "(n.)";
|
||||
case 1: return "(adj.)";
|
||||
case 2: return "(v.)";
|
||||
case 3: return "(adv.)";
|
||||
case 4: return "(prep.)";
|
||||
default:return "(error)";
|
||||
}
|
||||
}
|
||||
|
||||
//當清單上的某項被按下時
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent it = new Intent(this, ActWordInfo.class);
|
||||
it.putExtra("isAddingMode", false);
|
||||
it.putExtra("SelectedWord", information.get(position+2));
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下時
|
||||
public void btnBack11_Click(View view) {finish();}
|
||||
}
|
270
app/src/main/java/com/example/leeyuanair/englishhelper/ActSearchWord.java
Executable file
@ -0,0 +1,270 @@
|
||||
package com.example.leeyuanair.englishhelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.AssetManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.access.WordInfo;
|
||||
import com.example.leeyuanair.englishhelper.act_allwords.ActWordInfo;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class ActSearchWord extends AppCompatActivity implements RadioButton.OnClickListener, AdapterView.OnItemClickListener {
|
||||
//Valuables
|
||||
WordInfo[] words; //所有的單字與其資訊
|
||||
String selects; //表示使用者所選的篩選選項。"all"=全部, "n"=名詞, "adj"=形容詞, "v"=動詞, "adv"=副詞, "prep"=介係詞
|
||||
ArrayList<String> finds; //所選清單,表示搜尋時所找到的單字清單。
|
||||
ArrayAdapter<String> wordlist; //連結ArrayList與清單物件lstFinds之間的物件
|
||||
boolean isAddingMode; //判斷是否為Group增加單字的模式
|
||||
ArrayList<String> Addition; //紀錄使用者所要增加的單字
|
||||
//RadioButton
|
||||
RadioButton rdoAll, rdoNoun, rdoAdjective, rdoVerb, rdoAdverb, rdoPreposition;
|
||||
//Button
|
||||
Button btnSearch;
|
||||
//TextView
|
||||
TextView txtSearch;
|
||||
//ListView
|
||||
ListView lstFinds;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_search_word);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("單字查詢");
|
||||
//初始化變數
|
||||
selects = "all";
|
||||
finds = new ArrayList<>();
|
||||
wordlist = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,finds);
|
||||
//鏈結btnSearch元件
|
||||
btnSearch = (Button) findViewById(R.id.btnSearch);
|
||||
//鏈結txtSearch元件
|
||||
txtSearch = (TextView) findViewById(R.id.txtSearch);
|
||||
//鏈結lstFinds元件,並且與wordlist連結、登錄事件
|
||||
lstFinds = (ListView) findViewById(R.id.lstFinds);
|
||||
lstFinds.setAdapter(wordlist);
|
||||
lstFinds.setOnItemClickListener(this);
|
||||
//鏈結所有的RadioButton元件
|
||||
rdoAll = (RadioButton) findViewById(R.id.rdoAll);
|
||||
rdoNoun = (RadioButton) findViewById(R.id.rdoNoun);
|
||||
rdoAdjective = (RadioButton) findViewById(R.id.rdoAdjective);
|
||||
rdoVerb = (RadioButton) findViewById(R.id.rdoVerb);
|
||||
rdoAdverb = (RadioButton) findViewById(R.id.rdoAdverb);
|
||||
rdoPreposition = (RadioButton) findViewById(R.id.rdoPreposition);
|
||||
//註冊RadioButton事件
|
||||
rdoAll.setOnClickListener(this);
|
||||
rdoNoun.setOnClickListener(this);
|
||||
rdoAdjective.setOnClickListener(this);
|
||||
rdoVerb.setOnClickListener(this);
|
||||
rdoAdverb.setOnClickListener(this);
|
||||
rdoPreposition.setOnClickListener(this);
|
||||
//讀取所有單字
|
||||
AssetManager am = getAssets();
|
||||
try {
|
||||
InputStream is = am.open("Words.txt");
|
||||
byte[] data = new byte[is.available()];
|
||||
is.read(data); is.close();
|
||||
words = WordInfo.analyzeWordInfoString(new String(data));
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(this,"資料讀取錯誤",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//判別是否為增加單字模式
|
||||
isAddingMode = (boolean) getIntent().getExtras().get("isAddingMode");
|
||||
Addition = new ArrayList<>();
|
||||
}
|
||||
|
||||
//返回上一層頁面
|
||||
public void btnBack2_Click(View view) {
|
||||
Intent theIntent = new Intent();
|
||||
theIntent.putExtra("Addition", Addition);
|
||||
setResult(0, theIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
//當【搜尋】按鈕按下時 - 執行查詢單字的功能
|
||||
public void btnSearch_Click(View view) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE); //取得輸入介面物件
|
||||
inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0); //隱藏螢幕鍵盤
|
||||
String target = txtSearch.getText().toString(); //取得使用者所輸入的文字
|
||||
boolean isEnglish = checkEnglish(target.toCharArray()); //判斷使用者輸入的文字是否為英文
|
||||
//讀取所有單字資料
|
||||
try{
|
||||
String[] spis;
|
||||
finds.clear();
|
||||
//依條件尋找單字
|
||||
if(isEnglish){ //若使用者輸入的字串為英文時
|
||||
//循序尋找有沒有(部分)符合的字串與詞性
|
||||
for(WordInfo theWord : words){
|
||||
if(theWord.word.contains(target)){ //若使用者所輸入的字與所選單字有部分符合時
|
||||
if(checkPartofSpeech(theWord)){ //若該單字有使用者所指定的詞性時
|
||||
finds.add(theWord.word);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{ //若使用者輸入的字串為非英文時
|
||||
//循序尋找是否與使用者所選的詞性相符,且與使用者所輸入的文字有相關的單字
|
||||
for(WordInfo theWord : words){
|
||||
if(checkPartofMean(theWord, target)){
|
||||
finds.add(theWord.word);
|
||||
}
|
||||
}
|
||||
}
|
||||
//將所找到的資料更新至lstFinds
|
||||
if(finds.isEmpty())Toast.makeText(this,"未找到任何訊息相符的單字。",Toast.LENGTH_SHORT).show();
|
||||
wordlist.notifyDataSetChanged();
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(this,ex.toString(),Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//檢測是否為純英文單字字串
|
||||
boolean checkEnglish(char[] input){
|
||||
boolean isEnglish = true;
|
||||
for(int i=0;i<input.length;i++) {
|
||||
if ((input[i]<65 || input[i]>90) && (input[i]<97 || input[i]>122)) {
|
||||
isEnglish = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isEnglish;
|
||||
}
|
||||
|
||||
//判斷該單字是否有某指定的詞性
|
||||
boolean checkPartofSpeech(WordInfo theWord){
|
||||
boolean returns = false;
|
||||
if(selects.equals("all")){
|
||||
returns = true;
|
||||
}else{
|
||||
switch (selects){
|
||||
case "n" :
|
||||
returns = theWord.noun!=null;
|
||||
break;
|
||||
case "a" :
|
||||
returns = theWord.adjective!=null;
|
||||
break;
|
||||
case "v" :
|
||||
returns = theWord.verb!=null;
|
||||
break;
|
||||
case "adv" :
|
||||
returns = theWord.adverb!=null;
|
||||
break;
|
||||
case "prep" :
|
||||
returns = theWord.preposition!=null;
|
||||
break;
|
||||
default :
|
||||
}
|
||||
}
|
||||
return returns;
|
||||
}
|
||||
|
||||
//判斷是否與使用者所選的詞性相符,且與使用者所輸入的文字有相關的單字
|
||||
boolean checkPartofMean(WordInfo theWord,String target){
|
||||
boolean returns = false;
|
||||
if(selects.equals("all")){
|
||||
returns = (theWord.noun!=null) && (theWord.noun.contains(target)) ||
|
||||
(theWord.adjective!=null) && (theWord.adjective.contains(target)) ||
|
||||
(theWord.verb!=null) && (theWord.verb.contains(target)) ||
|
||||
(theWord.adverb!=null) && (theWord.adverb.contains(target)) ||
|
||||
(theWord.preposition!=null) && (theWord.preposition.contains(target));
|
||||
}else{
|
||||
switch (selects){
|
||||
case "n" :
|
||||
returns = (theWord.noun!=null) && (theWord.noun.contains(target));
|
||||
break;
|
||||
case "a" :
|
||||
returns = (theWord.adjective!=null) && (theWord.adjective.contains(target));
|
||||
break;
|
||||
case "v" :
|
||||
returns = (theWord.verb!=null) && (theWord.verb.contains(target));
|
||||
break;
|
||||
case "adv" :
|
||||
returns = (theWord.adverb!=null) && (theWord.adverb.contains(target));
|
||||
break;
|
||||
case "prep" :
|
||||
returns = (theWord.preposition!=null) && (theWord.preposition.contains(target));
|
||||
break;
|
||||
default :
|
||||
}
|
||||
}
|
||||
return returns;
|
||||
}
|
||||
|
||||
//RadioButton事件 - 代表唯一選取的功能
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//判斷呼叫事件的物件類別是否為AppCompatRadioButton,也就是單選按鈕。
|
||||
if(v.getClass().getSimpleName().equals("AppCompatRadioButton")){
|
||||
uncheckAllRadioButton();
|
||||
((RadioButton) v).setChecked(true);
|
||||
if(v==rdoAll)selects="all";
|
||||
else if(v==rdoNoun)selects="n";
|
||||
else if(v==rdoAdjective)selects="a";
|
||||
else if(v==rdoVerb)selects="v";
|
||||
else if(v==rdoAdverb)selects="adv";
|
||||
else if(v==rdoPreposition)selects="prep";
|
||||
}
|
||||
}
|
||||
|
||||
//程序 - 解除所有RadioButton的選取
|
||||
void uncheckAllRadioButton(){
|
||||
rdoAll.setChecked(false);
|
||||
rdoNoun.setChecked(false);
|
||||
rdoAdjective.setChecked(false);
|
||||
rdoVerb.setChecked(false);
|
||||
rdoAdverb.setChecked(false);
|
||||
rdoPreposition.setChecked(false);
|
||||
}
|
||||
|
||||
//當使用者按下清單裡的某一項時,即顯示使用者選所的單字訊息。
|
||||
//若模式為新增群組單字模式時,則傳遞新增單字的布林值true至下個頁面
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
try{
|
||||
Object SelItem = parent.getItemAtPosition(position);
|
||||
Intent theIntent = new Intent(this, ActWordInfo.class);
|
||||
theIntent.putExtra("SelectedWord", SelItem.toString());
|
||||
theIntent.putExtra("isAddingMode", isAddingMode);
|
||||
startActivityForResult(theIntent, 0);
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(this,ex.toString(),Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
//當下一層的頁面關閉時
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if(resultCode==0){
|
||||
String theWord = data.getExtras().getString("isAdd");
|
||||
//若使用者有選擇該單字且該單字之前沒有加入過群組的話則將單字加入
|
||||
if(theWord!=null && !Addition.contains(theWord)){
|
||||
Addition.add(theWord);
|
||||
Collections.sort(Addition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//攔截使用者所按下的按鍵 - 包含返回、家、視窗等等按鍵
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
Intent theIntent = new Intent();
|
||||
theIntent.putExtra("Addition", Addition);
|
||||
setResult(0, theIntent);
|
||||
finish();
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
44
app/src/main/java/com/example/leeyuanair/englishhelper/ActWordPackages.java
Executable file
@ -0,0 +1,44 @@
|
||||
package com.example.leeyuanair.englishhelper;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ActWordPackages extends AppCompatActivity implements ListView.OnItemClickListener {
|
||||
|
||||
//ListView清單元件
|
||||
ListView lstAllWordPackages;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_word_packages);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("單字包裹");
|
||||
//連結清單元件
|
||||
lstAllWordPackages = (ListView) findViewById(R.id.lstAllWordPackages);
|
||||
lstAllWordPackages.setOnItemClickListener(this);
|
||||
ArrayAdapter<String> wordPackageAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, MainActivity.WORD_PACKAGES_NAMES);
|
||||
lstAllWordPackages.setAdapter(wordPackageAdapter);
|
||||
}
|
||||
|
||||
//當清單元件裡的某項被按下時
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent it = new Intent(this, ActListOfWordPackage.class);
|
||||
it.putExtra("Index", position);
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下時
|
||||
public void btnBack10_Click(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
242
app/src/main/java/com/example/leeyuanair/englishhelper/MainActivity.java
Executable file
@ -0,0 +1,242 @@
|
||||
package com.example.leeyuanair.englishhelper;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.access.WordInfo;
|
||||
import com.example.leeyuanair.englishhelper.act_4selections.Act4Selection;
|
||||
import com.example.leeyuanair.englishhelper.act_allwords.ActAllVoca;
|
||||
import com.example.leeyuanair.englishhelper.act_allwords.ActWordInfo;
|
||||
import com.example.leeyuanair.englishhelper.act_memory.ActMemorySetting;
|
||||
import com.example.leeyuanair.englishhelper.act_spelling.ActSpellingSetting;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Random;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
//Global Static Variables 公有靜態變數
|
||||
public static LinkedHashMap<String, String[]> ALL_WORDS;
|
||||
public static ArrayList<String> WORDS;
|
||||
public static LinkedHashMap<String, ArrayList<String>> GROUPS;
|
||||
public static ArrayList<String> GROUP_NAMES;
|
||||
public static int groupCount;
|
||||
public static LinkedHashMap<String, ArrayList<String>> WORD_PACKAGES;
|
||||
public static ArrayList<String> WORD_PACKAGES_NAMES;
|
||||
//Buttn按鈕元件
|
||||
Button btn4Select;
|
||||
Button btnFillUp;
|
||||
Button btnMemory;
|
||||
Button btnSpelling;
|
||||
Button btnAllVoca;
|
||||
//TextView文字標籤元件
|
||||
TextView lblVersion;
|
||||
TextView lblWordMessage;
|
||||
//其他變數
|
||||
AssetManager am;
|
||||
public WordInfo[] words;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("英文幫手");
|
||||
//鏈結按鈕物件
|
||||
btn4Select = (Button) findViewById(R.id.btn4Select);
|
||||
btnMemory = (Button) findViewById(R.id.btnMemory);
|
||||
btnSpelling = (Button) findViewById(R.id.btnSpelling);
|
||||
btnAllVoca = (Button) findViewById(R.id.btnAllVoca);
|
||||
//鏈結文字標籤物件
|
||||
lblVersion = (TextView) findViewById(R.id.lblVersion);
|
||||
lblWordMessage = (TextView) findViewById(R.id.lblWordMessage);
|
||||
//其他設定
|
||||
am = getAssets();
|
||||
//####讀取單字資料####
|
||||
try{
|
||||
InputStream is = am.open("Words.txt");
|
||||
int length = is.available();
|
||||
byte[] data = new byte[length];
|
||||
is.read(data); is.close();
|
||||
ALL_WORDS = WordInfo.analyzeWordInfo(new String(data)); //將單字資料解析並將其結果放回ALL_WORDS裡
|
||||
WORDS = new ArrayList<>(); //建立WORDS英文單字
|
||||
WORDS.addAll(ALL_WORDS.keySet()); //將ALL_WORDS的鍵值加入到WORDS裡
|
||||
}catch(Exception ex){
|
||||
setTitle("Fail");
|
||||
lblVersion.setText(ex.toString());
|
||||
}
|
||||
String[] item = new String[5];
|
||||
//####是否初次使用此APP的確認函式,環境初始化函式####
|
||||
firstInitialize();
|
||||
//####讀取單字群組####
|
||||
GROUPS = new LinkedHashMap<>();
|
||||
GROUP_NAMES = new ArrayList<>();
|
||||
try{
|
||||
//讀取群組單字檔案
|
||||
InputStream is = new FileInputStream(getFilesDir()+"/groups.txt");
|
||||
byte[] data = new byte[is.available()];
|
||||
is.read(data); is.close();
|
||||
String info[] = ((new String(data)).replace("\r","")).split("\n"); //解析字串
|
||||
groupCount = Integer.parseInt(info[0]); //群組數量
|
||||
for(int i=1;i<info.length;i+=2) {
|
||||
GROUP_NAMES.add(info[i]);
|
||||
GROUPS.put(info[i], new ArrayList<>(Arrays.asList(info[i + 1].split(" "))));
|
||||
}
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(MainActivity.this, "群組單字資料讀取錯誤", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//####讀取單字包裹檔案####
|
||||
WORD_PACKAGES = new LinkedHashMap<>(); //建構WORD_PACKAGES
|
||||
WORD_PACKAGES_NAMES = new ArrayList<>();
|
||||
try{
|
||||
InputStream is = am.open("word_packages.txt"); //開起在assets的檔案word_packages.txt
|
||||
byte[] data = new byte[is.available()]; //建立data變數,並以該資料長度作為陣列的長度
|
||||
is.read(data); is.close(); //以byte[]的形式將資料讀出。讀出後將資料流關閉
|
||||
//解析字串
|
||||
String[] infos = ((new String(data)).replace("\r","")).split("\n"); //以換行符號為單位拆成若干個字串陣列infos[]
|
||||
String wordPackageName; ArrayList<String> content; //建立wordPackageName與content來暫存包裹名稱及其內容
|
||||
String[] spis1, spis2; //spis1與spis2表示infos[]內容的再細分,其中以空白符號作為單位
|
||||
//##循序讀取##
|
||||
for(int i=1;i<infos.length;i+=2){
|
||||
content = new ArrayList<>();
|
||||
spis1 = infos[i].split(" "); //解析
|
||||
spis2 = infos[i+1].split(" "); //解析
|
||||
wordPackageName = spis1[0];
|
||||
WORD_PACKAGES_NAMES.add(wordPackageName);
|
||||
content.add(spis1[1]); content.add(spis1[2]);
|
||||
content.addAll(Arrays.asList(spis2)); //利用Arrays類別裡的靜態函數asList()來將陣列spis2轉為表準清單
|
||||
WORD_PACKAGES.put(wordPackageName, content); //最後加入到WORD_PACKAGES裡
|
||||
}
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(MainActivity.this, "單字包裹資料讀取錯誤", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//####判別「每日一字」是否需要更新,如果不需要則顯示紀錄的單字;如果需要則更新並顯示其單字
|
||||
Calendar c = Calendar.getInstance();
|
||||
int y=c.get(c.YEAR), m=c.get(c.MONTH), d=c.get(c.DAY_OF_MONTH);
|
||||
String dayCheck = (String.valueOf(y)+ ((m+1)>9 ? String.valueOf(m+1) : "0"+String.valueOf(m+1))+ (d>9 ? String.valueOf(d) : "0"+String.valueOf(d)));
|
||||
try{
|
||||
InputStream is = new FileInputStream(getFilesDir()+"/daily.txt");
|
||||
byte[] data = new byte[is.available()];
|
||||
is.read(data); is.close();
|
||||
String[] dailyInfo = ((new String(data)).replace("\r","")).split("\n");
|
||||
//確認紀錄日期是否為今日
|
||||
if(dailyInfo[0].equals(dayCheck)){
|
||||
lblWordMessage.setText(dailyInfo[1]);
|
||||
}else{ //若不是,則更新日期與單字
|
||||
Random rnd = new Random(); rnd.setSeed(rnd.nextInt(100));
|
||||
String newWord = WORDS.get(rnd.nextInt(WORDS.size()));
|
||||
OutputStream os = new FileOutputStream(getFilesDir()+"/daily.txt", false);
|
||||
os.write((dayCheck+"\r\n"+newWord).getBytes());
|
||||
os.flush(); os.close();
|
||||
lblWordMessage.setText(newWord);
|
||||
}
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(MainActivity.this, "每日一字讀取錯誤", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當【字義選擇】按鈕按下時,開啟字義選擇頁面。
|
||||
public void btn4Select_Click(View view) {
|
||||
Intent it = new Intent(this, Act4Selection.class);
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//當【記憶練習】按鈕按下時,開啟記憶練習設定頁面。
|
||||
public void btnMemory_Click(View view) {
|
||||
Intent it = new Intent(this, ActMemorySetting.class);
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//當【拼字測驗】按鈕按下時,開啟拼字練習設定頁面
|
||||
public void btnSpelling_Click(View view) {
|
||||
Intent it = new Intent(this, ActSpellingSetting.class);
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//當【文字包裹】按鈕按下時,開啟文字包裹頁面
|
||||
public void btnWordPackage_Click(View view) {
|
||||
Intent it = new Intent(this, ActWordPackages.class);
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//當【單字列表】按鈕按下時,開啟單字列表頁面。
|
||||
public void btnAllVoca_Click(View view) {
|
||||
startActivity(new Intent(this, ActAllVoca.class));
|
||||
}
|
||||
|
||||
//當lblWordMessage標籤物件按下時
|
||||
public void lblWordMessage_Click(View view) {
|
||||
Intent it = new Intent(this, ActWordInfo.class);
|
||||
it.putExtra("isAddingMode", false);
|
||||
it.putExtra("SelectedWord", lblWordMessage.getText().toString());
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
//環境初始化 - 當使用者為第一次使用此Application時,初始化所有相關的變數。
|
||||
protected void firstInitialize(){
|
||||
try{
|
||||
//確認群組檔案是否存在,如果不存在就新增一個新的群組檔案
|
||||
File groups = new File(getFilesDir()+"/groups.txt");
|
||||
if(!groups.exists()){
|
||||
groups.createNewFile();
|
||||
OutputStream os = new FileOutputStream(getFilesDir()+"/groups.txt");
|
||||
os.write(("0").getBytes());
|
||||
os.flush(); os.close();
|
||||
}else{
|
||||
//groups.delete();
|
||||
//Toast.makeText(this,"Deleted",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//確認每日紀錄的檔案是否存在,如果不存在則新創一個
|
||||
File daily = new File(getFilesDir()+"/daily.txt");
|
||||
if(!daily.exists()){
|
||||
daily.createNewFile();
|
||||
OutputStream os = new FileOutputStream(getFilesDir()+"/daily.txt");
|
||||
String word = WORDS.get((new Random()).nextInt(WORDS.size())); //隨機選取一個單字
|
||||
Calendar c = Calendar.getInstance(); //取得當前時間
|
||||
int y=c.get(c.YEAR), m=c.get(c.MONTH), d=c.get(c.DAY_OF_MONTH);
|
||||
os.write((String.valueOf(y) +
|
||||
((m + 1) > 9 ? String.valueOf(m + 1) : "0" + String.valueOf(m + 1)) +
|
||||
(d > 9 ? String.valueOf(d) : "0" + String.valueOf(d)) +
|
||||
"\r\n" + word).getBytes());
|
||||
os.flush(); os.close();
|
||||
}
|
||||
}catch(Exception ex){
|
||||
lblVersion.setText(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
//當版本訊息lblVersion按下時
|
||||
public void lblVersion_Click(View view) {
|
||||
AlertDialog.Builder msgBox = new AlertDialog.Builder(this)
|
||||
.setTitle("關於英文幫手")
|
||||
.setMessage("此應用程式由Nebula3122製作。\r\n若有錯誤的地方就麻煩通知我吧,\r\n我會進行修正的動作,謝謝!")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}})
|
||||
.setNeutralButton("Email", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||
emailIntent.setType("plain/text");
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"alan159753@gmail.com"});
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "英文幫手 - 回應");
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "內文");
|
||||
startActivity(Intent.createChooser(emailIntent, "Email回覆"));
|
||||
}
|
||||
});
|
||||
msgBox.show();
|
||||
}
|
||||
}
|
25
app/src/main/java/com/example/leeyuanair/englishhelper/access/FTPThread.java
Executable file
@ -0,0 +1,25 @@
|
||||
package com.example.leeyuanair.englishhelper.access;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
|
||||
/**
|
||||
* Created by Lee Yuan Air on 2016/2/22.
|
||||
*/
|
||||
public class FTPThread extends Thread {
|
||||
FTPClient ftp;
|
||||
public void setFtp(FTPClient ftp){
|
||||
this.ftp = ftp;
|
||||
}
|
||||
@Override
|
||||
public void run(){
|
||||
try{
|
||||
ftp.connect("192.168.1.216",21);
|
||||
}catch(Exception ex){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.example.leeyuanair.englishhelper.access;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.access.WordInfo;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Created by Lee Yuan Air on 2016/4/10.
|
||||
*
|
||||
*/
|
||||
public class TheManager extends Application{
|
||||
|
||||
public WordInfo[] all_word;
|
||||
|
||||
public TheManager(){
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
public void start(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
108
app/src/main/java/com/example/leeyuanair/englishhelper/access/WordInfo.java
Executable file
@ -0,0 +1,108 @@
|
||||
package com.example.leeyuanair.englishhelper.access;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* Created by Lee Yuan Air on 2016/2/21.
|
||||
*
|
||||
*/
|
||||
public class WordInfo {
|
||||
public String word;
|
||||
public String noun, adjective, verb, adverb, preposition;
|
||||
public WordInfo(String word, String noun, String adjective, String verb, String adverb, String preposition){
|
||||
this.word = word;
|
||||
this.noun = noun;
|
||||
this.adjective = adjective;
|
||||
this.verb = verb;
|
||||
this.adverb = adverb;
|
||||
this.preposition = preposition;
|
||||
}
|
||||
public void setWord(String word){this.word = word;}
|
||||
public void setNoun(String noun){this.noun = noun;}
|
||||
public void setAdjective(String adjective){this.adjective = adjective;}
|
||||
public void setVerb(String verb){this.verb = verb;}
|
||||
public void getAdverb(String adverb){this.adverb = adverb;}
|
||||
public void setPreposition(String preposition){this.preposition = preposition;};
|
||||
public static void sort(WordInfo[] data){
|
||||
WordInfo temp;
|
||||
for(int i=1;i<data.length;i++){
|
||||
for(int q=data.length-1;q>=i;q--){
|
||||
if(data[q-1].word.compareTo(data[q].word)>0){
|
||||
temp = data[q-1];
|
||||
data[q-1] = data[q];
|
||||
data[q] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//解析字串並轉入HashMap集合物件裡的資料,最後回傳之。
|
||||
public static LinkedHashMap<String, String[]> analyzeWordInfo(String inputs){
|
||||
String[] info = (inputs.replace("\r","")).split("\n");
|
||||
LinkedHashMap<String, String[]> wordinfos = new LinkedHashMap<>();
|
||||
String[] spis;
|
||||
String word,n,a,v,adv,prep;
|
||||
for(int i=1;i<info.length;i++){
|
||||
spis = info[i].split(" ");
|
||||
word = spis[0];
|
||||
n=null; a=null; v=null; adv=null; prep=null;
|
||||
for(int q=1;q<spis.length;q+=2){
|
||||
switch (spis[q]){
|
||||
case "n" :
|
||||
n = spis[q+1];
|
||||
break;
|
||||
case "a" :
|
||||
a = spis[q+1];
|
||||
break;
|
||||
case "v" :
|
||||
v = spis[q+1];
|
||||
break;
|
||||
case "adv" :
|
||||
adv = spis[q+1];
|
||||
break;
|
||||
case "prep" :
|
||||
prep = spis[q+1];
|
||||
break;
|
||||
default :
|
||||
}
|
||||
}
|
||||
wordinfos.put(word, new String[] {n,a,v,adv,prep});
|
||||
}
|
||||
return wordinfos;
|
||||
}
|
||||
public static WordInfo[] analyzeWordInfoString(String inputs) {
|
||||
String[] info = (inputs.replace("\r","")).split("\n");
|
||||
WordInfo[] wordinfos = new WordInfo[info.length-1];
|
||||
String[] spis;
|
||||
String word,n,a,v,adv,prep;
|
||||
for(int i=1;i<info.length;i++){
|
||||
spis = info[i].split(" ");
|
||||
word = spis[0];
|
||||
n=null; a=null; v=null; adv=null; prep=null;
|
||||
for(int q=1;q<spis.length;q+=2){
|
||||
switch (spis[q]){
|
||||
case "n" :
|
||||
n = spis[q+1];
|
||||
break;
|
||||
case "a" :
|
||||
a = spis[q+1];
|
||||
break;
|
||||
case "v" :
|
||||
v = spis[q+1];
|
||||
break;
|
||||
case "adv" :
|
||||
adv = spis[q+1];
|
||||
break;
|
||||
case "prep" :
|
||||
prep = spis[q+1];
|
||||
break;
|
||||
default :
|
||||
}
|
||||
}
|
||||
wordinfos[i-1] = new WordInfo(word,n,a,v,adv,prep);
|
||||
}
|
||||
return wordinfos;
|
||||
}
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
package com.example.leeyuanair.englishhelper.act_4selections;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class Act4Selection extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener, CheckBox.OnCheckedChangeListener {
|
||||
|
||||
//Valuable全域變數
|
||||
int Selection; //使用者的選擇
|
||||
String extraMsg; //額外的訊息
|
||||
boolean qualified; //紀錄是否可以開始測驗
|
||||
boolean N , A, V, ADV, PREP; //表示該群組的某詞性是否可以獨立隨機選取
|
||||
//Button按鈕物件
|
||||
Button btnChangeGroup1;
|
||||
//CheckBox勾選方塊物件
|
||||
CheckBox chkOnlyGroupItem1;
|
||||
//TextView文字標籤物件
|
||||
TextView lblTimePerQ1;
|
||||
TextView lblExtraMsg1;
|
||||
//EditText文字編輯物件
|
||||
EditText txtQAmount1;
|
||||
//SeekBar滑桿元件
|
||||
SeekBar skbTimeSet1;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act4_selection);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("字義選擇 - 測驗設定");
|
||||
//連結按鈕物件
|
||||
btnChangeGroup1 = (Button) findViewById(R.id.btnChangeGroup1);
|
||||
//連結勾選方塊物件
|
||||
chkOnlyGroupItem1 = (CheckBox) findViewById(R.id.chkOnlyGroupItem1);
|
||||
chkOnlyGroupItem1.setOnCheckedChangeListener(this);
|
||||
//連結文字標籤物件
|
||||
lblTimePerQ1 = (TextView) findViewById(R.id.lblTimePerQ1);
|
||||
lblExtraMsg1 = (TextView) findViewById(R.id.lblExtraMsg1);
|
||||
//連結文字編輯物件
|
||||
txtQAmount1 = (EditText) findViewById(R.id.txtQAmount1);
|
||||
//連結滑桿元件
|
||||
skbTimeSet1 = (SeekBar) findViewById(R.id.skbTimeSet1);
|
||||
skbTimeSet1.setOnSeekBarChangeListener(this);
|
||||
//初始化變數
|
||||
Selection = -1;
|
||||
extraMsg = "";
|
||||
qualified = true;
|
||||
N = false; A = false; V = false; ADV = false; PREP = false;
|
||||
}
|
||||
|
||||
//當【+】按鈕按下時
|
||||
public void btnAdd1_Click(View view) {
|
||||
int num = Integer.parseInt(txtQAmount1.getText().toString()) + 1;
|
||||
txtQAmount1.setText(String.valueOf((num < 10000) ? num : 9999));
|
||||
}
|
||||
|
||||
//當【-】按鈕按下時
|
||||
public void btnSubtract1_Click(View view) {
|
||||
int num = Integer.parseInt(txtQAmount1.getText().toString()) - 1;
|
||||
txtQAmount1.setText(String.valueOf((num > 0) ? num : 1));
|
||||
}
|
||||
|
||||
//當按鈕物件btnChangeGroup1_Click按下時
|
||||
public void btnChangeGroup1_Click(View view) {
|
||||
final ArrayAdapter<String> grouplist = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
|
||||
byte[] data;
|
||||
grouplist.add("所有單字");
|
||||
//讀取群組檔案
|
||||
try{
|
||||
InputStream is = new FileInputStream(getFilesDir()+"/groups.txt");
|
||||
data = new byte[is.available()];
|
||||
is.read(data); is.close();
|
||||
final String[] info = ((new String(data)).replace("\r","")).split("\n");
|
||||
for(int i=1;i<info.length;i+=2)
|
||||
grouplist.add(info[i]);
|
||||
//建立對話方塊
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
alert.setTitle("選擇群組");
|
||||
alert.setAdapter(grouplist, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Selection = which - 1;
|
||||
//設定群組選擇按鈕之文字
|
||||
btnChangeGroup1.setText(grouplist.getItem(which).toString());
|
||||
//若使用者不是選擇「所有單字」,即選擇序數大於等於0時。
|
||||
if(Selection>=0){
|
||||
//確認該選擇的群組內容不為空
|
||||
if(!info[Selection*2+2].equals("0")){
|
||||
int n=0, a=0, v=0, adv=0, prep=0; //紀錄個詞性在群組內的數量
|
||||
String[] spis = info[Selection*2+2].split(" "); //分解群組內容(字串)
|
||||
//若群組單字量大於4時,符合最低群組取用條件
|
||||
if(spis.length>4){
|
||||
//標示該群組可進行測驗
|
||||
qualified = true;
|
||||
//逐一地解析內容,並篩選、紀錄詞性總數
|
||||
for(int i=0;i<spis.length;i++){
|
||||
String[] wordinfo = MainActivity.ALL_WORDS.get(spis[i]);
|
||||
n += (wordinfo[0]!=null) ? 1 : 0;
|
||||
a += (wordinfo[1]!=null) ? 1 : 0;
|
||||
v += (wordinfo[2]!=null) ? 1 : 0;
|
||||
adv += (wordinfo[3]!=null) ? 1 : 0;
|
||||
prep += (wordinfo[4]!=null) ? 1 : 0;
|
||||
}
|
||||
//依詞性數量來判斷提醒使用者的訊息
|
||||
N = n>3; A = a>3; V = v>3; ADV = adv>3; PREP = prep>3;
|
||||
extraMsg = ((N && A && V && ADV && PREP) ? "" : "由於此群組內的") +
|
||||
(N ? "" : " 名詞") + (A ? "" : " 形容詞") + (V ? "" : " 動詞") + (ADV ? "" : " 副詞") + (PREP ? "" : " 介係詞") +
|
||||
((N && A && V && ADV && PREP) ? "" : "類的數量小於3個,因此系統若隨機選到該類詞性時,其選項會包括群組外的同詞性單字。");
|
||||
//若【選項中僅出現群組裡的單字】的格子勾選時,顯示其訊息
|
||||
lblExtraMsg1.setTextColor(Color.argb(255,160,160,160));
|
||||
if(chkOnlyGroupItem1.isChecked()){
|
||||
lblExtraMsg1.setText(extraMsg);
|
||||
}
|
||||
}else{ //若群組單字量小於等於4時,則告知使用者該群組不符合最低條件。
|
||||
//標示該群組不能進行測驗
|
||||
qualified = false;
|
||||
lblExtraMsg1.setTextColor(Color.RED);
|
||||
extraMsg = "群組內的單字量必須大於4個才能開始測驗!";
|
||||
lblExtraMsg1.setText(extraMsg);
|
||||
}
|
||||
}else{ //若該群組為空時,也就是單字量為0時,告知使用者該群組不可用
|
||||
//標示該群組不能進行測驗
|
||||
qualified = false;
|
||||
lblExtraMsg1.setTextColor(Color.RED);
|
||||
extraMsg = "由於所選群組內無任何單字,因此無法開始測驗!";
|
||||
lblExtraMsg1.setText(extraMsg);
|
||||
}
|
||||
}else{ //當使用者選擇「所有單字」選項時
|
||||
//標示該群組可進行測驗
|
||||
qualified = true;
|
||||
lblExtraMsg1.setTextColor(Color.argb(255,160,160,160));
|
||||
lblExtraMsg1.setText("");
|
||||
extraMsg = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
//顯示對話方塊
|
||||
alert.show();
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(Act4Selection.this, "群組檔案讀取錯誤。", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//當【選項中僅出現群組裡的單字】勾選方塊按下時
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if(qualified){
|
||||
if(isChecked) {
|
||||
lblExtraMsg1.setText(extraMsg);
|
||||
} else {
|
||||
lblExtraMsg1.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下時
|
||||
public void btnBack_Click(View view) {finish();}
|
||||
|
||||
//當【說明】按鈕按下時
|
||||
public void btnExplanation1_Click(View view) {
|
||||
final AlertDialog.Builder adExp1, adExp2, adExp3;
|
||||
//設定對話方塊的內容
|
||||
adExp3 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("在設定的部分,你可以選擇目前所定義的群組單字、設定題目數及設定每一題的回答時間。" +
|
||||
"完成之後你就可以按下【開始測驗】來進行測驗了!")
|
||||
.setPositiveButton("完成", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
adExp2 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("若你選擇正確,增加一次回答正確的紀錄;若選擇錯誤,則會公布正確答案並增加一次回答錯誤的紀錄。")
|
||||
.setPositiveButton("下一頁", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
adExp3.show();
|
||||
}
|
||||
});
|
||||
adExp1 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("此測驗方法與四選一選擇題一樣,題目會秀出英文單字與其詞性," +
|
||||
"而下方有四個寫著不同中文意義的按鈕,你只需要選出與題目相符的答案。")
|
||||
.setPositiveButton("下一步", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
adExp2.show();
|
||||
}
|
||||
});
|
||||
adExp1.show();
|
||||
}
|
||||
|
||||
//當【開始測驗】按鈕按下時
|
||||
public void btnStartTest1_Click(View view) {
|
||||
//如果所選群組符合條件
|
||||
if(qualified){
|
||||
Intent it = new Intent(Act4Selection.this,ActMultipleChoice.class);
|
||||
it.putExtra("Selection", Selection); //使用者所選的群組
|
||||
it.putExtra("Amount", Integer.valueOf(txtQAmount1.getText().toString())); //測驗的題目總數
|
||||
it.putExtra("SecPerQ", skbTimeSet1.getProgress()); //一題的限制秒數
|
||||
//選項的單字是否僅出現群組中所有的單字
|
||||
if(chkOnlyGroupItem1.isChecked()){
|
||||
it.putExtra("cN", N); it.putExtra("cA", A); it.putExtra("cV", V);
|
||||
it.putExtra("cADV", ADV); it.putExtra("cPREP", PREP);
|
||||
}else{
|
||||
it.putExtra("cN", false); it.putExtra("cA", false); it.putExtra("cV", false);
|
||||
it.putExtra("cADV", false); it.putExtra("cPREP", false);
|
||||
}
|
||||
startActivity(it);
|
||||
}
|
||||
}
|
||||
|
||||
////SeekBar滑桿物件的事件處理副程式
|
||||
//當滑感滑動時
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if(progress==0){
|
||||
lblTimePerQ1.setText("每題答題時間: 無限制");
|
||||
}else{
|
||||
lblTimePerQ1.setText("每題答題時間: "+progress+"秒");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
|
||||
////#######################
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.example.leeyuanair.englishhelper.act_4selections;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
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 com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Act4SelectionResult extends AppCompatActivity implements ListView.OnItemClickListener {
|
||||
//Global Variables
|
||||
ArrayList<String[]> QuestionList;
|
||||
ArrayList<Integer> AnswerList;
|
||||
ArrayList<Integer> UserAnswerList;
|
||||
//TextView文字標籤物件
|
||||
TextView lblQuestionAmount1;
|
||||
TextView lblRights1;
|
||||
TextView lblWrongs1;
|
||||
//ListView清單物件
|
||||
ListView lstAnswerLog1;
|
||||
//ArrayAdapter清單陣列連結物件
|
||||
ArrayAdapter<String> answerLogAdapter;
|
||||
//AlertDialog.Builder對話方塊建立物件
|
||||
AlertDialog.Builder aswInfo;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act4_selection_result);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("字義選擇 - 測驗結果");
|
||||
//連結文字標籤物件
|
||||
lblQuestionAmount1 = (TextView) findViewById(R.id.lblQuestionAmount1);
|
||||
lblRights1 = (TextView) findViewById(R.id.lblRights1);
|
||||
lblWrongs1 = (TextView) findViewById(R.id.lblWrongs1);
|
||||
//連結清單物件
|
||||
lstAnswerLog1 = (ListView) findViewById(R.id.lstAnswerLog1);
|
||||
//取得測驗後的資料
|
||||
Bundle msg = getIntent().getExtras();
|
||||
QuestionList = (ArrayList<String[]>) msg.get("QuestionList");
|
||||
AnswerList = (ArrayList<Integer>) msg.get("AnswerList");
|
||||
UserAnswerList = (ArrayList<Integer>) msg.get("UserAnswerList");
|
||||
lblQuestionAmount1.setText(String.valueOf(msg.getInt("maxQ")));
|
||||
lblRights1.setText(String.valueOf(msg.getInt("rights")));
|
||||
lblWrongs1.setText(String.valueOf(msg.getInt("maxQ")-msg.getInt("rights")));
|
||||
//設定ArrayAdapter,並將其連結至lstAnswerLog1裡
|
||||
answerLogAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
|
||||
String[] itemSlot;
|
||||
for(int i=0; i<QuestionList.size(); i++){
|
||||
itemSlot = QuestionList.get(i);
|
||||
answerLogAdapter.add(((AnswerList.get(i).equals(UserAnswerList.get(i))) ? "O " : "X ")+(i+1)+". "+itemSlot[0]+" "+itemSlot[AnswerList.get(i)]);
|
||||
}
|
||||
lstAnswerLog1.setAdapter(answerLogAdapter);
|
||||
//將lstAnswerLog1的點選項目事件連結到此類別下的onItemClick()處
|
||||
lstAnswerLog1.setOnItemClickListener(this);
|
||||
//初始化對話方塊物件
|
||||
aswInfo = new AlertDialog.Builder(this);
|
||||
aswInfo.setPositiveButton("OK", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
}
|
||||
|
||||
//當lstAnswerLog1被按下某一個項目時
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
try {
|
||||
if (AnswerList.get(position).equals(UserAnswerList.get(position))) {
|
||||
aswInfo.setTitle("此題答對");
|
||||
aswInfo.setMessage("答案: " + QuestionList.get(position)[AnswerList.get(position)]);
|
||||
} else {
|
||||
aswInfo.setTitle("此題答錯");
|
||||
aswInfo.setMessage("正確答案: " + QuestionList.get(position)[AnswerList.get(position)] + "\r\n你的答案: " +
|
||||
((UserAnswerList.get(position).equals(-1)) ? "*超出時間" : QuestionList.get(position)[UserAnswerList.get(position)]));
|
||||
}
|
||||
aswInfo.show();
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(Act4SelectionResult.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
void keep(){
|
||||
|
||||
}
|
||||
|
||||
//當【返回至設定頁面】按鈕按下時
|
||||
public void btnBack5_Click(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
@ -0,0 +1,356 @@
|
||||
package com.example.leeyuanair.englishhelper.act_4selections;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class ActMultipleChoice extends AppCompatActivity {
|
||||
//Global Variable
|
||||
int maxQ, Q; //總題數, 目前答題
|
||||
int timelimit, timecount; //時間倒數值, 計時值
|
||||
int rights; //答對題數
|
||||
boolean cN, cA, cV, cADV, cPREP; //該詞性是否只取用群組中的單字
|
||||
boolean checks[];
|
||||
public int delay; //延遲時間
|
||||
public int mode; //表示目前計數的模式
|
||||
int backUpTimeCount; //計算使用者按下返回鍵時再按下一次返回鍵間的間隔時間
|
||||
//若在該時間之內則讓使用者退出測驗
|
||||
//題目方面的變數
|
||||
ArrayList<String[]> QuestionList; //題目清單
|
||||
ArrayList<Integer> AnswerList; //答案清單
|
||||
ArrayList<Integer> UserAnswerList; //紀錄使用者的回答
|
||||
//Timer計時器
|
||||
Timer countdownTimer;
|
||||
//TextView文字標籤物件
|
||||
TextView lbl4SelStatus1, lbl4SelStatus2;
|
||||
TextView lbl4SelQuestion;
|
||||
//Button按鈕物件
|
||||
Button btnSelection1, btnSelection2, btnSelection3, btnSelection4;
|
||||
//ProgressBar進度顯示物件
|
||||
ProgressBar pgbCountdown1;
|
||||
//AlertDialog.Builder對話框建立物件
|
||||
AlertDialog AnswerShows;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_multiple_choice);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("字義選擇");
|
||||
Bundle msg = getIntent().getExtras();
|
||||
mode = 1; delay=4;
|
||||
//##連結文字標籤物件
|
||||
lbl4SelStatus1 = (TextView) findViewById(R.id.lbl4SelStatus1);
|
||||
lbl4SelStatus2 = (TextView) findViewById(R.id.lbl4SelStatus2);
|
||||
lbl4SelQuestion = (TextView) findViewById(R.id.lbl4SelQuestion);
|
||||
//##連結按鈕物件
|
||||
btnSelection1 = (Button) findViewById(R.id.btnSelection1);
|
||||
btnSelection2 = (Button) findViewById(R.id.btnSelection2);
|
||||
btnSelection3 = (Button) findViewById(R.id.btnSelection3);
|
||||
btnSelection4 = (Button) findViewById(R.id.btnSelection4);
|
||||
//##連結進度表示物件 並 為其建立獨立的執行續以連結倒數的動作
|
||||
pgbCountdown1 = (ProgressBar) findViewById(R.id.pgbCountdown1);
|
||||
//##初始化對話框物件
|
||||
AnswerShows = (new AlertDialog.Builder(this)).create();
|
||||
AnswerShows.setTitle("答案");
|
||||
AnswerShows.setCancelable(false);
|
||||
//##取得資料
|
||||
maxQ = msg.getInt("Amount");
|
||||
timelimit = msg.getInt("SecPerQ") * 1000;
|
||||
checks = new boolean[5];
|
||||
checks[0] = msg.getBoolean("cN"); checks[1] = msg.getBoolean("cA"); checks[2] = msg.getBoolean("cV");
|
||||
checks[3] = msg.getBoolean("cADV"); checks[4] = msg.getBoolean("cPREP");
|
||||
//##初始化變數
|
||||
timecount = 0; Q = 0;
|
||||
rights = 0;
|
||||
countdownTimer = new Timer();
|
||||
countdownTimer.schedule(countdownTask, 0, 1);
|
||||
//將進度顯示物件的最大直設為timelimit
|
||||
pgbCountdown1.setMax(1000);
|
||||
//##初始化介面
|
||||
lbl4SelStatus1.setText("總題數: "+maxQ+" ,目前答題: 0");
|
||||
//##初始化題目列表
|
||||
InitQuestionList(msg.getInt("Selection"));
|
||||
}
|
||||
|
||||
//TimerTask計時器工作物件 - 當Timer倒數計時至一定時間時所執行的動作,其中利用此物件作為Timer工作表。
|
||||
public final TimerTask countdownTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
//####透過runOnUiThread來取得合法控制使用者介面物件的權利####
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//若backUpTimeCount大於0,則將其減1
|
||||
if (backUpTimeCount > 0) backUpTimeCount--;
|
||||
//####以下為測驗判斷程序####
|
||||
//依照mode是否為真,將timecount+1或-1
|
||||
timecount += mode;
|
||||
//如果延遲時間計數delay大於0 - 為使用者剛進入時的緩衝時間
|
||||
if (delay > 0) {
|
||||
//每次做1秒的倒數,當倒數至1秒時,delay-1,時間計數timecount重設回0,此動作直到delay==0為止。
|
||||
if (timecount == 1000) {
|
||||
delay--;
|
||||
timecount = 0;
|
||||
//當delay計數完時,將進度顯示物件的最大值設為使用者所限制的時間timelimit
|
||||
if (delay == 0) {
|
||||
pgbCountdown1.setMax((timelimit>0) ? timelimit : 500);
|
||||
if (timelimit == 0) {
|
||||
mode = 0;
|
||||
timecount=1;
|
||||
}
|
||||
lbl4SelQuestion.setText(QuestionList.get(Q)[0]);
|
||||
btnSelection1.setText(QuestionList.get(Q)[1]);
|
||||
btnSelection2.setText(QuestionList.get(Q)[2]);
|
||||
btnSelection3.setText(QuestionList.get(Q)[3]);
|
||||
btnSelection4.setText(QuestionList.get(Q)[4]);
|
||||
} else {
|
||||
//若delay沒有計數完,則顯示倒數數值delay
|
||||
lbl4SelQuestion.setText(String.valueOf(delay));
|
||||
}
|
||||
}
|
||||
} else { //如果delay==0時(即delay<0時),也就是使用者已經進入測驗狀態
|
||||
if (mode == 1) {
|
||||
//判別計數時間是否到達限制時間
|
||||
if (timecount > timelimit) {
|
||||
//如果以到達時間的話,將mode(測驗模式)設為false,表示目前暫停測驗
|
||||
//並告知使用者的作答時間已經超過預設時間、顯示答案及更新答題狀態
|
||||
//最後設定2秒短暫延遲時間讓使用者可以看得到答案
|
||||
mode = -1;
|
||||
UserAnswerList.add(-1);
|
||||
AnswerShows.setTitle("超過時間!");
|
||||
AnswerShows.setMessage("答案: " + QuestionList.get(Q)[AnswerList.get(Q)]);
|
||||
AnswerShows.show();
|
||||
pgbCountdown1.setProgress(2000);
|
||||
pgbCountdown1.setMax(2000);
|
||||
timecount = 2000;
|
||||
}
|
||||
} else {
|
||||
//若顯示答案的時間完畢後
|
||||
if (timecount == 0) {
|
||||
//確認全部題目是否答完
|
||||
if (Q == maxQ - 1) {
|
||||
AnswerShows.dismiss(); //把AnswerShows對話方塊取消掉
|
||||
countdownTimer.cancel();
|
||||
countdownTimer.purge();
|
||||
//開啟結果顯示頁面
|
||||
Intent it = new Intent(ActMultipleChoice.this, Act4SelectionResult.class);
|
||||
it.putExtra("QuestionList", QuestionList);
|
||||
it.putExtra("AnswerList", AnswerList);
|
||||
it.putExtra("UserAnswerList", UserAnswerList);
|
||||
it.putExtra("maxQ", maxQ);
|
||||
it.putExtra("rights", rights);
|
||||
startActivityForResult(it, 0);
|
||||
} else { //如果題目尚未全部答完的話,則目前題號+1,並更新題目內容
|
||||
mode = (timelimit == 0) ? 0 : 1; //把mode轉為true,為答題模式
|
||||
timecount = (timelimit == 0) ? 1 : 0; //若時限為無限制,則把timecount設為1,以免誤判
|
||||
AnswerShows.dismiss(); //把AnswerShows對話方塊取消掉
|
||||
//更新題目內容
|
||||
Q++; //題號+1
|
||||
//依照目前的題號,從題目清單裡提出題目與四個選項,並放入所設定的位置
|
||||
lbl4SelQuestion.setText(QuestionList.get(Q)[0]);
|
||||
btnSelection1.setText(QuestionList.get(Q)[1]);
|
||||
btnSelection2.setText(QuestionList.get(Q)[2]);
|
||||
btnSelection3.setText(QuestionList.get(Q)[3]);
|
||||
btnSelection4.setText(QuestionList.get(Q)[4]);
|
||||
//更新答題數狀態
|
||||
lbl4SelStatus1.setText("總題數: " + maxQ + ", 目前答題: " + (Q + 1));
|
||||
lbl4SelStatus2.setText("答對題數: " + String.valueOf(rights) + " ,答錯題數: " + String.valueOf(Q - rights));
|
||||
pgbCountdown1.setMax((timelimit>0) ? timelimit : 500); //將進度顯示物件的最大值設為timelimit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新進度顯示物件的進度數值
|
||||
pgbCountdown1.setProgress(timecount);
|
||||
}
|
||||
});
|
||||
//############################################################
|
||||
}
|
||||
};
|
||||
|
||||
//程序 - 初始化題目列表
|
||||
void InitQuestionList(int index){
|
||||
ArrayList<String> tarGroup = (index>=0) ? (MainActivity.GROUPS.get(MainActivity.GROUP_NAMES.get(index))) : (MainActivity.WORDS); //取得使用者所選的群組
|
||||
Random rnd = new Random(); //亂數產生器
|
||||
rnd.setSeed(rnd.nextInt(100));
|
||||
QuestionList = new ArrayList<>(); //題目清單
|
||||
AnswerList = new ArrayList<>(); //答案清單回答紀錄(清單)
|
||||
UserAnswerList = new ArrayList<>(); //使用者
|
||||
int type, ans; //type表示目前所視單字的某項詞性: 0為名詞、1為形容詞、2為動詞、3為副詞、4為介係詞; ans表示答案正確項
|
||||
//判別使用者所選定的題數數量是否大於群組內所有單字的數量
|
||||
ArrayList<String> rndGroup = new ArrayList<>(); //初始化基本亂數題庫
|
||||
//如果使用者所指定的題目數量超過所選單字群組內的單字數量的話,則亂數取得動作就做1次以上
|
||||
//其次數依照maxQ使用者指定出題數 除以 所選群組內單字量後結果的+1次
|
||||
for(int i=1;i<=(maxQ/tarGroup.size()+1);i++){
|
||||
rndGroup.addAll(randomizeItems(tarGroup));
|
||||
}
|
||||
String[] itemPorts; //項目插槽 - 0為詞性, 1~4為答案選項
|
||||
//##依次對每一個項目做整理的動作
|
||||
for(int i=1;i<=maxQ;i++){
|
||||
//##更新項目插槽
|
||||
itemPorts = new String[5];
|
||||
//##取得單字資訊
|
||||
String[] wordinfo = MainActivity.ALL_WORDS.get(rndGroup.get(i));
|
||||
type = rnd.nextInt(5); //隨機取得此字中的某一詞性
|
||||
while(wordinfo[type]==null){ //判斷所選單字有沒有該詞性,如果無,則項次+1直到有為止
|
||||
type++;
|
||||
if(type==5) type=0;
|
||||
}
|
||||
ans = rnd.nextInt(4)+1; //從1~4中隨機選取一項(號)作為要放入答案的地方
|
||||
AnswerList.add(ans); //將亂數所取的答案號放入答案清單中
|
||||
itemPorts[ans] = wordinfo[type]; //將正確的中文詞性意思放入該項中
|
||||
switch(type) { //依照所紀錄數值來決定要放入何種詞性(字串)
|
||||
case 0:
|
||||
itemPorts[0] = rndGroup.get(i) + " (n.)";
|
||||
break;
|
||||
case 1:
|
||||
itemPorts[0] = rndGroup.get(i) + " (adj.)";
|
||||
break;
|
||||
case 2:
|
||||
itemPorts[0] = rndGroup.get(i) + " (v.)";
|
||||
break;
|
||||
case 3:
|
||||
itemPorts[0] = rndGroup.get(i) + " (adv.)";
|
||||
break;
|
||||
case 4:
|
||||
itemPorts[0] = rndGroup.get(i) + " (prep.)";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//##由項目插槽的標號1做到標號4
|
||||
//設定初始亂數位置,當選擇到某一數值後,其後都會逐次往下,如: rndNum亂數取得到11,之後所要選的亂數都會是12,13,14...逐次下去的
|
||||
int rndNum = checks[type] ? (tarGroup.size()) : (MainActivity.ALL_WORDS.size());
|
||||
rndNum = rnd.nextInt(rndNum);
|
||||
String selected; //表示由亂數所選到的英文單字
|
||||
String[] selectedWordInfo; //表示所選到的英文單字的詞性內容
|
||||
for(int q=1 ; q<=4 ; q++) {
|
||||
/*
|
||||
//此部分可以簡化//
|
||||
*/
|
||||
//如果標號q內的內容為無值的話
|
||||
if(itemPorts[q]==null){
|
||||
//確認是否要在單字群組裡隨機選取
|
||||
if (checks[type]) {
|
||||
//##以rndNum選擇一個單字,直到符合為止
|
||||
do{
|
||||
if(rndNum < tarGroup.size()-1)
|
||||
rndNum++;
|
||||
else
|
||||
rndNum=0;
|
||||
//單字群組中從取得該單字
|
||||
selected = tarGroup.get(rndNum);
|
||||
//取得該單字的訊息
|
||||
selectedWordInfo = MainActivity.ALL_WORDS.get(selected);
|
||||
//最後確認所選的單字有沒有該詞性 *並且 確認所選單字並不與目標單字相符
|
||||
}while(selectedWordInfo[type]==null || selectedWordInfo[type].equals(itemPorts[ans]));
|
||||
itemPorts[q] = selectedWordInfo[type]; //將亂數所選到的英文單字的指定詞性的內容放入位於 q 號的項目插槽裡
|
||||
} else { //從所有單字裡隨機選取
|
||||
//##以rndNum選擇一個單字,直到符合為止
|
||||
do{
|
||||
rndNum++;
|
||||
if(rndNum >= MainActivity.ALL_WORDS.size())
|
||||
rndNum=0;
|
||||
//單字群組中從取得該單字
|
||||
selected = MainActivity.WORDS.get(rndNum);
|
||||
//取得該單字的訊息
|
||||
selectedWordInfo = MainActivity.ALL_WORDS.get(selected);
|
||||
//最後確認所選的單字有沒有該詞性 *並且 確認所選單字並不與目標單字相符
|
||||
}while(selectedWordInfo[type]==null || selectedWordInfo[type].equals(itemPorts[ans]));
|
||||
itemPorts[q] = selectedWordInfo[type]; //將亂數所選到的英文單字的指定詞性的內容放入位於 q 號的項目插槽裡
|
||||
}
|
||||
}
|
||||
}
|
||||
//將處理好的項目插槽(題目及選項)放入問題清單中
|
||||
QuestionList.add(itemPorts);
|
||||
}
|
||||
}
|
||||
//InitQuestionList -> 函式 - 回傳內容不重覆的隨機單字清單
|
||||
ArrayList<String> randomizeItems(ArrayList<String> group){
|
||||
ArrayList<String> rndGroup = (ArrayList<String>) group.clone(); //複製群組單字至rndGroup裡
|
||||
//建立亂數產生器物件
|
||||
Random rnd = new Random();
|
||||
rnd.setSeed(rnd.nextInt(100));
|
||||
//num表示由亂數所取得的整數數值; temp表示兩變數間交換內容時的暫存處
|
||||
int num; String temp;
|
||||
//##開始隨機排列內容:
|
||||
//作用範圍一次一次地從最大住標處做到至住標1
|
||||
//將所取的亂數放入num後,依num從rndGroup裡取出該英文單字後放入temp裡
|
||||
//然後再將rndGroup裡住標num處的英文單字覆蓋為目前範圍的最後一個英文單字(也就是在住標 i 處的英文單字)
|
||||
//最後將temp覆蓋至rndGroup裡的住標 i 處,就可完成兩變數內容交換的動作了。
|
||||
//##以上為不重複隨機排列集合內容的方法
|
||||
for(int i = rndGroup.size()-1;i>0;i--) {
|
||||
num = rnd.nextInt(i + 1);
|
||||
temp = rndGroup.get(num);
|
||||
rndGroup.set(num, rndGroup.get(i));
|
||||
rndGroup.set(i, temp);
|
||||
}
|
||||
return rndGroup;
|
||||
}
|
||||
|
||||
//當btnSelection1按鈕物件按下後
|
||||
public void btnSelection1_Click(View view) {if(delay==0){answerResult(AnswerList.get(Q)==1); UserAnswerList.add(1);}}
|
||||
//當btnSelection2按鈕物件按下後
|
||||
public void btnSelection2_Click(View view) {if(delay==0){answerResult(AnswerList.get(Q)==2); UserAnswerList.add(2);}}
|
||||
//當btnSelection3按鈕物件按下後
|
||||
public void btnSelection3_Click(View view) {if(delay==0){answerResult(AnswerList.get(Q)==3); UserAnswerList.add(3);}}
|
||||
//當btnSelection4按鈕物件按下後
|
||||
public void btnSelection4_Click(View view) {if(delay==0){answerResult(AnswerList.get(Q)==4); UserAnswerList.add(4);}}
|
||||
|
||||
//程序 - 使用者答錯或答對時的系統反應
|
||||
void answerResult(boolean isRight){
|
||||
rights += isRight ? 1 : 0;
|
||||
AnswerShows.setTitle(isRight ? "答對!" : "答錯!");
|
||||
AnswerShows.setMessage("答案: " + QuestionList.get(Q)[AnswerList.get(Q)]);
|
||||
AnswerShows.show();
|
||||
mode = -1;
|
||||
pgbCountdown1.setProgress(2000);
|
||||
pgbCountdown1.setMax(2000);
|
||||
timecount = 2000;
|
||||
}
|
||||
|
||||
//當下層的頁面關閉時,也就是結果顯示頁面關閉時,回到此頁面後直接關閉
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
finish();
|
||||
}
|
||||
|
||||
//攔截使用者所按下的按鍵 - 包含返回、家、視窗等等按鍵
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
if(backUpTimeCount==0){
|
||||
backUpTimeCount=2000;
|
||||
Toast.makeText(ActMultipleChoice.this, "再按一次即可離開測驗", Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
//當此頁面要關閉的時候
|
||||
@Override
|
||||
public void onDestroy(){
|
||||
countdownTimer.cancel();
|
||||
countdownTimer.purge();
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.example.leeyuanair.englishhelper.act_allwords;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
public class ActAddingGroup extends AppCompatActivity {
|
||||
//EditText
|
||||
EditText txtNewGroupName;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_adding_group);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("建立新的群組");
|
||||
//鏈結文字輸入方塊物件
|
||||
txtNewGroupName = (EditText) findViewById(R.id.txtNewGroupName);
|
||||
}
|
||||
|
||||
public void btnCancelNewGroup_Click(View view) {
|
||||
Intent resent = new Intent();
|
||||
resent.putExtra("NewGroupName", "$NONE");
|
||||
setResult(0, resent);
|
||||
finish();
|
||||
}
|
||||
|
||||
public void btnAddNewGroupName_Click(View view) {
|
||||
String groupName = txtNewGroupName.getText().toString();
|
||||
if(groupName.length()==0 || groupName.equals("$NONE")){
|
||||
AlertDialog.Builder ad = new AlertDialog.Builder(this);
|
||||
ad.setTitle("無效的群組名稱");
|
||||
ad.setMessage("群組名稱不可為空白或\"$NONE\"\n請重新輸入");
|
||||
ad.setPositiveButton("OK", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
ad.show();
|
||||
}else{
|
||||
Intent resent = new Intent();
|
||||
resent.putExtra("NewGroupName", txtNewGroupName.getText().toString());
|
||||
setResult(0, resent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.example.leeyuanair.englishhelper.act_allwords;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.ActSearchWord;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
public class ActAllVoca extends AppCompatActivity implements AdapterView.OnItemClickListener {
|
||||
//Buttons
|
||||
Button btnBackUp;
|
||||
//ListView
|
||||
ListView lstWords;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_all_voca);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("單字列表");
|
||||
//從Intent中解析Bundle
|
||||
Bundle msg = getIntent().getExtras();
|
||||
//連結按鈕物件
|
||||
btnBackUp = (Button) findViewById(R.id.btnBackUp);
|
||||
//鏈結清單物件
|
||||
lstWords = (ListView) findViewById(R.id.lstWords);
|
||||
lstWords.setOnItemClickListener(this);
|
||||
}
|
||||
//返回上一層
|
||||
public void btnBackUp_Click(View view) {finish();}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Object SelItem = parent.getItemAtPosition(position);
|
||||
Intent theIntent = new Intent(this,ActPieceVoca.class);
|
||||
theIntent.putExtra("SelectedItem",SelItem.toString());
|
||||
startActivity(theIntent);
|
||||
}
|
||||
|
||||
public void btnFinder_Click(View view) {
|
||||
Intent theIntent = new Intent(this, ActSearchWord.class);
|
||||
theIntent.putExtra("isAddingMode", false);
|
||||
startActivity(theIntent);
|
||||
}
|
||||
|
||||
public void btnGrouping_Click(View view) {
|
||||
Intent theIntent = new Intent(this,ActGrouping.class);
|
||||
startActivity(theIntent);
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.example.leeyuanair.englishhelper.act_allwords;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.ActSearchWord;
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class ActEditingGroup extends AppCompatActivity implements ListView.OnItemClickListener {
|
||||
//Valuable
|
||||
String groupName; //群組名稱
|
||||
ArrayList<String> groupArray; //指定群組中的所有單字
|
||||
ArrayAdapter<String> arrayAdapter;
|
||||
ArrayList<Integer> Selections;
|
||||
//ListView清單物件
|
||||
ListView lstGroupWords;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_editing_group);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
//鏈結清單物件
|
||||
lstGroupWords = (ListView) findViewById(R.id.lstGroupWords);
|
||||
lstGroupWords.setOnItemClickListener(this);
|
||||
//初始化變數//
|
||||
Selections = new ArrayList<>();
|
||||
//讀取上一層所給的資料
|
||||
groupName = getIntent().getExtras().getString("groupName");
|
||||
setTitle("群組\"" + groupName + "\"內的所有單字");
|
||||
groupArray = MainActivity.GROUPS.get(groupName);
|
||||
if(groupArray.get(0).equals("0"))
|
||||
groupArray.remove(0);
|
||||
arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, groupArray);
|
||||
//將arrayAdapter鏈結至lstGroupWords
|
||||
lstGroupWords.setAdapter(arrayAdapter);
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下時
|
||||
public void btnBack4_Click(View view) {
|
||||
Intent newIntent = new Intent();
|
||||
if(groupArray.size()==0)
|
||||
groupArray.add("0");
|
||||
setResult(1, newIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
//當【新增單字】按鈕按下時
|
||||
public void btnAddWord_Click(View view) {
|
||||
Intent theIntent = new Intent(this, ActSearchWord.class);
|
||||
theIntent.putExtra("isAddingMode", true);
|
||||
startActivityForResult(theIntent, 0);
|
||||
}
|
||||
//當【刪除單字】按鈕按下時
|
||||
public void btnRemoveWord_Click(View view) {
|
||||
if(!Selections.isEmpty()) {
|
||||
try {
|
||||
Collections.sort(Selections);
|
||||
for (int i = 0; i < arrayAdapter.getCount(); i++)
|
||||
lstGroupWords.setItemChecked(i, false);
|
||||
for (int i = Selections.size() - 1; i >= 0; i--)
|
||||
groupArray.remove((int) Selections.get(i));
|
||||
Selections.clear();
|
||||
arrayAdapter.notifyDataSetChanged();
|
||||
} catch (Exception ex) {
|
||||
Toast.makeText(ActEditingGroup.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(ActEditingGroup.this, "請選擇欲刪除的單字", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當下一層頁面關閉後
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if(resultCode==0){
|
||||
ArrayList<String> Addition = (ArrayList<String>) data.getExtras().get("Addition");
|
||||
for(String item : Addition){
|
||||
if(!groupArray.contains(item)){
|
||||
groupArray.add(item);
|
||||
}
|
||||
}
|
||||
Collections.sort(groupArray);
|
||||
arrayAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
//當使用者按下清單裡某一項時
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
try{
|
||||
if(Selections.contains(position))
|
||||
Selections.remove(Selections.indexOf(position));
|
||||
else
|
||||
Selections.add(position);
|
||||
}catch (Exception ex){
|
||||
Toast.makeText(ActEditingGroup.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//攔截使用者所按下的按鍵 - 包含返回、家、視窗等等按鍵
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
Intent newIntent = new Intent();
|
||||
if(groupArray.size()==0)
|
||||
groupArray.add("0");
|
||||
setResult(1, newIntent);
|
||||
finish();
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package com.example.leeyuanair.englishhelper.act_allwords;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActGrouping extends AppCompatActivity {
|
||||
//變數
|
||||
HashMap<String, ArrayList<String>> groups;
|
||||
//ArrayList<String> groups; //紀錄所有Groups的名稱
|
||||
ArrayAdapter<String> arrayAdapter;
|
||||
int grpCount;
|
||||
int SelPosition;
|
||||
//ListView
|
||||
ListView lstGroups;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_grouping);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("單字群組");
|
||||
//初始化變數
|
||||
groups = new HashMap<>();
|
||||
arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, MainActivity.GROUP_NAMES);
|
||||
SelPosition = -1;
|
||||
//鏈結清單元件
|
||||
lstGroups = (ListView) findViewById(R.id.lstGroups);
|
||||
lstGroups.setAdapter(arrayAdapter);
|
||||
lstGroups.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下 - 返回上一層
|
||||
public void btnBack3_Click(View view) {
|
||||
try {
|
||||
OutputStream os = new FileOutputStream(getFilesDir() + "/groups.txt", false); //false -> 複寫檔案
|
||||
String saves = String.valueOf(MainActivity.groupCount);
|
||||
//束整資料 - 將資料轉換成字串的形式並儲存
|
||||
for(String key : MainActivity.GROUP_NAMES){
|
||||
saves += "\r\n" + key + "\r\n" + WordsArrayList2String(MainActivity.GROUPS.get(key));
|
||||
}
|
||||
//將資料寫入
|
||||
os.write(saves.getBytes());
|
||||
os.close();
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
String WordsArrayList2String(ArrayList<String> words){
|
||||
String returns = words.get(0);
|
||||
for(int i=1;i<words.size();i++){
|
||||
returns += " " + words.get(i);
|
||||
}
|
||||
return returns;
|
||||
}
|
||||
|
||||
//當【新增群組】按鈕按下
|
||||
public void btnAddNewGroup_Click(View view) {
|
||||
//開啟ActAddingGroup新增群組的介面
|
||||
Intent theIntent = new Intent(this,ActAddingGroup.class);
|
||||
startActivityForResult(theIntent, 0);
|
||||
}
|
||||
|
||||
//當【移除群組】按鈕按下
|
||||
public void btnRemoveGroup_Click(View view) {
|
||||
try{
|
||||
final int index = lstGroups.getCheckedItemPosition(); //為使用者所選取的項目的駐標
|
||||
final String groupName = lstGroups.getItemAtPosition(index).toString(); //為使用者所選取的群組名稱
|
||||
//若使用者有選取項目(群組),即index大於-1時
|
||||
if (index>-1){
|
||||
//生成一個對話方塊來再次確認是否刪除
|
||||
AlertDialog.Builder ad = new AlertDialog.Builder(this);
|
||||
//設定對話方塊的標題為"確認刪除"
|
||||
ad.setTitle("確認刪除");
|
||||
//設定對話方塊的內容為"確定要刪除群組"[群組名稱]"?"
|
||||
ad.setMessage("確定要刪除群組\"" + lstGroups.getItemAtPosition(lstGroups.getCheckedItemPosition()) + "\"?");
|
||||
//設定當使用者按下對話方塊的正回應按鍵,也就是按下"確定"按鈕時的事件。
|
||||
//若使用者按下【確定】,以指定所選的項目,把groups裡的群組名稱與群組內容、arrayAdapter裡的群組名稱刪除。
|
||||
ad.setPositiveButton("確定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
try {
|
||||
MainActivity.GROUPS.remove(groupName);
|
||||
MainActivity.GROUP_NAMES.remove(index);
|
||||
MainActivity.groupCount--;
|
||||
arrayAdapter.notifyDataSetChanged();
|
||||
lstGroups.setSelection(-1);
|
||||
} catch (Exception ex) {
|
||||
Toast.makeText(ActGrouping.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
//設定當使用者按下對話方塊的負回應按鍵,也就是按下"取消"按鈕時的事件。
|
||||
ad.setNegativeButton("取消", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
//顯示對話方塊
|
||||
ad.show();
|
||||
}
|
||||
}catch (Exception ex){
|
||||
if(ex.getClass().getSimpleName().equals("NullPointerException"))
|
||||
Toast.makeText(this, "請選擇欲刪除的群組", Toast.LENGTH_SHORT).show();
|
||||
else
|
||||
Toast.makeText(ActGrouping.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當【編輯群組單字】按鈕按下
|
||||
public void btnViewGroupWords_Click(View view) {
|
||||
try{
|
||||
String groupName = lstGroups.getItemAtPosition(lstGroups.getCheckedItemPosition()).toString();
|
||||
Intent theIntent = new Intent(this, ActEditingGroup.class);
|
||||
theIntent.putExtra("groupName", groupName);
|
||||
startActivityForResult(theIntent, 1);
|
||||
}catch(Exception ex){
|
||||
if(ex.getClass().getSimpleName().equals("NullPointerException"))
|
||||
Toast.makeText(this, "請選擇欲編輯的群組", Toast.LENGTH_SHORT).show();
|
||||
else
|
||||
Toast.makeText(ActGrouping.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當下一層的版面關閉後
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (resultCode){
|
||||
case 0:
|
||||
String theName = data.getStringExtra("NewGroupName");
|
||||
if(!theName.equals("$NONE")){
|
||||
try{
|
||||
ArrayList<String> newArrayList = new ArrayList<>(); newArrayList.add("0");
|
||||
MainActivity.GROUPS.put(theName, newArrayList);
|
||||
MainActivity.GROUP_NAMES.add(theName);
|
||||
MainActivity.groupCount++;
|
||||
arrayAdapter.notifyDataSetChanged();
|
||||
}catch(Exception ex) {
|
||||
Toast.makeText(this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//ArrayList<String> groupArray = (ArrayList<String>) data.getExtras().get("groupArray");
|
||||
//String groupName = data.getExtras().getString("groupName");
|
||||
//groups.put(groupName, groupArray);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Keeps
|
||||
void keeps(){
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.example.leeyuanair.englishhelper.act_allwords;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.AssetManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
import com.example.leeyuanair.englishhelper.access.WordInfo;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActPieceVoca extends AppCompatActivity implements AdapterView.OnItemClickListener {
|
||||
ArrayList<String> WordsList;
|
||||
ArrayAdapter<String> arrayAdapter;
|
||||
//WordsData
|
||||
WordInfo[] words;
|
||||
//Button
|
||||
Button btnBack;
|
||||
//ListView
|
||||
ListView lstWords;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_piece_voca);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
//從Intent中解析Bundle
|
||||
Bundle msg = getIntent().getExtras();
|
||||
//鏈結按鈕物件
|
||||
btnBack = (Button) findViewById(R.id.btnBack1);
|
||||
//鏈結清單物件
|
||||
lstWords = (ListView) findViewById(R.id.lstWords1);
|
||||
lstWords.setOnItemClickListener(this);
|
||||
//設定基本清單數值
|
||||
WordsList = new ArrayList<String>();
|
||||
arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,WordsList);
|
||||
//取得於畫面ActAllVaco的lstWords裡所選擇項目,並依照該值取得相符的自首單字。
|
||||
String SelectedLetter = msg.getString("SelectedItem");
|
||||
readAppointedVoca(SelectedLetter);
|
||||
setTitle("字首為\""+SelectedLetter+"\"的所有單字");
|
||||
}
|
||||
|
||||
//程序: 讀取指定字首的單字,並設定至ListView。
|
||||
protected void readAppointedVoca(String letter){
|
||||
AssetManager as = getAssets();
|
||||
try{
|
||||
InputStream is = as.open("Words.txt");
|
||||
byte[] data = new byte[is.available()];
|
||||
is.read(data); is.close();
|
||||
WordsList.addAll(getAppointedVoca(new String(data),letter.toLowerCase()));
|
||||
arrayAdapter.notifyDataSetChanged();
|
||||
lstWords.setAdapter(arrayAdapter);
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(this,ex.toString(),Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
//函式: 取得指定字首的字(解析字串),並回傳所選到的字。
|
||||
protected ArrayList<String> getAppointedVoca(String data,String targe){
|
||||
ArrayList<String> returns = new ArrayList<String>();
|
||||
String[] info = (data.replace("\r","")).split("\n");
|
||||
String[] spis;
|
||||
for(int i = 1; i<info.length;i++){
|
||||
spis = info[i].split(" ");
|
||||
if(spis[0].indexOf(targe)==0){
|
||||
returns.add(spis[0]);
|
||||
}
|
||||
}
|
||||
return returns;
|
||||
}
|
||||
//當【返回】按鈕按下時,返回到上一層。
|
||||
public void btnBack1_onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
//處理清單按下某一項目時所處理的動作。即顯示使用者所選取的單字。
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Object SelItem = parent.getItemAtPosition(position);
|
||||
Intent theIntent = new Intent(this,ActWordInfo.class);
|
||||
theIntent.putExtra("SelectedWord", SelItem.toString());
|
||||
theIntent.putExtra("isAddingMode", false);
|
||||
//theIntent.putExtra("WordsData",words);
|
||||
startActivity(theIntent);
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package com.example.leeyuanair.englishhelper.act_allwords;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.AssetManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class ActWordInfo extends AppCompatActivity {
|
||||
//Global Variables
|
||||
boolean isAddingMode;
|
||||
String isAdd;
|
||||
//LinearLayout直式排版元件
|
||||
LinearLayout linNoun, linAdjective, linVerb, linAdverb, linPreposition;
|
||||
//TextView文字標籤元件
|
||||
TextView lblWordTitle, lblNoun, lblAdjective, lblVerb, lblAdverb, lblPreposition;
|
||||
//Button按鈕元件
|
||||
Button btnAdd2Addition;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_word_info);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
//取得傳遞的訊息
|
||||
Bundle msg = getIntent().getExtras();
|
||||
//鏈結橫列表格物件
|
||||
linNoun = (LinearLayout) findViewById(R.id.linNoun);
|
||||
linAdjective = (LinearLayout) findViewById(R.id.linAdjective);
|
||||
linVerb = (LinearLayout) findViewById(R.id.linVerb);
|
||||
linAdverb = (LinearLayout) findViewById(R.id.linAdverb);
|
||||
linPreposition = (LinearLayout) findViewById(R.id.linPreposition);
|
||||
//鏈結標籤物件
|
||||
lblWordTitle = (TextView) findViewById(R.id.lblWordTitle);
|
||||
lblNoun = (TextView) findViewById(R.id.lblNoun);
|
||||
lblAdjective = (TextView) findViewById(R.id.lblAdjective);
|
||||
lblVerb = (TextView) findViewById(R.id.lblVerb);
|
||||
lblAdverb = (TextView) findViewById(R.id.lblAdverb);
|
||||
lblPreposition = (TextView) findViewById(R.id.lblPreposition);
|
||||
//鏈結按鈕物件
|
||||
btnAdd2Addition = (Button) findViewById(R.id.btnAdd2Addition);
|
||||
//判斷是否有選擇單字的功能
|
||||
isAddingMode = (boolean) msg.get("isAddingMode");
|
||||
LayoutParams btnLayout = btnAdd2Addition.getLayoutParams();
|
||||
btnLayout.height = isAddingMode ? btnLayout.height : 0;
|
||||
btnAdd2Addition.setLayoutParams(btnLayout);
|
||||
btnAdd2Addition.setEnabled(isAddingMode);
|
||||
//初始化是否新增該單字的暫存,原設為無值null
|
||||
isAdd = null;
|
||||
//取得所選單字
|
||||
String SelectedWord = msg.getString("SelectedWord");
|
||||
setTitle("單字\""+SelectedWord+"\"的詞性、字義");
|
||||
//取得該單字的詞性與字義
|
||||
try{
|
||||
lblWordTitle.setText(SelectedWord);
|
||||
String[] pOS = MainActivity.ALL_WORDS.get(SelectedWord);
|
||||
lblNoun.setText((pOS[0]!=null && !pOS[0].equals("")) ? pOS[0] : "");
|
||||
lblAdjective.setText((pOS[1]!=null && !pOS[1].equals("")) ? pOS[1] : "");
|
||||
lblVerb.setText((pOS[2]!=null && !pOS[2].equals("")) ? pOS[2] : "");
|
||||
lblAdverb.setText((pOS[3]!=null && !pOS[3].equals("")) ? pOS[3] : "");
|
||||
lblPreposition.setText((pOS[4]!=null && !pOS[4].equals("")) ? pOS[4] : "");
|
||||
//找到使用者所選的單字時,解析該訊息並顯示詞性、字義
|
||||
hideLayout(lblNoun.getText().equals(""), linNoun);
|
||||
hideLayout(lblAdjective.getText().equals(""),linAdjective);
|
||||
hideLayout(lblVerb.getText().equals(""),linVerb);
|
||||
hideLayout(lblAdverb.getText().equals(""),linAdverb);
|
||||
hideLayout(lblPreposition.getText().equals(""),linPreposition);
|
||||
}catch(Exception ex) {
|
||||
Toast.makeText(this,"找不到該單字!",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
//影藏Layout的判斷函式
|
||||
public void hideLayout(boolean compare,LinearLayout ly){
|
||||
if(compare){
|
||||
ViewGroup.LayoutParams lay = ly.getLayoutParams();
|
||||
lay.height = 0;
|
||||
ly.setLayoutParams(lay);
|
||||
}
|
||||
}
|
||||
|
||||
//返回上一層
|
||||
public void btnBack2_onClick(View view) {
|
||||
Intent theIntent = new Intent();
|
||||
if(isAddingMode){
|
||||
theIntent.putExtra("isAdd", isAdd);
|
||||
}
|
||||
setResult(isAddingMode ? 0 : -1, theIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
//標示使用者要增加此單字
|
||||
public void btnAdd2Addition(View view) {
|
||||
isAdd = lblWordTitle.getText().toString();
|
||||
Toast.makeText(ActWordInfo.this, "已新增單字至群組", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
//攔截使用者所按下的按鍵 - 包含返回、家、視窗等等按鍵
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
Intent theIntent = new Intent();
|
||||
if(isAddingMode){
|
||||
theIntent.putExtra("isAdd", isAdd);
|
||||
}
|
||||
setResult(isAddingMode ? 0 : -1, theIntent);
|
||||
finish();
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
@ -0,0 +1,392 @@
|
||||
package com.example.leeyuanair.englishhelper.act_memory;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Random;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class ActMemoryPractice extends AppCompatActivity {
|
||||
//##Global Variable
|
||||
boolean mode; //練習模式: false表示有限題數, true表示練習至了解為止
|
||||
int groupIndex; //使用者所選的群組單字的序號
|
||||
int maxQ, Q; //表示指定的練習題數 與 目前題數
|
||||
int timelimit; //每題所限制的回答時間(毫秒)
|
||||
int timecount; //目前的計時
|
||||
int delay; //延遲次數(每次1秒)
|
||||
int width; //表示加上timecount的幅度,功能是與timecount相加
|
||||
int backUpTimeCount; //退出練習的確認時間
|
||||
ArrayList<String> QuestionList; //題目清單
|
||||
LinkedHashMap<String, Integer> WrongsList; //「NO」清單,記錄下所有不了解的單字的次數
|
||||
HashSet<String> QuickWrongsList; //與「NO」清單類似,只不過此清單只有在「練習至了解所有單字為止」時的模式才會用到
|
||||
//TextView文字標籤物件
|
||||
TextView lblMemoryStatus, lblQuestion1, lblMemoryHint;
|
||||
//ProgressBar進度顯示物件
|
||||
ProgressBar pgbCountdown2;
|
||||
//Timer計時器
|
||||
Timer countDownTimer;
|
||||
//AlertDialog對話框物件
|
||||
AlertDialog answerShows;
|
||||
//Random亂數產生器
|
||||
Random rnd;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_memory_practice);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("記憶練習");
|
||||
//連結文字標籤物件
|
||||
lblMemoryStatus = (TextView) findViewById(R.id.lblMemoryStatus);
|
||||
lblQuestion1 = (TextView) findViewById(R.id.lblQuestion1);
|
||||
lblMemoryHint = (TextView) findViewById(R.id.lblMemoryHint);
|
||||
//連結進度顯示物件
|
||||
pgbCountdown2 = (ProgressBar) findViewById(R.id.pgbCountdown2);
|
||||
pgbCountdown2.setMax(1000);
|
||||
//初始化對話方塊
|
||||
answerShows = (new AlertDialog.Builder(this)).create();
|
||||
answerShows.setCancelable(false);
|
||||
//初始化NO清單
|
||||
WrongsList = new LinkedHashMap<>();
|
||||
//初始化亂數產生器
|
||||
rnd = new Random();
|
||||
//取得資料 & 初始化
|
||||
Bundle msg = getIntent().getExtras();
|
||||
mode = msg.getBoolean("mode");
|
||||
timelimit = msg.getInt("timelimit");
|
||||
groupIndex = msg.getInt("Selection");
|
||||
//若模式為練習到了解為止..
|
||||
if (mode) {
|
||||
QuestionGenerator(1);
|
||||
QuickWrongsList = new HashSet<>();
|
||||
} else {
|
||||
maxQ = msg.getInt("questions");
|
||||
QuestionGenerator(maxQ);
|
||||
}
|
||||
Q = 0; //初始化題目計數
|
||||
timecount = 0; //初始化計時
|
||||
delay = 4; //初始化延遲次數
|
||||
width = 1;
|
||||
//初始化計時系統Timer
|
||||
countDownTimer = new Timer();
|
||||
countDownTimer.schedule(countDownTask, 0, 1);
|
||||
}
|
||||
|
||||
//####題目生成器####
|
||||
void QuestionGenerator(int questionAmount){
|
||||
try {
|
||||
ArrayList<String> sourceGroup = ((groupIndex >= 0) ? MainActivity.GROUPS.get(MainActivity.GROUP_NAMES.get(groupIndex)) : MainActivity.WORDS);
|
||||
QuestionList = new ArrayList<String>();
|
||||
for (int i = 1; i <= (questionAmount / sourceGroup.size()) + 1; i++)
|
||||
QuestionList.addAll(RandomizeList(sourceGroup));
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(ActMemoryPractice.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
//函式 - 回傳新的已打亂過的清單內容
|
||||
ArrayList<String> RandomizeList(ArrayList<String> list) {
|
||||
ArrayList<String> rndList = (ArrayList<String>) list.clone();
|
||||
try {
|
||||
String temp;
|
||||
int num;
|
||||
//利用rnd亂數產生器打亂原本的排列
|
||||
for (int i = rndList.size() - 1; i >= 0; i--) {
|
||||
num = rnd.nextInt(i + 1);
|
||||
temp = rndList.get(num);
|
||||
rndList.set(num, rndList.get(i));
|
||||
rndList.set(i, temp);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Toast.makeText(ActMemoryPractice.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return rndList;
|
||||
}
|
||||
//####快速題目生產器####
|
||||
void RapidQuestionGenerator(String word ,int value){
|
||||
if(!QuestionList.contains(word)){
|
||||
ArrayList<String> sourceGroup = ((groupIndex>=0) ? MainActivity.GROUPS.get(MainActivity.GROUP_NAMES.get(groupIndex)) : MainActivity.WORDS);
|
||||
ArrayList<String> rndList = new ArrayList<>(RandomizeList(sourceGroup));
|
||||
//若使用者所選的單字群組的單字量小於10: 為了避免在隨機選取的次數上發生問題,也就是隨機排列後的群組單字量不夠,這裡再增加一組的隨機的單字量
|
||||
if(sourceGroup.size()<10)
|
||||
rndList.addAll(RandomizeList(sourceGroup));
|
||||
for(int i=0;i<rndList.size();i++){
|
||||
if(!rndList.get(i).equals(word)){
|
||||
QuestionList.add(rndList.get(i));
|
||||
value--;
|
||||
if(value==0)break;
|
||||
}
|
||||
}
|
||||
QuestionList.add(word);
|
||||
}
|
||||
}
|
||||
|
||||
//####計時器工作####
|
||||
private final TimerTask countDownTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
//####透過runOnUiThread來取得合法控制使用者介面物件的權利####
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
timecount += width;
|
||||
//若已不再延遲的狀態...
|
||||
if (delay == 0) {
|
||||
//如果判別目前的狀態是作答中還是答案顯示中
|
||||
//width為1時代表作答中, width為-1代表答案顯示中
|
||||
if (width == 1) {
|
||||
//如果時間到的話(對此視為NO)
|
||||
if (timecount == timelimit) {
|
||||
//判別使用者所選的模式
|
||||
if (mode) {
|
||||
//判別NO清單裡是否有包含該單字,如果沒有包含就新增一個;如果已經包含了就增加其數值
|
||||
if (WrongsList.containsKey(QuestionList.get(0))) {
|
||||
//取出目前的題目當作key,並設其value為原先的數值+1
|
||||
WrongsList.put(QuestionList.get(0), WrongsList.get(QuestionList.get(0)) + 1);
|
||||
} else {
|
||||
WrongsList.put(QuestionList.get(0), 1);
|
||||
}
|
||||
QuickWrongsList.add(QuestionList.get(0));
|
||||
pgbCountdown2.setMax(5000);
|
||||
timecount=5000;
|
||||
width = -1;
|
||||
answerShows.setTitle("超過時間!");
|
||||
//解析該字有哪些詞性與意思,並設定於將要顯示的對話框上
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(QuestionList.get(0));
|
||||
answerShows.setMessage(QuestionList.get(0) +
|
||||
((partOfSpeech[0] != null) ? "\r\n" + "名詞(n.) " + partOfSpeech[0] : "") +
|
||||
((partOfSpeech[1] != null) ? "\r\n" + "形容詞(adj.) " + partOfSpeech[1] : "") +
|
||||
((partOfSpeech[2] != null) ? "\r\n" + "動詞(v.) " + partOfSpeech[2] : "") +
|
||||
((partOfSpeech[3] != null) ? "\r\n" + "副詞(adv.) " + partOfSpeech[3] : "") +
|
||||
((partOfSpeech[4] != null) ? "\r\n" + "介係詞(prep.) " + partOfSpeech[4] : ""));
|
||||
answerShows.show();
|
||||
String readdWord = QuestionList.remove(0);
|
||||
RapidQuestionGenerator(readdWord, rnd.nextInt(3) + 2);
|
||||
} else {
|
||||
//判別NO清單裡是否有包含該單字,如果沒有包含就新增一個;如果已經包含了就增加其數值
|
||||
if (WrongsList.containsKey(QuestionList.get(Q))) {
|
||||
//取出目前的題目當作key,並設其value為原先的數值+1
|
||||
WrongsList.put(QuestionList.get(Q), WrongsList.get(QuestionList.get(Q)) + 1);
|
||||
} else {
|
||||
WrongsList.put(QuestionList.get(Q), 1);
|
||||
}
|
||||
pgbCountdown2.setMax(5000);
|
||||
timecount=5000;
|
||||
width = -1;
|
||||
answerShows.setTitle("超過時間!");
|
||||
//解析該字有哪些詞性與意思,並設定於將要顯示的對話框上
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(QuestionList.get(Q));
|
||||
answerShows.setMessage("請熟記此單字: " + QuestionList.get(Q) +
|
||||
((partOfSpeech[0] != null) ? "\r\n" + "名詞(n.) " + partOfSpeech[0] : "") +
|
||||
((partOfSpeech[1] != null) ? "\r\n" + "形容詞(adj.) " + partOfSpeech[1] : "") +
|
||||
((partOfSpeech[2] != null) ? "\r\n" + "動詞(v.) " + partOfSpeech[2] : "") +
|
||||
((partOfSpeech[3] != null) ? "\r\n" + "副詞(adv.) " + partOfSpeech[3] : "") +
|
||||
((partOfSpeech[4] != null) ? "\r\n" + "介係詞(prep.) " + partOfSpeech[4] : ""));
|
||||
answerShows.show();
|
||||
}
|
||||
}
|
||||
} else if (width == -1) {
|
||||
//若倒數完畢
|
||||
if (timecount == 0) {
|
||||
//判別使用者所選的模式
|
||||
Q++; //題目計數+1
|
||||
answerShows.dismiss(); //隱藏對話框
|
||||
if (mode) {
|
||||
//判別題目是否做完了
|
||||
if (QuestionList.isEmpty() && QuickWrongsList.isEmpty()) {
|
||||
//##若題目已經做完了,則傳送紀錄並開啟結果頁面
|
||||
//停止計時器計時,並且停用該物件
|
||||
countDownTimer.cancel();
|
||||
countDownTimer.purge();
|
||||
//設置紀錄並開啟結果頁面
|
||||
Intent it = new Intent(ActMemoryPractice.this, ActMemoryResult.class);
|
||||
it.putExtra("mode", mode);
|
||||
it.putExtra("questions", Q);
|
||||
it.putExtra("WrongsList", WrongsList);
|
||||
startActivityForResult(it, 0);
|
||||
} else {
|
||||
lblQuestion1.setText(QuestionList.get(0));
|
||||
lblMemoryStatus.setText("目前題數: "+(Q+1));
|
||||
makeHint(QuestionList.get(0));
|
||||
if (timelimit == 0) {
|
||||
//如果時間無限制的話,就不需要在增加進度顯示物件的進度量
|
||||
//因此這裡pgbCountdown2的最大值設定為一定值
|
||||
//並且把變化量width設為0
|
||||
pgbCountdown2.setMax(500);
|
||||
timecount=1;
|
||||
width = 0;
|
||||
} else {
|
||||
pgbCountdown2.setMax(timelimit);
|
||||
width = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//判別題目是否尚未做完
|
||||
if (Q < maxQ) {
|
||||
//更新題目
|
||||
lblQuestion1.setText(QuestionList.get(Q));
|
||||
lblMemoryStatus.setText("剩餘題數: "+(maxQ-Q-1));
|
||||
makeHint(QuestionList.get(Q));
|
||||
//判別時間限制是否為0,也就是判斷使用者是否將時限設定為「無限制」
|
||||
if (timelimit == 0) {
|
||||
//如果時間無限制的話,就不需要在增加進度顯示物件的進度量
|
||||
//因此這裡pgbCountdown2的最大值設定為一定值
|
||||
//並且把變化量width設為0
|
||||
pgbCountdown2.setMax(500);
|
||||
timecount=1;
|
||||
width = 0;
|
||||
} else {
|
||||
pgbCountdown2.setMax(timelimit);
|
||||
width = 1;
|
||||
}
|
||||
} else {
|
||||
//##若題目已經做完了,則傳送紀錄並開啟結果頁面
|
||||
//停止計時器計時,並且停用該物件
|
||||
countDownTimer.cancel();
|
||||
countDownTimer.purge();
|
||||
//設置紀錄並開啟結果頁面
|
||||
Intent it = new Intent(ActMemoryPractice.this, ActMemoryResult.class);
|
||||
it.putExtra("mode", mode);
|
||||
it.putExtra("questions", maxQ);
|
||||
it.putExtra("WrongsList", WrongsList);
|
||||
startActivityForResult(it, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (timecount == 1000) {
|
||||
delay--;
|
||||
timecount = 0;
|
||||
lblQuestion1.setText(String.valueOf(delay));
|
||||
if (delay == 0) {
|
||||
if (timelimit == 0){
|
||||
width = 0;
|
||||
timecount=1;
|
||||
}
|
||||
lblQuestion1.setText(QuestionList.get(0));
|
||||
makeHint(QuestionList.get(0));
|
||||
pgbCountdown2.setMax(timelimit);
|
||||
if(mode)
|
||||
lblMemoryStatus.setText("目前題數: "+(Q+1));
|
||||
else
|
||||
lblMemoryStatus.setText("剩餘題數: "+(maxQ-Q-1));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新進度顯示物件
|
||||
pgbCountdown2.setProgress(timecount);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//程序 - 解析單字訊息 並 提示其有哪一些詞性
|
||||
void makeHint(String word){
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(word);
|
||||
lblMemoryHint.setText("這個單字有" + (partOfSpeech[0] != null ? " #名詞" : "") +
|
||||
(partOfSpeech[1] != null ? " #形容詞" : "") +
|
||||
(partOfSpeech[2] != null ? " #動詞" : "") +
|
||||
(partOfSpeech[3] != null ? " #副詞" : "") +
|
||||
(partOfSpeech[4] != null ? " #介係詞" : "") + " 詞性意思\r\n你清楚此單字的意思嗎?");
|
||||
}
|
||||
|
||||
//當【NO】按鈕按下時
|
||||
public void btnNO_Click(View view) {
|
||||
if(delay==0) {
|
||||
int Qnum = mode ? 0 : Q;
|
||||
//判別NO清單裡是否有包含該單字,如果沒有包含就新增一個;如果已經包含了就增加其數值
|
||||
if (WrongsList.containsKey(QuestionList.get(Qnum))) {
|
||||
//取出目前的題目當作key,並設其value為原先的數值+1
|
||||
WrongsList.put(QuestionList.get(Qnum), WrongsList.get(QuestionList.get(Qnum)) + 1);
|
||||
} else {
|
||||
WrongsList.put(QuestionList.get(Qnum), 1);
|
||||
}
|
||||
pgbCountdown2.setMax(5000);
|
||||
pgbCountdown2.setProgress(5000);
|
||||
timecount = 5000;
|
||||
width = -1;
|
||||
answerShows.setTitle("我不了解單字\"" + QuestionList.get(Qnum) + "\"!");
|
||||
//解析該字有哪些詞性與意思,並設定於將要顯示的對話框上
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(QuestionList.get(Qnum));
|
||||
answerShows.setMessage("請熟記此單字: " + QuestionList.get(Qnum) +
|
||||
((partOfSpeech[0] != null) ? "\r\n" + "名詞(n.) " + partOfSpeech[0] : "") +
|
||||
((partOfSpeech[1] != null) ? "\r\n" + "形容詞(adj.) " + partOfSpeech[1] : "") +
|
||||
((partOfSpeech[2] != null) ? "\r\n" + "動詞(v.) " + partOfSpeech[2] : "") +
|
||||
((partOfSpeech[3] != null) ? "\r\n" + "副詞(adv.) " + partOfSpeech[3] : "") +
|
||||
((partOfSpeech[4] != null) ? "\r\n" + "介係詞(prep.) " + partOfSpeech[4] : ""));
|
||||
answerShows.show();
|
||||
if (mode) {
|
||||
QuickWrongsList.add(QuestionList.get(0));
|
||||
String readdWord = QuestionList.remove(0);
|
||||
RapidQuestionGenerator(readdWord, rnd.nextInt(3) + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//當【YES】按鈕按下時
|
||||
public void btnYES_Click(View view) {
|
||||
if(delay==0) {
|
||||
int Qnum = mode ? 0 : Q; //依mode來判斷題目序號是0或是計算中的Q
|
||||
pgbCountdown2.setMax(1000);
|
||||
pgbCountdown2.setProgress(1000);
|
||||
timecount = 1000;
|
||||
width = -1;
|
||||
answerShows.setTitle("Good Job!");
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(QuestionList.get(Qnum));
|
||||
answerShows.setMessage(QuestionList.get(Qnum) +
|
||||
((partOfSpeech[0] != null) ? "\r\n" + "名詞(n.) " + partOfSpeech[0] : "") +
|
||||
((partOfSpeech[1] != null) ? "\r\n" + "形容詞(adj.) " + partOfSpeech[1] : "") +
|
||||
((partOfSpeech[2] != null) ? "\r\n" + "動詞(v.) " + partOfSpeech[2] : "") +
|
||||
((partOfSpeech[3] != null) ? "\r\n" + "副詞(adv.) " + partOfSpeech[3] : "") +
|
||||
((partOfSpeech[4] != null) ? "\r\n" + "介係詞(prep.) " + partOfSpeech[4] : ""));
|
||||
answerShows.show();
|
||||
if (mode) {
|
||||
QuickWrongsList.remove(QuestionList.get(0));
|
||||
QuestionList.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//攔截使用者所按下的按鍵 - 包含返回、家、視窗等等按鍵
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
if(backUpTimeCount==0){
|
||||
backUpTimeCount=2000;
|
||||
Toast.makeText(ActMemoryPractice.this, "再按一次即可離開測驗", Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
//當下層的頁面關閉時,也就是結果顯示頁面關閉時,回到此頁面後直接關閉
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
finish();
|
||||
}
|
||||
|
||||
//當此頁面要關閉的時候
|
||||
@Override
|
||||
public void onDestroy(){
|
||||
countDownTimer.cancel();
|
||||
countDownTimer.purge();
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.example.leeyuanair.englishhelper.act_memory;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
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 com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ActMemoryResult extends AppCompatActivity implements ListView.OnItemClickListener {
|
||||
//Global Variable
|
||||
int questions;
|
||||
HashMap<String, Integer> WrongsList;
|
||||
Object[] WrongsWordsArray;
|
||||
ArrayAdapter<String> WrongsAdapter;
|
||||
//TextView文字標籤物件
|
||||
TextView lblQuestionAmount2;
|
||||
TextView lblNotUnderstandText1;
|
||||
//ListView清單物件
|
||||
ListView lstNotUnderstandList;
|
||||
//AlertDialog對話框物件
|
||||
AlertDialog.Builder msgBox;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_memory_result);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("記憶練習 - 練習結果");
|
||||
try {
|
||||
//連結文字標籤物件
|
||||
lblQuestionAmount2 = (TextView) findViewById(R.id.lblQuestionAmount2);
|
||||
lblNotUnderstandText1 = (TextView) findViewById(R.id.lblNotUnderstandText1);
|
||||
//連結清單物件
|
||||
lstNotUnderstandList = (ListView) findViewById(R.id.lstNotUnderstandList);
|
||||
lstNotUnderstandList.setOnItemClickListener(this);
|
||||
//初始化對話框物件
|
||||
msgBox = new AlertDialog.Builder(this);
|
||||
msgBox.setTitle("單字訊息");
|
||||
msgBox.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
//取得結果資料
|
||||
Bundle msg = getIntent().getExtras();
|
||||
questions = msg.getInt("questions");
|
||||
lblQuestionAmount2.setText(String.valueOf(questions));
|
||||
WrongsList = (HashMap<String, Integer>) msg.get("WrongsList");
|
||||
//初始化清單物件變數
|
||||
if(WrongsList.isEmpty()){
|
||||
lblNotUnderstandText1.setText("Good Job! 你已經記起所有的單字了!");
|
||||
}else{
|
||||
WrongsAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
|
||||
WrongsWordsArray = WrongsList.keySet().toArray();
|
||||
for (Object word : WrongsWordsArray)
|
||||
WrongsAdapter.add(word.toString() + " ,次數: " + WrongsList.get(word));
|
||||
lstNotUnderstandList.setAdapter(WrongsAdapter);
|
||||
}
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(ActMemoryResult.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當清單lstWrongsList某項目被按下時
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(WrongsWordsArray[position]);
|
||||
msgBox.setMessage(WrongsWordsArray[position] +
|
||||
((partOfSpeech[0]!=null) ? "\r\n名詞(n.) "+partOfSpeech[0] : "") +
|
||||
((partOfSpeech[1]!=null) ? "\r\n形容詞(adj.) "+partOfSpeech[1] : "") +
|
||||
((partOfSpeech[2]!=null) ? "\r\n動詞(adj.) "+partOfSpeech[2] : "") +
|
||||
((partOfSpeech[3]!=null) ? "\r\n副詞(adj.) "+partOfSpeech[3] : "") +
|
||||
((partOfSpeech[4]!=null) ? "\r\n介係詞(adj.) "+partOfSpeech[4] : ""));
|
||||
msgBox.show();
|
||||
}
|
||||
|
||||
//當【返回至設定頁面】按鈕按下時
|
||||
public void btnBack7_Click(View view) {finish();}
|
||||
|
||||
}
|
@ -0,0 +1,192 @@
|
||||
package com.example.leeyuanair.englishhelper.act_memory;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActMemorySetting extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener {
|
||||
//Global Variable全域變數
|
||||
boolean qualified; //表示所選群組是否符合最低要求(單字量>4)
|
||||
int selection; //表示使用者所選擇的群組號
|
||||
boolean soManyWordsNotice; // 若是用者在了解模式下選擇超過100個單字的單字群組時所判別是否要提醒使用者的變數
|
||||
//Button按鈕物件
|
||||
Button btnChangeGroup2;
|
||||
//EditText文字編輯物件
|
||||
EditText txtQAmount2;
|
||||
//TextView文字標籤物件
|
||||
TextView lblTimePerQ2;
|
||||
TextView lblExtraMsg2;
|
||||
//RadioButton單選按鈕物件
|
||||
RadioButton rdoKeepPractice, rdoQuestions;
|
||||
//SeekBar滑桿元件
|
||||
SeekBar skbTimeSet2;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_memory_setting);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("記憶練習");
|
||||
//連結按鈕物件
|
||||
btnChangeGroup2 = (Button) findViewById(R.id.btnChangeGroup2);
|
||||
//連結文字編輯物件
|
||||
txtQAmount2 = (EditText) findViewById(R.id.txtQAmount2);
|
||||
//連結文字標籤物驗
|
||||
lblTimePerQ2 = (TextView) findViewById(R.id.lblTimePerQ2);
|
||||
lblExtraMsg2 = (TextView) findViewById(R.id.lblExtraMsg2);
|
||||
//連結單選按鈕物件
|
||||
rdoKeepPractice = (RadioButton) findViewById(R.id.rdoKeepPractice);
|
||||
rdoQuestions = (RadioButton) findViewById(R.id.rdoQuestions);
|
||||
//連結華感物件
|
||||
skbTimeSet2 = (SeekBar) findViewById(R.id.skbTimeSet2);
|
||||
skbTimeSet2.setOnSeekBarChangeListener(this);
|
||||
//初始化變數
|
||||
qualified=true;
|
||||
soManyWordsNotice = true;
|
||||
selection=-1;
|
||||
}
|
||||
|
||||
//當按鈕btnChangeGroup2 更換群組按鈕按下時
|
||||
public void btnChangeGroup2_Click(View view) {
|
||||
final ArrayAdapter<String> groupNames = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1);
|
||||
groupNames.add("所有單字"); groupNames.addAll(MainActivity.GROUP_NAMES);
|
||||
AlertDialog.Builder msgBox = new AlertDialog.Builder(this)
|
||||
.setTitle("選擇群組")
|
||||
.setAdapter(groupNames, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
btnChangeGroup2.setText(groupNames.getItem(which));
|
||||
selection=which-1;
|
||||
if(which>0){
|
||||
ArrayList<String> SelGroup = MainActivity.GROUPS.get(groupNames.getItem(which));
|
||||
if(SelGroup.size()<4) {
|
||||
lblExtraMsg2.setText("群組內的單字量必須大於4個才能開始練習!");
|
||||
lblExtraMsg2.setTextColor(Color.RED);
|
||||
soManyWordsNotice=false;
|
||||
qualified = false;
|
||||
}else if(SelGroup.size()>100){
|
||||
if(rdoKeepPractice.isChecked())
|
||||
lblExtraMsg2.setText("此單字群組的單字量大於100個,若要練習到完可能需要花較長的時間!");
|
||||
else
|
||||
lblExtraMsg2.setText("");
|
||||
qualified=true;
|
||||
soManyWordsNotice=true;
|
||||
}else{
|
||||
lblExtraMsg2.setText("");
|
||||
qualified = true;
|
||||
soManyWordsNotice=false;
|
||||
}
|
||||
}else{
|
||||
if(rdoKeepPractice.isChecked())
|
||||
lblExtraMsg2.setText("此單字群組的單字量大於100個,若要練習到完可能需要花較長的時間!");
|
||||
soManyWordsNotice=true;
|
||||
lblExtraMsg2.setText("");
|
||||
qualified = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
msgBox.show();
|
||||
}
|
||||
|
||||
//當【-】按鈕按下時
|
||||
public void btnSubtract2_Click(View view) {
|
||||
int num = Integer.parseInt(txtQAmount2.getText().toString()) - 1;
|
||||
txtQAmount2.setText(String.valueOf(num > 0 ? num : 1));
|
||||
}
|
||||
|
||||
//當【+】按鈕按下時
|
||||
public void btnAdd2_Click(View view) {
|
||||
int num = Integer.parseInt(txtQAmount2.getText().toString()) + 1;
|
||||
txtQAmount2.setText(String.valueOf(num < 10000 ? num : 9999));
|
||||
}
|
||||
|
||||
//當【練習到每個單字了解為止】單選按鈕按下時
|
||||
public void rdoKeepPractice_Click(View view) {
|
||||
rdoKeepPractice.setChecked(true);
|
||||
rdoQuestions.setChecked(false);
|
||||
if(soManyWordsNotice)
|
||||
lblExtraMsg2.setText("此單字群組的單字量大於100個,若要練習到完可能需要花較長的時間!");
|
||||
}
|
||||
|
||||
//當【依指定題數練習】單選按鈕按下時
|
||||
public void rdoQuestions_Click(View view) {
|
||||
rdoKeepPractice.setChecked(false);
|
||||
rdoQuestions.setChecked(true);
|
||||
if(soManyWordsNotice)
|
||||
lblExtraMsg2.setText("");
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下時
|
||||
public void btnBack6_Click(View view) {
|
||||
finish();
|
||||
}
|
||||
|
||||
//當【說明】按鈕按下時
|
||||
public void btnExplanation2_Click(View view) {
|
||||
final AlertDialog.Builder adExp1, adExp2, adExp3;
|
||||
adExp3 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("關於設定的部分,你可以選擇單字群組、設定題目數量與每題答題時間," +
|
||||
"練習模式可以選擇「練習到每個了解為止」、「依指定題數練習」這兩種方式。" +
|
||||
"完成設定之後就可以開始練習了!")
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
adExp2 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("如果知道該單字的意思的話,按下YES按鈕表示了解;若不知道該單字的意思," +
|
||||
"則按下NO表示不了解,每按一次NO系統就會記錄下一次。如果你所選的模式是練習到會為止," +
|
||||
"則系統也會一直持續記錄到完成為止。(雖然如此,因為有限性的關係,所以至多系統也只會到9999題為止)")
|
||||
.setPositiveButton("下一頁", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {adExp3.show();}});
|
||||
adExp1 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("由於字義選擇的四選一題目可以透過辨識選項的方式來答題," +
|
||||
"所以這可能無法完全檢視自己是否了解、熟悉該單字,因此,在記憶練習中除了會照常出題之外" +
|
||||
"這裡將四選項改成了YES、NO按鈕。")
|
||||
.setPositiveButton("下一頁", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {adExp2.show();}});
|
||||
adExp1.show();
|
||||
}
|
||||
|
||||
//當【開始練習】按鈕按下時
|
||||
public void btnStartTest2_Click(View view) {
|
||||
if (qualified) {
|
||||
Intent it = new Intent(this, ActMemoryPractice.class);
|
||||
it.putExtra("Selection", selection);
|
||||
it.putExtra("mode", rdoKeepPractice.isChecked());
|
||||
if (rdoQuestions.isChecked())
|
||||
it.putExtra("questions", Integer.parseInt(txtQAmount2.getText().toString()));
|
||||
it.putExtra("timelimit", skbTimeSet2.getProgress() * 1000);
|
||||
startActivity(it);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//##SeekBar滑桿物件的事件處理副程式##
|
||||
//當滑桿滑動時
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if(progress>0)
|
||||
lblTimePerQ2.setText("每題答題時間: "+progress+"秒");
|
||||
else
|
||||
lblTimePerQ2.setText("每題答題時間: 無限制");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
//#####################################
|
||||
}
|
@ -0,0 +1,215 @@
|
||||
package com.example.leeyuanair.englishhelper.act_spelling;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class ActSpellingExamine extends AppCompatActivity {
|
||||
//Global Variables
|
||||
int groupIndex; //所選的單字群組的編號
|
||||
int maxQ, Q; //總題數, 目前題號
|
||||
boolean prefix, suffix; //是否啟用字首、字尾提示
|
||||
int rights; //答對題數
|
||||
ArrayList<String> QuestionList; //題目清單
|
||||
ArrayList<String> UserAnswerList; //使用者的回答清單
|
||||
//LinearLayout直線型排版容器
|
||||
LinearLayout[] linPartOfSpeech;
|
||||
//TextView文字標籤元件
|
||||
TextView[] lblPartOfSpeech;
|
||||
TextView lblSpellingStatus1;
|
||||
TextView lblSpellingStatus2;
|
||||
TextView lblQuestionMessage;
|
||||
//EditText文字編輯元件
|
||||
EditText txtAnswerBar;
|
||||
//AlertDialog對話框物件
|
||||
AlertDialog.Builder response;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_spelling_examine);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("拼字測驗");
|
||||
//##連結直線型排版容器 並 初始化陣列
|
||||
try {
|
||||
linPartOfSpeech = new LinearLayout[5];
|
||||
linPartOfSpeech[0] = (LinearLayout) findViewById(R.id.linQNoun);
|
||||
linPartOfSpeech[1] = (LinearLayout) findViewById(R.id.linQAdjective);
|
||||
linPartOfSpeech[2] = (LinearLayout) findViewById(R.id.linQVerb);
|
||||
linPartOfSpeech[3] = (LinearLayout) findViewById(R.id.linQAdverb);
|
||||
linPartOfSpeech[4] = (LinearLayout) findViewById(R.id.linQPreposition);
|
||||
//##連結文字標籤元件 並 初始化陣列
|
||||
lblPartOfSpeech = new TextView[5];
|
||||
lblPartOfSpeech[0] = (TextView) findViewById(R.id.lblQNoun);
|
||||
lblPartOfSpeech[1] = (TextView) findViewById(R.id.lblQAdjective);
|
||||
lblPartOfSpeech[2] = (TextView) findViewById(R.id.lblQVerb);
|
||||
lblPartOfSpeech[3] = (TextView) findViewById(R.id.lblQAdverb);
|
||||
lblPartOfSpeech[4] = (TextView) findViewById(R.id.lblQPreposition);
|
||||
lblSpellingStatus1 = (TextView) findViewById(R.id.lblSpellingStatus1);
|
||||
lblSpellingStatus2 = (TextView) findViewById(R.id.lblSpellingStatus2);
|
||||
lblQuestionMessage = (TextView) findViewById(R.id.lblQuestionMessage);
|
||||
//##連結文字編輯元件
|
||||
txtAnswerBar = (EditText) findViewById(R.id.txtAnswerBar);
|
||||
//##初始化對話框
|
||||
response = new AlertDialog.Builder(this);
|
||||
response.setCancelable(false);
|
||||
response.setPositiveButton("OK", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
//取得資料
|
||||
Bundle msg = getIntent().getExtras();
|
||||
groupIndex = msg.getInt("selection");
|
||||
maxQ = msg.getInt("questions");
|
||||
prefix = msg.getBoolean("prefix");
|
||||
suffix = msg.getBoolean("suffix");
|
||||
//建立題目清單
|
||||
QuestionGenerator();
|
||||
//初始化
|
||||
UserAnswerList = new ArrayList<>();
|
||||
Q = 0;
|
||||
rights = 0;
|
||||
lblSpellingStatus1.setText("總題目: " + maxQ + ", 目前題號: 1");
|
||||
AnaliysisQuestion();
|
||||
//預備的對話框
|
||||
AlertDialog.Builder msgBox = new AlertDialog.Builder(this)
|
||||
.setTitle("預備")
|
||||
.setMessage("若輸入文字時會出現提示字的話,建議先關閉此項功能!" +
|
||||
"按下「Start」即可開始測驗。")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Start", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
msgBox.show();
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(ActSpellingExamine.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//程序 - 題目生成器
|
||||
void QuestionGenerator(){
|
||||
QuestionList = new ArrayList<>();
|
||||
ArrayList<String> sourceGroup = (groupIndex>=0) ? MainActivity.GROUPS.get(MainActivity.GROUP_NAMES.get(groupIndex)) : MainActivity.WORDS;
|
||||
for(int i=1;i<=(maxQ/sourceGroup.size())+1;i++)
|
||||
QuestionList.addAll(randomizeGroup(sourceGroup));
|
||||
}
|
||||
//題目生成器 -> 函式 - 回傳打亂過的新的清單
|
||||
ArrayList<String> randomizeGroup(ArrayList<String> sourceGroup){
|
||||
ArrayList<String> rndList = (ArrayList<String>) sourceGroup.clone();
|
||||
Random rnd = new Random(); rnd.setSeed(rnd.nextInt(100));
|
||||
String temp; int num;
|
||||
for(int i=rndList.size()-1;i>0;i--){
|
||||
num = rnd.nextInt(i+1);
|
||||
temp = rndList.get(num);
|
||||
rndList.set(num, rndList.get(i));
|
||||
rndList.set(i, temp);
|
||||
}
|
||||
return rndList;
|
||||
}
|
||||
|
||||
//程序 - 解析題目中的單字
|
||||
void AnaliysisQuestion(){
|
||||
String word = QuestionList.get(Q);
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(word);
|
||||
for(int i=0;i<5;i++){
|
||||
if(partOfSpeech[i]!=null){
|
||||
ViewGroup.LayoutParams lay = linPartOfSpeech[i].getLayoutParams();
|
||||
lay.height=180;
|
||||
linPartOfSpeech[i].setLayoutParams(lay);
|
||||
lblPartOfSpeech[i].setText(partOfSpeech[i]);
|
||||
}else{
|
||||
ViewGroup.LayoutParams lay = linPartOfSpeech[i].getLayoutParams();
|
||||
lay.height=0;
|
||||
linPartOfSpeech[i].setLayoutParams(lay);
|
||||
}
|
||||
}
|
||||
lblQuestionMessage.setText("#此單字長度為"+word.length()+",有以下詞性意義:");
|
||||
//依條件來生成提示
|
||||
txtAnswerBar.setHint((prefix ? word.charAt(0) : "_")+"_____________"+((suffix && word.length()>4) ? word.charAt(word.length()-1) : "_"));
|
||||
}
|
||||
|
||||
//當【提交答案】按鈕按下時
|
||||
public void btnAnswerIt_Click(View view) {
|
||||
// 隱藏螢幕鍵盤
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
try {
|
||||
//將使用者的答案增加至UserAnswerList中
|
||||
UserAnswerList.add(txtAnswerBar.getText().toString().trim());
|
||||
if (QuestionList.get(Q).equals(UserAnswerList.get(Q))) {
|
||||
rights++;
|
||||
response.setTitle("答案正確!");
|
||||
response.setMessage(QuestionList.get(Q));
|
||||
} else {
|
||||
response.setTitle("答案錯誤!");
|
||||
response.setMessage("正確答案: " + QuestionList.get(Q) +
|
||||
"\r\n你的答案: " + UserAnswerList.get(Q));
|
||||
}
|
||||
//題目序號+1
|
||||
Q++;
|
||||
//如果還有題目的話
|
||||
if (Q < maxQ) {
|
||||
//更新題目
|
||||
AnaliysisQuestion();
|
||||
txtAnswerBar.setText("");
|
||||
//更新狀態
|
||||
lblSpellingStatus2.setText("總題目: " + maxQ + ", 目前題號: " + (Q + 1));
|
||||
lblSpellingStatus1.setText("答對題數: " + rights + ", 答錯題數: " + (Q - rights));
|
||||
} else {
|
||||
response.setPositiveButton("測驗完成", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent it = new Intent(ActSpellingExamine.this, ActSpellingResult.class);
|
||||
it.putExtra("maxQ", maxQ);
|
||||
it.putExtra("rights", rights);
|
||||
it.putExtra("QuestionList", QuestionList);
|
||||
it.putExtra("UserAnswerList", UserAnswerList);
|
||||
startActivityForResult(it, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
response.show();
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(ActSpellingExamine.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當下一層的頁面關閉時
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
finish();
|
||||
}
|
||||
|
||||
//攔截使用者所按下的按鍵 - 包含返回、家、視窗等等按鍵
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event){
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
AlertDialog.Builder checker = new AlertDialog.Builder(this)
|
||||
.setTitle("確定離開測驗?")
|
||||
.setMessage("若中途離開此測驗將看不到所測的結果。")
|
||||
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {finish();}})
|
||||
.setNegativeButton("No", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
checker.show();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.example.leeyuanair.englishhelper.act_spelling;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
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 com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActSpellingResult extends AppCompatActivity implements ListView.OnItemClickListener{
|
||||
//Global Variables
|
||||
ArrayList<String> QuestionList;
|
||||
ArrayList<String> UserAnswerList;
|
||||
//ListView清單元件
|
||||
ListView lstAnswerLog2;
|
||||
//AlertDialog對話框元件
|
||||
AlertDialog.Builder msgBox;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_spelling_result);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("拼字測驗 - 測驗結果");
|
||||
//##連結清單元件
|
||||
lstAnswerLog2 = (ListView) findViewById(R.id.lstAnswerLog2);
|
||||
lstAnswerLog2.setOnItemClickListener(this);
|
||||
//##初始化對話框物件
|
||||
msgBox = new AlertDialog.Builder(this)
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
//##取得結果資料
|
||||
Bundle msg = getIntent().getExtras();
|
||||
//利用變數傳址的方法來立即地修改元件屬性
|
||||
((TextView) findViewById(R.id.lblQuestionAmount3)).setText(String.valueOf(msg.getInt("maxQ")));
|
||||
((TextView) findViewById(R.id.lblRights2)).setText(String.valueOf(msg.getInt("rights")));
|
||||
((TextView) findViewById(R.id.lblWrongs2)).setText(String.valueOf(msg.getInt("maxQ") - msg.getInt("rights")));
|
||||
//取得問題清單 及 使用者回答結果
|
||||
QuestionList = (ArrayList<String>) msg.get("QuestionList");
|
||||
UserAnswerList = (ArrayList<String>) msg.get("UserAnswerList");
|
||||
ArrayAdapter<String> logAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
|
||||
try {
|
||||
for (int i = 0; i < UserAnswerList.size(); i++) {
|
||||
logAdapter.add((QuestionList.get(i).equals(UserAnswerList.get(i)) ? "O " : "X ") +
|
||||
(i + 1) + ". " + QuestionList.get(i));
|
||||
}
|
||||
lstAnswerLog2.setAdapter(logAdapter);
|
||||
}catch(Exception ex){
|
||||
Toast.makeText(ActSpellingResult.this, ex.toString(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
//當lstAnswerLog2內的清單項按下時
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
String word = QuestionList.get(position);
|
||||
String[] partOfSpeech = MainActivity.ALL_WORDS.get(word);
|
||||
boolean isRight = (word.equals(UserAnswerList.get(position)));
|
||||
msgBox.setTitle(isRight ? "此題答對" : "此題答錯");
|
||||
msgBox.setMessage("正確答案: "+word+(isRight ? "\r\n" : "\r\n你的答案: "+UserAnswerList.get(position)+"\r\n") +
|
||||
(partOfSpeech[0]!=null ? "\r\n名詞(n.) "+partOfSpeech[0] : "") +
|
||||
(partOfSpeech[1]!=null ? "\r\n形容詞(adj.) "+partOfSpeech[1] : "") +
|
||||
(partOfSpeech[2]!=null ? "\r\n動詞(v.) "+partOfSpeech[2] : "") +
|
||||
(partOfSpeech[3]!=null ? "\r\n副詞(adv.) "+partOfSpeech[3] : "") +
|
||||
(partOfSpeech[4]!=null ? "\r\n介係詞(prep.) "+partOfSpeech[4] : ""));
|
||||
msgBox.show();
|
||||
}
|
||||
|
||||
//當【返回至設定頁面】按鈕按下時
|
||||
public void btnBack9_Click(View view) {finish();}
|
||||
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package com.example.leeyuanair.englishhelper.act_spelling;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Color;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.leeyuanair.englishhelper.MainActivity;
|
||||
import com.example.leeyuanair.englishhelper.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActSpellingSetting extends AppCompatActivity {
|
||||
//Global Variables
|
||||
int selection; //紀錄使用者所選擇的群組的編號
|
||||
boolean qualified; //表示所選的單字群組是否符合基本要求(單字量大於4個)
|
||||
//Button按鈕元件
|
||||
Button btnChangeGroup3;
|
||||
//TextView文字標籤元件
|
||||
TextView lblExtraMsg3;
|
||||
//EditText文字編輯元件
|
||||
EditText txtQAmount3;
|
||||
//CheckBox勾選元件
|
||||
CheckBox chkPrefix, chkSuffix;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_act_spelling_setting);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
setTitle("拼字測驗 - 測驗設定");
|
||||
//連結按鈕元件
|
||||
btnChangeGroup3 = (Button) findViewById(R.id.btnChangeGroup3);
|
||||
//連結文字標籤元件
|
||||
lblExtraMsg3 = (TextView) findViewById(R.id.lblExtraMsg3);
|
||||
//連結文字編輯元件
|
||||
txtQAmount3 = (EditText) findViewById(R.id.txtQAmount3);
|
||||
//連結勾選元件
|
||||
chkPrefix = (CheckBox) findViewById(R.id.chkPrefix);
|
||||
chkSuffix = (CheckBox) findViewById(R.id.chkSuffix);
|
||||
//初始化變數
|
||||
selection=-1;
|
||||
qualified=true;
|
||||
}
|
||||
|
||||
//當btnChangeGroup3按鈕按下時
|
||||
public void btnChangeGroup3_Click(View view) {
|
||||
final ArrayList<String> ad = new ArrayList<String>();
|
||||
ad.add("所有單字"); ad.addAll(MainActivity.GROUP_NAMES);
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(this)
|
||||
.setTitle("選擇群組")
|
||||
.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ad), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
selection=which-1;
|
||||
btnChangeGroup3.setText(ad.get(which));
|
||||
if(selection>=0){
|
||||
ArrayList<String> SelGroup = MainActivity.GROUPS.get(MainActivity.GROUP_NAMES.get(selection));
|
||||
qualified=SelGroup.size()>4;
|
||||
if(qualified){
|
||||
lblExtraMsg3.setTextColor(Color.argb(255,168,168,168));
|
||||
if(chkSuffix.isChecked() || chkPrefix.isChecked()){
|
||||
lblExtraMsg3.setText("如果某項單字長度小於5的話,題目只會提供字首或不提供");
|
||||
}else{
|
||||
lblExtraMsg3.setText("");
|
||||
}
|
||||
}else{
|
||||
lblExtraMsg3.setTextColor(Color.RED);
|
||||
lblExtraMsg3.setText("單字群組內的單字量必須大於4個。");
|
||||
}
|
||||
}else{
|
||||
qualified=true;
|
||||
lblExtraMsg3.setTextColor(Color.argb(255,168,168,168));
|
||||
if(chkSuffix.isChecked() || chkPrefix.isChecked()){
|
||||
lblExtraMsg3.setText("如果某項單字長度小於5的話,題目只會提供字首或不提供");
|
||||
}else{
|
||||
lblExtraMsg3.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
}
|
||||
|
||||
//當【+】按鈕按下時
|
||||
public void btnAdd3_Click(View view) {
|
||||
int num = Integer.parseInt(txtQAmount3.getText().toString()) + 1;
|
||||
txtQAmount3.setText(String.valueOf(num<10000 ? num : 9999));
|
||||
}
|
||||
|
||||
//當【-】按鈕按下時
|
||||
public void btnSubtract3_Click(View view) {
|
||||
int num = Integer.parseInt(txtQAmount3.getText().toString()) - 1;
|
||||
txtQAmount3.setText(String.valueOf(num>0 ? num : 1));
|
||||
}
|
||||
|
||||
//當【字首提示】勾選元件按下時
|
||||
public void chkPrefix_Click(View view) {
|
||||
if(qualified){
|
||||
if(chkSuffix.isChecked() || chkPrefix.isChecked()){
|
||||
lblExtraMsg3.setText("如果某項單字長度小於5的話,題目只會提供字首或不提供");
|
||||
}else{
|
||||
lblExtraMsg3.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//當【字尾提示】勾選元件按下時
|
||||
public void chkSuffix_Click(View view) {
|
||||
if(qualified){
|
||||
if(chkSuffix.isChecked() || chkPrefix.isChecked()){
|
||||
lblExtraMsg3.setText("如果某項單字長度小於5的話,題目只會提供字首或不提供");
|
||||
}else{
|
||||
lblExtraMsg3.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//當【開始測驗】按鈕按下時
|
||||
public void btnStartTest3_Click(View view) {
|
||||
if(qualified){
|
||||
Intent it = new Intent(this, ActSpellingExamine.class);
|
||||
it.putExtra("selection", selection);
|
||||
it.putExtra("questions", Integer.valueOf(txtQAmount3.getText().toString()));
|
||||
it.putExtra("prefix", chkPrefix.isChecked());
|
||||
it.putExtra("suffix", chkSuffix.isChecked());
|
||||
startActivity(it);
|
||||
}
|
||||
}
|
||||
|
||||
//當【說明】按鈕按下時
|
||||
public void btnExplanation3_Click(View view) {
|
||||
final AlertDialog.Builder adExp1, adExp2, adExp3;
|
||||
adExp3 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("在設定的部分,你可以選擇單字群組、設定題目數量與是否提示字首、字尾。" +
|
||||
"由於每個英文單字的長短個不同,因此次測驗不設置限時選項。設定完之後就可以開始進行測驗了。")
|
||||
.setPositiveButton("完成", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {}});
|
||||
adExp2 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("測驗時只要針對題目所示的詞性意思來寫出正確的英文單字即可。" +
|
||||
"若有字首或字尾的單字提示,在回答時仍須將其寫出。")
|
||||
.setPositiveButton("下一頁", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {adExp3.show();}});
|
||||
adExp1 = new AlertDialog.Builder(this)
|
||||
.setTitle("說明")
|
||||
.setMessage("除了了解單字字義之外,英文的拼寫也是相當地重要。在此測驗中," +
|
||||
"系統會隨機選擇群組中的單字並秀出其所有的詞性意思。")
|
||||
.setPositiveButton("下一頁", new DialogInterface.OnClickListener() {@Override public void onClick(DialogInterface dialog, int which) {adExp2.show();}});
|
||||
adExp1.show();
|
||||
}
|
||||
|
||||
//當【返回】按鈕按下時
|
||||
public void btnBack7_Click(View view) {finish();}
|
||||
|
||||
}
|
1
app/src/main/res/Test.txt
Executable file
@ -0,0 +1 @@
|
||||
123
|
4
app/src/main/res/drawable/drawable.xml
Executable file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</selector>
|
BIN
app/src/main/res/drawable/icon.png
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable/redngreen.png
Executable file
After Width: | Height: | Size: 10 KiB |
192
app/src/main/res/layout/activity_act4_selection.xml
Executable file
@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:style="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_4selections.Act4Selection"
|
||||
android:focusableInTouchMode="false"
|
||||
android:theme="@style/Theme.AppCompat.Light"
|
||||
android:focusable="false"
|
||||
android:contextClickable="false"
|
||||
android:clickable="false"
|
||||
android:transitionGroup="false"
|
||||
android:touchscreenBlocksFocus="false"
|
||||
android:nestedScrollingEnabled="false">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="群組:"
|
||||
android:id="@+id/lblSelectedGroup1"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/lin3Action1">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack1"
|
||||
android:textSize="18dp"
|
||||
android:height="50dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:onClick="btnBack_Click"
|
||||
android:layout_below="@+id/lblSelectedGroup1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="說明"
|
||||
android:id="@+id/btnExplanation1"
|
||||
android:textSize="18dp"
|
||||
android:layout_weight="1"
|
||||
android:onClick="btnExplanation1_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="開始測驗"
|
||||
android:id="@+id/btnStartTest1"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnStartTest1_Click" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="所有單字"
|
||||
android:id="@+id/btnChangeGroup1"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/lblSelectedGroup1"
|
||||
android:background="#ffffff"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_alignRight="@+id/lin3Action1"
|
||||
android:layout_alignEnd="@+id/lin3Action1"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:onClick="btnChangeGroup1_Click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="題數:"
|
||||
android:id="@+id/lblQuestions1"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_below="@+id/btnChangeGroup1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="-"
|
||||
android:id="@+id/btnSubtract1"
|
||||
android:layout_toRightOf="@+id/lblQuestions1"
|
||||
android:layout_below="@+id/btnChangeGroup1"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnSubtract1_Click" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:ems="10"
|
||||
android:id="@+id/txtQAmount1"
|
||||
android:layout_alignBottom="@+id/btnSubtract1"
|
||||
android:layout_toRightOf="@+id/btnSubtract1"
|
||||
android:layout_toEndOf="@+id/btnSubtract1"
|
||||
android:text="10"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLength="4" />
|
||||
|
||||
<Button
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="+"
|
||||
android:id="@+id/btnAdd1"
|
||||
android:textSize="18dp"
|
||||
android:layout_alignBottom="@+id/txtQAmount1"
|
||||
android:layout_toRightOf="@+id/txtQAmount1"
|
||||
android:layout_toEndOf="@+id/txtQAmount1"
|
||||
android:onClick="btnAdd1_Click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="每題答題時間: 10秒"
|
||||
android:id="@+id/lblTimePerQ1"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_below="@+id/lblQuestions1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<SeekBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:id="@+id/skbTimeSet1"
|
||||
android:layout_below="@+id/lblTimePerQ1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/lin3Action1"
|
||||
android:layout_alignEnd="@+id/lin3Action1"
|
||||
android:max="20"
|
||||
android:progress="10"
|
||||
android:layout_marginTop="5dp"
|
||||
android:indeterminate="false" />
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="選項中僅出現群組裡的單字"
|
||||
android:id="@+id/chkOnlyGroupItem1"
|
||||
android:layout_below="@+id/skbTimeSet1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="16dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="120dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/lblExtraMsg1"
|
||||
android:layout_below="@+id/chkOnlyGroupItem1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/btnChangeGroup1"
|
||||
android:layout_alignEnd="@+id/btnChangeGroup1"
|
||||
android:textColor="#a0a0a0"
|
||||
android:textSize="16dp" />
|
||||
|
||||
</RelativeLayout>
|
131
app/src/main/res/layout/activity_act4_selection_result.xml
Executable file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_4selections.Act4SelectionResult">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回至設定頁面"
|
||||
android:id="@+id/btnBack5"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack5_Click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="總題數"
|
||||
android:id="@+id/lblQuestionAmountText1"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_alignRight="@+id/btnBack5"
|
||||
android:layout_alignEnd="@+id/btnBack5"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="答對題數"
|
||||
android:id="@+id/lblRightsText1"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textColor="#074200"
|
||||
android:textSize="18dp"
|
||||
android:layout_below="@+id/lblQuestionAmount1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginLeft="55dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="答錯題數"
|
||||
android:id="@+id/lblWrongsText1"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#450000"
|
||||
android:layout_alignRight="@+id/lblQuestionAmountText1"
|
||||
android:layout_alignEnd="@+id/lblQuestionAmountText1"
|
||||
android:layout_marginRight="55dp"
|
||||
android:layout_below="@+id/lblQuestionAmount1"
|
||||
android:layout_marginTop="15dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQuestionAmount1"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#464646"
|
||||
android:layout_below="@+id/lblQuestionAmountText1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblRights1"
|
||||
android:textSize="16dp"
|
||||
android:textColor="#027600"
|
||||
android:layout_below="@+id/lblRightsText1"
|
||||
android:layout_alignRight="@+id/lblRightsText1"
|
||||
android:layout_alignEnd="@+id/lblRightsText1"
|
||||
android:layout_marginRight="25dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblWrongs1"
|
||||
android:textSize="16dp"
|
||||
android:textColor="#8a0000"
|
||||
android:layout_alignRight="@+id/lblWrongsText1"
|
||||
android:layout_alignEnd="@+id/lblWrongsText1"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_below="@+id/lblWrongsText1"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="作答結果"
|
||||
android:id="@+id/lblAnswerLogText1"
|
||||
android:layout_below="@+id/lblRights1"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:background="#d4ddec" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstAnswerLog1"
|
||||
android:layout_below="@+id/lblAnswerLogText1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@+id/btnBack5"
|
||||
android:background="#b7e3ff"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp" />
|
||||
|
||||
</RelativeLayout>
|
61
app/src/main/res/layout/activity_act_adding_group.xml
Executable file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_allwords.ActAddingGroup">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="請輸入新群組的名稱:"
|
||||
android:id="@+id/lblNewGroupNameText"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txtNewGroupName"
|
||||
android:layout_below="@+id/lblNewGroupNameText"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:singleLine="true"
|
||||
android:lines="1"
|
||||
android:hint="Group Name..." />
|
||||
|
||||
<Button
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="取消"
|
||||
android:id="@+id/btnCancelNewGroup"
|
||||
android:layout_below="@+id/txtNewGroupName"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnCancelNewGroup_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="新增"
|
||||
android:id="@+id/btnAddNewGroupName"
|
||||
android:layout_below="@+id/txtNewGroupName"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnAddNewGroupName_Click" />
|
||||
|
||||
</RelativeLayout>
|
88
app/src/main/res/layout/activity_act_all_voca.xml
Executable file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_allwords.ActAllVoca">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBackUp"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:height="20dp"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBackUp_Click"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="330dp"
|
||||
android:id="@+id/lstWords"
|
||||
android:layout_below="@+id/textView"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="5dp"
|
||||
style="@style/AlertDialog.AppCompat"
|
||||
android:background="#cefbff"
|
||||
android:headerDividersEnabled="true"
|
||||
android:entries="@array/A2Z"
|
||||
android:fastScrollEnabled="false"
|
||||
android:fastScrollAlwaysVisible="true"
|
||||
android:layout_above="@+id/btnBackUp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="55dp"
|
||||
android:text="英文單字查詢"
|
||||
android:id="@+id/btnFinder"
|
||||
android:height="60dp"
|
||||
android:textColor="#0937c1"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold"
|
||||
android:onClick="btnFinder_Click"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="單字字首分類"
|
||||
android:id="@+id/textView"
|
||||
android:layout_below="@+id/btnFinder"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#000000"
|
||||
android:height="40dp"
|
||||
android:gravity="center"
|
||||
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="170dp"
|
||||
android:layout_height="55dp"
|
||||
android:text="單字群組"
|
||||
android:id="@+id/btnGrouping"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="18dp"
|
||||
android:layout_toRightOf="@+id/btnFinder"
|
||||
android:layout_toEndOf="@+id/btnFinder"
|
||||
android:onClick="btnGrouping_Click" />
|
||||
|
||||
</RelativeLayout>
|
73
app/src/main/res/layout/activity_act_editing_group.xml
Executable file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_allwords.ActEditingGroup">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack4_Click"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack4_Click" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/linActEditingGroup">
|
||||
|
||||
<Button
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="新增單字"
|
||||
android:id="@+id/btnAddWord"
|
||||
android:layout_below="@+id/linActEditingGroup"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#046500"
|
||||
android:onClick="btnAddWord_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="刪除單字"
|
||||
android:id="@+id/btnRemoveWord"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textColor="#6a0000"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnRemoveWord_Click" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstGroupWords"
|
||||
android:layout_below="@+id/linActEditingGroup"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_above="@+id/btnBack4_Click"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="#cefbff"
|
||||
android:choiceMode="multipleChoice" />
|
||||
|
||||
</RelativeLayout>
|
80
app/src/main/res/layout/activity_act_grouping.xml
Executable file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_allwords.ActGrouping">
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstGroups"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_above="@+id/btnBack3"
|
||||
android:background="#cefbff"
|
||||
android:fastScrollEnabled="true"
|
||||
android:choiceMode="singleChoice"
|
||||
|
||||
android:layout_below="@+id/btnViewGroupWords"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack3"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack3_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="編輯群組單字"
|
||||
android:id="@+id/btnViewGroupWords"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:layout_below="@+id/btnAddNewGroup"
|
||||
android:onClick="btnViewGroupWords_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="165dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="新增群組"
|
||||
android:id="@+id/btnAddNewGroup"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#046500"
|
||||
android:onClick="btnAddNewGroup_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="移除群組"
|
||||
android:id="@+id/btnRemoveGroup"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="18dp"
|
||||
android:layout_toRightOf="@+id/btnAddNewGroup"
|
||||
android:layout_toEndOf="@+id/btnAddNewGroup"
|
||||
android:textColor="#6a0000"
|
||||
android:onClick="btnRemoveGroup_Click" />
|
||||
|
||||
</RelativeLayout>
|
65
app/src/main/res/layout/activity_act_list_of_word_package.xml
Executable file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.example.leeyuanair.englishhelper.ActListOfWordPackage">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="Explanation"
|
||||
android:id="@+id/lblWordPackageExplanation"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="#d5d6ff"
|
||||
android:textSize="14dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp"
|
||||
android:text="系列內容"
|
||||
android:id="@+id/lblWordPackageText"
|
||||
android:textSize="22dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:layout_below="@+id/lblWordPackageExplanation"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_alignRight="@+id/lblWordPackageExplanation"
|
||||
android:layout_alignEnd="@+id/lblWordPackageExplanation"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack11"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack11_Click" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstWordPackage"
|
||||
android:layout_below="@+id/lblWordPackageText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@+id/btnBack11"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="#c7f3ff" />
|
||||
</RelativeLayout>
|
109
app/src/main/res/layout/activity_act_memory_practice.xml
Executable file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_memory.ActMemoryPractice"
|
||||
android:background="@drawable/redngreen">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:id="@+id/lblMemoryStatus"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16dp"
|
||||
android:background="#b4ffffff"
|
||||
android:text="記憶練習" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/linearLayout">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NO"
|
||||
android:id="@+id/btnNO"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="#ff7272"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="15dp"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnNO_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="YES"
|
||||
android:id="@+id/btnYES"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:background="#7de685"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnYES_Click" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="200dp"
|
||||
android:text="4"
|
||||
android:id="@+id/lblQuestion1"
|
||||
android:layout_below="@+id/lblMemoryStatus"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/lblMemoryStatus"
|
||||
android:layout_alignEnd="@+id/lblMemoryStatus"
|
||||
android:singleLine="false"
|
||||
android:layout_marginTop="50dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:background="#64ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="預備..."
|
||||
android:id="@+id/lblMemoryHint"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:layout_above="@+id/pgbCountdown2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/pgbCountdown2"
|
||||
android:layout_alignEnd="@+id/pgbCountdown2" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:id="@+id/pgbCountdown2"
|
||||
android:layout_above="@+id/linearLayout"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/linearLayout"
|
||||
android:layout_alignEnd="@+id/linearLayout"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:max="2000"
|
||||
android:progress="1000"
|
||||
android:indeterminate="false"
|
||||
android:progressTint="#67abff" />
|
||||
|
||||
</RelativeLayout>
|
77
app/src/main/res/layout/activity_act_memory_result.xml
Executable file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_memory.ActMemoryResult">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="答題題數"
|
||||
android:id="@+id/lblQuestionAmountText2"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQuestionAmount2"
|
||||
android:layout_below="@+id/lblQuestionAmountText2"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#464646"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_alignRight="@+id/lblQuestionAmountText2"
|
||||
android:layout_alignEnd="@+id/lblQuestionAmountText2"
|
||||
android:layout_alignLeft="@+id/lblQuestionAmountText2"
|
||||
android:layout_alignStart="@+id/lblQuestionAmountText2"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="以下為你不熟的單字,請努力記熟!"
|
||||
android:id="@+id/lblNotUnderstandText1"
|
||||
android:layout_below="@+id/lblQuestionAmount2"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textColor="#080051"
|
||||
android:textSize="18dp"
|
||||
android:gravity="center"
|
||||
android:background="#a4c7dd" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回至設定頁面"
|
||||
android:id="@+id/btnBack7"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignRight="@+id/lblNotUnderstandText1"
|
||||
android:layout_alignEnd="@+id/lblNotUnderstandText1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack7_Click" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstNotUnderstandList"
|
||||
android:layout_below="@+id/lblNotUnderstandText1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@+id/btnBack7"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#b7e3ff"
|
||||
android:layout_marginBottom="5dp" />
|
||||
</RelativeLayout>
|
199
app/src/main/res/layout/activity_act_memory_setting.xml
Executable file
@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_memory.ActMemorySetting">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="群組:"
|
||||
android:id="@+id/lblSelectedGroup2"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="所有單字"
|
||||
android:id="@+id/btnChangeGroup2"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/lblSelectedGroup2"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="#ffffff"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:onClick="btnChangeGroup2_Click" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="練習到每個單字了解為止"
|
||||
android:id="@+id/rdoKeepPractice"
|
||||
android:textSize="18dp"
|
||||
android:checked="true"
|
||||
android:layout_below="@+id/lblPracticeMode"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:onClick="rdoKeepPractice_Click" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="依指定題數練習"
|
||||
android:id="@+id/rdoQuestions"
|
||||
android:textSize="18dp"
|
||||
android:layout_below="@+id/rdoKeepPractice"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:onClick="rdoQuestions_Click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="題數:"
|
||||
android:id="@+id/lblQuestions2"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_below="@+id/btnChangeGroup2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="-"
|
||||
android:id="@+id/btnSubtract2"
|
||||
android:layout_below="@+id/btnChangeGroup2"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_toRightOf="@+id/lblQuestions2"
|
||||
android:layout_toEndOf="@+id/lblQuestions2"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnSubtract2_Click" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:ems="10"
|
||||
android:id="@+id/txtQAmount2"
|
||||
android:layout_alignBottom="@+id/btnSubtract2"
|
||||
android:layout_toRightOf="@+id/btnSubtract2"
|
||||
android:layout_toEndOf="@+id/btnSubtract2"
|
||||
android:maxLength="4"
|
||||
android:text="10"
|
||||
android:gravity="center" />
|
||||
|
||||
<Button
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="+"
|
||||
android:id="@+id/btnAdd2"
|
||||
android:textSize="18dp"
|
||||
android:layout_alignBottom="@+id/btnSubtract2"
|
||||
android:layout_toRightOf="@+id/txtQAmount2"
|
||||
android:layout_toEndOf="@+id/txtQAmount2"
|
||||
android:onClick="btnAdd2_Click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="每題答題時間: 10秒"
|
||||
android:id="@+id/lblTimePerQ2"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_below="@+id/lblQuestions2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="25dp" />
|
||||
|
||||
<SeekBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/skbTimeSet2"
|
||||
android:layout_below="@+id/lblTimePerQ2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/btnChangeGroup2"
|
||||
android:layout_alignEnd="@+id/btnChangeGroup2"
|
||||
android:layout_marginTop="5dp"
|
||||
android:max="20"
|
||||
android:progress="10" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="練習模式:"
|
||||
android:id="@+id/lblPracticeMode"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_below="@+id/skbTimeSet2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/lin3Action2">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack6"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack6_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="說明"
|
||||
android:id="@+id/btnExplanation2"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnExplanation2_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="開始練習"
|
||||
android:id="@+id/btnStartTest2"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnStartTest2_Click" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="120dp"
|
||||
android:id="@+id/lblExtraMsg2"
|
||||
android:layout_below="@+id/rdoQuestions"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/skbTimeSet2"
|
||||
android:layout_alignEnd="@+id/skbTimeSet2"
|
||||
android:textSize="16dp"
|
||||
android:text="此單字群組的單字量大於100個,若要練習到完可能需要花較長的時間!"
|
||||
android:textColor="#8c8c8c" />
|
||||
|
||||
</RelativeLayout>
|
124
app/src/main/res/layout/activity_act_multiple_choice.xml
Executable file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_4selections.ActMultipleChoice">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/pgbCountdown1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/lin4Selection">
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Selection 1"
|
||||
android:id="@+id/btnSelection1"
|
||||
android:onClick="btnSelection1_Click"
|
||||
android:layout_alignBottom="@+id/pgbCountdown1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Selection 2"
|
||||
android:id="@+id/btnSelection2"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnSelection2_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Selection 3"
|
||||
android:id="@+id/btnSelection3"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnSelection3_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Selection 4"
|
||||
android:id="@+id/btnSelection4"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnSelection4_Click" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="130dp"
|
||||
android:text="4"
|
||||
android:id="@+id/lbl4SelQuestion"
|
||||
android:textSize="24dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#323229"
|
||||
android:layout_below="@+id/lin4SelStatus" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/pgbCountdown1"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:indeterminate="false"
|
||||
android:max="10"
|
||||
android:progress="5"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_below="@+id/lbl4SelQuestion" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:id="@+id/lin4SelStatus"
|
||||
android:background="#e1ffdf">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="總題數: 10, 目前答題: 1"
|
||||
android:id="@+id/lbl4SelStatus1"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#000000"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="答對題數: 0 ,答錯題數: 0"
|
||||
android:id="@+id/lbl4SelStatus2"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#001078"
|
||||
android:textSize="14dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
43
app/src/main/res/layout/activity_act_piece_voca.xml
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_allwords.ActPieceVoca">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack1"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:height="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack1_onClick"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="430dp"
|
||||
android:id="@+id/lstWords1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#cefbff"
|
||||
android:layout_marginTop="0dp"
|
||||
android:fastScrollAlwaysVisible="false"
|
||||
android:fastScrollEnabled="true"
|
||||
android:minHeight="300dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:textAlignment="center"
|
||||
android:smoothScrollbar="false"
|
||||
android:layout_above="@+id/btnBack1"
|
||||
android:layout_alignParentTop="true" />
|
||||
</RelativeLayout>
|
135
app/src/main/res/layout/activity_act_search_word.xml
Executable file
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:screenOrientation="portrait"
|
||||
tools:context=".ActSearchWord">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="請輸入欲搜索的單字、隻字或字義"
|
||||
android:id="@+id/lblSearchText"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="20dp"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txtSearch"
|
||||
android:layout_below="@+id/lblSearchText"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:hint="Search..." />
|
||||
|
||||
<Button
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:text="搜尋"
|
||||
android:id="@+id/btnSearch"
|
||||
android:layout_below="@+id/txtSearch"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnSearch_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack2"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnBack2_Click"
|
||||
android:layout_below="@+id/lstFinds" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="260dp"
|
||||
android:id="@+id/lstFinds"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btnSearch"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#cefbff"
|
||||
android:fastScrollEnabled="true" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="形容詞"
|
||||
android:id="@+id/rdoAdjective"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/rdoNoun" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="副詞"
|
||||
android:id="@+id/rdoAdverb"
|
||||
android:layout_below="@+id/rdoVerb"
|
||||
android:layout_alignLeft="@+id/rdoVerb" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="動詞"
|
||||
android:id="@+id/rdoVerb"
|
||||
android:layout_column="1"
|
||||
android:layout_alignTop="@+id/rdoAll"
|
||||
android:layout_toRightOf="@+id/rdoAll"
|
||||
android:layout_marginLeft="50dp" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="介係詞"
|
||||
android:id="@+id/rdoPreposition"
|
||||
android:layout_alignLeft="@+id/rdoAdverb"
|
||||
android:layout_alignStart="@+id/rdoAdverb"
|
||||
android:layout_below="@+id/rdoAdverb" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="名詞"
|
||||
android:id="@+id/rdoNoun"
|
||||
android:layout_weight="1"
|
||||
android:layout_column="0"
|
||||
android:layout_below="@+id/rdoAll" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="全部"
|
||||
android:id="@+id/rdoAll"
|
||||
android:layout_column="0"
|
||||
android:checked="true"
|
||||
android:layout_alignTop="@+id/btnSearch"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
</RelativeLayout>
|
265
app/src/main/res/layout/activity_act_spelling_examine.xml
Executable file
@ -0,0 +1,265 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_spelling.ActSpellingExamine">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="#此單字長度為N/A,有以下詞性意義:"
|
||||
android:id="@+id/lblQuestionMessage"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textColor="#350c00"
|
||||
android:textSize="18dp"
|
||||
android:layout_below="@+id/btnAnswerIt"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="280dp"
|
||||
android:layout_below="@+id/lblQuestionMessage"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/rltlQPartOfSpeech"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/linQPreposition"
|
||||
android:layout_below="@+id/linQAdverb"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="介係詞(prep.)"
|
||||
android:id="@+id/lblQPrepositionText"
|
||||
android:textSize="22dp"
|
||||
android:textColor="#003a65" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQPreposition"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/linQAdverb"
|
||||
android:layout_below="@+id/linQVerb"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="副詞(adv.)"
|
||||
android:id="@+id/lblQAdverbText"
|
||||
android:textSize="22dp"
|
||||
android:textColor="#003a65" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQAdverb"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/linQVerb"
|
||||
android:layout_below="@+id/linQAdjective"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="動詞(v.)"
|
||||
android:id="@+id/lblQVerbText"
|
||||
android:textSize="22dp"
|
||||
android:textColor="#003a65" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQVerb"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_below="@+id/linQNoun"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/linQAdjective"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="形容詞(adj.)"
|
||||
android:id="@+id/lblQAdjectiveText"
|
||||
android:textSize="22dp"
|
||||
android:textColor="#003a65" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQAdjective"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/linQNoun"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="名詞(n.)"
|
||||
android:id="@+id/lblQNounText"
|
||||
android:textSize="22dp"
|
||||
android:textColor="#003a65" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQNoun"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/linSpellingStatus"
|
||||
android:background="#d3ffdd">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="總題數: N/A, 目前題號: 0"
|
||||
android:id="@+id/lblSpellingStatus2"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignRight="@+id/lblSpellingStatus1"
|
||||
android:layout_alignEnd="@+id/lblSpellingStatus1"
|
||||
android:textColor="#000000"
|
||||
android:textSize="14dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="3dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="答對題數: 0, 答錯題數: 0"
|
||||
android:id="@+id/lblSpellingStatus1"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@+id/lblSpellingStatus2"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="#003f8d"
|
||||
android:textSize="14dp"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="提交答案"
|
||||
android:id="@+id/btnAnswerIt"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnAnswerIt_Click"
|
||||
android:layout_below="@+id/txtAnswerBar"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="30dp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txtAnswerBar"
|
||||
android:layout_alignRight="@+id/btnAnswerIt"
|
||||
android:layout_alignEnd="@+id/btnAnswerIt"
|
||||
android:singleLine="true"
|
||||
android:hint="Answer..."
|
||||
android:gravity="center"
|
||||
android:layout_below="@+id/lblAnswerBarText"
|
||||
android:layout_alignLeft="@+id/btnAnswerIt"
|
||||
android:layout_alignStart="@+id/btnAnswerIt" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="請在此寫上答案(全部小寫):"
|
||||
android:id="@+id/lblAnswerBarText"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textColor="#191919"
|
||||
android:textSize="16dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/linSpellingStatus"
|
||||
android:layout_marginTop="5dp" />
|
||||
|
||||
</RelativeLayout>
|
148
app/src/main/res/layout/activity_act_spelling_result.xml
Executable file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_spelling.ActSpellingResult">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="總題數"
|
||||
android:id="@+id/lblQuestionAmountText3"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="N/A"
|
||||
android:id="@+id/lblQuestionAmount3"
|
||||
android:layout_below="@+id/lblQuestionAmountText3"
|
||||
android:layout_alignRight="@+id/lblQuestionAmountText3"
|
||||
android:layout_alignEnd="@+id/lblQuestionAmountText3"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#323232"
|
||||
android:textSize="18dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_below="@+id/lblQuestionAmount3"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/linRightsWrongs2">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:measureWithLargestChild="false"
|
||||
android:id="@+id/linRights2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="答對題數"
|
||||
android:id="@+id/lblRightsText2"
|
||||
android:textColor="#074200"
|
||||
android:textSize="18dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lblRights2"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#027600"
|
||||
android:text="N/A"
|
||||
android:textSize="16dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/linWrongs2">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="答錯題數"
|
||||
android:id="@+id/lblWrongsText2"
|
||||
android:textColor="#450000"
|
||||
android:textSize="18dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lblWrongs2"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#8a0000"
|
||||
android:text="N/A"
|
||||
android:textSize="16dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="作答結果"
|
||||
android:id="@+id/lblAnswerLogText2"
|
||||
android:layout_below="@+id/linRightsWrongs2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="18dp"
|
||||
android:background="#d4ddec" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回至設定頁面"
|
||||
android:id="@+id/btnBack9"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack9_Click" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstAnswerLog2"
|
||||
android:layout_below="@+id/lblAnswerLogText2"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@+id/btnBack9"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="#b7e3ff" />
|
||||
</RelativeLayout>
|
190
app/src/main/res/layout/activity_act_spelling_setting.xml
Executable file
@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_spelling.ActSpellingSetting">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="群組:"
|
||||
android:id="@+id/lblSelectedGroup3"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="24dp"
|
||||
android:textColor="#000000"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="所有單字"
|
||||
android:id="@+id/btnChangeGroup3"
|
||||
android:background="#ffffff"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:onClick="btnChangeGroup3_Click"
|
||||
android:layout_toRightOf="@+id/lblSelectedGroup3"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginLeft="10dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="題數:"
|
||||
android:id="@+id/lblQuestions3"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_below="@+id/btnChangeGroup3"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<Button
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="-"
|
||||
android:id="@+id/btnSubtract3"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnSubtract3_Click"
|
||||
android:layout_below="@+id/btnChangeGroup3"
|
||||
android:layout_toRightOf="@+id/lblQuestions3"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:ems="10"
|
||||
android:id="@+id/txtQAmount3"
|
||||
android:text="10"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLength="4"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_toRightOf="@+id/btnSubtract3"
|
||||
android:layout_alignBottom="@+id/btnSubtract3" />
|
||||
|
||||
<Button
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="+"
|
||||
android:id="@+id/btnAdd3"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnAdd3_Click"
|
||||
android:layout_alignBottom="@+id/txtQAmount3"
|
||||
android:layout_toRightOf="@+id/txtQAmount3"
|
||||
android:layout_toEndOf="@+id/txtQAmount3" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="提示:"
|
||||
android:id="@+id/lblSetHint"
|
||||
android:textColor="#000000"
|
||||
android:textSize="24dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_below="@+id/lblQuestions3"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_below="@+id/lblSetHint"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/linSetHint">
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="字首提示"
|
||||
android:id="@+id/chkPrefix"
|
||||
android:layout_below="@+id/lblSetHint"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="18dp"
|
||||
android:layout_weight="1"
|
||||
android:onClick="chkPrefix_Click" />
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="字尾提示"
|
||||
android:id="@+id/chkSuffix"
|
||||
android:textSize="18dp"
|
||||
android:layout_below="@+id/chkPrefix"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_weight="1"
|
||||
android:onClick="chkSuffix_Click" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:id="@+id/lin3Action3"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack8"
|
||||
android:textSize="18dp"
|
||||
android:height="50dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:onClick="btnBack7_Click"
|
||||
android:layout_below="@+id/lblSelectedGroup1"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="說明"
|
||||
android:id="@+id/btnExplanation3"
|
||||
android:textSize="18dp"
|
||||
android:layout_weight="1"
|
||||
android:onClick="btnExplanation3_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="開始測驗"
|
||||
android:id="@+id/btnStartTest3"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnStartTest3_Click" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="100dp"
|
||||
android:id="@+id/lblExtraMsg3"
|
||||
android:layout_below="@+id/linSetHint"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignRight="@+id/linSetHint"
|
||||
android:layout_alignEnd="@+id/linSetHint"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="16dp"
|
||||
android:textColor="#a8a8a8" />
|
||||
|
||||
</RelativeLayout>
|
216
app/src/main/res/layout/activity_act_word_info.xml
Executable file
@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".act_allwords.ActWordInfo">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack2"
|
||||
android:textSize="18dp"
|
||||
android:height="20dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginBottom="-5dp"
|
||||
android:onClick="btnBack2_onClick" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="#465bce"
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Telecommunications"
|
||||
android:id="@+id/lblWordTitle"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="32dp"
|
||||
android:layout_below="@+id/frameLayout"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_gravity="top|center" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@+id/frameLayout"
|
||||
android:id="@+id/linNoun">
|
||||
|
||||
<TextView
|
||||
android:inputType="textMultiLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="名詞(n.)"
|
||||
android:id="@+id/lblNounText"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_below="@+id/frameLayout"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textColor="#003a65"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="26dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Noun"
|
||||
android:id="@+id/lblNoun"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20dp"
|
||||
android:layout_marginTop="0dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_below="@+id/linNoun"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:id="@+id/linAdjective">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="形容詞(adj.)"
|
||||
android:id="@+id/lblAdjectiveText"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#003a65"
|
||||
android:textSize="26dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Adjective"
|
||||
android:id="@+id/lblAdjective"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_below="@+id/linAdjective"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:id="@+id/linVerb">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="動詞(v.)"
|
||||
android:id="@+id/lblVerbText"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="#003a65"
|
||||
android:textSize="26dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Verb"
|
||||
android:id="@+id/lblVerb"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_below="@+id/linVerb"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:id="@+id/linAdverb">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:id="@+id/lblAdverbText"
|
||||
android:text="副詞(adv.)"
|
||||
android:textColor="#003a65"
|
||||
android:textSize="26dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Adverb"
|
||||
android:id="@+id/lblAdverb"
|
||||
android:textSize="20dp"
|
||||
android:textColor="#000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_below="@+id/linAdverb"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:id="@+id/linPreposition">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="介係詞(prep.)"
|
||||
android:id="@+id/lblPrepositionText"
|
||||
android:textColor="#003a65"
|
||||
android:textSize="26dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Preposition"
|
||||
android:id="@+id/lblPreposition"
|
||||
android:textSize="20dp"
|
||||
android:textColor="#000000" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:text="新增至群組單字中"
|
||||
android:id="@+id/btnAdd2Addition"
|
||||
android:layout_above="@+id/btnBack2"
|
||||
android:layout_alignRight="@+id/linPreposition"
|
||||
android:layout_alignEnd="@+id/linPreposition"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:onClick="btnAdd2Addition"
|
||||
android:textSize="18dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
</RelativeLayout>
|
65
app/src/main/res/layout/activity_act_word_packages.xml
Executable file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.example.leeyuanair.englishhelper.ActWordPackages">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
android:text="單字包裹提供了一系列不同主題的單字組\n當你不曉得要背什麼或是要尋找近似的單字\n時可以來這裡看看喔"
|
||||
android:id="@+id/lblWPExplanation"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="#e3e1fe"
|
||||
android:gravity="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="14dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:text="系列單字包裹"
|
||||
android:id="@+id/lblAllWordPackageText"
|
||||
android:layout_below="@+id/lblWPExplanation"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
android:textColor="#282828" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回"
|
||||
android:id="@+id/btnBack10"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textSize="18dp"
|
||||
android:onClick="btnBack10_Click" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lstAllWordPackages"
|
||||
android:layout_below="@+id/lblAllWordPackageText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@+id/btnBack10"
|
||||
android:background="#c7f3ff"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp" />
|
||||
</RelativeLayout>
|
125
app/src/main/res/layout/activity_main.xml
Executable file
@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="com.example.leeyuanair.englishhelper.MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="v1.0.0"
|
||||
android:id="@+id/lblVersion"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:onClick="lblVersion_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="字義選擇"
|
||||
android:id="@+id/btn4Select"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:minWidth="300dp"
|
||||
android:minHeight="60dp"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btn4Select_Click"
|
||||
android:layout_below="@+id/lblWordMessage" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="單字列表"
|
||||
android:id="@+id/btnAllVoca"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:width="300dp"
|
||||
android:height="60dp"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnAllVoca_Click"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="30dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="InMessage"
|
||||
android:id="@+id/lblWordMessage"
|
||||
android:textSize="26dp"
|
||||
android:textColor="#0015ff"
|
||||
android:width="300dp"
|
||||
android:autoText="false"
|
||||
android:gravity="center"
|
||||
android:layout_alignParentTop="false"
|
||||
android:layout_alignLeft="@+id/btn4Select"
|
||||
android:layout_alignStart="@+id/btn4Select"
|
||||
android:background="#fff7d6"
|
||||
android:layout_below="@+id/lblWordMessageTitle"
|
||||
android:textStyle="italic"
|
||||
android:onClick="lblWordMessage_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="記憶練習"
|
||||
android:id="@+id/btnMemory"
|
||||
android:minHeight="60dp"
|
||||
android:minWidth="300dp"
|
||||
android:singleLine="false"
|
||||
android:textSize="20dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/btn4Select"
|
||||
android:onClick="btnMemory_Click" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="拼字測驗"
|
||||
android:id="@+id/btnSpelling"
|
||||
android:minHeight="60dp"
|
||||
android:minWidth="300dp"
|
||||
android:singleLine="false"
|
||||
android:textSize="20dp"
|
||||
android:layout_below="@+id/btnMemory"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:onClick="btnSpelling_Click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/lblWordMessageTitle"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignLeft="@+id/lblWordMessage"
|
||||
android:layout_alignStart="@+id/lblWordMessage"
|
||||
android:layout_alignRight="@+id/lblWordMessage"
|
||||
android:layout_alignEnd="@+id/lblWordMessage"
|
||||
android:gravity="center"
|
||||
android:textSize="18dp"
|
||||
android:background="#fff7d6"
|
||||
android:textColor="#001567"
|
||||
android:text="每日一字" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="單字包裹"
|
||||
android:id="@+id/btnWordPackage"
|
||||
android:minHeight="60dp"
|
||||
android:minWidth="300dp"
|
||||
android:singleLine="false"
|
||||
android:textSize="20dp"
|
||||
android:onClick="btnWordPackage_Click"
|
||||
android:layout_below="@+id/btnSpelling"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
|
||||
</RelativeLayout>
|
BIN
app/src/main/res/mipmap-hdpi/appicon.png
Executable file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/appicon.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/appicon.png
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/appicon.png
Executable file
After Width: | Height: | Size: 6.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/appicon.png
Executable file
After Width: | Height: | Size: 9.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 10 KiB |
6
app/src/main/res/values-w820dp/dimens.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
6
app/src/main/res/values/colors.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
</resources>
|
5
app/src/main/res/values/dimens.xml
Executable file
@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
</resources>
|
31
app/src/main/res/values/strings.xml
Executable file
@ -0,0 +1,31 @@
|
||||
<resources>
|
||||
<string name="app_name">英文幫手</string>
|
||||
<string-array name="A2Z">
|
||||
<item>A</item>
|
||||
<item>B</item>
|
||||
<item>C</item>
|
||||
<item>D</item>
|
||||
<item>E</item>
|
||||
<item>F</item>
|
||||
<item>G</item>
|
||||
<item>H</item>
|
||||
<item>I</item>
|
||||
<item>J</item>
|
||||
<item>K</item>
|
||||
<item>L</item>
|
||||
<item>M</item>
|
||||
<item>N</item>
|
||||
<item>O</item>
|
||||
<item>P</item>
|
||||
<item>Q</item>
|
||||
<item>R</item>
|
||||
<item>S</item>
|
||||
<item>T</item>
|
||||
<item>U</item>
|
||||
<item>V</item>
|
||||
<item>W</item>
|
||||
<item>X</item>
|
||||
<item>Y</item>
|
||||
<item>Z</item>
|
||||
</string-array>
|
||||
</resources>
|
11
app/src/main/res/values/styles.xml
Executable file
@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
15
app/src/test/java/com/example/leeyuanair/englishhelper/ExampleUnitTest.java
Executable file
@ -0,0 +1,15 @@
|
||||
package com.example.leeyuanair.englishhelper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
23
build.gradle
Executable file
@ -0,0 +1,23 @@
|
||||
// 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.5.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
18
gradle.properties
Executable file
@ -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=-Xmx1024m -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
|
6
gradle/wrapper/gradle-wrapper.properties
vendored
Executable file
@ -0,0 +1,6 @@
|
||||
#Wed Oct 21 11:34:03 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
|
160
gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
||||
#!/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
|
||||
|
||||
# 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\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
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"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# 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 "$@"
|
90
gradlew.bat
vendored
Executable file
@ -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
|
1
settings.gradle
Executable file
@ -0,0 +1 @@
|
||||
include ':app'
|