Browse Source

Automatic Commit By liuyuqi

liuyuqi-dellpc 2 years ago
commit
5e833cc037
87 changed files with 2957 additions and 0 deletions
  1. 15 0
      .gitignore
  2. 3 0
      .idea/.gitignore
  3. 6 0
      .idea/compiler.xml
  4. 20 0
      .idea/gradle.xml
  5. 17 0
      .idea/misc.xml
  6. 3 0
      README.md
  7. 1 0
      app/.gitignore
  8. 50 0
      app/build.gradle
  9. 21 0
      app/proguard-rules.pro
  10. 26 0
      app/src/androidTest/java/me/yoqi/android/jkbd/ExampleInstrumentedTest.java
  11. 33 0
      app/src/main/AndroidManifest.xml
  12. 57 0
      app/src/main/java/me/yoqi/android/jkbd/MyApp.java
  13. 29 0
      app/src/main/java/me/yoqi/android/jkbd/base/BaseActivity.java
  14. 17 0
      app/src/main/java/me/yoqi/android/jkbd/base/BaseFragment.java
  15. 63 0
      app/src/main/java/me/yoqi/android/jkbd/bean/Exam.java
  16. 112 0
      app/src/main/java/me/yoqi/android/jkbd/bean/Question.java
  17. 38 0
      app/src/main/java/me/yoqi/android/jkbd/bean/Result.java
  18. 85 0
      app/src/main/java/me/yoqi/android/jkbd/biz/ExamBiz.java
  19. 18 0
      app/src/main/java/me/yoqi/android/jkbd/biz/IExamBiz.java
  20. 85 0
      app/src/main/java/me/yoqi/android/jkbd/dao/ExamDao.java
  21. 10 0
      app/src/main/java/me/yoqi/android/jkbd/dao/IExamDao.java
  22. 70 0
      app/src/main/java/me/yoqi/android/jkbd/ui/MainActivity.java
  23. 485 0
      app/src/main/java/me/yoqi/android/jkbd/ui/RandomTest.java
  24. 50 0
      app/src/main/java/me/yoqi/android/jkbd/ui/SplashActivity.java
  25. 497 0
      app/src/main/java/me/yoqi/android/jkbd/utils/OkHttpUtils.java
  26. 67 0
      app/src/main/java/me/yoqi/android/jkbd/utils/ResultUtils.java
  27. 59 0
      app/src/main/java/me/yoqi/android/jkbd/view/QuestionAdapter.java
  28. 30 0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  29. 170 0
      app/src/main/res/drawable/ic_launcher_background.xml
  30. 58 0
      app/src/main/res/layout/activity_main.xml
  31. 323 0
      app/src/main/res/layout/activity_random.xml
  32. 8 0
      app/src/main/res/layout/activity_splash.xml
  33. 17 0
      app/src/main/res/layout/item_question.xml
  34. 17 0
      app/src/main/res/layout/layout_result.xml
  35. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  36. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  37. BIN
      app/src/main/res/mipmap-hdpi/answer24x24.png
  38. BIN
      app/src/main/res/mipmap-hdpi/btn.png
  39. BIN
      app/src/main/res/mipmap-hdpi/commit.png
  40. BIN
      app/src/main/res/mipmap-hdpi/dialog_bg.jpg
  41. BIN
      app/src/main/res/mipmap-hdpi/error_24px.png
  42. BIN
      app/src/main/res/mipmap-hdpi/exam_bg.png
  43. BIN
      app/src/main/res/mipmap-hdpi/exam_commit32x32.png
  44. BIN
      app/src/main/res/mipmap-hdpi/exam_next32x32.png
  45. BIN
      app/src/main/res/mipmap-hdpi/exam_pre32x32.png
  46. BIN
      app/src/main/res/mipmap-hdpi/exam_question_content.png
  47. BIN
      app/src/main/res/mipmap-hdpi/exam_title.png
  48. BIN
      app/src/main/res/mipmap-hdpi/exit_bg.png
  49. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  50. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.webp
  51. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  52. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
  53. BIN
      app/src/main/res/mipmap-hdpi/icon.png
  54. BIN
      app/src/main/res/mipmap-hdpi/login32x32.png
  55. BIN
      app/src/main/res/mipmap-hdpi/login_bg.png
  56. BIN
      app/src/main/res/mipmap-hdpi/login_btn_bg.png
  57. BIN
      app/src/main/res/mipmap-hdpi/login_exit32x32.png
  58. BIN
      app/src/main/res/mipmap-hdpi/main.jpg
  59. BIN
      app/src/main/res/mipmap-hdpi/main_menu_bg.png
  60. BIN
      app/src/main/res/mipmap-hdpi/main_menu_exam.png
  61. BIN
      app/src/main/res/mipmap-hdpi/main_menu_exit.png
  62. BIN
      app/src/main/res/mipmap-hdpi/main_menu_message.png
  63. BIN
      app/src/main/res/mipmap-hdpi/main_menu_result.png
  64. BIN
      app/src/main/res/mipmap-hdpi/myicon.png
  65. BIN
      app/src/main/res/mipmap-hdpi/noselected.png
  66. BIN
      app/src/main/res/mipmap-hdpi/ques24x24.png
  67. BIN
      app/src/main/res/mipmap-hdpi/splash.jpg
  68. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.webp
  69. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
  70. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.webp
  71. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
  72. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
  73. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
  74. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
  75. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
  76. 16 0
      app/src/main/res/values-night/themes.xml
  77. 16 0
      app/src/main/res/values/colors.xml
  78. 3 0
      app/src/main/res/values/strings.xml
  79. 9 0
      app/src/main/res/values/themes.xml
  80. 17 0
      app/src/test/java/me/yoqi/android/jkbd/ExampleUnitTest.java
  81. 17 0
      build.gradle
  82. 19 0
      gradle.properties
  83. BIN
      gradle/wrapper/gradle-wrapper.jar
  84. 6 0
      gradle/wrapper/gradle-wrapper.properties
  85. 185 0
      gradlew
  86. 89 0
      gradlew.bat
  87. 10 0
      settings.gradle

+ 15 - 0
.gitignore

@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties

+ 3 - 0
.idea/.gitignore

@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml

+ 6 - 0
.idea/compiler.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <bytecodeTargetLevel target="1.8" />
+  </component>
+</project>

+ 20 - 0
.idea/gradle.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="GradleSettings">
+    <option name="linkedExternalProjectsSettings">
+      <GradleProjectSettings>
+        <option name="testRunner" value="GRADLE" />
+        <option name="distributionType" value="DEFAULT_WRAPPED" />
+        <option name="externalProjectPath" value="$PROJECT_DIR$" />
+        <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-5.1.1" />
+        <option name="modules">
+          <set>
+            <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/app" />
+          </set>
+        </option>
+        <option name="resolveModulePerSourceSet" value="false" />
+      </GradleProjectSettings>
+    </option>
+  </component>
+</project>

+ 17 - 0
.idea/misc.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="DesignSurface">
+    <option name="filePathToZoomLevelMap">
+      <map>
+        <entry key="..\:/workspace/JKBD/app/src/main/res/layout/activity_main.xml" value="0.18888888888888888" />
+        <entry key="..\:/workspace/JKBD/app/src/main/res/layout/layout_result.xml" value="0.1984375" />
+      </map>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/build/classes" />
+  </component>
+  <component name="ProjectType">
+    <option name="id" value="Android" />
+  </component>
+</project>

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# JKBD
+
+驾考宝典App

+ 1 - 0
app/.gitignore

@@ -0,0 +1 @@
+/build

+ 50 - 0
app/build.gradle

@@ -0,0 +1,50 @@
+plugins {
+    id 'com.android.application'
+}
+
+android {
+    compileSdk 30
+
+    defaultConfig {
+        applicationId "me.yoqi.android.jkbd"
+        minSdk 21
+        targetSdk 30
+        versionCode 1
+        versionName "1.0"
+
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+}
+
+dependencies {
+    implementation fileTree(include: ['*.jar'], dir: 'libs')
+
+    implementation 'androidx.appcompat:appcompat:1.2.0'
+    implementation 'com.google.android.material:material:1.3.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+    testImplementation 'junit:junit:4.+'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+
+    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+        exclude group: 'com.android.support', module: 'support-annotations'
+    })
+    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
+    implementation 'com.squareup.okio:okio-parent:1.13.0'
+    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.8.1'
+    implementation 'com.google.code.gson:gson:2.8.1'
+    implementation 'com.squareup.picasso:picasso:2.5.2'
+    implementation 'com.jakewharton:butterknife:8.6.0'
+    annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
+}

+ 21 - 0
app/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# 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 *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 26 - 0
app/src/androidTest/java/me/yoqi/android/jkbd/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
+package me.yoqi.android.jkbd;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+        assertEquals("me.yoqi.android.jkbd", appContext.getPackageName());
+    }
+}

