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
1 package com.example.lede2;\r
2 \r
3 import android.content.Context;\r
4 import android.content.Intent;\r
5 import android.os.Bundle;\r
6 import android.support.v7.app.AppCompatActivity;\r
7 import android.util.Log;\r
8 import android.view.View;\r
9 import android.view.inputmethod.InputMethodManager;\r
10 import android.widget.Button;\r
11 \r
12 /**\r
13  * Created by Brian on 2/16/2018.\r
14  */\r
15 \r
16 public class AllInstallOptions extends AppCompatActivity implements View.OnClickListener,\r
17         View.OnFocusChangeListener {\r
18     Button installOneDeviceButton;\r
19     Button installCommPatternButton;\r
20     Button installTwoDevicesAndCommPattern;\r
21     Button installAddress;\r
22     Button installDeviceAddress;\r
23     Button installZigbeeDeviceAddress;\r
24     Button installHost;\r
25 \r
26 \r
27     protected void onCreate(Bundle savedInstanceState) {\r
28         super.onCreate(savedInstanceState);\r
29         setContentView(R.layout.install_options);\r
30 \r
31         installOneDeviceButton = (Button) findViewById(R.id.doneDrivers);\r
32         installZigbeeDeviceAddress = (Button) findViewById(R.id.install_zigbee_device_address);\r
33         installOneDeviceButton.setOnClickListener(this);\r
34         installZigbeeDeviceAddress.setOnClickListener(this);\r
35 \r
36     }\r
37 \r
38     @Override\r
39     public void onClick(View view) {\r
40         if (view == installOneDeviceButton) {\r
41             Log.d("CLICKING", "Clicking on add device!");\r
42             startActivity(new Intent(this, AddDeviceActivity.class));\r
43         }\r
44         if (view == installZigbeeDeviceAddress) {\r
45             Log.d("CLICKING", "Clicking on install zigbee!");\r
46             startActivity(new Intent(this, InstallZigbeeDeviceAddress.class));\r
47         }\r
48 \r
49     }\r
50 \r
51     public void onFocusChange(View view, boolean hasFocus) {\r
52         InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);\r
53         if (hasFocus) {\r
54             imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);\r
55         } else {\r
56             imm.hideSoftInputFromWindow(view.getWindowToken(), 0);\r
57         }\r
58     }\r
59 }