瀏覽代碼

Added Controllers

Fruit of Eden 7 年之前
父節點
當前提交
dd05ca3087

+ 47 - 21
app/app.iml

@@ -86,17 +86,28 @@
       <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
@@ -104,27 +115,42 @@
       <excludeFolder url="file://$MODULE_DIR$/build/reports" />
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
-    <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
+    <orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="Gradle: org.nanohttpd:nanohttpd:2.2.0@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:transition-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.0@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-fragment-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-compat-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:design-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core-1.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-media-compat-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:common:1.1.0@jar" level="project" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils-27.1.1" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:versionedparcelable-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:print-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:documentfile-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel-1.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:transition-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:customview-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.qmuiteam:qmui-1.1.3" level="project" />
+    <orderEntry type="library" name="Gradle: org.nanohttpd:nanohttpd:2.3.1@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:cursoradapter-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:cardview-v7-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-compat-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:drawerlayout-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:common:1.1.1@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:design-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-fragment-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:interpolator-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:28.0.0-alpha3@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:coordinatorlayout-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:slidingpanelayout-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:collections:28.0.0-alpha3@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-utils-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:loader-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.1@jar" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core-1.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:viewpager-28.0.0-alpha3" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout-28.0.0-alpha3" level="project" />
   </component>
 </module>

+ 7 - 5
app/build.gradle

@@ -1,13 +1,13 @@
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 27
+    compileSdkVersion 28
     buildToolsVersion "27.0.3"
 
     defaultConfig {
         applicationId "com.mikhaellopez.androidwebserver"
         minSdkVersion 20
-        targetSdkVersion 27
+        targetSdkVersion 28
         versionCode 1
         versionName "1.0"
     }
@@ -20,7 +20,9 @@ android {
 }
 
 dependencies {
-    implementation 'org.nanohttpd:nanohttpd:2.2.0'
-    implementation 'com.android.support:appcompat-v7:27.1.1'
-    implementation 'com.android.support:design:27.1.1'
+    implementation 'com.qmuiteam:qmui:1.1.3'
+    //implementation 'com.github.eluleci:flatui:3.0.0'
+    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
+    implementation 'com.android.support:design:28.0.0-alpha3'
+    implementation 'org.nanohttpd:nanohttpd:2.3.1'
 }

+ 2 - 2
app/src/main/AndroidManifest.xml

@@ -5,16 +5,16 @@
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
 
     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
         android:supportsRtl="true"
-        android:theme="@style/AppTheme">
+        android:theme="@style/QMUIUse">
         <activity android:name=".MainActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />

+ 108 - 2
app/src/main/java/com/mikhaellopez/androidwebserver/MainActivity.java

@@ -8,7 +8,9 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
+import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
+import android.os.Build;
 import android.os.Bundle;
 import android.support.design.widget.CoordinatorLayout;
 import android.support.design.widget.FloatingActionButton;
@@ -17,9 +19,13 @@ import android.support.v4.content.ContextCompat;
 import android.support.v7.app.AppCompatActivity;
 import android.view.KeyEvent;
 import android.view.View;
+import android.widget.Button;
 import android.widget.EditText;
 import android.widget.TextView;
 
+import java.lang.reflect.Method;
+import java.util.UUID;
+
 /**
  * Created by Mikhael LOPEZ on 14/12/2015.
  */
@@ -39,6 +45,11 @@ public class MainActivity extends AppCompatActivity {
     private View textViewMessage;
     private TextView textViewIpAccess;
 
+    private WifiManager wifiManager;
+    private Button open;
+    boolean flag = false;
+    private String deviceId = getUniquePsuedoID();
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -72,10 +83,102 @@ public class MainActivity extends AppCompatActivity {
             }
         });
 
+        //获取wifi管理服务
+        wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+        open = (Button)findViewById(R.id.open_hotspot);
+        //通过按钮事件设置热点
+        open.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                //如果是打开状态就关闭,如果是关闭就打开
+                flag=!flag;
+                setWifiApEnabled(flag);
+            }
+        });
+
+
         // INIT BROADCAST RECEIVER TO LISTEN NETWORK STATE CHANGED
         initBroadcastReceiverNetworkStateChanged();
     }
 
