atom
This commit is contained in:
@@ -16,13 +16,18 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.fisherbone.ContactsHelp;
|
||||
import com.fisherbone.fuzhu.BaseActivity;
|
||||
import com.fisherbone.fuzhu.ChangLiang;
|
||||
@@ -38,6 +43,8 @@ import com.fisherbone.fuzhu.db.DouyinBean;
|
||||
import com.fisherbone.fuzhu.db.dao.DouyinDao;
|
||||
import com.fisherbone.fuzhu.db.zhuanghaoBeanData;
|
||||
import com.fisherbone.fuzhu.dialog.BaseTipsDialog;
|
||||
import com.fisherbone.fuzhu.entity.DakaVideoBean;
|
||||
import com.fisherbone.fuzhu.entity.DeviceByDouyinBean;
|
||||
import com.fisherbone.fuzhu.entity.SettingBean;
|
||||
import com.fisherbone.fuzhu.entity.touchTaskBean;
|
||||
import com.fisherbone.fuzhu.okgonet.HttpConstants;
|
||||
@@ -53,7 +60,9 @@ import com.fisherbone.fuzhu.utils.SPUtils;
|
||||
import com.fisherbone.fuzhu.utils.SystemUtil;
|
||||
import com.fisherbone.fuzhu.utils.UpdateManager;
|
||||
import com.fisherbone.fuzhu.utils.VersionUtils;
|
||||
import com.fisherbone.fuzhu.utils.WidgetTools;
|
||||
import com.fisherbone.fuzhu.widget.TitleBar;
|
||||
import com.fisherbone.fuzhu.widget.streamlist.dataBean;
|
||||
import com.google.gson.Gson;
|
||||
import com.jeremyliao.liveeventbus.LiveEventBus;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
@@ -79,6 +88,7 @@ public class SettingActivity extends BaseActivity {
|
||||
private static final int REQUEST_QRCODE = 0x01;
|
||||
private UpdateManager mUpdateManager;//版本更新
|
||||
private DouyinDao douyinDao;
|
||||
private String selectType="1";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -145,7 +155,8 @@ public class SettingActivity extends BaseActivity {
|
||||
new BaseTipsDialog().showDownloadDialog(SettingActivity.this, "确认注销该设备吗?", "确定", new BaseTipsDialog.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
zhuxiao();
|
||||
String device_id = (String) SPUtils.getSp(SettingActivity.this, FZConfig.KEY_DEVICE_ID, "");
|
||||
zhuxiao(device_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -252,6 +263,41 @@ public class SettingActivity extends BaseActivity {
|
||||
public void click(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.rl_env:
|
||||
//设备是否注册
|
||||
// final HttpParams paramsPost = new HttpParams();
|
||||
// new NetApi().getPostData(paramsPost, HttpConstants.URi_device_Appoperate_checkDevice).subscribe(new com.fisherbone.fuzhu.okgonet.Observer<Response>() {
|
||||
// @Override
|
||||
// public void onNext(Response response) {
|
||||
// String body = (String) response.body();
|
||||
// try {
|
||||
// JSONObject jsonObject = new JSONObject(body);
|
||||
// String msg = jsonObject.getString("msg");
|
||||
// String success = jsonObject.getString("success");
|
||||
// if (VALUE_ZERO.equals(success)) {
|
||||
// com.fisherbone.fuzhu.utils.ToastUtils.showToast(SettingActivity.this, "已激活无需再次获取");
|
||||
// } else {
|
||||
// ArrayList<DouyinBean> douyinBeans = douyinDao.queryAll();
|
||||
// douyinDao.delete(douyinBeans);
|
||||
// if (AblUtil.isAccessibilityServiceOpen(SettingActivity.this)) {
|
||||
// AblStepHandler.getInstance().setStop(false);
|
||||
// AblStepHandler.sendMsg(AblSteps.STEP_50);
|
||||
// } else {
|
||||
// ToastUtils.showShort("请先开启辅助服务)))))))");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } catch (JSONException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
ArrayList<DouyinBean> douyinBeans = douyinDao.queryAll();
|
||||
douyinDao.delete(douyinBeans);
|
||||
if (AblUtil.isAccessibilityServiceOpen(SettingActivity.this)) {
|
||||
@@ -260,6 +306,7 @@ public class SettingActivity extends BaseActivity {
|
||||
} else {
|
||||
ToastUtils.showShort("请先开启辅助服务)))))))");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -391,6 +438,39 @@ public class SettingActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取要注销的设备id
|
||||
*/
|
||||
private void getDeviceByDouyin() {
|
||||
Gson gson = new Gson();
|
||||
ArrayList<DouyinBean> douyinBeans1 = douyinDao.queryAll();
|
||||
String s1 = gson.toJson(douyinBeans1);
|
||||
Log.e("提交的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}]
|
||||
String s = EmojiFilter.filterEmoji(s1);//去除字符串中包含的表情符号
|
||||
Log.e("提交的字符串(不包含表情符号)", s);
|
||||
TecentNetworkApi.getService(NewsApiInterface.class)
|
||||
.getDeviceByDouyin(s)
|
||||
.subscribe(new BaseObserver<DeviceByDouyinBean>() {
|
||||
@Override
|
||||
public void onSuccess(DeviceByDouyinBean urgentTaskBean) {
|
||||
String s1 = gson.toJson(urgentTaskBean);
|
||||
Log.e("jisdfsdfsdfsdf", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}]
|
||||
int success = urgentTaskBean.getSuccess();
|
||||
if (success == 0) {
|
||||
List<DeviceByDouyinBean.DataBean> data = urgentTaskBean.getData();
|
||||
SelectADialog selectADialog = new SelectADialog(SettingActivity.this, 0, data);
|
||||
selectADialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
Log.e("Error", "Message:" + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求最新版本号
|
||||
*/
|
||||
@@ -489,6 +569,123 @@ public class SettingActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SelectADialog extends Dialog implements View.OnClickListener {
|
||||
|
||||
private Context context;
|
||||
List<DeviceByDouyinBean.DataBean> data;
|
||||
|
||||
public SelectADialog(@NonNull Context context, @StyleRes int themeResId, List<DeviceByDouyinBean.DataBean> data) {
|
||||
super(context, themeResId);
|
||||
this.context = context;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
this.setContentView(R.layout.douyindevice_dialog);
|
||||
RecyclerView reply_rcey = findViewById(R.id.device_recy);
|
||||
TextView tvSexCancel = findViewById(R.id.tvSexCancel);
|
||||
TextView tvSexSend = findViewById(R.id.tvSexSend);
|
||||
tvSexCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
tvSexSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
DeviceByDouyinBean.DataBean dataBean = data.get(i);
|
||||
if (dataBean.getIf_sel_del().equals("1")) {
|
||||
String device_id = dataBean.getDevice_id();
|
||||
zhuxiao(device_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayoutManager manager = new LinearLayoutManager(SettingActivity.this);
|
||||
reply_rcey.setLayoutManager(manager);
|
||||
reply_rcey.setAdapter(new BaseQuickAdapter<DeviceByDouyinBean.DataBean, BaseViewHolder>(R.layout.item_reply_dialog, data) {
|
||||
@Override
|
||||
protected void convert(final BaseViewHolder helper, final DeviceByDouyinBean.DataBean item) {
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.img_modify), "", helper.getAdapterPosition()+1+"."+item.getDevice_name());
|
||||
ImageView ima_word = helper.getView(R.id.ima_word);
|
||||
if (item.getIf_sel_del().equals("0")) {
|
||||
ima_word.setImageResource(R.mipmap.icon_cheched_false);
|
||||
} else {
|
||||
ima_word.setImageResource(R.mipmap.icon_cheched_true);
|
||||
}
|
||||
helper.getView(R.id.ima_word).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//本次选择
|
||||
if (IsSelecet(helper.getAdapterPosition())) {
|
||||
cancalchoose(helper.getAdapterPosition());
|
||||
} else {
|
||||
//selectType 0为单选 1为多选
|
||||
if (selectType.equals("0")) {
|
||||
//先清除上次选中状态
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
DeviceByDouyinBean.DataBean dataBean = data.get(i);
|
||||
if (dataBean.getIf_sel_del().equals("1")) {
|
||||
cancalchoose(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
selecttrue(helper.getAdapterPosition());
|
||||
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中(单选)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void selecttrue(int position) {
|
||||
data.get(position).setIf_sel_del("1");
|
||||
}
|
||||
/**
|
||||
* 取消
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void cancalchoose(int childposition) {
|
||||
data.get(childposition).setIf_sel_del("0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前条目是否选中
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean IsSelecet(int childposition) {
|
||||
|
||||
if (data.get(childposition).getIf_sel_del().equals("1")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isHuaWei() {
|
||||
String manufacturer = Build.MANUFACTURER;
|
||||
//这个字符串可以自己定义,例如判断华为就填写huawei,魅族就填写meizu
|
||||
@@ -498,10 +695,11 @@ public class SettingActivity extends BaseActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void zhuxiao() {
|
||||
String device_id = (String) SPUtils.getSp(SettingActivity.this, FZConfig.KEY_DEVICE_ID, "");
|
||||
private void zhuxiao(String device_id) {
|
||||
|
||||
final HttpParams paramsPost = new HttpParams();
|
||||
paramsPost.put("device_id", device_id);//扫码(设备)id
|
||||
// paramsPost.put("device_id", device_id);//扫码(设备)id
|
||||
paramsPost.put("device_id", "13616318615152");//扫码(设备)id
|
||||
new NetApi().getPostData(paramsPost, HttpConstants.URi_Device_Appscanlogin_cancellationDevice).subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
@@ -510,8 +708,15 @@ public class SettingActivity extends BaseActivity {
|
||||
SPUtils.setSP(SettingActivity.this, FZConfig.IS_ACTIVATION, "1");
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(body);
|
||||
String success = jsonObject.getString("success");
|
||||
String msg = jsonObject.getString("msg");
|
||||
ToastUtils.showShort(msg);
|
||||
if("1".equals(success)){
|
||||
|
||||
}else if("2".equals(success)){
|
||||
getDeviceByDouyin();
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.fisherbone.fuzhu.api;
|
||||
|
||||
import com.fisherbone.fuzhu.entity.DeviceByDouyinBean;
|
||||
import com.fisherbone.fuzhu.entity.touchTaskBean;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
@@ -22,7 +23,9 @@ public interface NewsApiInterface {
|
||||
@FormUrlEncoded
|
||||
Observable<touchTaskBean> getPhoneNum(@Field("device_id") String device_id,
|
||||
@Field("number") String number);
|
||||
|
||||
@POST("app/Appscanlogin/getDeviceByDouyin")
|
||||
@FormUrlEncoded
|
||||
Observable<DeviceByDouyinBean> getDeviceByDouyin(@Field("douyin") String douyin);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.fisherbone.fuzhu.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeviceByDouyinBean extends BaseModel {
|
||||
|
||||
|
||||
|
||||
|
||||
private String msg;
|
||||
private int success;
|
||||
private List<DataBean> device;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(int success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return device;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.device = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
public String getDevice_id() {
|
||||
return device_id;
|
||||
}
|
||||
|
||||
public void setDevice_id(String device_id) {
|
||||
this.device_id = device_id;
|
||||
}
|
||||
|
||||
public String getDevice_name() {
|
||||
return device_name;
|
||||
}
|
||||
|
||||
public void setDevice_name(String device_name) {
|
||||
this.device_name = device_name;
|
||||
}
|
||||
|
||||
private String device_id;
|
||||
private String device_name;
|
||||
|
||||
public String getIf_sel_del() {
|
||||
return if_sel_del;
|
||||
}
|
||||
|
||||
public void setIf_sel_del(String if_sel_del) {
|
||||
this.if_sel_del = if_sel_del;
|
||||
}
|
||||
|
||||
private String if_sel_del="0";//是否选中 //0未选中 1为选中
|
||||
}
|
||||
}
|
||||
@@ -224,6 +224,7 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
|
||||
return doubinum;
|
||||
}
|
||||
return "0";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
65
app/src/main/res/layout/douyindevice_dialog.xml
Normal file
65
app/src/main/res/layout/douyindevice_dialog.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="276dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/dialogwhite"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:text="请选择当前的设备号"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/device_recy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/light" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSexCancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="取消"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/light" />
|
||||
<TextView
|
||||
android:id="@+id/tvSexSend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="确认"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Binary file not shown.
Reference in New Issue
Block a user