+ 33 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="me.yoqi.android.jkbd">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+
+    <application
+        android:name=".MyApp"
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:roundIcon="@mipmap/ic_launcher_round"
+        android:supportsRtl="true"
+        android:theme="@style/Theme.JKBD">
+        <activity android:name=".ui.MainActivity"/>
+        <activity
+            android:name=".ui.SplashActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".ui.RandomTest"
+            android:screenOrientation="fullSensor">
+
+        </activity>
+    </application>
+
+</manifest>

+ 57 - 0
app/src/main/java/me/yoqi/android/jkbd/MyApp.java

@@ -0,0 +1,57 @@
+package me.yoqi.android.jkbd;
+
+import android.app.Application;
+
+import java.util.List;
+
+import me.yoqi.android.jkbd.bean.Exam;
+import me.yoqi.android.jkbd.bean.Question;
+import me.yoqi.android.jkbd.biz.IExamBiz;
+
+/**
+ * @author liuyuqi.gov@msn.cn
+ * @date 4/5/2022
+ */
+public class MyApp extends Application {
+    public static String LOAD_EXAM = "load_exam";
+    public static String LOAD_QUESTION = "load_question";
+    public static String LOAD_DATA_SUCCESS = "load_data_success";
+
+    Exam exam;
+    List<Question> questionList;
+    public static MyApp instance;
+
+    IExamBiz iExamBiz;
+
+    public Exam getExam() {
+        return exam;
+    }
+
+    public void setExam(Exam exam) {
+        this.exam = exam;
+    }
+
+    public List<Question> getQuestionList() {
+        return questionList;
+    }
+
+    public void setQuestionList(List<Question> questionList) {
+        this.questionList = questionList;
+    }
+
+    public static MyApp getInstance() {
+        return instance;
+    }
+
+    public void setInstance(MyApp instance) {
+        this.instance = instance;
+    }
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        instance = this;
+
+        getExam();
+    }
+}

+ 29 - 0
app/src/main/java/me/yoqi/android/jkbd/base/BaseActivity.java

@@ -0,0 +1,29 @@
+package me.yoqi.android.jkbd.base;
+
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+/**
+ * @author liuyuqi.gov@msn.cn
+ * @date 4/5/2022
+ */
+public abstract class BaseActivity extends AppCompatActivity {
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(getLayout());
+        init();
+    }
+
+    protected abstract void init();
+
+    /**
+     * 设置布局文件
+     *
+     * @return
+     */
+    abstract int getLayout();
+
+}

+ 17 - 0
app/src/main/java/me/yoqi/android/jkbd/base/BaseFragment.java

@@ -0,0 +1,17 @@
+package me.yoqi.android.jkbd.base;
+
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
+/**
+ * @author liuyuqi.gov@msn.cn
+ * @date 4/5/2022
+ */
+public class BaseFragment extends Fragment {
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+}

+ 63 - 0
app/src/main/java/me/yoqi/android/jkbd/bean/Exam.java

@@ -0,0 +1,63 @@
+package me.yoqi.android.jkbd.bean;
+
+import java.io.Serializable;
+
+/**
+ * Created by LEO on 2017/6/28.
+ */
+
+public class Exam implements Serializable{
+
+    /**
+     * subjectTitle : c1
+     * uid : 1
+     * limitTime : 10
+     * questionCount : 100
+     */
+
+    private String subjectTitle;
+    private int uid;
+    private int limitTime;
+    private int questionCount;
+
+    public String getSubjectTitle() {
+        return subjectTitle;
+    }
+
+    public void setSubjectTitle(String subjectTitle) {
+        this.subjectTitle = subjectTitle;
+    }
+
+    public int getUid() {
+        return uid;
+    }
+
+    public void setUid(int uid) {
+        this.uid = uid;
+    }
+
+    public int getLimitTime() {
+        return limitTime;
+    }
+
+    public void setLimitTime(int limitTime) {
+        this.limitTime = limitTime;
+    }
+
+    public int getQuestionCount() {
+        return questionCount;
+    }
+
+    public void setQuestionCount(int questionCount) {
+        this.questionCount = questionCount;
+    }
+
+    @Override
+    public String toString() {
+        return "考试信息{" +
+                "考试科目='" + subjectTitle + '\'' +
+                ", 剩余时间=" + limitTime +
+                ", 考题数量=" + questionCount +
+                '}';
+    }
+}

+ 112 - 0
app/src/main/java/me/yoqi/android/jkbd/bean/Question.java