+    public static String getUniquePsuedoID()
+    {
+        // If all else fails, if the user does have lower than API 9 (lower
+        // than Gingerbread), has reset their phone or 'Secure.ANDROID_ID'
+        // returns 'null', then simply the ID returned will be solely based
+        // off their Android device information. This is where the collisions
+        // can happen.
+        // Thanks http://www.pocketmagic.net/?p=1662!
+        // Try not to use DISPLAY, HOST or ID - these items could change.
+        // If there are collisions, there will be overlapping data
+        String m_szDevIDShort = "35" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (Build.CPU_ABI.length() % 10) + (Build.DEVICE.length() % 10) + (Build.MANUFACTURER.length() % 10) + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10);
+
+        // Thanks to @Roman SL!
+        // http://stackoverflow.com/a/4789483/950427
+        // Only devices with API >= 9 have android.os.Build.SERIAL
+        // http://developer.android.com/reference/android/os/Build.html#SERIAL
+        // If a user upgrades software or roots their phone, there will be a duplicate entry
+        String serial = null;
+        try
+        {
+            serial = android.os.Build.class.getField("SERIAL").get(null).toString();
+            // Go ahead and return the serial for api => 9
+            return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
+        }
+        catch (Exception e)
+        {
+            // String needs to be initialized
+            serial = "serial"; // some value
+        }
+
+        // Thanks @Joe!
+        // http://stackoverflow.com/a/2853253/950427
+        // Finally, combine the values we have found by using the UUID class to create a unique identifier
+        return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
+    }
+
+    private void setWifiApEnabled(boolean flag) {
+        if(flag) createWifiHotspot("", "");
+    }
+
+    /**
+     * 创建Wifi热点
+     */
+    private void createWifiHotspot(String WIFI_HOTSPOT_SSID, String key) {
+        if (wifiManager.isWifiEnabled()) {
+            //如果wifi处于打开状态,则关闭wifi,
+            wifiManager.setWifiEnabled(false);
+        }
+        WifiConfiguration config = new WifiConfiguration();
+        config.SSID = WIFI_HOTSPOT_SSID;
+        config.preSharedKey = key;
+        config.hiddenSSID = false;
+        config.allowedAuthAlgorithms
+                .set(WifiConfiguration.AuthAlgorithm.OPEN);//开放系统认证
+        config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
+        config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
+        config.allowedPairwiseCiphers
+                .set(WifiConfiguration.PairwiseCipher.TKIP);
+        config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
+        config.allowedPairwiseCiphers
+                .set(WifiConfiguration.PairwiseCipher.CCMP);
+        config.status = WifiConfiguration.Status.ENABLED;
+        //通过反射调用设置热点
+        try {
+            Method method = wifiManager.getClass().getMethod(
+                    "setWifiApEnabled", WifiConfiguration.class, Boolean.TYPE);
+            boolean enable = (Boolean) method.invoke(wifiManager, config, true);
+            if (enable) {
+                Snackbar.make(coordinatorLayout, "WIFI 热点创建成功,SSID:"+WIFI_HOTSPOT_SSID + ",密码:"+key, Snackbar.LENGTH_LONG).show();
+            } else {
+                Snackbar.make(coordinatorLayout, "WIFI 热点创建失败",Snackbar.LENGTH_LONG).show();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Snackbar.make(coordinatorLayout, "WIFI 热点创建失败"+ e.getMessage(),Snackbar.LENGTH_LONG).show();
+        }
+    }
+
     //region Start And Stop AndroidWebServer
     private boolean startAndroidWebServer() {
         if (!isStarted) {
@@ -86,11 +189,14 @@ public class MainActivity extends AppCompatActivity {
                 }
                 androidWebServer = new AndroidWebServer(port);
                 androidWebServer.start();
+                setWifiApEnabled(true);
                 return true;
             } catch (Exception e) {
                 e.printStackTrace();
                 Snackbar.make(coordinatorLayout, "The PORT " + port + " doesn't work, please change it between 1000 and 9999.", Snackbar.LENGTH_LONG).show();
             }
+        }else{
+            setWifiApEnabled(false);
         }
         return false;
     }
