Skip to content

Commit

Permalink
add: 增加设备zRGBW图标
Browse files Browse the repository at this point in the history
fix: 优化帮助/关于页面按钮显示
add: 设备配对页面增加设备对应的文档跳转
版本号: v1.7.1
  • Loading branch information
a2633063 committed Oct 14, 2020
1 parent fbd7f62 commit a6b9527
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 83 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
minSdkVersion 21
targetSdkVersion 28
versionCode 47
versionName "v1.7.0"
versionName "v1.7.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
18 changes: 18 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.zyc.zcontrol",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 47,
"versionName": "v1.7.1",
"outputFile": "app-release.apk"
}
]
}
64 changes: 24 additions & 40 deletions app/src/main/java/com/zyc/zcontrol/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
Expand Down Expand Up @@ -846,46 +847,29 @@ public void onClick(View v) {
}
});
//endregion
//region zTC1页面跳转
popupView.findViewById(R.id.btn_ztc1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://github.com/a2633063/zTC1/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
//endregion
//region zDC1页面跳转
popupView.findViewById(R.id.btn_zdc1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://github.com/a2633063/zDC1/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
//endregion
//region zA1页面跳转
popupView.findViewById(R.id.btn_za1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://github.com/a2633063/zA1/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
//endregion
//region zM1页面跳转
popupView.findViewById(R.id.btn_zm1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://github.com/a2633063/zM1/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
//endregion

LinearLayout ll=popupView.findViewById(R.id.ll);

for(int i=0;i<Device.TYPE_COUNT;i++) {
Button b = new Button(this);
// b.setBackground(null);
// b.setTextColor(0xa0ffffff);
// b.setBackgroundResource(R.drawable.background_gray_borders);
b.setAllCaps(false);
b.setText(Device.TypeName[i]+"文档");
final String TypeUri=Device.TypeUri[i];
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "打开文档:"+TypeUri, Toast.LENGTH_SHORT).show();
Uri uri = Uri.parse(TypeUri);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
ll.addView(b);
}

//region window初始化
window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.alpha(0xffff0000)));
window.setOutsideTouchable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.net.nsd.NsdManager;
import android.net.nsd.NsdServiceInfo;
import android.os.Bundle;
Expand All @@ -25,6 +26,7 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.zyc.zcontrol.MainActivity;
import com.zyc.zcontrol.MainApplication;
import com.zyc.zcontrol.R;
import com.zyc.zcontrol.deviceItem.DeviceClass.Device;
Expand All @@ -33,6 +35,7 @@
import java.util.List;

import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TYPE_COUNT;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TypeUri;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.Type_Icon;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TYPE_UNKNOWN;
import static com.zyc.zcontrol.deviceItem.DeviceClass.Device.TypeName;
Expand Down Expand Up @@ -356,6 +359,7 @@ public View getView(int position1, View convertView, ViewGroup parent) {

holder.tv = convertView.findViewById(R.id.textView);
holder.im = convertView.findViewById(R.id.imageView);
holder.im_help = convertView.findViewById(R.id.iv_help);


convertView.setTag(holder);
Expand All @@ -366,13 +370,23 @@ public View getView(int position1, View convertView, ViewGroup parent) {

holder.tv.setText(TypeName[position]);
holder.im.setImageResource(Type_Icon[position]);
holder.im_help.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Toast.makeText(MainActivity.this, "打开文档:"+TypeUri, Toast.LENGTH_SHORT).show();
Uri uri = Uri.parse(TypeUri[position]);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});

return convertView;
}

class ViewHolder {
ImageView im;
TextView tv;
ImageView im_help;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public class Device {
//设备名称
public final static String[] TypeName = new String[]{
"按键伴侣",//0
"智能排插zTC1",//1
"智能排插zDC1", //2
"空气净化器zA1", //3
"空气检测仪zM1", //4
"体重秤zS7/zS7pe", //5
"时钟", //6
"zTC1智能排插",//1
"zDC1智能排插", //2
"zA1空气净化器", //3
"zM1空气检测仪", //4
"zS7/zS7pe体重秤", //5
"zClock时钟", //6
"zMOPS插座", //7
"zRGBW灯", //8
};
Expand All @@ -67,7 +67,7 @@ public class Device {
R.drawable.device_icon_zs7,//5
R.drawable.device_icon_zclock,//6
R.drawable.device_icon_zmops,//7
R.drawable.device_icon_ongoing,//4
R.drawable.device_icon_zrgbw,//4
};

//设备对应配对页面
Expand Down
Binary file added app/src/main/res/drawable/device_icon_zrgbw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/res/layout/list_item_main_device_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,15 @@
android:text="test"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:layout_weight="1"
android:textSize="20dp" />

<ImageView
android:id="@+id/iv_help"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="16dp"
android:paddingEnd="32dp"
android:gravity="end"
app:srcCompat="@drawable/ic_help_outline_black_24dp" />
</LinearLayout>
41 changes: 6 additions & 35 deletions app/src/main/res/layout/popupwindow_main_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:addStatesFromChildren="false"
android:scrollbars="none">
android:padding="16dp"
android:scrollbars="vertical">

<LinearLayout
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff333333"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
android:padding="8dp">

<TextView
android:id="@+id/tv_title"
Expand Down Expand Up @@ -58,7 +60,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="当前APP支持的控制设备:\nzTC1(排插)|zDC1(排插)|zA1(空气净化器)|zM1(空气检测器)|按键伴侣\n\n本app开源地址:"
android:text="当前APP支持的控制设备:\nzTC1(排插)|zDC1(排插)|zA1(空气净化器)|zM1(空气检测器)|按键伴侣|zS7/zS7pe(体重秤)|zClock(数码管时钟)|zMOPS(插座)|zRGBW(灯泡)\n相关文档见下方按钮跳转\n本app开源地址:"
android:textSize="18dp" />

<TextView
Expand All @@ -71,8 +73,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textColor="@android:color/white"
android:text="\n支付宝打赏:(点击图片可直接跳转支付宝)\n"
android:textColor="@android:color/white"
android:textSize="18dp" />

<ImageView
Expand Down Expand Up @@ -101,38 +103,7 @@
android:layout_gravity="bottom"
android:text="app文档" />

<Button
android:id="@+id/btn_ztc1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="zTC1文档" />

<Button
android:id="@+id/btn_zdc1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="zDC1文档" />

<Button
android:id="@+id/btn_za1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="zA1文档" />
<Button
android:id="@+id/btn_zm1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="zM1文档" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:enabled="false"
android:text="按键伴侣文档" />
</LinearLayout>
</ScrollView>
</LinearLayout>

0 comments on commit a6b9527

Please sign in to comment.