@@ -0,0 +1,112 @@
+package me.yoqi.android.jkbd.bean;
+
+/**
+ * Created by LEO on 2017/6/28.
+ */
+
+public final class Question {
+
+    /**
+     * id : 134
+     * question : 这个导向箭头是何含义?
+     * answer : 3
+     * item1 : 指示向左变道
+     * item2 : 指示前方直行
+     * item3 : 指示前方左转弯
+     * item4 : 指示前方右转弯
+     * explains : 请记住了哦,不难的吧
+     * url : http://images.juheapi.com/jztk/c1c2subject1/134.jpg
+     */
+
+    private int id;
+    private String question;
+    private String answer;
+    private String item1;
+    private String item2;
+    private String item3;
+    private String item4;
+    private String explains;
+    private String url;
+
+    private String userAnswer;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getQuestion() {
+        return question;
+    }
+
+    public void setQuestion(String question) {
+        this.question = question;
+    }
+
+    public String getAnswer() {
+        return answer;
+    }
+
+    public void setAnswer(String answer) {
+        this.answer = answer;
+    }
+
+    public String getItem1() {
+        return item1;
+    }
+
+    public void setItem1(String item1) {
+        this.item1 = item1;
+    }
+
+    public String getItem2() {
+        return item2;
+    }
+
+    public void setItem2(String item2) {
+        this.item2 = item2;
+    }
+
+    public String getItem3() {
+        return item3;
+    }
+
+    public void setItem3(String item3) {
+        this.item3 = item3;
+    }
+
+    public String getItem4() {
+        return item4;
+    }
+
+    public void setItem4(String item4) {
+        this.item4 = item4;
+    }
+
+    public String getExplains() {
+        return explains;
+    }
+
+    public void setExplains(String explains) {
+        this.explains = explains;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUserAnswer() {
+        return userAnswer;
+    }
+
+    public void setUserAnswer(String userAnswer) {
+        this.userAnswer = userAnswer;
+    }
+}

+ 38 - 0
app/src/main/java/me/yoqi/android/jkbd/bean/Result.java

@@ -0,0 +1,38 @@
+package me.yoqi.android.jkbd.bean;
+
+import java.util.List;
+
+/**
+ * Created by LEO on 2017/6/28.
+ */
+
+public class Result {
+    private int error_code;
+    private String reason;
+    private List<Question> result;
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public int getError_code() {
+        return error_code;
+    }
+
+    public void setError_code(int error_code) {
+        this.error_code = error_code;
+    }
+
+
+    public List<Question> getResult() {
+        return result;
+    }
+
+    public void setResult(List<Question> result) {
+        this.result = result;
+    }
+}

+ 85 - 0
app/src/main/java/me/yoqi/android/jkbd/biz/ExamBiz.java

@@ -0,0 +1,85 @@
+package me.yoqi.android.jkbd.biz;
+
+import java.util.List;
+
+import me.yoqi.android.jkbd.MyApp;
+import me.yoqi.android.jkbd.bean.Question;
+import me.yoqi.android.jkbd.dao.ExamDao;
+import me.yoqi.android.jkbd.dao.IExamDao;
+
+
+/**
+ * Created by LEO on 2017/6/30.
+ */
+
+public class ExamBiz implements IExamBiz {
+    IExamDao dao;
+
+    int index=0;
+    List<Question> questionList;
+
+    public ExamBiz() {
+        this.dao = new ExamDao();
+    }
+    @Override
+    public int getIndex() {
+        return index;
+    }
+
+    @Override
+    public void ExamStart() {
+        index=0;
+        dao.loadExamInfo();
+        dao.loadQuestionLists();
+    }
+
+    @Override
+    public void Pre() {
+        if(index>0){
+            index--;
+        }
+    }
+
+    @Override
+    public void Next() {
+        this.getQuestion();
+        if(index>=0&&index<questionList.size()-1){
+            index++;
+        }
+    }
+
+    @Override
+    public int commit() {
+        int score=0;
+        for(Question question:questionList){
+            String userAnswer=question.getUserAnswer();
+            if(userAnswer!=null&&!userAnswer.equals("")){
+                if(question.getAnswer().equals(userAnswer)){
+                    score++;
+                }
+            }
+        }
+
+        return score;
+    }
+
+
+    @Override
+    public Question getQuestion() {
+        questionList= MyApp.instance.getQuestionList();
+        if(questionList.get(index)!=null){
+            return questionList.get(index);
+        }
+        return null;
+    }
+
+    @Override
+    public Question getQuestion(int index) {
+        questionList=MyApp.instance.getQuestionList();
+        this.index=index;
+        if(questionList.get(this.index)!=null){
+            return questionList.get(this.index);
+        }
+        return null;
+    }
+}

+ 18 - 0
app/src/main/java/me/yoqi/android/jkbd/biz/IExamBiz.java

@@ -0,0 +1,18 @@
+package me.yoqi.android.jkbd.biz;
+
+
+import me.yoqi.android.jkbd.bean.Question;
+
+/**
+ * Created by LEO on 2017/6/30.
+ */
+
+public interface IExamBiz {
+    public void ExamStart();
+    public void Pre();
+    public void Next();
+    public int commit();
+    public Question getQuestion();
+    public Question getQuestion(int index);
+    public int getIndex();
+}

+ 85 - 0
app/src/main/java/me/yoqi/android/jkbd/dao/ExamDao.java

@@ -0,0 +1,85 @@
+package me.yoqi.android.jkbd.dao;
+
+import android.content.Intent;
+import android.util.Log;
+
+import java.util.List;
+
+import me.yoqi.android.jkbd.MyApp;
+import me.yoqi.android.jkbd.bean.Exam;
+import me.yoqi.android.jkbd.bean.Question;
+import me.yoqi.android.jkbd.bean.Result;
+import me.yoqi.android.jkbd.utils.OkHttpUtils;
+import me.yoqi.android.jkbd.utils.ResultUtils;
+
+
+/**
+ * Created by LEO on 2017/6/30.
+ */
+
+public class ExamDao implements IExamDao{
+    @Override
+    public void loadExamInfo() {
+        OkHttpUtils<Exam> utils=new OkHttpUtils<>(MyApp.getInstance());
+        String uri="http://101.251.196.90:8080/JztkServer/examInfo";
+        utils.url(uri)
+                .targetClass(Exam.class)
+                .execute(new OkHttpUtils.OnCompleteListener<Exam>(){
+
+                    @Override
+                    public void onSuccess(Exam exam) {
+
+                        Log.e("main","result=------"+exam);
+
+                        MyApp.getInstance().setExam(exam);
+
+                        MyApp.getInstance()
+                                .sendBroadcast(new Intent(MyApp.LOAD_EXAM)
+                                                    .putExtra(MyApp.LOAD_DATA_SUCCESS,true));
+                    }
+
+                    @Override
+                    public void onError(String error) {
+                        Log.e("main","error="+error);
+                        MyApp.getInstance()
+                                .sendBroadcast(new Intent(MyApp.LOAD_EXAM)
+                                        .putExtra(MyApp.LOAD_DATA_SUCCESS,false));
+                    }
+                });
+    }
+
+    @Override
+    public void loadQuestionLists() {
+        OkHttpUtils<String> utils=new OkHttpUtils<>(MyApp.getInstance());
+        String uri="http://101.251.196.90:8080/JztkServer/getQuestions?testType=rand";
+        utils.url(uri)
+                .targetClass(String.class)
+                .execute(new OkHttpUtils.OnCompleteListener<String>(){
+                    @Override
+                    public void onSuccess(String jsonStr) {
+                        boolean success=false;
+                        Result result= ResultUtils.getListResultFromJson(jsonStr);
+                        if(result!=null&&result.getError_code()==0){
+                            List<Question> list=result.getResult();
+                            if(list!=null&&list.size()>0){
+//                                mExamList=list;
+                                MyApp.getInstance().setQuestionList(list);
+                                success=true;
+                            }
+                        }
+                        MyApp.getInstance()
+                                .sendBroadcast(new Intent(MyApp.LOAD_QUESTION)
+                                        .putExtra(MyApp.LOAD_DATA_SUCCESS,success));
+                    }
+
+                    @Override
+                    public void onError(String error) {
+                        Log.e("main","error="+error);
+
+                        MyApp.getInstance()
+                                .sendBroadcast(new Intent(MyApp.LOAD_QUESTION)
+                                        .putExtra(MyApp.LOAD_DATA_SUCCESS,false));
+                    }
+                });
+    }
+}

+ 10 - 0
app/src/main/java/me/yoqi/android/jkbd/dao/IExamDao.java

@@ -0,0 +1,10 @@
+package me.yoqi.android.jkbd.dao;
+
+/**
+ * Created by LEO on 2017/6/30.
+ */
+
+public interface IExamDao {
+    public void loadExamInfo();
+    public void loadQuestionLists();
+}

+ 70 - 0
app/src/main/java/me/yoqi/android/jkbd/ui/MainActivity.java

@@ -0,0 +1,70 @@
+package me.yoqi.android.jkbd.ui;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import me.yoqi.android.jkbd.R;
+
+
+public class MainActivity extends AppCompatActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+    }
+
+    @Override
+    public void onBackPressed() {
+        Intent intent=new Intent();
+        setResult(RESULT_OK, intent);
+        finish();
+    }
+
+    public void test(View view) {
+//        OkHttpUtils<Exam> utils=new OkHttpUtils<>(this);
+//        String uri="http://101.251.196.90:8080/JztkServer/examInfo";
+//        utils.url(uri)
+//                .targetClass(Exam.class)
+//                .execute(new OkHttpUtils.OnCompleteListener<Exam>(){
+//
+//                    @Override
+//                    public void onSuccess(Exam exam) {
+//
+//                        Log.e("main","result="+exam);
+//                        Intent intent=new Intent(MainActivity.this,RandomTest.class);
+//
+//                        Bundle bundle = new Bundle();
+//                        bundle.putSerializable("exam",exam);
+//                        intent.putExtras(bundle);
+//                        startActivity(intent);
+//                    }
+//
+//                    @Override
+//                    public void onError(String error) {
+//                        Log.e("main","error="+error);
+//                    }
+//                });
+
+        Intent intent=new Intent(MainActivity.this,RandomTest.class);
+        startActivity(intent);
+
+    }
+
+    public void test_all(View view) {
+
+    }
+
+    public void setting(View view) {
+
+    }
+
+    public void quit(View view) {
+        Intent intent=new Intent();
+        setResult(RESULT_OK, intent);
+        finish();
+    }
+}

+ 485 - 0
app/src/main/java/me/yoqi/android/jkbd/ui/RandomTest.java

