Showing
13 changed files
with
734 additions
and
87 deletions
| ... | ... | @@ -39,5 +39,6 @@ dependencies { |
| 39 | 39 | compile 'com.android.support:appcompat-v7:25.2.0' |
| 40 | 40 | compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4' |
| 41 | 41 | compile 'com.android.support:design:25.2.0' |
| 42 | + compile 'org.greenrobot:eventbus:3.0.0' | |
| 42 | 43 | testCompile 'junit:junit:4.12' |
| 43 | 44 | } | ... | ... |
| ... | ... | @@ -8,7 +8,7 @@ import android.util.Log; |
| 8 | 8 | |
| 9 | 9 | public class GlobalVar { |
| 10 | 10 | public static final String CHARSET_UTF8 = "utf-8"; |
| 11 | - public static final byte MAX_BYTE = (byte) 0xFF; | |
| 11 | + public static final int MAX_BYTE = 0xFF; | |
| 12 | 12 | static GlobalVar globalVar = new GlobalVar(); |
| 13 | 13 | |
| 14 | 14 | ... | ... |
| 1 | +package com.adroplat.fist_switch.jni; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by wugian on 2017/3/22 | |
| 7 | + */ | |
| 8 | +public class Device1 { | |
| 9 | + /** | |
| 10 | + * CmdType : 17 | |
| 11 | + * ErrorCode : 0 | |
| 12 | + * DeviceIp : [192,168,31,163] | |
| 13 | + * DeviceNum : [255,255,255,255,0,255] | |
| 14 | + * DeviceKey : [120,56,53,98,97,117] | |
| 15 | + * DevicePort : 9000 | |
| 16 | + * MappedIp : [0,0,0,0] | |
| 17 | + * MappedPort : 0 | |
| 18 | + * SubDevices : [{"SubDeviceNum":4294967151,"SubDeviceType":33,"SubDeviceStatus":0,"SubDeviceOnlineStatus":0,"SubDeviceBit":0}] | |
| 19 | + */ | |
| 20 | + | |
| 21 | + private int CmdType; | |
| 22 | + private int ErrorCode; | |
| 23 | + private int DevicePort; | |
| 24 | + private int MappedPort; | |
| 25 | + private List<Integer> DeviceIp; | |
| 26 | + private List<Integer> DeviceNum; | |
| 27 | + private List<Integer> DeviceKey; | |
| 28 | + private List<Integer> MappedIp; | |
| 29 | + private List<SubDevicesEntity> SubDevices; | |
| 30 | + | |
| 31 | + public int getCmdType() { | |
| 32 | + return CmdType; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setCmdType(int CmdType) { | |
| 36 | + this.CmdType = CmdType; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public int getErrorCode() { | |
| 40 | + return ErrorCode; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setErrorCode(int ErrorCode) { | |
| 44 | + this.ErrorCode = ErrorCode; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public int getDevicePort() { | |
| 48 | + return DevicePort; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setDevicePort(int DevicePort) { | |
| 52 | + this.DevicePort = DevicePort; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public int getMappedPort() { | |
| 56 | + return MappedPort; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setMappedPort(int MappedPort) { | |
| 60 | + this.MappedPort = MappedPort; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public List<Integer> getDeviceIp() { | |
| 64 | + return DeviceIp; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setDeviceIp(List<Integer> DeviceIp) { | |
| 68 | + this.DeviceIp = DeviceIp; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public List<Integer> getDeviceNum() { | |
| 72 | + return DeviceNum; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public void setDeviceNum(List<Integer> DeviceNum) { | |
| 76 | + this.DeviceNum = DeviceNum; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public List<Integer> getDeviceKey() { | |
| 80 | + return DeviceKey; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public void setDeviceKey(List<Integer> DeviceKey) { | |
| 84 | + this.DeviceKey = DeviceKey; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public List<Integer> getMappedIp() { | |
| 88 | + return MappedIp; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public void setMappedIp(List<Integer> MappedIp) { | |
| 92 | + this.MappedIp = MappedIp; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public List<SubDevicesEntity> getSubDevices() { | |
| 96 | + return SubDevices; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setSubDevices(List<SubDevicesEntity> SubDevices) { | |
| 100 | + this.SubDevices = SubDevices; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public static class SubDevicesEntity { | |
| 104 | + /** | |
| 105 | + * SubDeviceNum : 4294967151 | |
| 106 | + * SubDeviceType : 33 | |
| 107 | + * SubDeviceStatus : 0 | |
| 108 | + * SubDeviceOnlineStatus : 0 | |
| 109 | + * SubDeviceBit : 0 | |
| 110 | + */ | |
| 111 | + private long SubDeviceNum; | |
| 112 | + private int SubDeviceType; | |
| 113 | + private int SubDeviceStatus; | |
| 114 | + private int SubDeviceOnlineStatus; | |
| 115 | + private int SubDeviceBit; | |
| 116 | + | |
| 117 | + public long getSubDeviceNum() { | |
| 118 | + return SubDeviceNum; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setSubDeviceNum(long SubDeviceNum) { | |
| 122 | + this.SubDeviceNum = SubDeviceNum; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public int getSubDeviceType() { | |
| 126 | + return SubDeviceType; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setSubDeviceType(int SubDeviceType) { | |
| 130 | + this.SubDeviceType = SubDeviceType; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public int getSubDeviceStatus() { | |
| 134 | + return SubDeviceStatus; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public void setSubDeviceStatus(int SubDeviceStatus) { | |
| 138 | + this.SubDeviceStatus = SubDeviceStatus; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public int getSubDeviceOnlineStatus() { | |
| 142 | + return SubDeviceOnlineStatus; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public void setSubDeviceOnlineStatus(int SubDeviceOnlineStatus) { | |
| 146 | + this.SubDeviceOnlineStatus = SubDeviceOnlineStatus; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public int getSubDeviceBit() { | |
| 150 | + return SubDeviceBit; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public void setSubDeviceBit(int SubDeviceBit) { | |
| 154 | + this.SubDeviceBit = SubDeviceBit; | |
| 155 | + } | |
| 156 | + } | |
| 157 | +} | ... | ... |
| ... | ... | @@ -12,9 +12,12 @@ import com.adroplat.fist_switch.utils.ToastUtils; |
| 12 | 12 | import com.adroplat.fist_switch.utils.WifiUtils; |
| 13 | 13 | import com.adroplat.fist_switch.utils.protocol.one.FistProtocol; |
| 14 | 14 | import com.google.gson.Gson; |
| 15 | +import com.qnbar.switchcontrol.model.MessageEvent; | |
| 15 | 16 | import io.realm.Realm; |
| 17 | +import org.greenrobot.eventbus.EventBus; | |
| 16 | 18 | |
| 17 | 19 | import java.util.ArrayList; |
| 20 | +import java.util.Arrays; | |
| 18 | 21 | |
| 19 | 22 | /** |
| 20 | 23 | * Created by WLJ on 2016/1/14. |
| ... | ... | @@ -22,6 +25,11 @@ import java.util.ArrayList; |
| 22 | 25 | public class FistJni { |
| 23 | 26 | private static final String TAG = FistJni.class.getSimpleName(); |
| 24 | 27 | |
| 28 | + public static final int DEVICE_HUBS_ONLINE_NOTIFY = 0x7101; | |
| 29 | + private static final String DEVICE_HUBS_ONLINE_NOTIFY_STR = "DEVICE_HUBS_ONLINE_NOTIFY_STR"; | |
| 30 | + public static final int DEVICE_SWITCH_ONLINE_NOTIFY = 0x7102; | |
| 31 | + private static final String DEVICE_SWITCH_ONLINE_NOTIFY_STR = "DEVICE_SWITCH_ONLINE_NOTIFY_STR"; | |
| 32 | + | |
| 25 | 33 | static { |
| 26 | 34 | System.loadLibrary("fist_ndk"); |
| 27 | 35 | } |
| ... | ... | @@ -64,18 +72,42 @@ public class FistJni { |
| 64 | 72 | sendJsonDevice(CONFIG_DONE, device); |
| 65 | 73 | } |
| 66 | 74 | |
| 75 | + private static ArrayList<Device> hubs; | |
| 76 | + | |
| 77 | + public static ArrayList<Device> getHubs() { | |
| 78 | + if (hubs == null) { | |
| 79 | + hubs = new ArrayList<>(); | |
| 80 | + } | |
| 81 | + return hubs; | |
| 82 | + } | |
| 83 | + | |
| 84 | + private static ArrayList<SubDevice> subDevices; | |
| 85 | + | |
| 86 | + public static ArrayList<SubDevice> getSubDevices() { | |
| 87 | + if (subDevices == null) { | |
| 88 | + subDevices = new ArrayList<>(); | |
| 89 | + } | |
| 90 | + return subDevices; | |
| 91 | + } | |
| 92 | + | |
| 67 | 93 | private static void online(Device device, String jsonDevice) { |
| 68 | - Realm realm = Realm.getDefaultInstance(); | |
| 69 | -// Hub host = realm.where(Hub.class) | |
| 70 | -// .equalTo(Hub.Companion.getDEVICE_NUM(), device.getLongDeviceNum()).findFirst(); | |
| 71 | -// if (null != host) {//已存储,更新IP,查询子设备 | |
| 72 | -// realm.beginTransaction(); | |
| 73 | -// host.setIp(device.getIntDeviceIp()); | |
| 74 | -// host.setLAN(true); | |
| 75 | -// realm.commitTransaction(); | |
| 76 | -// FistJni.getInstance().query(jsonDevice); | |
| 77 | -// } | |
| 78 | - realm.close(); | |
| 94 | + boolean hasAdded = false; | |
| 95 | + for (Device device1 : getHubs()) { | |
| 96 | + if (Arrays.equals(device1.getDeviceIp(), device.getDeviceIp())) { | |
| 97 | + hasAdded = true; | |
| 98 | + } | |
| 99 | + } | |
| 100 | + if (!hasAdded) { | |
| 101 | + getHubs().add(device); | |
| 102 | + } | |
| 103 | + sendMessage(DEVICE_HUBS_ONLINE_NOTIFY, DEVICE_HUBS_ONLINE_NOTIFY_STR); | |
| 104 | + } | |
| 105 | + | |
| 106 | + private static void sendMessage(int type, String typeStr) { | |
| 107 | + MessageEvent messageEvent = new MessageEvent(); | |
| 108 | + messageEvent.setEventId(type); | |
| 109 | + messageEvent.setMessage(typeStr); | |
| 110 | + EventBus.getDefault().post(messageEvent); | |
| 79 | 111 | } |
| 80 | 112 | |
| 81 | 113 | private static void saveRemote(Device device) { |
| ... | ... | @@ -135,7 +167,7 @@ public class FistJni { |
| 135 | 167 | } |
| 136 | 168 | if (FistProtocol.CommondType.CMD_TYPE_SEARCH_RESPONSE == cmdTpye) {//查询响应 |
| 137 | 169 | removeId(device); |
| 138 | -// online(device, jsonDevice); | |
| 170 | + online(device, jsonDevice); | |
| 139 | 171 | sendJsonDevice(SEARCH_RESPONSE, device); |
| 140 | 172 | |
| 141 | 173 | } else if (FistProtocol.CommondType.CMD_TYPE_CONFIG_DONE == cmdTpye) {//配置完成处理 |
| ... | ... | @@ -150,39 +182,8 @@ public class FistJni { |
| 150 | 182 | sendJsonDevice(ADD_DONE, device); |
| 151 | 183 | ArrayList<SubDevice> subDevices = device.getSubDevices(); |
| 152 | 184 | if (!subDevices.isEmpty()) {//查询结果不为空 |
| 153 | -// Realm realm = Realm.getDefaultInstance(); | |
| 154 | -// long hostNum = device.getLongDeviceNum(); | |
| 155 | -// RealmResults<Hub> hubs = realm.where(Hub.class) | |
| 156 | -// .equalTo(Hub.Companion.getDEVICE_NUM(), hostNum) | |
| 157 | -// .notEqualTo(Transform.Companion.getSYNC_CODE(), SyncState.DELETE.ordinal()).findAll(); | |
| 158 | -// if (!hubs.isEmpty()) { | |
| 159 | -// int subSize = subDevices.size(); | |
| 160 | -// for (int i = 0; i < subSize; i++) { | |
| 161 | -// SubDevice subDevice = subDevices.get(i); | |
| 162 | -// long subDeviceNum = subDevice.getSubDeviceNum(); | |
| 163 | -// RealmResults<SwSubDev> swSubDevs = realm.where(SwSubDev.class) | |
| 164 | -// .equalTo(SwSubDev.Companion.getHOST_NUM(), hostNum) | |
| 165 | -// .equalTo(SwSubDev.Companion.getPARENT_NUM(), subDeviceNum) | |
| 166 | -// .findAll(); | |
| 167 | -// if (!swSubDevs.isEmpty()) {//数据库已存储 | |
| 168 | -// int lightingSize = swSubDevs.size(); | |
| 169 | -// byte lingtingState = (byte) subDevice.getSubDeviceStatus(); | |
| 170 | -// for (int j = 0; j < lightingSize; j++) {//更新开关状态 | |
| 171 | -// SwSubDev lighting = swSubDevs.get(j); | |
| 172 | -// realm.beginTransaction(); | |
| 173 | -// byte currentState = (byte) (lingtingState >> lighting.getDeviceNum() & 1); | |
| 174 | -// if (0 == currentState) { | |
| 175 | -// lighting.setOn(false); | |
| 176 | -// } else { | |
| 177 | -// lighting.setOn(true); | |
| 178 | -// } | |
| 179 | -// realm.commitTransaction(); | |
| 180 | -// } | |
| 181 | -// } | |
| 182 | -// } | |
| 183 | -// } | |
| 184 | - | |
| 185 | -// realm.close(); | |
| 185 | + getSubDevices().addAll(subDevices); | |
| 186 | + sendMessage(DEVICE_SWITCH_ONLINE_NOTIFY, DEVICE_SWITCH_ONLINE_NOTIFY_STR); | |
| 186 | 187 | } |
| 187 | 188 | // sendJsonDevice(LightingGroupAdapter.REFRESH, device); |
| 188 | 189 | |
| ... | ... | @@ -306,7 +307,7 @@ public class FistJni { |
| 306 | 307 | }.execute(); |
| 307 | 308 | } |
| 308 | 309 | |
| 309 | - public void query( ) { | |
| 310 | + public void query() { | |
| 310 | 311 | // if (!HeService.isConn()) { |
| 311 | 312 | // return; |
| 312 | 313 | // } | ... | ... |
| ... | ... | @@ -6,7 +6,6 @@ import android.view.View; |
| 6 | 6 | import com.adroplat.fist_switch.jni.FistJni; |
| 7 | 7 | |
| 8 | 8 | public class MainActivity extends AppCompatActivity { |
| 9 | - | |
| 10 | 9 | @Override |
| 11 | 10 | protected void onCreate(Bundle savedInstanceState) { |
| 12 | 11 | super.onCreate(savedInstanceState); |
| ... | ... | @@ -43,7 +42,7 @@ public class MainActivity extends AppCompatActivity { |
| 43 | 42 | fistJni.startSdk(); |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | - public void searchLocalDevice(View view){ | |
| 45 | + public void searchLocalDevice(View view) { | |
| 47 | 46 | FistJni fistJni = FistJni.getInstance(); |
| 48 | 47 | fistJni.searchLocalDevice(); |
| 49 | 48 | } |
| ... | ... | @@ -53,12 +52,16 @@ public class MainActivity extends AppCompatActivity { |
| 53 | 52 | FistJni fistJni = FistJni.getInstance(); |
| 54 | 53 | fistJni.query(); |
| 55 | 54 | } |
| 55 | + | |
| 56 | + | |
| 56 | 57 | public void normalC1(View view) { |
| 57 | 58 | FistJni fistJni = FistJni.getInstance(); |
| 58 | 59 | fistJni.normalC("{\"CmdType\":32,\"ErrorCode\":0,\"DeviceIp\":[192,168,31,163],\"DeviceNum\":[255,255,255,255,0,255],\"DeviceKey\":[120,56,53,98,97,117],\"DevicePort\":9000,\"MappedIp\":[0,0,0,0],\"MappedPort\":0,\"SubDevices\":[{\"SubDeviceNum\":4294967151,\"SubDeviceType\":33,\"SubDeviceStatus\":1,\"SubDeviceOnlineStatus\":0,\"SubDeviceBit\":0}]}"); |
| 59 | 60 | } |
| 61 | + | |
| 60 | 62 | public void normalC(View view) { |
| 61 | 63 | FistJni fistJni = FistJni.getInstance(); |
| 62 | 64 | fistJni.normalC("{\"CmdType\":32,\"ErrorCode\":0,\"DeviceIp\":[192,168,31,163],\"DeviceNum\":[255,255,255,255,0,255],\"DeviceKey\":[120,56,53,98,97,117],\"DevicePort\":9000,\"MappedIp\":[0,0,0,0],\"MappedPort\":0,\"SubDevices\":[{\"SubDeviceNum\":4294967151,\"SubDeviceType\":33,\"SubDeviceStatus\":0,\"SubDeviceOnlineStatus\":0,\"SubDeviceBit\":0}]}"); |
| 63 | 65 | } |
| 66 | + | |
| 64 | 67 | } | ... | ... |
| 1 | 1 | package com.qnbar.switchcontrol; |
| 2 | 2 | |
| 3 | +import android.graphics.Rect; | |
| 3 | 4 | import android.os.Bundle; |
| 4 | -import android.support.design.widget.FloatingActionButton; | |
| 5 | -import android.support.design.widget.Snackbar; | |
| 6 | 5 | import android.support.v7.app.AppCompatActivity; |
| 7 | -import android.support.v7.widget.Toolbar; | |
| 6 | +import android.support.v7.widget.GridLayoutManager; | |
| 7 | +import android.support.v7.widget.RecyclerView; | |
| 8 | +import android.util.Log; | |
| 8 | 9 | import android.view.View; |
| 10 | +import com.adroplat.fist_switch.jni.Device; | |
| 9 | 11 | import com.adroplat.fist_switch.jni.FistJni; |
| 12 | +import com.adroplat.fist_switch.jni.SubDevice; | |
| 13 | +import com.google.gson.Gson; | |
| 14 | +import com.qnbar.switchcontrol.adapter.DeviceListAdapter; | |
| 15 | +import com.qnbar.switchcontrol.adapter.SwitchListAdapter; | |
| 16 | +import com.qnbar.switchcontrol.model.MessageEvent; | |
| 17 | +import org.greenrobot.eventbus.EventBus; | |
| 18 | +import org.greenrobot.eventbus.Subscribe; | |
| 19 | +import org.greenrobot.eventbus.ThreadMode; | |
| 10 | 20 | |
| 11 | 21 | public class SwitchControlActivity extends AppCompatActivity { |
| 12 | 22 | |
| ... | ... | @@ -14,8 +24,12 @@ public class SwitchControlActivity extends AppCompatActivity { |
| 14 | 24 | protected void onCreate(Bundle savedInstanceState) { |
| 15 | 25 | super.onCreate(savedInstanceState); |
| 16 | 26 | setContentView(R.layout.activity_switch_control); |
| 17 | - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
| 18 | - setSupportActionBar(toolbar); | |
| 27 | + EventBus.getDefault().register(this); | |
| 28 | + | |
| 29 | + //TODO EventBus,List of Hub,List of Lights | |
| 30 | +// Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
| 31 | +// setSupportActionBar(toolbar); | |
| 32 | + initList(); | |
| 19 | 33 | FistJni fistJni = FistJni.getInstance(); |
| 20 | 34 | fistJni.startSdk(); |
| 21 | 35 | searchLocalDevice(); |
| ... | ... | @@ -23,17 +37,17 @@ public class SwitchControlActivity extends AppCompatActivity { |
| 23 | 37 | getSupportActionBar().setTitle("智能开关控制"); |
| 24 | 38 | } |
| 25 | 39 | |
| 26 | - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
| 27 | - fab.setOnClickListener(new View.OnClickListener() { | |
| 28 | - @Override | |
| 29 | - public void onClick(View view) { | |
| 30 | - Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | |
| 31 | - .setAction("Action", null).show(); | |
| 32 | - } | |
| 33 | - }); | |
| 40 | +// FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
| 41 | +// fab.setOnClickListener(new View.OnClickListener() { | |
| 42 | +// @Override | |
| 43 | +// public void onClick(View view) { | |
| 44 | +// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | |
| 45 | +// .setAction("Action", null).show(); | |
| 46 | +// } | |
| 47 | +// }); | |
| 34 | 48 | } |
| 35 | 49 | |
| 36 | - public void searchLocalDevice(){ | |
| 50 | + public void searchLocalDevice() { | |
| 37 | 51 | FistJni fistJni = FistJni.getInstance(); |
| 38 | 52 | fistJni.searchLocalDevice(); |
| 39 | 53 | } |
| ... | ... | @@ -53,4 +67,94 @@ public class SwitchControlActivity extends AppCompatActivity { |
| 53 | 67 | fistJni.normalC("{\"CmdType\":32,\"ErrorCode\":0,\"DeviceIp\":[192,168,31,163],\"DeviceNum\":[255,255,255,255,0,255],\"DeviceKey\":[120,56,53,98,97,117],\"DevicePort\":9000,\"MappedIp\":[0,0,0,0],\"MappedPort\":0,\"SubDevices\":[{\"SubDeviceNum\":4294967151,\"SubDeviceType\":33,\"SubDeviceStatus\":0,\"SubDeviceOnlineStatus\":0,\"SubDeviceBit\":0}]}"); |
| 54 | 68 | } |
| 55 | 69 | |
| 70 | + DeviceListAdapter hubAdapter; | |
| 71 | + SwitchListAdapter switchAdapter; | |
| 72 | + RecyclerView hubRv; | |
| 73 | + RecyclerView switchRv; | |
| 74 | + | |
| 75 | + void initList() { | |
| 76 | + hubRv = (RecyclerView) findViewById(R.id.hubsRv); | |
| 77 | + hubAdapter = new DeviceListAdapter(); | |
| 78 | + | |
| 79 | + GridLayoutManager layoutManager = new /*Focus*/GridLayoutManager(this, 5); | |
| 80 | + GridLayoutManager layoutManager2 = new /*Focus*/GridLayoutManager(this, 5); | |
| 81 | + hubRv.setLayoutManager(layoutManager); | |
| 82 | + hubRv.addItemDecoration(new MovieItemDecoration()); | |
| 83 | + hubAdapter.setListener(new DeviceListAdapter.OnRecyclerViewItemClickListener() { | |
| 84 | + @Override | |
| 85 | + public void onItemClick(Device light, int position) { | |
| 86 | + FistJni fistJni = FistJni.getInstance(); | |
| 87 | + fistJni.query(new Gson().toJson(light)); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @Override | |
| 91 | + public void onLongClick(Device light, int position) { | |
| 92 | + | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Override | |
| 96 | + public void onMenuClick(View v, int position) { | |
| 97 | + | |
| 98 | + } | |
| 99 | + }); | |
| 100 | + hubRv.setAdapter(hubAdapter); | |
| 101 | + hubRv.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); | |
| 102 | + | |
| 103 | + | |
| 104 | + switchAdapter = new SwitchListAdapter(); | |
| 105 | + switchRv = (RecyclerView) findViewById(R.id.switchRv); | |
| 106 | + | |
| 107 | + switchRv.setLayoutManager(layoutManager2); | |
| 108 | + switchRv.addItemDecoration(new MovieItemDecoration()); | |
| 109 | + switchAdapter.setListener(new SwitchListAdapter.OnRecyclerViewItemClickListener() { | |
| 110 | + @Override | |
| 111 | + public void onItemClick(SubDevice light, int position) { | |
| 112 | + | |
| 113 | + } | |
| 114 | + | |
| 115 | + @Override | |
| 116 | + public void onLongClick(SubDevice light, int position) { | |
| 117 | + | |
| 118 | + } | |
| 119 | + | |
| 120 | + @Override | |
| 121 | + public void onMenuClick(View v, int position) { | |
| 122 | + | |
| 123 | + } | |
| 124 | + }); | |
| 125 | + switchRv.setAdapter(switchAdapter); | |
| 126 | + switchRv.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); | |
| 127 | + } | |
| 128 | + | |
| 129 | + public class MovieItemDecoration extends RecyclerView.ItemDecoration { | |
| 130 | + @Override | |
| 131 | + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, | |
| 132 | + RecyclerView.State state) { | |
| 133 | + outRect.top = 40; | |
| 134 | + outRect.left = 15; | |
| 135 | + outRect.right = 15; | |
| 136 | + outRect.bottom = 40; | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 141 | + public void onMoonEvent(MessageEvent messageEvent) { | |
| 142 | + switch (messageEvent.getEventId()) { | |
| 143 | + case FistJni.DEVICE_HUBS_ONLINE_NOTIFY: | |
| 144 | + Log.d("switch", messageEvent.getMessage()); | |
| 145 | + hubAdapter.notifyDataSetChanged(); | |
| 146 | + break; | |
| 147 | + | |
| 148 | + case FistJni.DEVICE_SWITCH_ONLINE_NOTIFY: | |
| 149 | + Log.d("switch", messageEvent.getMessage()); | |
| 150 | + switchAdapter.notifyDataSetChanged(); | |
| 151 | + break; | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + @Override | |
| 156 | + protected void onDestroy() { | |
| 157 | + super.onDestroy(); | |
| 158 | + EventBus.getDefault().unregister(this); | |
| 159 | + } | |
| 56 | 160 | } | ... | ... |
| 1 | +/* | |
| 2 | + * Copyright 2017 wugian | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +package com.qnbar.switchcontrol.adapter; | |
| 18 | + | |
| 19 | +import android.graphics.Color; | |
| 20 | +import android.support.v7.widget.RecyclerView; | |
| 21 | +import android.util.Log; | |
| 22 | +import android.view.KeyEvent; | |
| 23 | +import android.view.LayoutInflater; | |
| 24 | +import android.view.View; | |
| 25 | +import android.view.ViewGroup; | |
| 26 | +import android.widget.TextView; | |
| 27 | +import com.adroplat.fist_switch.jni.Device; | |
| 28 | +import com.adroplat.fist_switch.jni.FistJni; | |
| 29 | +import com.qnbar.switchcontrol.R; | |
| 30 | + | |
| 31 | +public class DeviceListAdapter extends RecyclerView.Adapter<DeviceListAdapter.DeviceHolder> | |
| 32 | + implements View.OnClickListener, View.OnLongClickListener { | |
| 33 | + | |
| 34 | + OnRecyclerViewItemClickListener listener; | |
| 35 | + | |
| 36 | + public void setListener(OnRecyclerViewItemClickListener listener) { | |
| 37 | + this.listener = listener; | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public DeviceHolder onCreateViewHolder(ViewGroup parent, | |
| 42 | + int viewType) { | |
| 43 | + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.hub_item, parent, false); | |
| 44 | + view.setFocusable(true); | |
| 45 | + view.setFocusableInTouchMode(true); | |
| 46 | + view.setOnClickListener(this); | |
| 47 | + view.setOnLongClickListener(this); | |
| 48 | + view.setOnFocusChangeListener(new View.OnFocusChangeListener() { | |
| 49 | + @Override | |
| 50 | + public void onFocusChange(View v, boolean hasFocus) { | |
| 51 | + if (hasFocus) { | |
| 52 | + v.setBackgroundColor(Color.GRAY); | |
| 53 | + } else { | |
| 54 | + v.setBackgroundColor(Color.TRANSPARENT); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + }); | |
| 58 | + view.setOnKeyListener(new View.OnKeyListener() { | |
| 59 | + @Override | |
| 60 | + public boolean onKey(View view, int keycode, KeyEvent keyEvent) { | |
| 61 | + if (keycode == KeyEvent.KEYCODE_MENU && keyEvent.getAction() == KeyEvent.ACTION_UP) { | |
| 62 | + Log.d("menu", "onKey: key menu"); | |
| 63 | + if (listener != null) { | |
| 64 | + listener.onMenuClick(view, (Integer) view.getTag()); | |
| 65 | + } | |
| 66 | + return true; | |
| 67 | + } | |
| 68 | + return false; | |
| 69 | + } | |
| 70 | + }); | |
| 71 | + return new DeviceHolder(view); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 75 | + public void onBindViewHolder(DeviceHolder holder, int position) { | |
| 76 | + int size = FistJni.getHubs().size(); | |
| 77 | + if (position > size - 1 && size != 0) { | |
| 78 | + position = 0; | |
| 79 | + } | |
| 80 | + holder.itemView.setTag(position); | |
| 81 | + Device light = FistJni.getHubs().get(position); | |
| 82 | + holder.render(light); | |
| 83 | +// RelativeLayout item = (RelativeLayout) | |
| 84 | +// holder.itemView.findViewById(R.id.root); | |
| 85 | +// ViewGroup.LayoutParams layoutParams = item.getLayoutParams(); | |
| 86 | +// layoutParams.width = itemWidth; | |
| 87 | +// layoutParams.height = itemHeight; | |
| 88 | +// item.setLayoutParams(layoutParams); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @Override | |
| 92 | + public int getItemCount() { | |
| 93 | + return FistJni.getHubs().size()/* == 0 ? 0 : Lights.getInstance().size() + 2*/; | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Override | |
| 97 | + public long getItemId(int position) { | |
| 98 | + return position; | |
| 99 | + } | |
| 100 | + | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public void onClick(View v) { | |
| 104 | + if (listener != null) { | |
| 105 | + Integer tag = (Integer) v.getTag(); | |
| 106 | + listener.onItemClick(FistJni.getHubs().get(tag), tag); | |
| 107 | + } | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Override | |
| 111 | + public boolean onLongClick(View v) { | |
| 112 | + if (listener != null) { | |
| 113 | + Integer tag = (Integer) v.getTag(); | |
| 114 | + listener.onLongClick(FistJni.getHubs().get(tag), tag); | |
| 115 | + return true; | |
| 116 | + } | |
| 117 | + return false; | |
| 118 | + } | |
| 119 | + | |
| 120 | + class DeviceHolder extends RecyclerView.ViewHolder { | |
| 121 | + | |
| 122 | + TextView deviceNumTv; | |
| 123 | + TextView deviceIp; | |
| 124 | + TextView deviceKey; | |
| 125 | + | |
| 126 | + DeviceHolder(View v) { | |
| 127 | + super(v); | |
| 128 | + deviceNumTv = (TextView) v.findViewById(R.id.deviceNumTv); | |
| 129 | + deviceIp = (TextView) v.findViewById(R.id.deviceIp); | |
| 130 | + deviceKey = (TextView) v.findViewById(R.id.deviceKey); | |
| 131 | + } | |
| 132 | + | |
| 133 | + void render(Device light) { | |
| 134 | + deviceNumTv.setText(light.getLongDeviceNum() + ""); | |
| 135 | + deviceIp.setText(light.getStringDeviceIp()); | |
| 136 | + deviceKey.setText(light.getDeviceStrKey()); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + | |
| 140 | + public interface OnRecyclerViewItemClickListener { | |
| 141 | + void onItemClick(Device light, int position); | |
| 142 | + | |
| 143 | + void onLongClick(Device light, int position); | |
| 144 | + | |
| 145 | + void onMenuClick(View v, int position); | |
| 146 | + } | |
| 147 | +} | ... | ... |
| 1 | +/* | |
| 2 | + * Copyright 2017 wugian | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +package com.qnbar.switchcontrol.adapter; | |
| 18 | + | |
| 19 | +import android.graphics.Color; | |
| 20 | +import android.support.v7.widget.RecyclerView; | |
| 21 | +import android.util.Log; | |
| 22 | +import android.view.KeyEvent; | |
| 23 | +import android.view.LayoutInflater; | |
| 24 | +import android.view.View; | |
| 25 | +import android.view.ViewGroup; | |
| 26 | +import android.widget.TextView; | |
| 27 | +import com.adroplat.fist_switch.jni.FistJni; | |
| 28 | +import com.adroplat.fist_switch.jni.SubDevice; | |
| 29 | +import com.qnbar.switchcontrol.R; | |
| 30 | + | |
| 31 | +public class SwitchListAdapter extends RecyclerView.Adapter<SwitchListAdapter.DeviceHolder> | |
| 32 | + implements View.OnClickListener, View.OnLongClickListener { | |
| 33 | + | |
| 34 | + OnRecyclerViewItemClickListener listener; | |
| 35 | + | |
| 36 | + public void setListener(OnRecyclerViewItemClickListener listener) { | |
| 37 | + this.listener = listener; | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public DeviceHolder onCreateViewHolder(ViewGroup parent, | |
| 42 | + int viewType) { | |
| 43 | + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.switch_item, parent, false); | |
| 44 | + view.setFocusable(true); | |
| 45 | + view.setFocusableInTouchMode(true); | |
| 46 | + view.setOnClickListener(this); | |
| 47 | + view.setOnLongClickListener(this); | |
| 48 | + view.setOnFocusChangeListener(new View.OnFocusChangeListener() { | |
| 49 | + @Override | |
| 50 | + public void onFocusChange(View v, boolean hasFocus) { | |
| 51 | + if (hasFocus) { | |
| 52 | + v.setBackgroundColor(Color.GRAY); | |
| 53 | + } else { | |
| 54 | + v.setBackgroundColor(Color.TRANSPARENT); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + }); | |
| 58 | + view.setOnKeyListener(new View.OnKeyListener() { | |
| 59 | + @Override | |
| 60 | + public boolean onKey(View view, int keycode, KeyEvent keyEvent) { | |
| 61 | + if (keycode == KeyEvent.KEYCODE_MENU && keyEvent.getAction() == KeyEvent.ACTION_UP) { | |
| 62 | + Log.d("menu", "onKey: key menu"); | |
| 63 | + if (listener != null) { | |
| 64 | + listener.onMenuClick(view, (Integer) view.getTag()); | |
| 65 | + } | |
| 66 | + return true; | |
| 67 | + } | |
| 68 | + return false; | |
| 69 | + } | |
| 70 | + }); | |
| 71 | + return new DeviceHolder(view); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 75 | + public void onBindViewHolder(DeviceHolder holder, int position) { | |
| 76 | +// int size = FistJni.getSubDevices().size(); | |
| 77 | +// if (position > size - 1 && size != 0) { | |
| 78 | +// position = 0; | |
| 79 | +// } | |
| 80 | + holder.itemView.setTag(position); | |
| 81 | + SubDevice light = FistJni.getSubDevices().get(position); | |
| 82 | + holder.render(light); | |
| 83 | +// RelativeLayout item = (RelativeLayout) | |
| 84 | +// holder.itemView.findViewById(R.id.root); | |
| 85 | +// ViewGroup.LayoutParams layoutParams = item.getLayoutParams(); | |
| 86 | +// layoutParams.width = itemWidth; | |
| 87 | +// layoutParams.height = itemHeight; | |
| 88 | +// item.setLayoutParams(layoutParams); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @Override | |
| 92 | + public int getItemCount() { | |
| 93 | + return FistJni.getSubDevices().size()/* == 0 ? 0 : Lights.getInstance().size() + 2*/; | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Override | |
| 97 | + public long getItemId(int position) { | |
| 98 | + return position; | |
| 99 | + } | |
| 100 | + | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public void onClick(View v) { | |
| 104 | + if (listener != null) { | |
| 105 | + Integer tag = (Integer) v.getTag(); | |
| 106 | + listener.onItemClick(FistJni.getSubDevices().get(tag), tag); | |
| 107 | + } | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Override | |
| 111 | + public boolean onLongClick(View v) { | |
| 112 | + if (listener != null) { | |
| 113 | + Integer tag = (Integer) v.getTag(); | |
| 114 | + listener.onLongClick(FistJni.getSubDevices().get(tag), tag); | |
| 115 | + return true; | |
| 116 | + } | |
| 117 | + return false; | |
| 118 | + } | |
| 119 | + | |
| 120 | + class DeviceHolder extends RecyclerView.ViewHolder { | |
| 121 | + | |
| 122 | + TextView subDeviceNum; | |
| 123 | + TextView subDeviceStatus; | |
| 124 | + | |
| 125 | + DeviceHolder(View v) { | |
| 126 | + super(v); | |
| 127 | + subDeviceNum = (TextView) v.findViewById(R.id.subDeviceNum); | |
| 128 | + subDeviceStatus = (TextView) v.findViewById(R.id.subDeviceStatus); | |
| 129 | + } | |
| 130 | + | |
| 131 | + void render(SubDevice light) { | |
| 132 | + subDeviceNum.setText(light.getSubDeviceNum() + ""); | |
| 133 | + subDeviceStatus.setText(light.getSubDeviceOnlineStatus() + ""); | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + public interface OnRecyclerViewItemClickListener { | |
| 138 | + void onItemClick(SubDevice light, int position); | |
| 139 | + | |
| 140 | + void onLongClick(SubDevice light, int position); | |
| 141 | + | |
| 142 | + void onMenuClick(View v, int position); | |
| 143 | + } | |
| 144 | +} | ... | ... |
| 1 | +package com.qnbar.switchcontrol.model; | |
| 2 | + | |
| 3 | +public class MessageEvent { | |
| 4 | + private int eventId; | |
| 5 | + private String message; | |
| 6 | + | |
| 7 | + public int getEventId() { | |
| 8 | + return eventId; | |
| 9 | + } | |
| 10 | + | |
| 11 | + public void setEventId(int eventId) { | |
| 12 | + this.eventId = eventId; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public String getMessage() { | |
| 16 | + return message; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setMessage(String message) { | |
| 20 | + this.message = message; | |
| 21 | + } | |
| 22 | +} | |
| \ No newline at end of file | ... | ... |
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<android.support.design.widget.CoordinatorLayout | |
| 2 | +<LinearLayout | |
| 3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | - xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 5 | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 6 | 6 | android:layout_width="match_parent" |
| 7 | 7 | android:layout_height="match_parent" |
| 8 | + android:padding="16dp" | |
| 9 | + android:orientation="vertical" | |
| 10 | + app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
| 11 | + tools:showIn="@layout/activity_switch_control" | |
| 8 | 12 | tools:context="com.qnbar.switchcontrol.SwitchControlActivity"> |
| 9 | 13 | |
| 10 | - <android.support.design.widget.AppBarLayout | |
| 11 | - android:layout_height="wrap_content" | |
| 12 | - android:layout_width="match_parent" | |
| 13 | - android:theme="@style/AppTheme.AppBarOverlay"> | |
| 14 | - | |
| 15 | - <android.support.v7.widget.Toolbar | |
| 16 | - android:id="@+id/toolbar" | |
| 17 | - android:layout_width="match_parent" | |
| 18 | - android:layout_height="?attr/actionBarSize" | |
| 19 | - android:background="?attr/colorPrimary" | |
| 20 | - app:popupTheme="@style/AppTheme.PopupOverlay"/> | |
| 14 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
| 15 | + android:text="主机" android:textSize="20sp"/> | |
| 21 | 16 | |
| 22 | - </android.support.design.widget.AppBarLayout> | |
| 17 | + <android.support.v7.widget.RecyclerView | |
| 18 | + android:id="@+id/hubsRv" | |
| 19 | + android:layout_marginTop="15dp" | |
| 20 | + android:layout_width="match_parent" | |
| 21 | + android:layout_height="wrap_content" | |
| 22 | + android:layout_alignParentStart="true" | |
| 23 | + android:layout_below="@+id/button"/> | |
| 23 | 24 | |
| 24 | - <include layout="@layout/content_switch_control"/> | |
| 25 | + <TextView android:layout_width="wrap_content" | |
| 26 | + android:layout_height="wrap_content" | |
| 27 | + android:layout_marginTop="30dp" | |
| 28 | + android:text="开关" | |
| 29 | + android:textSize="20sp"/> | |
| 25 | 30 | |
| 26 | - <android.support.design.widget.FloatingActionButton | |
| 27 | - android:id="@+id/fab" | |
| 28 | - android:layout_width="wrap_content" | |
| 31 | + <android.support.v7.widget.RecyclerView | |
| 32 | + android:id="@+id/switchRv" | |
| 33 | + android:layout_marginTop="15dp" | |
| 34 | + android:layout_width="match_parent" | |
| 29 | 35 | android:layout_height="wrap_content" |
| 30 | - android:layout_gravity="bottom|end" | |
| 31 | - android:layout_margin="@dimen/fab_margin" | |
| 32 | - app:srcCompat="@android:drawable/ic_dialog_email"/> | |
| 36 | + android:layout_alignParentStart="true" | |
| 37 | + android:layout_below="@+id/button"/> | |
| 33 | 38 | |
| 34 | -</android.support.design.widget.CoordinatorLayout> | |
| 39 | +</LinearLayout> | ... | ... |
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<android.support.constraint.ConstraintLayout | |
| 2 | +<LinearLayout | |
| 3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | 4 | xmlns:tools="http://schemas.android.com/tools" |
| 5 | 5 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 6 | 6 | android:layout_width="match_parent" |
| 7 | 7 | android:layout_height="match_parent" |
| 8 | + android:padding="16dp" | |
| 8 | 9 | app:layout_behavior="@string/appbar_scrolling_view_behavior" |
| 9 | 10 | tools:showIn="@layout/activity_switch_control" |
| 10 | 11 | tools:context="com.qnbar.switchcontrol.SwitchControlActivity"> |
| 11 | -</android.support.constraint.ConstraintLayout> | |
| 12 | + | |
| 13 | + <android.support.v7.widget.RecyclerView | |
| 14 | + android:id="@+id/hubsRv" | |
| 15 | + android:layout_width="match_parent" | |
| 16 | + android:layout_height="wrap_content" | |
| 17 | + android:layout_alignParentStart="true" | |
| 18 | + android:layout_below="@+id/button" /> | |
| 19 | + | |
| 20 | +</LinearLayout> | ... | ... |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="match_parent" | |
| 4 | + android:padding="5dp" | |
| 5 | + android:layout_height="match_parent" | |
| 6 | + android:orientation="vertical" | |
| 7 | +> | |
| 8 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
| 9 | + android:id="@+id/deviceNumTv" | |
| 10 | + android:textSize="16sp" | |
| 11 | + android:textColor="@android:color/black" | |
| 12 | + android:text="device num" | |
| 13 | + /> | |
| 14 | + | |
| 15 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
| 16 | + android:id="@+id/deviceIp" | |
| 17 | + android:text="device ip" | |
| 18 | + android:textSize="16sp" | |
| 19 | + android:textColor="@android:color/black" | |
| 20 | + android:layout_marginTop="4dp" | |
| 21 | + /> | |
| 22 | + | |
| 23 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
| 24 | + android:id="@+id/deviceKey" | |
| 25 | + android:layout_marginTop="4dp" | |
| 26 | + android:textSize="16sp" | |
| 27 | + android:textColor="@android:color/black" | |
| 28 | + android:text="device key" | |
| 29 | + /> | |
| 30 | + | |
| 31 | +</LinearLayout> | ... | ... |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="match_parent" | |
| 4 | + android:padding="5dp" | |
| 5 | + android:layout_height="match_parent" | |
| 6 | + android:orientation="vertical" | |
| 7 | +> | |
| 8 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
| 9 | + android:id="@+id/subDeviceNum" | |
| 10 | + android:textSize="16sp" | |
| 11 | + android:textColor="@android:color/black" | |
| 12 | + android:text="SubDeviceNum" | |
| 13 | + /> | |
| 14 | + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" | |
| 15 | + android:id="@+id/subDeviceStatus" | |
| 16 | + android:textSize="16sp" | |
| 17 | + android:layout_marginTop="4dp" | |
| 18 | + android:textColor="@android:color/black" | |
| 19 | + android:text="SubDeviceStatus" | |
| 20 | + /> | |
| 21 | + | |
| 22 | + | |
| 23 | +</LinearLayout> | ... | ... |
Please
register
or
login
to post a comment