The final version for lede-gui (the phone app for device registration)
[iot2.git] / others / lede-gui / src / main / java / com / example / lede2 / AllInstallOptions.java
diff --git a/others/lede-gui/src/main/java/com/example/lede2/AllInstallOptions.java b/others/lede-gui/src/main/java/com/example/lede2/AllInstallOptions.java
new file mode 100644 (file)
index 0000000..2248620
--- /dev/null
@@ -0,0 +1,59 @@
+package com.example.lede2;\r
+\r
+import android.content.Context;\r
+import android.content.Intent;\r
+import android.os.Bundle;\r
+import android.support.v7.app.AppCompatActivity;\r
+import android.util.Log;\r
+import android.view.View;\r
+import android.view.inputmethod.InputMethodManager;\r
+import android.widget.Button;\r
+\r
+/**\r
+ * Created by Brian on 2/16/2018.\r
+ */\r
+\r
+public class AllInstallOptions extends AppCompatActivity implements View.OnClickListener,\r
+        View.OnFocusChangeListener {\r
+    Button installOneDeviceButton;\r
+    Button installCommPatternButton;\r
+    Button installTwoDevicesAndCommPattern;\r
+    Button installAddress;\r
+    Button installDeviceAddress;\r
+    Button installZigbeeDeviceAddress;\r
+    Button installHost;\r
+\r
+\r
+    protected void onCreate(Bundle savedInstanceState) {\r
+        super.onCreate(savedInstanceState);\r
+        setContentView(R.layout.install_options);\r
+\r
+        installOneDeviceButton = (Button) findViewById(R.id.doneDrivers);\r
+        installZigbeeDeviceAddress = (Button) findViewById(R.id.install_zigbee_device_address);\r
+        installOneDeviceButton.setOnClickListener(this);\r
+        installZigbeeDeviceAddress.setOnClickListener(this);\r
+\r
+    }\r
+\r
+    @Override\r
+    public void onClick(View view) {\r
+        if (view == installOneDeviceButton) {\r
+            Log.d("CLICKING", "Clicking on add device!");\r
+            startActivity(new Intent(this, AddDeviceActivity.class));\r
+        }\r
+        if (view == installZigbeeDeviceAddress) {\r
+            Log.d("CLICKING", "Clicking on install zigbee!");\r
+            startActivity(new Intent(this, InstallZigbeeDeviceAddress.class));\r
+        }\r
+\r
+    }\r
+\r
+    public void onFocusChange(View view, boolean hasFocus) {\r
+        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);\r
+        if (hasFocus) {\r
+            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);\r
+        } else {\r
+            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);\r
+        }\r
+    }\r
+}
\ No newline at end of file