@@ -0,0 +1,485 @@
+package me.yoqi.android.jkbd.ui;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Gallery;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.ProgressBar;
+import android.widget.RadioButton;
+import android.widget.TextView;
+
+import com.squareup.picasso.Picasso;
+
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import me.yoqi.android.jkbd.R;
+import me.yoqi.android.jkbd.bean.Exam;
+import me.yoqi.android.jkbd.bean.Question;
+import me.yoqi.android.jkbd.biz.ExamBiz;
+import me.yoqi.android.jkbd.biz.IExamBiz;
+import me.yoqi.android.jkbd.view.QuestionAdapter;
+
+import static android.R.color.black;
+
+/**
+ * Created by LEO on 2017/6/29.
+ */
+
+public class RandomTest extends Activity {
+    @BindView(R.id.pb_loading) ProgressBar pb_loading;
+    @BindView(R.id.tv_loading) TextView tv_loading;
+    @BindView(R.id.ll_loading) LinearLayout linearLayout;
+    @BindView(R.id.subject) TextView subject;
+    @BindView(R.id.questionCount) TextView questionCount;
+    @BindView(R.id.limitTime) TextView limitTime;
+    @BindView(R.id.tv_time) TextView tv_time;
+    @BindView(R.id.tv_id) TextView tv_id;
+    @BindView(R.id.tv_question) TextView tv_question;
+    @BindView(R.id.img_pic) ImageButton img_pic;
+    @BindView(R.id.tv_A) TextView q1;
+    @BindView(R.id.tv_B) TextView q2;
+    @BindView(R.id.tv_C) TextView q3;
+    @BindView(R.id.ll_C) LinearLayout ll_C;
+    @BindView(R.id.tv_D) TextView q4;
+    @BindView(R.id.ll_D) LinearLayout ll_D;
+    @BindView(R.id.cb_A) RadioButton cb_A;
+    @BindView(R.id.cb_B) RadioButton cb_B;
+    @BindView(R.id.cb_C) RadioButton cb_C;
+    @BindView(R.id.cb_D) RadioButton cb_D;
+    @BindView(R.id.gallery) Gallery gallery;
+    private TextView[] tvOps=new TextView[4];
+    private RadioButton[] rb = new RadioButton[4];
+    private QuestionAdapter questionAdapter;
+//    private TextView subject, limitTime, questionCount, tv_loading;
+//    private TextView tv_id, tv_question, q1, q2, q3, q4, tv_time;
+//    private ImageButton img_pic;
+//    private LinearLayout linearLayout, ll_C, ll_D;
+//    private ProgressBar pb_loading;
+//    private RadioButton cb_A, cb_B, cb_C, cb_D;
+//    private RadioButton[] rb = new RadioButton[4];
+//    private Gallery gallery;
+//    private QuestionAdapter questionAdapter;
+
+    Exam exam;
+    Question question;
+    List<Question> questionList;
+
+    IExamBiz iExamBiz;
+
+    boolean isExam = false;
+    boolean isQustion = false;
+
+    boolean isExamReceiver = false;
+    boolean isQustionReceiver = false;
+
+    LoadExamBroadcast loadExamBroadcast;
+    LoadQuestionBroadcast loadQuestionBroadcast;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_random);
+        ButterKnife.bind(this);
+
+        loadExamBroadcast = new LoadExamBroadcast();
+        loadQuestionBroadcast = new LoadQuestionBroadcast();
+        setListener();
+
+        initView();
+
+        iExamBiz = new ExamBiz();
+        loadData();
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        if (loadExamBroadcast != null) {
+            unregisterReceiver(loadExamBroadcast);
+        }
+        if (loadQuestionBroadcast != null) {
+            unregisterReceiver(loadQuestionBroadcast);
+        }
+    }
+
+    private void setListener() {
+        registerReceiver(loadExamBroadcast, new IntentFilter(ExamApplication.LOAD_EXAM));
+        registerReceiver(loadQuestionBroadcast, new IntentFilter(ExamApplication.LOAD_QUESTION));
+    }
+
+    private void loadData() {
+        linearLayout.setEnabled(false);
+        pb_loading.setVisibility(View.VISIBLE);
+        tv_loading.setText("Loading...");
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                iExamBiz.ExamStart();
+            }
+        }).start();
+    }
+
+    private void initData() {
+        if (isExamReceiver && isQustionReceiver) {
+            if (isExam && isQustion) {
+                linearLayout.setVisibility(View.GONE);
+
+                exam = ExamApplication.getInstance().getExam();
+                if (exam != null) {
+                    subject.setText("" + exam.getSubjectTitle());
+                    limitTime.setText("" + exam.getLimitTime());
+                    questionCount.setText("" + exam.getQuestionCount());
+                    initGallery();
+                    initTimer(exam);
+                } else {
+                    Log.e("exam", "exam为空!");
+                }
+
+                question = iExamBiz.getQuestion();
+                if (question != null) {
+                    tv_id.setText(iExamBiz.getIndex() + 1 + ".");
+                    tv_question.setText("" + question.getQuestion());
+                    q1.setText("" + question.getItem1());
+                    q2.setText("" + question.getItem2());
+                    q3.setText("" + question.getItem3());
+                    q4.setText("" + question.getItem4());
+
+                    ll_C.setVisibility(question.getItem3().equals("") ? View.GONE : View.VISIBLE);
+                    ll_D.setVisibility(question.getItem4().equals("") ? View.GONE : View.VISIBLE);
+                    cb_C.setVisibility(question.getItem3().equals("") ? View.GONE : View.VISIBLE);
+                    cb_D.setVisibility(question.getItem4().equals("") ? View.GONE : View.VISIBLE);
+
+                    if (question.getUrl() != null && !question.getUrl().equals("")) {
+                        img_pic.setVisibility(View.VISIBLE);
+                        Picasso.with(this).load(question.getUrl()).into(img_pic);
+                    } else {
+                        img_pic.setVisibility(View.GONE);
+                    }
+
+                    initRadioButton();
+
+                    String userAnswer = question.getUserAnswer();
+                    if (userAnswer != null && !userAnswer.equals("")) {
+                        int a = Integer.parseInt(userAnswer) - 1;
+                        rb[a].setChecked(true);
+                    }
+
+                } else {
+                    Log.e("onCreate:question", "questionList为空!");
+                }
+            } else {
+                linearLayout.setEnabled(true);
+                pb_loading.setVisibility(View.GONE);
+                tv_loading.setText("加载失败,点击屏幕重新加载!");
+
+                linearLayout.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        loadData();
+                    }
+                });
+            }
+        }
+
+    }
+
+    private void initGallery() {
+        questionAdapter = new QuestionAdapter(this);
+        gallery.setAdapter(questionAdapter);
+        gallery.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                Log.e("gallery", "gallery item position=" + position);
+                setUserAnswer();
+                iExamBiz.getQuestion(position);
+                initExam();
+                initQuestion();
+            }
+        });
+    }
+
+    private void initExam() {
+        exam = ExamApplication.getInstance().getExam();
+        if (exam != null) {
+            subject.setText("" + exam.getSubjectTitle());
+            limitTime.setText("" + exam.getLimitTime());
+            questionCount.setText("" + exam.getQuestionCount());
+        } else {
+            Log.e("initExam:exam", "exam为空!");
+        }
+    }
+
+    private void initQuestion() {
+        question = iExamBiz.getQuestion();
+        if (question != null) {
+            tv_id.setText(iExamBiz.getIndex() + 1 + ".");
+            tv_question.setText("" + question.getQuestion());
+            q1.setText("" + question.getItem1());
+            q2.setText("" + question.getItem2());
+            q3.setText("" + question.getItem3());
+            q4.setText("" + question.getItem4());
+
+            ll_C.setVisibility(question.getItem3().equals("") ? View.GONE : View.VISIBLE);
+            ll_D.setVisibility(question.getItem4().equals("") ? View.GONE : View.VISIBLE);
+            cb_C.setVisibility(question.getItem3().equals("") ? View.GONE : View.VISIBLE);
+            cb_D.setVisibility(question.getItem4().equals("") ? View.GONE : View.VISIBLE);
+
+            if (question.getUrl() != null && !question.getUrl().equals("")) {
+                img_pic.setVisibility(View.VISIBLE);
+                Picasso.with(this).load(question.getUrl()).into(img_pic);
+            } else {
+                img_pic.setVisibility(View.GONE);
+            }
+
+            initRadioButton();
+
+            String userAnswer = question.getUserAnswer();
+            if (userAnswer != null && !userAnswer.equals("")) {
+                int a = Integer.parseInt(userAnswer) - 1;
+                rb[a].setChecked(true);
+                setRadioButtonEnable(false);
+                setAnswerTextColor(question.getAnswer(),userAnswer);
+            } else {
+                setRadioButtonEnable(true);
+                setOpsColor();
+            }
+
+
+        } else {
+            Log.e("initQuestion:question", "questionList为空!");
+        }
+    }
+
+    private void setOpsColor() {
+        for (int i = 0; i < tvOps.length; i++) {
+            tvOps[i].setTextColor(getResources().getColor(black));
+        }
+    }
+
+    private void setAnswerTextColor(String answer, String userAnswer) {
+        int ra=Integer.parseInt(answer)-1;
+        for (int i = 0; i < tvOps.length; i++) {
+            if(i==ra){
+                tvOps[i].setTextColor(getResources().getColor(R.color.green));
+            }else{
+                if(!userAnswer.equals(answer)){
+                    int ua=Integer.parseInt(userAnswer)-1;
+                    if(i==ua){
+                        tvOps[i].setTextColor(getResources().getColor(R.color.red));
+                    }else{
+                        tvOps[i].setTextColor(getResources().getColor(black));
+                    }
+                }
+            }
+        }
+    }
+
+    private void initTimer(Exam exam) {
+        int sumTime = exam.getLimitTime() * 60 * 1000;
+//        int sumTime=1*60*1000;
+
+        final long overTime = sumTime + System.currentTimeMillis();
+        final Timer timer = new Timer();
+        timer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                long l = overTime - System.currentTimeMillis();
+                final long min = l / 1000 / 60;
+                final long sec = l / 1000 % 60;
+                runOnUiThread(new Runnable() {
+                    @Override
+                    public void run() {
+                        tv_time.setText("剩余时间:" + min + "分" + sec + "秒");
+                    }
+                });
+            }
+        }, 0, 1000);
+
+        timer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                timer.cancel();
+                runOnUiThread(new Runnable() {
+                    @Override
+                    public void run() {
+                        commit(null);
+                    }
+                });
+            }
+        }, sumTime);
+
+    }
+
+
+    private void initView() {
+//        subject = (TextView) findViewById(R.id.subject);
+//        limitTime = (TextView) findViewById(R.id.limitTime);
+//        questionCount = (TextView) findViewById(R.id.questionCount);
+
+//        tv_id = (TextView) findViewById(R.id.tv_id);
+//        tv_question = (TextView) findViewById(R.id.tv_question);
+//        q1 = (TextView) findViewById(R.id.tv_A);
+//        q2 = (TextView) findViewById(R.id.tv_B);
+//        q3 = (TextView) findViewById(R.id.tv_C);
+//        q4 = (TextView) findViewById(R.id.tv_D);
+//        tv_time = (TextView) findViewById(R.id.tv_time);
+//        img_pic = (ImageButton) findViewById(R.id.img_pic);
+
+//        linearLayout = (LinearLayout) findViewById(R.id.ll_loading);
+//        tv_loading = (TextView) findViewById(R.id.tv_loading);
+//        pb_loading = (ProgressBar) findViewById(R.id.pb_loading);
+
+//        ll_C = (LinearLayout) findViewById(R.id.ll_C);
+//        ll_D = (LinearLayout) findViewById(R.id.ll_D);
+
+//        cb_A = (RadioButton) findViewById(R.id.cb_A);
+//        cb_B = (RadioButton) findViewById(R.id.cb_B);
+//        cb_C = (RadioButton) findViewById(R.id.cb_C);
+//        cb_D = (RadioButton) findViewById(R.id.cb_D);
+        rb[0] = cb_A;
+        rb[1] = cb_B;
+        rb[2] = cb_C;
+        rb[3] = cb_D;
+        tvOps[0]=q1;
+        tvOps[1]=q2;
+        tvOps[2]=q3;
+        tvOps[3]=q4;
+
+//        gallery = (Gallery) findViewById(R.id.gallery);
+
+        cb_A.setOnClickListener(listener);
+        cb_B.setOnClickListener(listener);
+        cb_C.setOnClickListener(listener);
+        cb_D.setOnClickListener(listener);
+    }
+
+    View.OnClickListener listener = new View.OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            v.getId();
+            for (int i = 0; i < 4; i++) {
+                if (rb[i].getId() != v.getId()) {
+                    rb[i].setChecked(false);
+                }
+            }
+        }
+    };
+
+
+    public void pre(View view) {
+        setUserAnswer();
+        iExamBiz.Pre();
+        //initData();
+        initExam();
+        initQuestion();
+    }
+
+    public void next(View view) {
+        setUserAnswer();
+        iExamBiz.Next();
+        //initData();
+        initExam();
+        initQuestion();
+    }
+
+    public void initRadioButton() {
+        cb_A.setChecked(false);
+        cb_B.setChecked(false);
+        cb_C.setChecked(false);
+        cb_D.setChecked(false);
+    }
+
+    public void setUserAnswer() {
+
+        for (int i = 0; i < rb.length; i++) {
+            if (rb[i].isChecked()) {
+                iExamBiz.getQuestion().setUserAnswer(String.valueOf(i + 1));
+                questionAdapter.notifyDataSetChanged();
+                return;
+            }
+        }
+        iExamBiz.getQuestion().setUserAnswer("");
+        questionAdapter.notifyDataSetChanged();
+    }
+
+    public void setRadioButtonEnable(boolean b) {
+        for (int i = 0; i < rb.length; i++) {
+            rb[i].setEnabled(b);
+        }
+    }
+
+    public void commit(View view){
+        AlertDialog.Builder builder=new AlertDialog.Builder(this);
+        builder.setTitle("交卷")
+                .setMessage("你还有剩余时间,确认交卷么?")
+                .setPositiveButton("确认", new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        commit();
+                    }
+                })
+                .setNegativeButton("取消",null);
+        builder.create().show();
+    }
+
+    public void commit() {
+        setUserAnswer();
+        int score = iExamBiz.commit();
+        View inflate = View.inflate(this, R.layout.layout_result, null);
+        TextView tvResult = (TextView) inflate.findViewById(R.id.tv_result);
+        tvResult.setText("你的分数为\n" + score + "分!");
+
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        builder.setIcon(R.mipmap.exam_commit32x32)
+                .setTitle("交卷")
+                .setView(inflate)
+                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        finish();
+                    }
+                });
+        builder.setCancelable(false);
+        builder.create().show();
+    }
+
+    class LoadExamBroadcast extends BroadcastReceiver {
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            boolean isSuccess = intent.getBooleanExtra(ExamApplication.LOAD_DATA_SUCCESS, false);
+            if (isSuccess) {
+                isExam = true;
+            }
+            isExamReceiver = true;
+            initData();
+        }
+    }
+
+    class LoadQuestionBroadcast extends BroadcastReceiver {
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            boolean isSuccess = intent.getBooleanExtra(ExamApplication.LOAD_DATA_SUCCESS, false);
+            if (isSuccess) {
+                isQustion = true;
+            }
+            isQustionReceiver = true;
+            initData();
+        }
+    }
+}

