Skip to content

Commit

Permalink
add: 各设备配对页面优化
Browse files Browse the repository at this point in the history
版本:v1.0.0
  • Loading branch information
a2633063 committed Mar 28, 2020
1 parent d176d3b commit fffeea6
Show file tree
Hide file tree
Showing 15 changed files with 1,279 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.zyc.zcontrol"
minSdkVersion 21
targetSdkVersion 28
versionCode 31
versionName "v0.14.0"
versionCode 32
versionName "v1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":31,"versionName":"v0.13.3","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":32,"versionName":"v1.0.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
15 changes: 14 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".deviceItem.m1.M1LinkActivity"
android:label="zM1配网" />
<activity
android:name=".deviceItem.a1.A1LinkActivity"
android:label="zA1配网" />
<activity
android:name=".DeviceSortActivity"
android:label="排序"></activity>
android:label="排序" />
<activity
android:name=".deviceItem.a1.A1PlugActivity"
android:label="插口" />
Expand Down Expand Up @@ -109,6 +114,14 @@
android:name="com.espressif.ESPtouchActivity"
android:label="添加设备"
android:screenOrientation="portrait" />
<activity
android:name=".deviceItem.tc1.TC1LinkActivity"
android:label="zTC1配网"
android:screenOrientation="portrait" />
<activity
android:name=".deviceItem.dc1.DC1LinkActivity"
android:label="zDC1配网"
android:screenOrientation="portrait" />
<activity
android:name="com.easylink.EasylinkActivity"
android:label="添加设备"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.easylink.EasylinkActivity;
import com.espressif.ESPtouchActivity;
import com.zyc.zcontrol.MainApplication;
import com.zyc.zcontrol.R;
import com.zyc.zcontrol.deviceItem.DeviceClass.Device;
Expand All @@ -36,7 +34,6 @@

import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TYPE_COUNT;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TYPE_ICON;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TYPE_TC1;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TypeName;


Expand Down Expand Up @@ -105,11 +102,12 @@ protected void onCreate(Bundle savedInstanceState) {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//TODO 配对页面设备点击逻辑处理
device_type = position;
Intent intent = new Intent(DeviceAddChoiceActivity.this, ESPtouchActivity.class);
if (device_type == TYPE_TC1) {
intent = new Intent(DeviceAddChoiceActivity.this, EasylinkActivity.class);
if (Device.LinkActivity[device_type] != null) {
Intent intent = new Intent(DeviceAddChoiceActivity.this, Device.LinkActivity[device_type]);
startActivityForResult(intent, 1);
} else {
Toast.makeText(DeviceAddChoiceActivity.this, "此设备无配对页面", Toast.LENGTH_SHORT).show();
}
startActivityForResult(intent, 1);
}
});
//endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
import androidx.annotation.DrawableRes;
import androidx.fragment.app.Fragment;

import com.espressif.ESPtouchActivity;
import com.zyc.zcontrol.R;
import com.zyc.zcontrol.deviceItem.a1.A1LinkActivity;
import com.zyc.zcontrol.deviceItem.dc1.DC1LinkActivity;
import com.zyc.zcontrol.deviceItem.m1.M1LinkActivity;
import com.zyc.zcontrol.deviceItem.tc1.TC1LinkActivity;


public class Device {
Expand Down Expand Up @@ -41,6 +46,18 @@ public class Device {
R.drawable.device_icon_ongoing,//5
R.drawable.device_icon_ongoing,//4
};


public final static Class LinkActivity[] =
{
ESPtouchActivity.class,
TC1LinkActivity.class,
DC1LinkActivity.class,
A1LinkActivity.class,
M1LinkActivity.class,
null,
null,
};
//endregion

protected int type = TYPE_UNKNOWN;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.zyc.zcontrol.deviceItem.a1;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MenuItem;

import com.zyc.zcontrol.R;

public class A1LinkActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_a1_link);

//region 顶部返回按钮
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
//endregion
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
this.finish();
return true;
}
return super.onOptionsItemSelected(item);
}

}
Loading

0 comments on commit fffeea6

Please sign in to comment.