@@ -123,7 +229,7 @@ public class MainActivity extends AppCompatActivity {
     }
 
     private String getIpAccess() {
-        WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
+        WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
         int ipAddress = wifiManager.getConnectionInfo().getIpAddress();
         final String formatedIpAddress = String.format("%d.%d.%d.%d", (ipAddress & 0xff), (ipAddress >> 8 & 0xff), (ipAddress >> 16 & 0xff), (ipAddress >> 24 & 0xff));
         return "http://" + formatedIpAddress + ":";
@@ -135,7 +241,7 @@ public class MainActivity extends AppCompatActivity {
     }
 
     public boolean isConnectedInWifi() {
-        WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+        WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
         NetworkInfo networkInfo = ((ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
         if (networkInfo != null && networkInfo.isAvailable() && networkInfo.isConnected()
                 && wifiManager.isWifiEnabled() && networkInfo.getTypeName().equals("WIFI")) {

+ 7 - 2
app/src/main/java/com/mikhaellopez/androidwebserver/controller/ConsoleController.java

@@ -1,7 +1,12 @@
 package com.mikhaellopez.androidwebserver.controller;
 
-public class ConsoleController {
-    public String dispatch(int action, Map<>){
+import com.mikhaellopez.androidwebserver.service.ArgumentProvider;
+
+import org.json.JSONObject;
+import java.util.Map;
 
+public class ConsoleController {
+    public String dispatch(int action, Map<String,String> arguments){
+        return ArgumentProvider.map2query(arguments);
     }
 }

+ 5 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/controller/EchoController.java

@@ -0,0 +1,5 @@
+package com.mikhaellopez.androidwebserver.controller;
+
+public class EchoController {
+
+}

+ 81 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/service/ArgumentProvider.java

@@ -0,0 +1,81 @@
+package com.mikhaellopez.androidwebserver.service;
+
+import com.mikhaellopez.androidwebserver.utils.StringUtils;
+
+import org.json.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ArgumentProvider {
+    public static JSONObject map2json(Map<String,String> maps){
+        return new JSONObject();
+    }
+
+    public static Map<String,String> json2map(JSONObject jsonObject){
+        return new HashMap<>();
+    }
+
+    public static String map2query(Map<String,String> map){
+        if (map == null) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder();
+        if (map.size() > 0) {
+            for (String key : map.keySet()) {
+                sb.append(key).append("=");
+                if (StringUtils.isEmpty(map.get(key))) {
+                    sb.append("&");
+                } else {
+                    Object object = map.get(key);
+                    String value = object.toString();
+                    System.out.println(value);
+                    sb.append(value).append("&");
+                }
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 将url参数转换成map
+     * @param param aa=11&bb=22&cc=33
+     * @return
+     */
+    public static Map<String, Object> getUrlParams(String param) {
+        Map<String, Object> map = new HashMap<String, Object>(0);
+        if (StringUtils.isEmpty(param)) {
+            return map;
+        }
+        String[] params = param.split("&");
+        for (int i = 0; i < params.length; i++) {
+            String[] p = params[i].split("=");
+            if (p.length == 2) {
+                map.put(p[0], p[1]);
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 将map转换成url
+     * @param map
+     * @return
+     */
+    public static String getUrlParamsByMap(Map<String, Object> map) {
+        if (map == null) {
+            return "";
+        }
+        StringBuffer sb = new StringBuffer();
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
+            sb.append(entry.getKey() + "=" + entry.getValue());
+            sb.append("&");
+        }
+        String s = sb.toString();
+        if (s.endsWith("&")) {
+            s = StringUtils.substringBefore(s, "&");
+        }
+        return s;
+    }
+
+}

+ 4 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/service/ConfigService.java

@@ -0,0 +1,4 @@
+package com.mikhaellopez.androidwebserver.service;
+
+public class ConfigService {
+}

+ 4 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/service/PersistService.java

@@ -0,0 +1,4 @@
+package com.mikhaellopez.androidwebserver.service;
+
+public class PersistService {
+}

+ 4 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/service/RoomService.java

@@ -0,0 +1,4 @@
+package com.mikhaellopez.androidwebserver.service;
+
+public class RoomService {
+}

+ 4 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/service/WarzoneService.java

@@ -0,0 +1,4 @@
+package com.mikhaellopez.androidwebserver.service;
+
+public class WarzoneService {
+}

+ 4 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/utils/DateUtils.java

@@ -0,0 +1,4 @@
+package com.mikhaellopez.androidwebserver.utils;
+
+public class DateUtils {
+}

+ 18 - 0
app/src/main/java/com/mikhaellopez/androidwebserver/utils/StringUtils.java

@@ -0,0 +1,18 @@
+package com.mikhaellopez.androidwebserver.utils;
+
+public class StringUtils {
+
+    public static boolean isEmpty(String s) {
+        return s == null || s.isEmpty() || s.matches("^[ ]+$");
+    }
+
+    public static String substringBefore(String s, String pointert) {
+        if(pointert == null || pointert.isEmpty()){
+            return s;
+        }
+        if(s == null){
+            return  "";
+        }
+        return s.substring(0,s.lastIndexOf(pointert));
+    }
+}

+ 89 - 0
app/src/main/res/layout/activity_login.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/coordinatorLayout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="match_parent"
+            android:layout_height="150dp"
+            android:scaleType="centerCrop"
+            android:src="@drawable/header" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:background="@color/colorPrimaryLight"
+            android:gravity="center"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:id="@+id/textViewIpAccess"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="http://000.000.000.000:"
+                    android:textColor="@android:color/white"
+                    android:textSize="20sp"
+                    android:textStyle="bold" />
+
+                <EditText
+                    android:id="@+id/editTextPort"
+                    android:layout_width="60dp"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:hint="8080"
+                    android:inputType="numberDecimal"
+                    android:maxLength="4"
+                    android:text="8080"
+                    android:textColor="@android:color/white"
+                    android:textSize="20sp"
+                    android:textStyle="bold" />
+
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/textViewMessage"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="50dp"
+                android:layout_marginRight="50dp"
+                android:layout_marginTop="50dp"
+                android:gravity="center"
+                android:text="@string/message"
+                android:textColor="@android:color/white"
+                android:textSize="18sp"
+                android:visibility="invisible" />
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+    <android.support.design.widget.FloatingActionButton
+        android:id="@+id/floatingActionButtonOnOff"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="end|bottom"
+        android:layout_margin="16dp"
+        android:elevation="4dp"
+        android:src="@drawable/on_btn"
+        app:backgroundTint="@color/colorRed" />
+
+    <TextView
+        android:id="@+id/textView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="TextView" />
+
+</android.support.design.widget.CoordinatorLayout>

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

@@ -80,4 +80,16 @@
         android:src="@drawable/on_btn"
         app:backgroundTint="@color/colorRed" />
 
+    <Button
+        android:id="@+id/open_hotspot"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="Button" />
+
+    <TextView
+        android:id="@+id/open_hotspot_msg"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:text="TextView" />
+
 </android.support.design.widget.CoordinatorLayout>

+ 89 - 0
app/src/main/res/layout/activity_player.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/coordinatorLayout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="match_parent"
+            android:layout_height="150dp"
+            android:scaleType="centerCrop"
+            android:src="@drawable/header" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:background="@color/colorPrimaryLight"
+            android:gravity="center"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:id="@+id/textViewIpAccess"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="http://000.000.000.000:"
+                    android:textColor="@android:color/white"
+                    android:textSize="20sp"
+                    android:textStyle="bold" />
+
+                <EditText
+                    android:id="@+id/editTextPort"
+                    android:layout_width="60dp"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:hint="8080"
+                    android:inputType="numberDecimal"
+                    android:maxLength="4"
+                    android:text="8080"
+                    android:textColor="@android:color/white"
+                    android:textSize="20sp"
+                    android:textStyle="bold" />
+
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/textViewMessage"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="50dp"
+                android:layout_marginRight="50dp"
+                android:layout_marginTop="50dp"
+                android:gravity="center"
+                android:text="@string/message"
+                android:textColor="@android:color/white"
+                android:textSize="18sp"
+                android:visibility="invisible" />
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+    <android.support.design.widget.FloatingActionButton
+        android:id="@+id/floatingActionButtonOnOff"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="end|bottom"
+        android:layout_margin="16dp"
+        android:elevation="4dp"
+        android:src="@drawable/on_btn"
+        app:backgroundTint="@color/colorRed" />
+
+    <TextView
+        android:id="@+id/textView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="TextView" />
+
+</android.support.design.widget.CoordinatorLayout>

+ 89 - 0
app/src/main/res/layout/activity_start.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/coordinatorLayout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="match_parent"
+            android:layout_height="150dp"
+            android:scaleType="centerCrop"
+            android:src="@drawable/header" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:background="@color/colorPrimaryLight"
+            android:gravity="center"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:id="@+id/textViewIpAccess"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="http://000.000.000.000:"
+                    android:textColor="@android:color/white"
+                    android:textSize="20sp"
+                    android:textStyle="bold" />
+
+                <EditText
+                    android:id="@+id/editTextPort"
+                    android:layout_width="60dp"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:hint="8080"
+                    android:inputType="numberDecimal"
+                    android:maxLength="4"
+                    android:text="8080"
+                    android:textColor="@android:color/white"
+                    android:textSize="20sp"
+                    android:textStyle="bold" />
+
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/textViewMessage"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="50dp"
+                android:layout_marginRight="50dp"
+                android:layout_marginTop="50dp"
+                android:gravity="center"
+                android:text="@string/message"
+                android:textColor="@android:color/white"
+                android:textSize="18sp"
+                android:visibility="invisible" />
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+    <android.support.design.widget.FloatingActionButton
+        android:id="@+id/floatingActionButtonOnOff"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="end|bottom"
+        android:layout_margin="16dp"
+        android:elevation="4dp"
+        android:src="@drawable/on_btn"
+        app:backgroundTint="@color/colorRed" />
+
+    <TextView
+        android:id="@+id/textView"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="TextView" />
+
+</android.support.design.widget.CoordinatorLayout>

+ 5 - 5
app/src/main/res/values/strings.xml

@@ -1,7 +1,7 @@
 <resources>
-    <string name="app_name">AndroidWebServer</string>
-    <string name="message">You can now access the Android Web Server from a browser connected to the same wifi network.</string>
-    <string name="dialog_exit_message">Android Web Server is currently running. If you exit the application we will stop it. Are sure you want to exit the application?</string>
-    <string name="warning">Warning</string>
-    <string name="wifi_message">You must connect to a WiFi network to use this service.</string>
+    <string name="app_name">坦竞主机APP</string>
+    <string name="message">使用终端APP扫描下方二维码,开始配对</string>
+    <string name="dialog_exit_message">系统正在运行中,如果现在退出,那么程序也会自动退出哦!</string>
+    <string name="warning">警告</string>
+    <string name="wifi_message">您必须处于WIFI环境中才能使用此服务(异常情况)</string>
 </resources>

+ 6 - 0
app/src/main/res/values/styles.xml

@@ -10,4 +10,10 @@
         <item name="colorAccent">@color/colorAccent</item>
     </style>
 
+    <style name="QMUIUse.ext" parent="QMUIUse" />
+
+    <style name="QMUIUse" parent="QMUI.Compat">
+        <!--<item name="colorPrimary">@color/colorPrimary</item>-->
+    </style>
+
 </resources>