+ 50 - 0
app/src/main/java/me/yoqi/android/jkbd/ui/SplashActivity.java

@@ -0,0 +1,50 @@
+package me.yoqi.android.jkbd.ui;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.CountDownTimer;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import me.yoqi.android.jkbd.R;
+
+/**
+ * Created by clawpo on 2017/6/27.
+ */
+
+public class SplashActivity extends AppCompatActivity {
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_splash);
+        mCountDownTimer.start();
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        switch (requestCode) {
+            case 1:
+                if (resultCode == RESULT_OK) {
+                    finish();
+                }
+                break;
+            default:
+        }
+    }
+
+    CountDownTimer mCountDownTimer  = new CountDownTimer(2000,1000) {
+        @Override
+        public void onTick(long millisUntilFinished) {
+
+        }
+
+        @Override
+        public void onFinish() {
+            Intent intent = new Intent(SplashActivity.this, MainActivity.class);
+            //startActivity(intent);
+            startActivityForResult(intent, 1);
+        }
+    };
+}

+ 497 - 0
app/src/main/java/me/yoqi/android/jkbd/utils/OkHttpUtils.java

@@ -0,0 +1,497 @@
+package me.yoqi.android.jkbd.utils;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+import com.google.gson.Gson;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.FileNameMap;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import okhttp3.Cache;
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.FormBody;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+
+/**
+ * Created by yao on 2016/9/16.
+ *
+ */
+public class OkHttpUtils<T> {
+    private static String UTF_8 = "utf-8";
+    public static final int RESULT_SUCCESS = 0;
+    public static final int RESULT_ERROR = 1;
+    public static final int DOWNLOAD_START=2;
+    public static final int DOWNLOADING=3;
+    public static final int DOWNLOAD_FINISH=4;
+
+    private static OkHttpClient mOkHttpClient;
+    private Handler mHandler;
+
+    private String SERVER_ROOT;
+    private Context mContext;
+
+    public void setSERVER_ROOT(String SERVER_ROOT) {
+        this.SERVER_ROOT = SERVER_ROOT;
+    }
+
+    public void setContext(Context context) {
+        mContext = context;
+    }
+
+    /**
+     * 存放post请求的实体,实体中存放File类型的文件
+     */
+    RequestBody mFileBody;
+    FormBody.Builder mFormBodyBuilder;
+    MultipartBody.Builder mMultipartBodyBuilder;
+
+    public interface OnCompleteListener<T> {
+        void onSuccess(T result);
+
+        void onError(String error);
+    }
+
+    private OnCompleteListener<T> mListener;
+
+    OkHttpClient.Builder mBuilder;
+    /**
+     * 构造器,mOkHttpClient必须单例,无论创建多少个OkHttpUtils的实例。
+     * 都由mOkHttpClient一个对象处理所有的网络请求。
+     */
+    public OkHttpUtils(Context context) {
+        mContext = context;
+        if (mOkHttpClient == null) {//线程安全的单例
+            synchronized (OkHttpUtils.class) {
+                if (mOkHttpClient == null) {
+                    mBuilder = new OkHttpClient.Builder();
+                    //获取sd卡的缓存文件夹
+                    File cacheDir = context.getExternalCacheDir();
+                    mOkHttpClient = mBuilder
+                            .connectTimeout(10, TimeUnit.SECONDS)
+                            .writeTimeout(20,TimeUnit.SECONDS)
+                            .readTimeout(10,TimeUnit.SECONDS)
+                            .cache(new Cache(cacheDir,10*(1<<20)))//设置缓存位置和缓存大小
+                            .build();
+                }
+            }
+        }
+        initHandler();
+    }
+
+    /**
+     * 设置与服务端连接的时限
+     * @param connectTime:连接的时限
+     * @return
+     */
+    public OkHttpUtils<T> connectTimeout(int connectTime) {
+        if (mBuilder == null) {
+            return this;
+        }
+        mBuilder.connectTimeout(connectTime, TimeUnit.SECONDS);
+        return this;
+    }
+
+    /**
+     * 设置写数据的时限
+     * @param writeTimeout:写数据的时限
+     * @return
+     */
+    public OkHttpUtils<T> writeTimeout(int writeTimeout) {
+        if (mBuilder == null) {
+            return this;
+        }
+        mBuilder.writeTimeout(writeTimeout, TimeUnit.SECONDS);
+        return this;
+    }
+
+    /**
+     * 设置读取数据的时限
+     * @param readTimeout:读取数据的时限
+     * @return
+     */
+    public OkHttpUtils<T> readTimeout(int readTimeout) {
+        if (mBuilder == null) {
+            return this;
+        }
+        mBuilder.readTimeout(readTimeout, TimeUnit.SECONDS);
+        return this;
+    }
+
+    /**
+     * 设置缓存
+     * 第一次请求会请求网络得到数据,第二次以及后面的请求则会从缓存中取出数据
+     * @param file:缓存的路径
+     * @param fileSize:缓存的容量
+     * @return
+     */
+    public OkHttpUtils<T> cache(File file, int fileSize) {
+        if (mBuilder == null) {
+            return this;
+        }
+        mBuilder.cache(new Cache(file, fileSize));
+        return this;
+    }
+
+
+    private void initHandler() {
+        mHandler = new Handler(mContext.getMainLooper()) {
+            @Override
+            public void handleMessage(Message msg) {
+                switch (msg.what) {
+                    case RESULT_ERROR:
+                        mListener.onError(msg.obj==null?msg.toString():msg.obj.toString());
+                        break;
+                    case RESULT_SUCCESS:
+                        T result = (T) msg.obj;
+                        mListener.onSuccess(result);
+                        break;
+                }
+            }
+        };
+    }
+
+    /**
+     * 用post请求,添加一个文件
+     * @param file:添加至form的文件
+     * @return
+     */
+    public OkHttpUtils<T> addFile(File file) {
+        mFileBody = RequestBody.create(null, file);
+        return this;
+    }
+
+    /**
+     * 支持设置媒体文件类型的addFile
+     * @param type:媒体类型
+     * @param file:添加至form的文件
+     * @return
+     */
+    public OkHttpUtils<T> addFile(String type, File file) {
+        mFileBody = RequestBody.create(MediaType.parse(type), file);
+        return this;
+    }
+
+    public OkHttpUtils<T> addFile2(File file) {
+        if (mUrl == null) {
+            return this;
+        }
+        RequestBody fileBody = RequestBody.create(MediaType.parse(guessMimeType(file.getName())), file);
+        mFileBody = new MultipartBody.Builder().addFormDataPart("filename", file.getName(), fileBody).build();
+        return this;
+    }
+    private String guessMimeType(String path) {
+        FileNameMap fileNameMap = URLConnection.getFileNameMap();
+        String contentTypeFor = fileNameMap.getContentTypeFor(path);
+        if (contentTypeFor == null)
+        {
+            contentTypeFor = "application/octet-stream";
+        }
+        return contentTypeFor;
+    }
+
+    /**
+     * 设置为post的请求
+     * @return
+     */
+    public OkHttpUtils<T> post() {
+        mFormBodyBuilder = new FormBody.Builder();
+        return this;
+    }
+
+    StringBuilder mUrl;
+
+    public OkHttpUtils<T> url(String url) {
+        mUrl = new StringBuilder(url);
+        return this;
+    }
+
+    public OkHttpUtils<T> setRequestUrl(String request) {
+        //http://101.251.196.90:8080/JztkServer/examInfo
+        //http://120.26.242.249:8080/SuperWeChatServerV2.0/register?m_user_name=aaaaaa&m_user_nick=aaaaaa&m_user_password=aaaaaa
+        mUrl = new StringBuilder(SERVER_ROOT);
+        mUrl.append(request);
+//        Log.e("okhttp","1 murl="+ mUrl.toString());
+        return this;
+    }
+
+    /**
+     * 用于json解析的类对象
+     */
+    Class<T> mClazz;
+
+    /**
+     * 设置json解析的目标类对象
+     * @param clazz:解析的类对象
+     * @return
+     */
+    public OkHttpUtils<T> targetClass(Class<T> clazz) {
+        mClazz = clazz;
+        return this;
+    }
+
+    /**
+     * 添加请求参数至url,包括GET和POST请求
+     * 不包括POST请求中上传文件的同时向Form中添加其它参数的情况
+     * @param key:键
+     * @param value:值
+     */
+    public OkHttpUtils<T> addParam(String key, String value) {
+        try {
+            //post请求的request参数也要拼接到url中
+            if (mFormBodyBuilder != null) {//post请求的参数添加方式
+                mFormBodyBuilder.add(key, URLEncoder.encode(value, UTF_8));
+            } else {//get请求的参数添加方式
+                if (mUrl.indexOf("?") == -1) {
+                    mUrl.append("?");
+                } else {
+                    mUrl.append("&");
+                }
+                mUrl.append(key).append("=").append(URLEncoder.encode(value, UTF_8));
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        return this;
+    }
+
+    /**
+     * * post请求,上传文件的同时允许在Form中添加多个参数
+     * @param key:参数的键
+     * @param value:参数的值
+     * @return
+     */
+    public OkHttpUtils<T> addFormParam(String key, String value) {
+        if (mMultipartBodyBuilder == null) {
+            mMultipartBodyBuilder =new MultipartBody.Builder();
+            mMultipartBodyBuilder.setType(MultipartBody.FORM);
+            try {
+                mUrl.append("?")
+                        .append(key)
+                        .append("=")
+                        .append(URLEncoder.encode(value, UTF_8));
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+        }else if (mUrl.indexOf("?") > -1) {
+            mMultipartBodyBuilder.addFormDataPart(key, value);
+        }
+        return this;
+    }
+
+    /**
+     * post请求中在Form中添加包含上传文件的多个参数
+     * @param name:文件的大类型
+     * @param fileName:文件名包括扩展名
+     * @param mediaType:文件的媒体类型
+     * @param file:文件
+     * @return
+     */
+    public OkHttpUtils<T> addFormParam(String name, String fileName, String mediaType, File file) {
+        if (mMultipartBodyBuilder == null) {
+            return this;
+        }
+        mMultipartBodyBuilder.addFormDataPart(name, fileName, RequestBody.create(MediaType.parse(mediaType), file));
+        return this;
+    }
+
+    /**
+     * 发送请求
+     * @param listener:处理服务端返回结果的代码
+     */
+    public void execute(OnCompleteListener<T> listener) {
+        if (listener != null) {
+            mListener = listener;
+        }
+        Request.Builder builder = new Request.Builder().url(mUrl.toString());
+        Log.e("OKHttp","url="+mUrl);
+        if (mFormBodyBuilder != null) {
+            RequestBody body = mFormBodyBuilder.build();
+            builder.post(body);
+        }
+        if (mFileBody != null) {
+            builder.post(mFileBody);
+        }
+        //如果是post请求向Form中添加多个参数
+        if (mMultipartBodyBuilder != null) {
+            MultipartBody multipartBody = mMultipartBodyBuilder.build();
+            builder.post(multipartBody);
+        }
+        //创建请求
+        Request request = builder.build();
+        Call call = mOkHttpClient.newCall(request);
+        if (mCallback != null) {
+            call.enqueue(mCallback);
+            return;
+        }
+        call.enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+                Message msg = Message.obtain();
+                msg.what = RESULT_ERROR;
+                msg.obj = e.getMessage();
+                mHandler.sendMessage(msg);
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) throws IOException {
+                String json = response.body().string();
+                if (mClazz==null){
+                    targetClass((Class<T>) String.class);
+                }
+                if(mClazz.equals(String.class)){
+                    Message msg = Message.obtain();
+                    msg.what = RESULT_SUCCESS;
+                    msg.obj = json;
+                    mHandler.sendMessage(msg);
+                }else {
+                    Gson gson = new Gson();
+                    T value = gson.fromJson(json, mClazz);
+                    Message msg = Message.obtain();
+                    msg.what = RESULT_SUCCESS;
+                    msg.obj = value;
+                    mHandler.sendMessage(msg);
+                }
+            }
+        });
+    }
+
+    Callback mCallback;
+    /**
+     * 在OkHttp创建的工作线程中执行一段代码,
+     * @param callback
+     * @return
+     */
+    public OkHttpUtils<T> doInBackground(Callback callback) {
+        mCallback=callback;
+        return this;
+    }
+
+    /**
+     * 在主线程中执行的代码,doInBackground方法之后调用
+     * @param listener
+     * @return
+     */
+    public OkHttpUtils<T> onPostExecute(OnCompleteListener<T> listener) {
+        mListener=listener;
+        return this;
+    }
+
+    /**doInBackground()之前在主线程中执行的方法,类似与AsyncTask中的onPreExecute()
+     * @param r:运行的代码
+     * @return
+     */
+    public OkHttpUtils<T> onPreExecute(Runnable r) {
+        r.run();
+        return this;
+    }
+
+    /**
+     * 工作线程向主线程发送消息
+     * @param msg
+     */
+    public void sendMessage(Message msg) {
+        mHandler.sendMessage(msg);
+    }
+
+    /**
+     * 重载的sendMessage方法,用于发送空消息
+     * @param what
+     */
+    public void sendMessage(int what) {
+        mHandler.sendEmptyMessage(what);
+    }
+
+    public <T> T parseJson(String json, Class<?> clazz) {
+        Gson gson=new Gson();
+        T t = (T) gson.fromJson(json, clazz);
+        return t;
+    }
+
+    /**
+     * 专门针对Result类的json解析方法,不具有通用性,属性定制、专用的方法
+     * @param result
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+//    public <T> T parseJson(Result result, Class<?> clazz) {
+//        if (result.getRetCode() == 0) {
+//            String json = result.getRetData().toString();
+//            T t = parseJson(json, clazz);
+//            return t;
+//        }
+//        return null;
+//    }
+
+    /**
+     * 下载文件,支持更新下载进度
+     * @param response:服务端返回的响应类对象
+     * @param file:保存下载文件的File
+     * @throws Exception:IO异常
+     */
+    public void downloadFile(Response response, File file) throws Exception {
+        FileOutputStream out = new FileOutputStream(file);
+
+        InputStream in = response.body().byteStream();
+        int len;
+        byte[] buffer = new byte[1024 * 5];
+        //获取文件的字节数
+        long fileSize = response.body().contentLength();
+        int  total=0;//累加下载的字节数
+        int percent=1;//下载的预期百分比
+        int currentPer;//当前下载的百分比
+        mHandler.sendEmptyMessage(DOWNLOAD_START);
+        while ((len=in.read(buffer)) != -1) {
+            out.write(buffer,0,len);
+            total+=len;
+            //计算下载的百分比
+            currentPer= (int) (total*100L/fileSize);
+            if (currentPer >= percent) {
+                Message msg = Message.obtain();
+                msg.what= OkHttpUtils.DOWNLOADING;
+                msg.arg1=percent;
+                sendMessage(msg);
+                percent=currentPer+1;
+            }
+        }
+        sendMessage(OkHttpUtils.DOWNLOAD_FINISH);
+    }
+
+    public <T>  ArrayList<T> array2List(T[] array) {
+        List<T> list = Arrays.asList(array);
+        ArrayList<T> arrayList = new ArrayList<>(list);
+        return arrayList;
+    }
+
+    /**
+     * 释放mClient的资源
+     */
+    public static void release() {
+        if (mOkHttpClient != null) {
+            //取消所有请求
+            mOkHttpClient.dispatcher().cancelAll();
+            mOkHttpClient=null;
+        }
+    }
+
+}

+ 67 - 0
app/src/main/java/me/yoqi/android/jkbd/utils/ResultUtils.java

@@ -0,0 +1,67 @@
+package me.yoqi.android.jkbd.utils;
+
+import android.util.Log;
+
+import com.google.gson.Gson;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import me.yoqi.android.jkbd.bean.Question;
+import me.yoqi.android.jkbd.bean.Result;
+
+
+public class ResultUtils {
+    static String UTF_8 = "utf-8";
+    public static Result getListResultFromJson(String jsonStr){
+        Result result = new Result();
+        Log.e("Utils","jsonStr="+jsonStr);
+        try {
+            if(jsonStr==null || jsonStr.isEmpty() || jsonStr.length()<3)return null;
+            JSONObject jsonObject = new JSONObject(jsonStr);
+            if(!jsonObject.isNull("error_code")) {
+                result.setError_code(jsonObject.getInt("error_code"));
+            }else if(!jsonObject.isNull("msg")){
+                result.setError_code(jsonObject.getInt("msg"));
+            }
+            if(!jsonObject.isNull("reason")) {
+                result.setReason(jsonObject.getString("reason"));
+            }else if(!jsonObject.isNull("result")){
+                result.setReason(jsonObject.getString("result"));
+            }
+            if(!jsonObject.isNull("result")) {
+                JSONArray array = jsonObject.getJSONArray("result");
+                if (array != null) {
+                    List<Question> list = new ArrayList<Question>();
+                    for (int i = 0; i < array.length(); i++) {
+                        JSONObject jsonGroupAvatar = array.getJSONObject(i);
+                        Question ga = new Gson().fromJson(jsonGroupAvatar.toString(), Question.class);
+                        list.add(ga);
+                    }
+                    result.setResult(list);
+                    return result;
+                }
+            }else{
+                JSONArray array = new JSONArray(jsonStr);
+                if (array != null) {
+                    List<Question> list = new ArrayList<Question>();
+                    for (int i = 0; i < array.length(); i++) {
+                        JSONObject jsonGroupAvatar = array.getJSONObject(i);
+                        Question ga = new Gson().fromJson(jsonGroupAvatar.toString(), Question.class);
+                        list.add(ga);
+                    }
+                    result.setResult(list);
+                    return result;
+                }
+            }
+            return result;
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return  null;
+    }
+
+}

+ 59 - 0
app/src/main/java/me/yoqi/android/jkbd/view/QuestionAdapter.java

@@ -0,0 +1,59 @@
+package me.yoqi.android.jkbd.view;
+
+import android.content.Context;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.util.List;
+import me.yoqi.android.jkbd.MyApp;
+import me.yoqi.android.jkbd.R;
+import me.yoqi.android.jkbd.bean.Question;
+
+/**
+ * Created by LEO on 2017/7/4.
+ */
+
+public class QuestionAdapter extends BaseAdapter {
+    Context mContext;
+    List<Question> questionList;
+
+    public QuestionAdapter(Context mContext) {
+        this.mContext = mContext;
+        questionList= MyApp.getInstance().getQuestionList();
+    }
+
+    @Override
+    public int getCount() {
+        return (questionList!=null)?questionList.size():0;
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return null;
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return 0;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        View view=View.inflate(mContext, R.layout.item_question,null);
+        ImageView imv_question= (ImageView) view.findViewById(R.id.imv_question);
+        TextView tv_no= (TextView) view.findViewById(R.id.tv_no);
+        String ua=questionList.get(position).getUserAnswer();
+        String ra=questionList.get(position).getAnswer();
+        if(ua!=null&&!ua.equals("")){
+            imv_question.setImageResource(ua.equals(ra)?R.mipmap.answer24x24:R.mipmap.error_24px);
+            //imv_question.setImageResource(R.mipmap.answer24x24);
+        }else{
+            imv_question.setImageResource(R.mipmap.noselected);
+        }
+        tv_no.setText("第"+(position+1)+"题");
+        return view;
+    }
+}

+ 30 - 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml

@@ -0,0 +1,30 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:aapt="http://schemas.android.com/aapt"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
+        <aapt:attr name="android:fillColor">
+            <gradient
+                android:endX="85.84757"
+                android:endY="92.4963"
+                android:startX="42.9492"
+                android:startY="49.59793"
+                android:type="linear">
+                <item
+                    android:color="#44000000"
+                    android:offset="0.0" />
+                <item
+                    android:color="#00000000"
+                    android:offset="1.0" />
+            </gradient>
+        </aapt:attr>
+    </path>
+    <path
+        android:fillColor="#FFFFFF"
+        android:fillType="nonZero"
+        android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
+        android:strokeWidth="1"
+        android:strokeColor="#00000000" />
+</vector>

+ 170 - 0
app/src/main/res/drawable/ic_launcher_background.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillColor="#3DDC84"
+        android:pathData="M0,0h108v108h-108z" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M9,0L9,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,0L19,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,0L29,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,0L39,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,0L49,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,0L59,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,0L69,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,0L79,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M89,0L89,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M99,0L99,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,9L108,9"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,19L108,19"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,29L108,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,39L108,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,49L108,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,59L108,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,69L108,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,79L108,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,89L108,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,99L108,99"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,29L89,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,39L89,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,49L89,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,59L89,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,69L89,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,79L89,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,19L29,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,19L39,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,19L49,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,19L59,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,19L69,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,19L79,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+</vector>

+ 58 - 0
app/src/main/res/layout/activity_main.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@mipmap/main">
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="horizontal"
+        android:gravity="center">
+        <Button
+            android:onClick="test"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:drawableTop="@mipmap/main_menu_exam"
+            android:text="随机测试"
+            android:background="@null"/>
+        <Button
+            android:onClick="test_all"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:drawableTop="@mipmap/main_menu_result"
+            android:text="全部测试"
+            android:background="@null"/>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="horizontal">
+        <Button
+            android:onClick="setting"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:drawableTop="@mipmap/main_menu_message"
+            android:background="@null"
+            android:text="设置"/>
+        <Button
+            android:onClick="quit"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:drawableTop="@mipmap/main_menu_exit"
+            android:background="@null"
+            android:text="退出"/>
+    </LinearLayout>
+
+
+</LinearLayout>

+ 323 - 0
app/src/main/res/layout/activity_random.xml

@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@mipmap/main">
+
+    <LinearLayout
+        android:id="@+id/ll_loading"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:gravity="center">
+        <ProgressBar
+            android:id="@+id/pb_loading"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            />
+        <TextView
+            android:id="@+id/tv_loading"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Loading..."/>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_weight="1.5"
+        android:orientation="vertical"
+        android:gravity="center_horizontal">
+
+        <ImageButton
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@mipmap/exam_title"
+            android:background="@null"/>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="left"
+                android:layout_marginLeft="20dp"
+                android:text="考试科目:"/>
+            <TextView
+                android:id="@+id/subject"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="left"
+                tools:text="c1"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="left"
+                android:layout_marginLeft="20dp"
+                android:text="考试数量:"/>
+
+
+            <TextView
+                android:id="@+id/questionCount"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="left"
+                tools:text="100" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="left"
+                android:layout_marginLeft="20dp"
+                android:text="考试时间:"/>
+            <TextView
+                android:id="@+id/limitTime"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="left"
+                tools:text="10分钟"/>
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/tv_time"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="剩余时间:9分16秒"/>
+
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="#000"
+            android:layout_marginLeft="5dp"/>
+
+    </LinearLayout>
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_weight="1">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:orientation="vertical"
+            android:gravity="center_horizontal">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+                <TextView
+                    android:id="@+id/tv_id"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    android:layout_marginLeft="20dp"
+                    tools:text="1."/>
+                <TextView
+                    android:id="@+id/tv_question"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    tools:text="这个标题是何含义?"/>
+            </LinearLayout>
+
+
+
+            <ImageButton
+                android:id="@+id/img_pic"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@null"
+                tools:src="@mipmap/btn" />
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="10dp"
+                android:layout_gravity="center" />
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    android:layout_marginLeft="20dp"
+                    android:text="A:"/>
+                <TextView
+                    android:id="@+id/tv_A"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    tools:text="考试数量:100"/>
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    android:layout_marginLeft="20dp"
+                    android:text="B:"/>
+                <TextView
+                    android:id="@+id/tv_B"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    tools:text="考试数量:100"/>
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_C"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    android:layout_marginLeft="20dp"
+                    android:text="C:"/>
+                <TextView
+                    android:id="@+id/tv_C"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    tools:text="考试数量:100"/>
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_D"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    android:layout_marginLeft="20dp"
+                    android:text="D:"/>
+                <TextView
+                    android:id="@+id/tv_D"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="left"
+                    tools:text="考试数量:100"/>
+            </LinearLayout>
+
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="10dp"
+                android:layout_gravity="center" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="40dp"
+                android:gravity="center">
+                <!--<RadioGroup
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:orientation="horizontal"
+                    android:gravity="center">-->
+
+                <RadioButton
+                    android:id="@+id/cb_A"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginRight="30dp"
+                    android:text="A"/>
+                <RadioButton
+                    android:id="@+id/cb_B"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginRight="30dp"
+                    android:text="B"/>
+                <RadioButton
+                    android:id="@+id/cb_C"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginRight="30dp"
+                    android:text="C"/>
+                <RadioButton
+                    android:id="@+id/cb_D"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginRight="30dp"
+                    android:text="D"/>
+
+                <!--</RadioGroup>-->
+
+            </LinearLayout>
+
+            <Gallery
+                android:id="@+id/gallery"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:spacing="10sp"
+                android:layout_marginTop="30dp">
+
+            </Gallery>
+
+        </LinearLayout>
+
+    </ScrollView>
+
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_weight="1.4"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center">
+            <Button
+                android:onClick="pre"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:drawableLeft="@mipmap/exam_pre32x32"
+                android:text="上一题"
+                android:background="@null"/>
+            <Button
+                android:onClick="next"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:drawableRight="@mipmap/exam_next32x32"
+                android:text="下一题"
+                android:layout_marginLeft="100dp"
+                android:background="@null"/>
+        </LinearLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="center">
+            <Button
+                android:onClick="commit"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:drawableLeft="@mipmap/exam_commit32x32"
+                android:text="交卷"
+                android:background="@null"/>
+        </LinearLayout>
+
+    </LinearLayout>
+
+</LinearLayout>

+ 8 - 0
app/src/main/res/layout/activity_splash.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+    android:background="@mipmap/splash">
+
+</LinearLayout>

+ 17 - 0
app/src/main/res/layout/item_question.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center">
+    <ImageView
+        android:id="@+id/imv_question"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@mipmap/ques24x24"/>
+    <TextView
+        android:id="@+id/tv_no"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="第1题"/>
+
+</LinearLayout>

+ 17 - 0
app/src/main/res/layout/layout_result.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@mipmap/dialog_bg"
+    android:gravity="center">
+    <TextView
+        android:id="@+id/tv_result"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="你的分数是\n90分"
+        android:gravity="center"
+        android:layout_gravity="center"
+        android:textSize="20sp"
+        android:textColor="#000"/>
+
+</LinearLayout>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/answer24x24.png


BIN
app/src/main/res/mipmap-hdpi/btn.png


BIN
app/src/main/res/mipmap-hdpi/commit.png


BIN
app/src/main/res/mipmap-hdpi/dialog_bg.jpg


BIN
app/src/main/res/mipmap-hdpi/error_24px.png


BIN
app/src/main/res/mipmap-hdpi/exam_bg.png


BIN
app/src/main/res/mipmap-hdpi/exam_commit32x32.png


BIN
app/src/main/res/mipmap-hdpi/exam_next32x32.png


BIN
app/src/main/res/mipmap-hdpi/exam_pre32x32.png


BIN
app/src/main/res/mipmap-hdpi/exam_question_content.png


BIN
app/src/main/res/mipmap-hdpi/exam_title.png


BIN
app/src/main/res/mipmap-hdpi/exit_bg.png


BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-hdpi/icon.png


BIN
app/src/main/res/mipmap-hdpi/login32x32.png


BIN
app/src/main/res/mipmap-hdpi/login_bg.png


BIN
app/src/main/res/mipmap-hdpi/login_btn_bg.png


BIN
app/src/main/res/mipmap-hdpi/login_exit32x32.png


BIN
app/src/main/res/mipmap-hdpi/main.jpg


BIN
app/src/main/res/mipmap-hdpi/main_menu_bg.png


BIN
app/src/main/res/mipmap-hdpi/main_menu_exam.png


BIN
app/src/main/res/mipmap-hdpi/main_menu_exit.png


BIN
app/src/main/res/mipmap-hdpi/main_menu_message.png


BIN
app/src/main/res/mipmap-hdpi/main_menu_result.png


BIN
app/src/main/res/mipmap-hdpi/myicon.png


BIN
app/src/main/res/mipmap-hdpi/noselected.png


BIN
app/src/main/res/mipmap-hdpi/ques24x24.png


BIN
app/src/main/res/mipmap-hdpi/splash.jpg


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp


+ 16 - 0
app/src/main/res/values-night/themes.xml

@@ -0,0 +1,16 @@
+<resources xmlns:tools="http://schemas.android.com/tools">
+    <!-- Base application theme. -->
+    <style name="Theme.JKBD" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
+        <!-- Primary brand color. -->
+        <item name="colorPrimary">@color/purple_200</item>
+        <item name="colorPrimaryVariant">@color/purple_700</item>
+        <item name="colorOnPrimary">@color/black</item>
+        <!-- Secondary brand color. -->
+        <item name="colorSecondary">@color/teal_200</item>
+        <item name="colorSecondaryVariant">@color/teal_200</item>
+        <item name="colorOnSecondary">@color/black</item>
+        <!-- Status bar color. -->
+        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
+        <!-- Customize your theme here. -->
+    </style>
+</resources>

+ 16 - 0
app/src/main/res/values/colors.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="purple_200">#FFBB86FC</color>
+    <color name="purple_500">#FF6200EE</color>
+    <color name="purple_700">#FF3700B3</color>
+    <color name="teal_200">#FF03DAC5</color>
+    <color name="teal_700">#FF018786</color>
+    <color name="black">#FF000000</color>
+    <color name="white">#FFFFFFFF</color>
+
+    <color name="colorPrimary">#3F51B5</color>
+    <color name="colorPrimaryDark">#303F9F</color>
+    <color name="colorAccent">#FF4081</color>
+    <color name="green">#7FFF00</color>
+    <color name="red">#EE0000</color>
+</resources>

+ 3 - 0
app/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">驾考宝典</string>
+</resources>

+ 9 - 0
app/src/main/res/values/themes.xml

@@ -0,0 +1,9 @@
+<resources xmlns:tools="http://schemas.android.com/tools">
+    <style name="Theme.JKBD" 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>

+ 17 - 0
app/src/test/java/me/yoqi/android/jkbd/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package me.yoqi.android.jkbd;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 17 - 0
build.gradle

@@ -0,0 +1,17 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+    repositories {
+        google()
+        mavenCentral()
+    }
+    dependencies {
+        classpath "com.android.tools.build:gradle:4.1.0"
+
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}

+ 19 - 0
gradle.properties

@@ -0,0 +1,19 @@
+# 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.
+org.gradle.jvmargs=-Xmx2048m -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
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true

BIN
gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
+#Tue Apr 05 12:35:13 CST 2022
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME

+ 185 - 0
gradlew

@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# 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
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# 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
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+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" -a "$nonstop" = "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 or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"

+ 89 - 0
gradlew.bat

@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@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
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@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="-Xmx64m" "-Xms64m"
+
+@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 execute
+
+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 execute
+
+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
+
+: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 %*
+
+: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

+ 10 - 0
settings.gradle

@@ -0,0 +1,10 @@
+dependencyResolutionManagement {
+    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositories {
+        google()
+        mavenCentral()
+        jcenter() // Warning: this repository is going to shut down soon
+    }
+}
+rootProject.name = "JKBD"
+include ':app'