完成Android端开发
@@ -3,19 +3,15 @@
|
||||
"Data": [
|
||||
{
|
||||
"title": "微信公众号",
|
||||
"content": "<a href=\"https://t.1yb.co/71xZ\">获取更多资讯内容,欢迎微信搜索公众号:「我的Android开源之旅」</a>"
|
||||
"content": "<a href=\"http://www.wumei.live\">获取更多资讯内容,欢迎微信搜索公众号:「我的Android开源之旅」</a>"
|
||||
},
|
||||
{
|
||||
"title": "关于作者",
|
||||
"content": "点击关注作者,了解最新动态!<br /><a href=\"https://github.com/xuexiangjys\"><font color=\"#800080\">Github</font></a><br />\n<a href=\"https://www.zhihu.com/people/xuexiangjys/posts\"><font color=\"#0000FF\">知乎</font></a><br />\n<a href=\"https://juejin.im/user/598feef55188257d592e56ed/posts\"><font color=\"#000000\">掘金</font></a><br /><a href=\"https://www.jianshu.com/u/6bf605575337\"><font color=\"#FF0000\">简书</font></a><br />\n<a href=\"https://segmentfault.com/blog/openAndroidX\"><font color=\"#008000\">思否</font></a><br />\n<a href=\"https://space.bilibili.com/483850585/video\"><font color=\"#FFA500\">哔哩哔哩</font></a><br />\n<a href=\"https://www.toutiao.com/c/user/token/MS4wLjABAAAAqD0Pe01AhT2Hgi3w7HzboVuq57gntoAJJURwAkM3Elv0-EA9WSKUSy1DujIYLAEm/\"><font color=\"#FF0000\">今日头条</font></a>"
|
||||
},
|
||||
{
|
||||
"title": "赞助作者",
|
||||
"content": "你的打赏是我维护的动力,<a href=\"https://gitee.com/xuexiangjys/Resource/blob/master/doc/sponsor.md\"><font color=\"#800080\">点击此处支持我吧!</font></a>"
|
||||
"content": "点击关注作者,了解最新动态!<br /><a href=\"https://gitee.com/kerwincui/wumei-smart\"><font color=\"#800080\">Gitee</font></a><br />"
|
||||
},
|
||||
{
|
||||
"title": "QQ交流群",
|
||||
"content": "<a href=\"https://qm.qq.com/cgi-bin/qm/qr?k=i1rhgvRxlJRlJzigL0QemICtkk0H6g3J\">XUI开源交流1号群</a><br /><a href=\"https://qm.qq.com/cgi-bin/qm/qr?k=_0IhSCvLxdsgxAIBtTXr__bwsxZl4Eva\">XUI开源交流2号群</a><br /><a href=\"https://qm.qq.com/cgi-bin/qm/qr?k=GRVNTA4ehFuIUhQwqiZkjqYeQoxRBqCI\">AndroidGitHub开源交流群</a><br /><a href=\"https://qm.qq.com/cgi-bin/qm/qr?k=0OHp7jgMiF9SsfrzmOaxcauxMP9fZjc3\">XUpdate官方交流群</a>"
|
||||
"content": "<a href=\"https://qm.qq.com/cgi-bin/qm/qr?k=P_oc91N6KC39zp2PEV_-BY3xMnAokeZ8\">物美智能交流群</a><br />"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -14,14 +14,15 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.multidex.MultiDex;
|
||||
|
||||
import com.kerwin.wumei.BuildConfig;
|
||||
import com.kerwin.wumei.http.interceptor.CustomLoggingInterceptor;
|
||||
import com.kerwin.wumei.utils.SettingSPUtils;
|
||||
import com.kerwin.wumei.utils.sdkinit.ANRWatchDogInit;
|
||||
import com.kerwin.wumei.utils.sdkinit.UMengInit;
|
||||
import com.kerwin.wumei.utils.sdkinit.XBasicLibInit;
|
||||
import com.kerwin.wumei.utils.sdkinit.XUpdateInit;
|
||||
import com.xuexiang.xhttp2.XHttpSDK;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getServeUrl;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
@@ -60,7 +61,7 @@ public class MyApp extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
initLibs();
|
||||
|
||||
initHttp();
|
||||
app = this;
|
||||
mBroadcastData = new MutableLiveData<>();
|
||||
IntentFilter filter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
|
||||
@@ -102,6 +103,16 @@ public class MyApp extends Application {
|
||||
ANRWatchDogInit.init();
|
||||
}
|
||||
|
||||
private void initHttp() {
|
||||
XHttpSDK.init(this); //初始化网络请求框架,必须首先执行
|
||||
XHttpSDK.setSuccessCode(200);
|
||||
XHttpSDK.debug(); //需要调试的时候执行
|
||||
XHttpSDK.debug(new CustomLoggingInterceptor()); //设置自定义的日志打印拦截器
|
||||
XHttpSDK.setBaseUrl(getServeUrl()); //设置网络请求的基础地址
|
||||
// XHttpSDK.addInterceptor(new CustomDynamicInterceptor()); //设置动态参数添加拦截器
|
||||
// XHttpSDK.addInterceptor(new CustomExpiredInterceptor()); //请求失效校验拦截器
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return 当前app是否是调试开发模式
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
@@ -35,9 +36,11 @@ import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
||||
import com.kerwin.wumei.core.BaseActivity;
|
||||
import com.kerwin.wumei.fragment.LoginFragment;
|
||||
import com.kerwin.wumei.fragment.device.AddDeviceFragment;
|
||||
import com.kerwin.wumei.utils.NetUtils;
|
||||
import com.xuexiang.xui.utils.KeyboardUtils;
|
||||
import com.xuexiang.xui.utils.StatusBarUtils;
|
||||
import com.xuexiang.xui.widget.progress.CircleProgressView;
|
||||
import com.xuexiang.xutil.display.Colors;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -68,6 +71,10 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
return mViewModel;
|
||||
}
|
||||
|
||||
private AddDeviceFragment addDeviceFragment;
|
||||
private IEsptouchTask mEsptouchTask;
|
||||
|
||||
|
||||
public void executeEsptouch() {
|
||||
EspTouchViewModel viewModel = mViewModel;
|
||||
// byte[] ssid = viewModel.ssidBytes == null ? ByteUtil.getBytesByString(viewModel.ssid): viewModel.ssidBytes;
|
||||
@@ -77,7 +84,8 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
byte[] password = pwdStr == null ? null : ByteUtil.getBytesByString(pwdStr.toString());
|
||||
byte[] bssid = TouchNetUtil.parseBssid2bytes(viewModel.bssid);
|
||||
byte[] broadcast = {(byte) (mViewModel.packageModeGroup.getCheckedRadioButtonId() == R.id.packageBroadcast? 1 : 0)};
|
||||
byte[] deviceCount = "1".getBytes();
|
||||
int count = mViewModel.xsbDeviceCount.getSelectedNumber();
|
||||
byte[] deviceCount = String.valueOf(count).getBytes();
|
||||
if (mTask != null) {
|
||||
mTask.cancelEsptouch();
|
||||
}
|
||||
@@ -259,12 +267,19 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
public static class EsptouchAsyncTask4 extends AsyncTask<byte[], IEsptouchResult, List<IEsptouchResult>> {
|
||||
/**
|
||||
* 中断配网任务
|
||||
*/
|
||||
public void interruptEspTouchTask(){
|
||||
if (mEsptouchTask != null) {
|
||||
mEsptouchTask.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public class EsptouchAsyncTask4 extends AsyncTask<byte[], IEsptouchResult, List<IEsptouchResult>> {
|
||||
private WeakReference<AddDeviceActivity> mActivity;
|
||||
private final Object mLock = new Object();
|
||||
private ProgressDialog mProgressDialog;
|
||||
private AlertDialog mResultDialog;
|
||||
private IEsptouchTask mEsptouchTask;
|
||||
|
||||
|
||||
EsptouchAsyncTask4(AddDeviceActivity activity) {
|
||||
mActivity = new WeakReference<>(activity);
|
||||
@@ -272,12 +287,6 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
|
||||
public void cancelEsptouch() {
|
||||
cancel(true);
|
||||
if (mProgressDialog != null) {
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
if (mResultDialog != null) {
|
||||
mResultDialog.dismiss();
|
||||
}
|
||||
if (mEsptouchTask != null) {
|
||||
mEsptouchTask.interrupt();
|
||||
}
|
||||
@@ -285,26 +294,8 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
Activity activity = mActivity.get();
|
||||
mProgressDialog = new ProgressDialog(activity);
|
||||
mProgressDialog.setMessage(activity.getString(R.string.esptouch1_configuring_message));
|
||||
mProgressDialog.setCanceledOnTouchOutside(false);
|
||||
mProgressDialog.setOnCancelListener(dialog -> {
|
||||
synchronized (mLock) {
|
||||
if (mEsptouchTask != null) {
|
||||
mEsptouchTask.interrupt();
|
||||
}
|
||||
}
|
||||
});
|
||||
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getText(android.R.string.cancel),
|
||||
(dialog, which) -> {
|
||||
synchronized (mLock) {
|
||||
if (mEsptouchTask != null) {
|
||||
mEsptouchTask.interrupt();
|
||||
}
|
||||
}
|
||||
});
|
||||
mProgressDialog.show();
|
||||
addDeviceFragment = (AddDeviceFragment) getSupportFragmentManager().getFragments().get(0);
|
||||
addDeviceFragment.beginCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -341,13 +332,9 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
protected void onPostExecute(List<IEsptouchResult> result) {
|
||||
AddDeviceActivity activity = mActivity.get();
|
||||
activity.mTask = null;
|
||||
mProgressDialog.dismiss();
|
||||
if (result == null) {
|
||||
mResultDialog = new AlertDialog.Builder(activity)
|
||||
.setMessage(R.string.esptouch1_configure_result_failed_port)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
mResultDialog.setCanceledOnTouchOutside(false);
|
||||
addDeviceFragment.showMessage("建立 EspTouch 任务失败, 端口可能被其他程序占用",false);
|
||||
addDeviceFragment.endCounter();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,31 +343,20 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
if (firstResult.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// the task received some results including cancelled while
|
||||
// executing before receiving enough results
|
||||
|
||||
if (!firstResult.isSuc()) {
|
||||
mResultDialog = new AlertDialog.Builder(activity)
|
||||
.setMessage(R.string.esptouch1_configure_result_failed)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
mResultDialog.setCanceledOnTouchOutside(false);
|
||||
addDeviceFragment.showMessage("配网失败",false);
|
||||
addDeviceFragment.endCounter();
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<CharSequence> resultMsgList = new ArrayList<>(result.size());
|
||||
String message="";
|
||||
for (IEsptouchResult touchResult : result) {
|
||||
String message = activity.getString(R.string.esptouch1_configure_result_success_item,
|
||||
touchResult.getBssid(), touchResult.getInetAddress().getHostAddress());
|
||||
resultMsgList.add(message);
|
||||
message += "BSSID: "+touchResult.getBssid()+", 地址: "+touchResult.getInetAddress().getHostAddress()+"\n";
|
||||
}
|
||||
CharSequence[] items = new CharSequence[resultMsgList.size()];
|
||||
mResultDialog = new AlertDialog.Builder(activity)
|
||||
.setTitle(R.string.esptouch1_configure_result_success)
|
||||
.setItems(resultMsgList.toArray(items), null)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
mResultDialog.setCanceledOnTouchOutside(false);
|
||||
|
||||
addDeviceFragment.endCounter();
|
||||
addDeviceFragment.showMessage("完成配网\n"+message,true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,6 +367,8 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
mWifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
|
||||
mViewModel = new EspTouchViewModel();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -407,4 +385,6 @@ public class AddDeviceActivity extends BaseActivity {
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return KeyboardUtils.onDisableBackKeyDown(keyCode) && super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.KeyEvent;
|
||||
|
||||
import com.kerwin.wumei.core.BaseActivity;
|
||||
import com.kerwin.wumei.fragment.LoginFragment;
|
||||
import com.kerwin.wumei.fragment.device.DeviceDetailFragment;
|
||||
import com.xuexiang.xui.utils.KeyboardUtils;
|
||||
import com.xuexiang.xui.utils.StatusBarUtils;
|
||||
import com.xuexiang.xutil.display.Colors;
|
||||
|
||||
@@ -51,6 +51,12 @@ import androidx.core.location.LocationManagerCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.kerwin.wumei.entity.User;
|
||||
import com.kerwin.wumei.fragment.profile.AccountFragment;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.UserInfoApiResult;
|
||||
import com.kerwin.wumei.utils.sdkinit.XUpdateInit;
|
||||
|
||||
import com.espressif.iot.esptouch.EsptouchTask;
|
||||
import com.espressif.iot.esptouch.IEsptouchResult;
|
||||
import com.espressif.iot.esptouch.IEsptouchTask;
|
||||
@@ -70,6 +76,7 @@ import com.kerwin.wumei.fragment.device.AddDeviceFragment;
|
||||
import com.kerwin.wumei.fragment.device.GroupFragment;
|
||||
import com.kerwin.wumei.fragment.device.SceneFragment;
|
||||
import com.kerwin.wumei.fragment.device.ShareDeviceFragment;
|
||||
import com.kerwin.wumei.fragment.news.HomePageFragment;
|
||||
import com.kerwin.wumei.fragment.news.NewsFragment;
|
||||
import com.kerwin.wumei.fragment.profile.ProfileFragment;
|
||||
import com.kerwin.wumei.fragment.device.DeviceFragment;
|
||||
@@ -78,6 +85,9 @@ import com.kerwin.wumei.utils.Utils;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.kerwin.wumei.widget.GuideTipsDialog;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.core.PageOption;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xui.adapter.FragmentAdapter;
|
||||
@@ -99,6 +109,10 @@ import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
public class MainActivity extends BaseActivity implements View.OnClickListener, ViewPager.OnPageChangeListener, BottomNavigationView.OnNavigationItemSelectedListener, ClickUtils.OnClick2ExitListener, Toolbar.OnMenuItemClickListener {
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
@@ -129,6 +143,7 @@ public class MainActivity extends BaseActivity implements View.OnClickListener,
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
initViews();
|
||||
// initData();
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@@ -148,14 +163,20 @@ public class MainActivity extends BaseActivity implements View.OnClickListener,
|
||||
BaseFragment[] fragments = new BaseFragment[]{
|
||||
new DeviceFragment(),
|
||||
new SceneFragment(),
|
||||
new NewsFragment(),
|
||||
new HomePageFragment(),
|
||||
new ProfileFragment(),
|
||||
};
|
||||
FragmentAdapter<BaseFragment> adapter = new FragmentAdapter<>(getSupportFragmentManager(), fragments);
|
||||
viewPager.setOffscreenPageLimit(mTitles.length - 1);
|
||||
viewPager.setAdapter(adapter);
|
||||
|
||||
//显示提示
|
||||
// GuideTipsDialog.showTips(this);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
GuideTipsDialog.showTips(this);
|
||||
XUpdateInit.checkUpdate(this, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,10 +204,11 @@ public class MainActivity extends BaseActivity implements View.OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2019-10-09 初始化数据
|
||||
// 绑定数据
|
||||
ivAvatar.setImageResource(R.drawable.ic_default_head);
|
||||
tvAvatar.setText("15208747707");
|
||||
tvSign.setText("物美点亮智慧生活...");
|
||||
tvAvatar.setText("匿名用户");
|
||||
tvSign.setText("物美智能点亮智慧生活...");
|
||||
getUserInfo(tvAvatar,tvSign );
|
||||
navHeader.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@@ -197,34 +219,31 @@ public class MainActivity extends BaseActivity implements View.OnClickListener,
|
||||
|
||||
//侧边栏点击事件
|
||||
navView.setNavigationItemSelectedListener(menuItem -> {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.nav_add_device:
|
||||
PageOption.to(AddDeviceFragment.class) //跳转的fragment
|
||||
.setAnim(CoreAnim.slide) //页面转场动画
|
||||
.setRequestCode(100) //请求码,用于返回结果
|
||||
.setAddToBackStack(true) //是否加入堆栈
|
||||
.setNewActivity(true,AddDeviceActivity.class) //是否使用新的Activity打开
|
||||
.open(this); //打开页面进行跳转
|
||||
break;
|
||||
case R.id.nav_settings:
|
||||
openNewPage(SettingsFragment.class);
|
||||
break;
|
||||
case R.id.nav_about:
|
||||
openNewPage(AboutFragment.class);
|
||||
break;
|
||||
case R.id.nav_message:
|
||||
openNewPage(MessageFragment.class);
|
||||
break;
|
||||
case R.id.nav_share_device:
|
||||
openNewPage(ShareDeviceFragment.class);
|
||||
break;
|
||||
case R.id.nav_group:
|
||||
openNewPage(GroupFragment.class);
|
||||
break;
|
||||
default:
|
||||
XToastUtils.toast("点击了:" + menuItem.getTitle());
|
||||
break;
|
||||
}
|
||||
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.nav_add_device:
|
||||
PageOption.to(AddDeviceFragment.class) //跳转的fragment
|
||||
.setAnim(CoreAnim.slide) //页面转场动画
|
||||
.setRequestCode(100) //请求码,用于返回结果
|
||||
.setAddToBackStack(true) //是否加入堆栈
|
||||
.setNewActivity(true, AddDeviceActivity.class) //是否使用新的Activity打开
|
||||
.open(this); //打开页面进行跳转
|
||||
break;
|
||||
case R.id.nav_about:
|
||||
openNewPage(AboutFragment.class);
|
||||
break;
|
||||
case R.id.nav_serve_config:
|
||||
drawerLayout.closeDrawers();
|
||||
toolbar.setTitle(menuItem.getTitle());
|
||||
viewPager.setCurrentItem(1, false);
|
||||
break;
|
||||
case R.id.nav_message:
|
||||
openNewPage(MessageFragment.class);
|
||||
break;
|
||||
default:
|
||||
XToastUtils.toast("点击了:" + menuItem.getTitle());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -258,7 +277,7 @@ public class MainActivity extends BaseActivity implements View.OnClickListener,
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.nav_header:
|
||||
XToastUtils.toast("功能完善中...");
|
||||
openNewPage(AccountFragment.class);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -325,5 +344,36 @@ public class MainActivity extends BaseActivity implements View.OnClickListener,
|
||||
XUtil.exitApp();
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取用户信息
|
||||
*/
|
||||
private void getUserInfo(TextView avatar,TextView sign){
|
||||
if(!hasToken()) return;
|
||||
XHttp.get("/prod-api/getInfo")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<UserInfoApiResult<User>, User>(new TipRequestCallBack<User>() {
|
||||
@Override
|
||||
public void onSuccess(User user) throws Throwable {
|
||||
Log.d("user:",user.getNickName());
|
||||
if(user.getNickName()!=null && user.getNickName().length()!=0)
|
||||
{
|
||||
avatar.setText(user.getNickName());
|
||||
}else{
|
||||
avatar.setText(user.getUserName());
|
||||
}
|
||||
sign.setText("物美智能开源项目(wumei-smart)");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -38,15 +38,16 @@ public class SplashActivity extends BaseSplashActivity implements CancelAdapt {
|
||||
*/
|
||||
@Override
|
||||
protected void onSplashFinished() {
|
||||
if (SettingUtils.isAgreePrivacy()) {
|
||||
loginOrGoMainPage();
|
||||
} else {
|
||||
Utils.showPrivacyDialog(this, (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
SettingUtils.setIsAgreePrivacy(true);
|
||||
loginOrGoMainPage();
|
||||
});
|
||||
}
|
||||
loginOrGoMainPage();
|
||||
// if (SettingUtils.isAgreePrivacy()) {
|
||||
// loginOrGoMainPage();
|
||||
// } else {
|
||||
// Utils.showPrivacyDialog(this, (dialog, which) -> {
|
||||
// dialog.dismiss();
|
||||
// SettingUtils.setIsAgreePrivacy(true);
|
||||
// loginOrGoMainPage();
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
private void loginOrGoMainPage() {
|
||||
|
||||
@@ -5,12 +5,13 @@ import android.widget.EditText;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.xuexiang.xui.widget.picker.XSeekBar;
|
||||
import com.xuexiang.xui.widget.spinner.materialspinner.MaterialSpinner;
|
||||
|
||||
public class EspTouchViewModel {
|
||||
public MaterialSpinner ssidSpinner;
|
||||
public EditText apPasswordEdit;
|
||||
public EditText deviceCountEdit;
|
||||
public XSeekBar xsbDeviceCount;
|
||||
public RadioGroup packageModeGroup;
|
||||
public TextView messageView;
|
||||
public Button confirmBtn;
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2021 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.adapter.entity;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ApiService {
|
||||
/**
|
||||
* 获得小贴士
|
||||
*/
|
||||
@GET("/xuexiangjys/Resource/raw/master/jsonapi/tips.json")
|
||||
@GET("http://wumei.live/tips.json")
|
||||
Observable<ApiResult<List<TipInfo>>> getTips();
|
||||
}
|
||||
|
||||
|
||||
121
android/app/src/main/java/com/kerwin/wumei/entity/Dept.java
Normal file
@@ -0,0 +1,121 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Dept {
|
||||
private String remark;
|
||||
|
||||
private int deptId;
|
||||
|
||||
private int parentId;
|
||||
|
||||
private String ancestors;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String orderNum;
|
||||
|
||||
private String leader;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String status;
|
||||
|
||||
private String delFlag;
|
||||
|
||||
private String parentName;
|
||||
|
||||
private List<Dept> children ;
|
||||
|
||||
public void setRemark(String remark){
|
||||
this.remark = remark;
|
||||
}
|
||||
public String getRemark(){
|
||||
return this.remark;
|
||||
}
|
||||
public void setDeptId(int deptId){
|
||||
this.deptId = deptId;
|
||||
}
|
||||
public int getDeptId(){
|
||||
return this.deptId;
|
||||
}
|
||||
public void setParentId(int parentId){
|
||||
this.parentId = parentId;
|
||||
}
|
||||
public int getParentId(){
|
||||
return this.parentId;
|
||||
}
|
||||
public void setAncestors(String ancestors){
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
public String getAncestors(){
|
||||
return this.ancestors;
|
||||
}
|
||||
public void setDeptName(String deptName){
|
||||
this.deptName = deptName;
|
||||
}
|
||||
public String getDeptName(){
|
||||
return this.deptName;
|
||||
}
|
||||
public void setOrderNum(String orderNum){
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
public String getOrderNum(){
|
||||
return this.orderNum;
|
||||
}
|
||||
public void setLeader(String leader){
|
||||
this.leader = leader;
|
||||
}
|
||||
public String getLeader(){
|
||||
return this.leader;
|
||||
}
|
||||
public void setPhone(String phone){
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getPhone(){
|
||||
return this.phone;
|
||||
}
|
||||
public void setEmail(String email){
|
||||
this.email = email;
|
||||
}
|
||||
public String getEmail(){
|
||||
return this.email;
|
||||
}
|
||||
public void setStatus(String status){
|
||||
this.status = status;
|
||||
}
|
||||
public String getStatus(){
|
||||
return this.status;
|
||||
}
|
||||
public void setDelFlag(String delFlag){
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public String getDelFlag(){
|
||||
return this.delFlag;
|
||||
}
|
||||
public void setParentName(String parentName){
|
||||
this.parentName = parentName;
|
||||
}
|
||||
public String getParentName(){
|
||||
return this.parentName;
|
||||
}
|
||||
public void setChildren(List<Dept> children){
|
||||
this.children = children;
|
||||
}
|
||||
public List<Dept> getChildren(){
|
||||
return this.children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
public class DictData {
|
||||
|
||||
/** 字典标签 */
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
private Integer dictValue;
|
||||
|
||||
/** 字典编码 */
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典类型 */
|
||||
private String dictType;
|
||||
|
||||
|
||||
public Long getDictCode()
|
||||
{
|
||||
return dictCode;
|
||||
}
|
||||
public void setDictCode(Long dictCode)
|
||||
{
|
||||
this.dictCode = dictCode;
|
||||
}
|
||||
|
||||
public String getDictLabel()
|
||||
{
|
||||
return dictLabel;
|
||||
}
|
||||
public void setDictLabel(String dictLabel)
|
||||
{
|
||||
this.dictLabel = dictLabel;
|
||||
}
|
||||
|
||||
public Integer getDictValue()
|
||||
{
|
||||
return dictValue;
|
||||
}
|
||||
public void setDictValue(Integer dictValue)
|
||||
{
|
||||
this.dictValue = dictValue;
|
||||
}
|
||||
|
||||
public String getDictType()
|
||||
{
|
||||
return dictType;
|
||||
}
|
||||
public void setDictType(String dictType)
|
||||
{
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
public class IotCategory {
|
||||
/** 序号 */
|
||||
private Long categoryId;
|
||||
|
||||
/** 分类名称 */
|
||||
private String categoryName;
|
||||
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
}
|
||||
126
android/app/src/main/java/com/kerwin/wumei/entity/IotDevice.java
Normal file
@@ -0,0 +1,126 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class IotDevice {
|
||||
/** 序号 */
|
||||
private Long deviceId;
|
||||
|
||||
/** 编号 */
|
||||
private String deviceNum;
|
||||
|
||||
/** 分类 */
|
||||
private String categoryName;
|
||||
|
||||
/** 名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 固件版本 */
|
||||
private String firmwareVersion;
|
||||
|
||||
/** 用户 */
|
||||
private String ownerId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 设备温度 */
|
||||
private String deviceTemp;
|
||||
|
||||
/** 创建时间 */
|
||||
private String createTime;
|
||||
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceNum(String deviceNum)
|
||||
{
|
||||
this.deviceNum = deviceNum;
|
||||
}
|
||||
|
||||
public String getDeviceNum()
|
||||
{
|
||||
return deviceNum;
|
||||
}
|
||||
public void setCategoryId(String categoryId)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setFirmwareVersion(String firmwareVersion)
|
||||
{
|
||||
this.firmwareVersion = firmwareVersion;
|
||||
}
|
||||
|
||||
public String getFirmwareVersion()
|
||||
{
|
||||
return firmwareVersion;
|
||||
}
|
||||
public void setOwnerId(String ownerId)
|
||||
{
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
|
||||
public String getOwnerId()
|
||||
{
|
||||
return ownerId;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setDeviceTemp(String deviceTemperature)
|
||||
{
|
||||
this.deviceTemp = deviceTemperature;
|
||||
}
|
||||
public String getDeviceTemp()
|
||||
{
|
||||
return deviceTemp;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
public class IotDeviceSet {
|
||||
/** 序号 */
|
||||
private Long deviceSetId;
|
||||
|
||||
/** 设备 */
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备编号 */
|
||||
private String deviceNum;
|
||||
|
||||
/** 报警 */
|
||||
private Integer isAlarm;
|
||||
|
||||
/** 雷达感应 */
|
||||
private Integer isRadar;
|
||||
|
||||
/** 托管 */
|
||||
private Integer isHost;
|
||||
|
||||
/** 重启 */
|
||||
private Integer isReset;
|
||||
|
||||
/** 打开AP */
|
||||
private Integer isAp;
|
||||
|
||||
/** 是否离线使用 */
|
||||
private Integer isWifiOffline;
|
||||
|
||||
/** 是否使用证书 */
|
||||
private Integer isOpenCertifi;
|
||||
|
||||
/** 智能配网 */
|
||||
private Integer isSmartConfig;
|
||||
|
||||
/** 射频遥控 */
|
||||
private Integer isRfControl;
|
||||
|
||||
/** 遥控配对 */
|
||||
private Integer isRfLearn;
|
||||
|
||||
/** 遥控清码 */
|
||||
private Integer isRfClear;
|
||||
|
||||
/** 按键一 */
|
||||
private Integer rfOneFunc;
|
||||
|
||||
/** 按键二 */
|
||||
private Integer rfTwoFunc;
|
||||
|
||||
/** 按键三 */
|
||||
private Integer rfThreeFunc;
|
||||
|
||||
/** 按键四 */
|
||||
private Integer rfFourFunc;
|
||||
|
||||
/** 用户 */
|
||||
private String ownerId;
|
||||
|
||||
/** 配网地址 */
|
||||
private String networkAddress;
|
||||
|
||||
/** 配网IP */
|
||||
private String networkIp;
|
||||
|
||||
/** 雷达感应间隔 */
|
||||
private Integer radarInterval;
|
||||
|
||||
public void setDeviceSetId(Long deviceSetId)
|
||||
{
|
||||
this.deviceSetId = deviceSetId;
|
||||
}
|
||||
|
||||
public Long getDeviceSetId()
|
||||
{
|
||||
return deviceSetId;
|
||||
}
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceNum(String deviceNum)
|
||||
{
|
||||
this.deviceNum = deviceNum;
|
||||
}
|
||||
|
||||
public String getDeviceNum()
|
||||
{
|
||||
return deviceNum;
|
||||
}
|
||||
public void setIsAlarm(Integer isAlarm)
|
||||
{
|
||||
this.isAlarm = isAlarm;
|
||||
}
|
||||
|
||||
public Integer getIsAlarm()
|
||||
{
|
||||
return isAlarm;
|
||||
}
|
||||
public void setIsRadar(Integer isRadar)
|
||||
{
|
||||
this.isRadar = isRadar;
|
||||
}
|
||||
|
||||
public Integer getIsRadar()
|
||||
{
|
||||
return isRadar;
|
||||
}
|
||||
public void setIsHost(Integer isHost)
|
||||
{
|
||||
this.isHost = isHost;
|
||||
}
|
||||
|
||||
public Integer getIsHost()
|
||||
{
|
||||
return isHost;
|
||||
}
|
||||
public void setIsReset(Integer isReset)
|
||||
{
|
||||
this.isReset = isReset;
|
||||
}
|
||||
|
||||
public Integer getIsReset()
|
||||
{
|
||||
return isReset;
|
||||
}
|
||||
|
||||
public void setIsAp(Integer isAp)
|
||||
{
|
||||
this.isAp = isAp;
|
||||
}
|
||||
public Integer getIsAp()
|
||||
{
|
||||
return isAp;
|
||||
}
|
||||
|
||||
public void setIsWifiOffline(Integer isWifiOffline)
|
||||
{
|
||||
this.isWifiOffline = isWifiOffline;
|
||||
}
|
||||
public Integer getIsWifiOffline()
|
||||
{
|
||||
return isWifiOffline;
|
||||
}
|
||||
|
||||
public void setIsOpenCertifi(Integer isOpenCertifi)
|
||||
{
|
||||
this.isOpenCertifi = isOpenCertifi;
|
||||
}
|
||||
public Integer getIsOpenCertifi()
|
||||
{
|
||||
return isOpenCertifi;
|
||||
}
|
||||
|
||||
public void setIsSmartConfig(Integer isSmartConfig)
|
||||
{
|
||||
this.isSmartConfig = isSmartConfig;
|
||||
}
|
||||
|
||||
public Integer getIsSmartConfig()
|
||||
{
|
||||
return isSmartConfig;
|
||||
}
|
||||
public void setIsRfControl(Integer isRfControl)
|
||||
{
|
||||
this.isRfControl = isRfControl;
|
||||
}
|
||||
|
||||
public Integer getIsRfControl()
|
||||
{
|
||||
return isRfControl;
|
||||
}
|
||||
public void setIsRfLearn(Integer isRfLearn)
|
||||
{
|
||||
this.isRfLearn = isRfLearn;
|
||||
}
|
||||
|
||||
public Integer getIsRfLearn()
|
||||
{
|
||||
return isRfLearn;
|
||||
}
|
||||
public void setIsRfClear(Integer isRfClear)
|
||||
{
|
||||
this.isRfClear = isRfClear;
|
||||
}
|
||||
|
||||
public Integer getIsRfClear()
|
||||
{
|
||||
return isRfClear;
|
||||
}
|
||||
public void setRfOneFunc(Integer rfOneFunc)
|
||||
{
|
||||
this.rfOneFunc = rfOneFunc;
|
||||
}
|
||||
|
||||
public Integer getRfOneFunc()
|
||||
{
|
||||
return rfOneFunc;
|
||||
}
|
||||
public void setRfTwoFunc(Integer rfTwoFunc)
|
||||
{
|
||||
this.rfTwoFunc = rfTwoFunc;
|
||||
}
|
||||
|
||||
public Integer getRfTwoFunc()
|
||||
{
|
||||
return rfTwoFunc;
|
||||
}
|
||||
public void setRfThreeFunc(Integer rfThreeFunc)
|
||||
{
|
||||
this.rfThreeFunc = rfThreeFunc;
|
||||
}
|
||||
|
||||
public Integer getRfThreeFunc()
|
||||
{
|
||||
return rfThreeFunc;
|
||||
}
|
||||
public void setRfFourFunc(Integer rfFourFunc)
|
||||
{
|
||||
this.rfFourFunc = rfFourFunc;
|
||||
}
|
||||
|
||||
public Integer getRfFourFunc()
|
||||
{
|
||||
return rfFourFunc;
|
||||
}
|
||||
public void setOwnerId(String ownerId)
|
||||
{
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
|
||||
public String getOwnerId()
|
||||
{
|
||||
return ownerId;
|
||||
}
|
||||
public void setNetworkAddress(String networkAddress)
|
||||
{
|
||||
this.networkAddress = networkAddress;
|
||||
}
|
||||
|
||||
public String getNetworkAddress()
|
||||
{
|
||||
return networkAddress;
|
||||
}
|
||||
public void setNetworkIp(String networkIp)
|
||||
{
|
||||
this.networkIp = networkIp;
|
||||
}
|
||||
|
||||
public String getNetworkIp()
|
||||
{
|
||||
return networkIp;
|
||||
}
|
||||
|
||||
public void setRadarInterval(Integer radarInterval)
|
||||
{
|
||||
this.radarInterval = radarInterval;
|
||||
}
|
||||
|
||||
public Integer getRadarInterval()
|
||||
{
|
||||
return radarInterval;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class IotDeviceStatus {
|
||||
/** 序号 */
|
||||
private Long deviceStatusId;
|
||||
|
||||
/** 设备 */
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备编号 */
|
||||
private String deviceNum;
|
||||
|
||||
/** 继电器 */
|
||||
private Integer relayStatus;
|
||||
|
||||
/** 灯状态 */
|
||||
private Integer lightStatus;
|
||||
|
||||
/** 在线 */
|
||||
private Integer isOnline;
|
||||
|
||||
/** 设备温度 */
|
||||
private BigDecimal deviceTemperature;
|
||||
|
||||
/** 设备湿度 */
|
||||
private Integer rssi;
|
||||
|
||||
/** 空气温度 */
|
||||
private BigDecimal airTemperature;
|
||||
|
||||
/** 空气湿度 */
|
||||
private BigDecimal airHumidity;
|
||||
|
||||
/** 触发源 */
|
||||
private Integer triggerSource;
|
||||
|
||||
/** 彩灯亮度 */
|
||||
private Integer brightness;
|
||||
|
||||
/** 渐变间隔 */
|
||||
private Integer lightInterval;
|
||||
|
||||
/** 彩灯模式 */
|
||||
private Integer lightMode;
|
||||
|
||||
/** 灯渐变时间 */
|
||||
private Integer fadeTime;
|
||||
|
||||
/** 红灯 */
|
||||
private Integer red;
|
||||
|
||||
/** 绿灯 */
|
||||
private Integer green;
|
||||
|
||||
/** 蓝灯 */
|
||||
private Integer blue;
|
||||
|
||||
public void setDeviceStatusId(Long deviceStatusId)
|
||||
{
|
||||
this.deviceStatusId = deviceStatusId;
|
||||
}
|
||||
|
||||
public Long getDeviceStatusId()
|
||||
{
|
||||
return deviceStatusId;
|
||||
}
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceNum(String deviceNum)
|
||||
{
|
||||
this.deviceNum = deviceNum;
|
||||
}
|
||||
|
||||
public String getDeviceNum()
|
||||
{
|
||||
return deviceNum;
|
||||
}
|
||||
public void setRelayStatus(Integer relayStatus)
|
||||
{
|
||||
this.relayStatus = relayStatus;
|
||||
}
|
||||
|
||||
public Integer getRelayStatus()
|
||||
{
|
||||
return relayStatus;
|
||||
}
|
||||
public void setLightStatus(Integer lightStatus)
|
||||
{
|
||||
this.lightStatus = lightStatus;
|
||||
}
|
||||
|
||||
public Integer getLightStatus()
|
||||
{
|
||||
return lightStatus;
|
||||
}
|
||||
public void setIsOnline(Integer isOnline)
|
||||
{
|
||||
this.isOnline = isOnline;
|
||||
}
|
||||
|
||||
public Integer getIsOnline()
|
||||
{
|
||||
return isOnline;
|
||||
}
|
||||
public void setDeviceTemperature(BigDecimal deviceTemperature)
|
||||
{
|
||||
this.deviceTemperature = deviceTemperature;
|
||||
}
|
||||
|
||||
public BigDecimal getDeviceTemperature()
|
||||
{
|
||||
return deviceTemperature;
|
||||
}
|
||||
public void setRssi(Integer rssi)
|
||||
{
|
||||
this.rssi = rssi;
|
||||
}
|
||||
|
||||
public Integer getRssi()
|
||||
{
|
||||
return rssi;
|
||||
}
|
||||
public void setAirTemperature(BigDecimal airTemperature)
|
||||
{
|
||||
this.airTemperature = airTemperature;
|
||||
}
|
||||
|
||||
public BigDecimal getAirTemperature()
|
||||
{
|
||||
return airTemperature;
|
||||
}
|
||||
public void setAirHumidity(BigDecimal airHumidity)
|
||||
{
|
||||
this.airHumidity = airHumidity;
|
||||
}
|
||||
|
||||
public BigDecimal getAirHumidity()
|
||||
{
|
||||
return airHumidity;
|
||||
}
|
||||
public void setTriggerSource(Integer triggerSource)
|
||||
{
|
||||
this.triggerSource = triggerSource;
|
||||
}
|
||||
|
||||
public Integer getTriggerSource()
|
||||
{
|
||||
return triggerSource;
|
||||
}
|
||||
public void setBrightness(Integer brightness)
|
||||
{
|
||||
this.brightness = brightness;
|
||||
}
|
||||
|
||||
public Integer getBrightness()
|
||||
{
|
||||
return brightness;
|
||||
}
|
||||
public void setLightInterval(Integer lightInterval)
|
||||
{
|
||||
this.lightInterval = lightInterval;
|
||||
}
|
||||
|
||||
public Integer getLightInterval()
|
||||
{
|
||||
return lightInterval;
|
||||
}
|
||||
public void setLightMode(Integer lightMode)
|
||||
{
|
||||
this.lightMode = lightMode;
|
||||
}
|
||||
|
||||
public Integer getLightMode()
|
||||
{
|
||||
return lightMode;
|
||||
}
|
||||
public void setRed(Integer red)
|
||||
{
|
||||
this.red = red;
|
||||
}
|
||||
|
||||
public Integer getRed()
|
||||
{
|
||||
return red;
|
||||
}
|
||||
public void setGreen(Integer green)
|
||||
{
|
||||
this.green = green;
|
||||
}
|
||||
|
||||
public Integer getGreen()
|
||||
{
|
||||
return green;
|
||||
}
|
||||
public void setBlue(Integer blue)
|
||||
{
|
||||
this.blue = blue;
|
||||
}
|
||||
|
||||
public Integer getBlue()
|
||||
{
|
||||
return blue;
|
||||
}
|
||||
|
||||
public void setFadeTime(Integer fadeTime)
|
||||
{
|
||||
this.fadeTime = fadeTime;
|
||||
}
|
||||
public Integer getFadeTime()
|
||||
{
|
||||
return fadeTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
public class IotGroup {
|
||||
/** 设备分组 */
|
||||
private Long groupId;
|
||||
|
||||
/** 用户 */
|
||||
private Long userId;
|
||||
|
||||
/** 分组名称 */
|
||||
private String groupName;
|
||||
|
||||
/** 排序 */
|
||||
private Integer groupOrder;
|
||||
|
||||
public void setGroupId(Long groupId)
|
||||
{
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setGroupName(String groupName)
|
||||
{
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getGroupName()
|
||||
{
|
||||
return groupName;
|
||||
}
|
||||
public void setGroupOrder(Integer groupOrder)
|
||||
{
|
||||
this.groupOrder = groupOrder;
|
||||
}
|
||||
|
||||
public Integer getGroupOrder()
|
||||
{
|
||||
return groupOrder;
|
||||
}
|
||||
}
|
||||
119
android/app/src/main/java/com/kerwin/wumei/entity/Roles.java
Normal file
@@ -0,0 +1,119 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
public class Roles {
|
||||
private String remark;
|
||||
|
||||
private int roleId;
|
||||
|
||||
private String roleName;
|
||||
|
||||
private String roleKey;
|
||||
|
||||
private String roleSort;
|
||||
|
||||
private String dataScope;
|
||||
|
||||
private boolean menuCheckStrictly;
|
||||
|
||||
private boolean deptCheckStrictly;
|
||||
|
||||
private String status;
|
||||
|
||||
private boolean flag;
|
||||
|
||||
private String menuIds;
|
||||
|
||||
private String deptIds;
|
||||
|
||||
private boolean admin;
|
||||
|
||||
public void setRemark(String remark){
|
||||
this.remark = remark;
|
||||
}
|
||||
public String getRemark(){
|
||||
return this.remark;
|
||||
}
|
||||
public void setRoleId(int roleId){
|
||||
this.roleId = roleId;
|
||||
}
|
||||
public int getRoleId(){
|
||||
return this.roleId;
|
||||
}
|
||||
public void setRoleName(String roleName){
|
||||
this.roleName = roleName;
|
||||
}
|
||||
public String getRoleName(){
|
||||
return this.roleName;
|
||||
}
|
||||
public void setRoleKey(String roleKey){
|
||||
this.roleKey = roleKey;
|
||||
}
|
||||
public String getRoleKey(){
|
||||
return this.roleKey;
|
||||
}
|
||||
public void setRoleSort(String roleSort){
|
||||
this.roleSort = roleSort;
|
||||
}
|
||||
public String getRoleSort(){
|
||||
return this.roleSort;
|
||||
}
|
||||
public void setDataScope(String dataScope){
|
||||
this.dataScope = dataScope;
|
||||
}
|
||||
public String getDataScope(){
|
||||
return this.dataScope;
|
||||
}
|
||||
public void setMenuCheckStrictly(boolean menuCheckStrictly){
|
||||
this.menuCheckStrictly = menuCheckStrictly;
|
||||
}
|
||||
public boolean getMenuCheckStrictly(){
|
||||
return this.menuCheckStrictly;
|
||||
}
|
||||
public void setDeptCheckStrictly(boolean deptCheckStrictly){
|
||||
this.deptCheckStrictly = deptCheckStrictly;
|
||||
}
|
||||
public boolean getDeptCheckStrictly(){
|
||||
return this.deptCheckStrictly;
|
||||
}
|
||||
public void setStatus(String status){
|
||||
this.status = status;
|
||||
}
|
||||
public String getStatus(){
|
||||
return this.status;
|
||||
}
|
||||
public void setFlag(boolean flag){
|
||||
this.flag = flag;
|
||||
}
|
||||
public boolean getFlag(){
|
||||
return this.flag;
|
||||
}
|
||||
public void setMenuIds(String menuIds){
|
||||
this.menuIds = menuIds;
|
||||
}
|
||||
public String getMenuIds(){
|
||||
return this.menuIds;
|
||||
}
|
||||
public void setDeptIds(String deptIds){
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
public String getDeptIds(){
|
||||
return this.deptIds;
|
||||
}
|
||||
public void setAdmin(boolean admin){
|
||||
this.admin = admin;
|
||||
}
|
||||
public boolean getAdmin(){
|
||||
return this.admin;
|
||||
}
|
||||
}
|
||||
162
android/app/src/main/java/com/kerwin/wumei/entity/User.java
Normal file
@@ -0,0 +1,162 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class User {
|
||||
|
||||
private String remark;
|
||||
|
||||
private int userId;
|
||||
|
||||
private int deptId;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private String email;
|
||||
|
||||
private String phonenumber;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private String status;
|
||||
|
||||
private String loginIp;
|
||||
|
||||
private String loginDate;
|
||||
|
||||
private Dept dept;
|
||||
|
||||
private List<Roles> roles ;
|
||||
|
||||
private String roleIds;
|
||||
|
||||
private String postIds;
|
||||
|
||||
private boolean admin;
|
||||
|
||||
private String createTime;
|
||||
|
||||
public void setRemark(String remark){
|
||||
this.remark = remark;
|
||||
}
|
||||
public String getRemark(){
|
||||
return this.remark;
|
||||
}
|
||||
public void setUserId(int userId){
|
||||
this.userId = userId;
|
||||
}
|
||||
public int getUserId(){
|
||||
return this.userId;
|
||||
}
|
||||
public void setDeptId(int deptId){
|
||||
this.deptId = deptId;
|
||||
}
|
||||
public int getDeptId(){
|
||||
return this.deptId;
|
||||
}
|
||||
public void setUserName(String userName){
|
||||
this.userName = userName;
|
||||
}
|
||||
public String getUserName(){
|
||||
return this.userName;
|
||||
}
|
||||
public void setNickName(String nickName){
|
||||
this.nickName = nickName;
|
||||
}
|
||||
public String getNickName(){
|
||||
return this.nickName;
|
||||
}
|
||||
public void setEmail(String email){
|
||||
this.email = email;
|
||||
}
|
||||
public String getEmail(){
|
||||
return this.email;
|
||||
}
|
||||
public void setPhonenumber(String phonenumber){
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
public String getPhonenumber(){
|
||||
return this.phonenumber;
|
||||
}
|
||||
public void setSex(String sex){
|
||||
this.sex = sex;
|
||||
}
|
||||
public String getSex(){
|
||||
return this.sex;
|
||||
}
|
||||
public void setAvatar(String avatar){
|
||||
this.avatar = avatar;
|
||||
}
|
||||
public String getAvatar(){
|
||||
return this.avatar;
|
||||
}
|
||||
public void setStatus(String status){
|
||||
this.status = status;
|
||||
}
|
||||
public String getStatus(){
|
||||
return this.status;
|
||||
}
|
||||
public void setLoginIp(String loginIp){
|
||||
this.loginIp = loginIp;
|
||||
}
|
||||
public String getLoginIp(){
|
||||
return this.loginIp;
|
||||
}
|
||||
public void setLoginDate(String loginDate){
|
||||
this.loginDate = loginDate;
|
||||
}
|
||||
public String getLoginDate(){
|
||||
return this.loginDate;
|
||||
}
|
||||
public void setDept(Dept dept){
|
||||
this.dept = dept;
|
||||
}
|
||||
public Dept getDept(){
|
||||
return this.dept;
|
||||
}
|
||||
public void setRoles(List<Roles> roles){
|
||||
this.roles = roles;
|
||||
}
|
||||
public List<Roles> getRoles(){
|
||||
return this.roles;
|
||||
}
|
||||
public void setRoleIds(String roleIds){
|
||||
this.roleIds = roleIds;
|
||||
}
|
||||
public String getRoleIds(){
|
||||
return this.roleIds;
|
||||
}
|
||||
public void setPostIds(String postIds){
|
||||
this.postIds = postIds;
|
||||
}
|
||||
public String getPostIds(){
|
||||
return this.postIds;
|
||||
}
|
||||
public void setAdmin(boolean admin){
|
||||
this.admin = admin;
|
||||
}
|
||||
public boolean getAdmin(){
|
||||
return this.admin;
|
||||
}
|
||||
public void setCreateTime(String createTime){
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getCreateTime(){
|
||||
return this.createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity.bo;
|
||||
|
||||
public class CaptureImage {
|
||||
private String uuid;
|
||||
|
||||
private String img;
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid ;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
public void setImg(String img) {
|
||||
this.img = img ;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.entity.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class IotDeviceVo {
|
||||
private Long deviceId;
|
||||
|
||||
/** 编号 */
|
||||
private String deviceNum;
|
||||
|
||||
/** 分类 */
|
||||
private Long categoryId;
|
||||
|
||||
/** 分类名称 */
|
||||
private String categoryName;
|
||||
|
||||
/** 名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 固件版本 */
|
||||
private String firmwareVersion;
|
||||
|
||||
/** 用户 */
|
||||
private String ownerId;
|
||||
|
||||
private String nickName;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 报警 */
|
||||
private Integer isAlarm;
|
||||
|
||||
/** 雷达感应 */
|
||||
private Integer isRadar;
|
||||
|
||||
/** 射频遥控 */
|
||||
private Integer isRfControl;
|
||||
|
||||
/** 配网地址 */
|
||||
private String networkAddress;
|
||||
|
||||
/** 配网IP */
|
||||
private String networkIp;
|
||||
|
||||
/** 继电器 */
|
||||
private Integer relayStatus;
|
||||
|
||||
/** 灯状态 */
|
||||
private Integer lightStatus;
|
||||
|
||||
/** 在线 */
|
||||
private Integer isOnline;
|
||||
|
||||
/** 设备温度 */
|
||||
private BigDecimal deviceTemperature;
|
||||
|
||||
/** 设备湿度 */
|
||||
private Integer rssi;
|
||||
|
||||
|
||||
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceNum(String deviceNum)
|
||||
{
|
||||
this.deviceNum = deviceNum;
|
||||
}
|
||||
public String getDeviceNum()
|
||||
{
|
||||
return deviceNum;
|
||||
}
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setFirmwareVersion(String firmwareVersion) { this.firmwareVersion = firmwareVersion; }
|
||||
public String getFirmwareVersion()
|
||||
{
|
||||
return firmwareVersion;
|
||||
}
|
||||
public void setOwnerId(String ownerId)
|
||||
{
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
public String getOwnerId()
|
||||
{
|
||||
return ownerId;
|
||||
}
|
||||
public void setNickName(String nickName)
|
||||
{
|
||||
this.nickName = nickName;
|
||||
}
|
||||
public String getNickName()
|
||||
{
|
||||
return nickName;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setIsAlarm(Integer isAlarm)
|
||||
{
|
||||
this.isAlarm = isAlarm;
|
||||
}
|
||||
public Integer getIsAlarm()
|
||||
{
|
||||
return isAlarm;
|
||||
}
|
||||
public void setIsRadar(Integer isRadar)
|
||||
{
|
||||
this.isRadar = isRadar;
|
||||
}
|
||||
public Integer getIsRadar()
|
||||
{
|
||||
return isRadar;
|
||||
}
|
||||
public void setIsRfControl(Integer isRfControl)
|
||||
{
|
||||
this.isRfControl = isRfControl;
|
||||
}
|
||||
public Integer getIsRfControl()
|
||||
{
|
||||
return isRfControl;
|
||||
}
|
||||
public void setNetworkAddress(String networkAddress)
|
||||
{
|
||||
this.networkAddress = networkAddress;
|
||||
}
|
||||
public String getNetworkAddress()
|
||||
{
|
||||
return networkAddress;
|
||||
}
|
||||
public void setNetworkIp(String networkIp)
|
||||
{
|
||||
this.networkIp = networkIp;
|
||||
}
|
||||
public String getNetworkIp()
|
||||
{
|
||||
return networkIp;
|
||||
}
|
||||
|
||||
public void setRelayStatus(Integer relayStatus)
|
||||
{
|
||||
this.relayStatus = relayStatus;
|
||||
}
|
||||
public Integer getRelayStatus()
|
||||
{
|
||||
return relayStatus;
|
||||
}
|
||||
public void setLightStatus(Integer lightStatus)
|
||||
{
|
||||
this.lightStatus = lightStatus;
|
||||
}
|
||||
public Integer getLightStatus()
|
||||
{
|
||||
return lightStatus;
|
||||
}
|
||||
public void setIsOnline(Integer isOnline)
|
||||
{
|
||||
this.isOnline = isOnline;
|
||||
}
|
||||
public Integer getIsOnline()
|
||||
{
|
||||
return isOnline;
|
||||
}
|
||||
public void setDeviceTemperature(BigDecimal deviceTemperature) { this.deviceTemperature = deviceTemperature; }
|
||||
public BigDecimal getDeviceTemperature()
|
||||
{
|
||||
return deviceTemperature;
|
||||
}
|
||||
public void setRssi(Integer rssi)
|
||||
{
|
||||
this.rssi = rssi;
|
||||
}
|
||||
public Integer getRssi()
|
||||
{
|
||||
return rssi;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
/*
|
||||
* Copyright (C) 2021 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.fragment;
|
||||
|
||||
@@ -24,6 +18,7 @@ import com.kerwin.wumei.core.webview.AgentWebActivity;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.grouplist.XUIGroupListView;
|
||||
import com.xuexiang.xutil.app.AppUtils;
|
||||
|
||||
@@ -36,6 +31,8 @@ import butterknife.BindView;
|
||||
|
||||
@Page(name = "关于")
|
||||
public class AboutFragment extends BaseFragment {
|
||||
@BindView(R.id.titlebar_min)
|
||||
TitleBar titleBarMin;
|
||||
|
||||
@BindView(R.id.tv_version)
|
||||
TextView mVersionTextView;
|
||||
@@ -43,6 +40,13 @@ public class AboutFragment extends BaseFragment {
|
||||
XUIGroupListView mAboutGroupListView;
|
||||
@BindView(R.id.tv_copyright)
|
||||
TextView mCopyrightTextView;
|
||||
@BindView(R.id.tv_autho)
|
||||
TextView tvAutho;
|
||||
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -51,12 +55,15 @@ public class AboutFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
titleBarMin.setLeftClickListener(v -> popToBack());
|
||||
|
||||
mVersionTextView.setText(String.format("版本号:%s", AppUtils.getAppVersionName()));
|
||||
tvAutho.setText("Author:kerwinci Website:www.wumei.live");
|
||||
|
||||
XUIGroupListView.newSection(getContext())
|
||||
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_homepage)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_project_github)))
|
||||
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_author_github)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_author_github)))
|
||||
.addItemView(mAboutGroupListView.createItemView("版本"), v -> XToastUtils.toast("版本升级"))
|
||||
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_add_qq_group)))
|
||||
.addTo(mAboutGroupListView);
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy", Locale.CHINA);
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -1,37 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2021 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.fragment;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.kerwin.wumei.activity.LoginActivity;
|
||||
import com.kerwin.wumei.activity.MainActivity;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.utils.RandomUtils;
|
||||
import com.kerwin.wumei.entity.IotGroup;
|
||||
import com.kerwin.wumei.entity.bo.CaptureImage;
|
||||
import com.kerwin.wumei.entity.User;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.CaptchaImageApiResult;
|
||||
import com.kerwin.wumei.http.request.ListApiResult;
|
||||
import com.kerwin.wumei.http.request.TokenApiResult;
|
||||
import com.kerwin.wumei.http.request.UserInfoApiResult;
|
||||
import com.kerwin.wumei.utils.MMKVUtils;
|
||||
import com.kerwin.wumei.utils.SettingUtils;
|
||||
import com.kerwin.wumei.utils.TokenUtils;
|
||||
import com.kerwin.wumei.utils.Utils;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xui.utils.CountDownButtonHelper;
|
||||
import com.xuexiang.xui.utils.ResUtils;
|
||||
import com.xuexiang.xui.utils.ThemeUtils;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
@@ -39,9 +49,15 @@ import com.xuexiang.xui.widget.button.roundbutton.RoundButton;
|
||||
import com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText;
|
||||
import com.xuexiang.xutil.app.ActivityUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
|
||||
/**
|
||||
* 登录页面
|
||||
@@ -54,12 +70,17 @@ public class LoginFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.et_phone_number)
|
||||
MaterialEditText etPhoneNumber;
|
||||
@BindView(R.id.et_password)
|
||||
MaterialEditText etPassword;
|
||||
@BindView(R.id.et_verify_code)
|
||||
MaterialEditText etVerifyCode;
|
||||
@BindView(R.id.btn_get_verify_code)
|
||||
RoundButton btnGetVerifyCode;
|
||||
@BindView(R.id.iv_code)
|
||||
ImageView imgVertifyCode;
|
||||
@BindView(R.id.btn_clear)
|
||||
RoundButton btnClear;
|
||||
|
||||
private CountDownButtonHelper mCountDownHelper;
|
||||
private String uuid="";
|
||||
private String token="";
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -77,6 +98,7 @@ public class LoginFragment extends BaseFragment {
|
||||
titleBar.addAction(new TitleBar.TextAction(R.string.title_jump_login) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
clearToken();
|
||||
onLoginSuccess();
|
||||
}
|
||||
});
|
||||
@@ -85,87 +107,103 @@ public class LoginFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mCountDownHelper = new CountDownButtonHelper(btnGetVerifyCode, 60);
|
||||
|
||||
//隐私政策弹窗
|
||||
if (!SettingUtils.isAgreePrivacy()) {
|
||||
Utils.showPrivacyDialog(getContext(), (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
SettingUtils.setIsAgreePrivacy(true);
|
||||
});
|
||||
}
|
||||
// if (!SettingUtils.isAgreePrivacy()) {
|
||||
// Utils.showPrivacyDialog(getContext(), (dialog, which) -> {
|
||||
// dialog.dismiss();
|
||||
// SettingUtils.setIsAgreePrivacy(true);
|
||||
// });
|
||||
// }
|
||||
getCatpureImage();
|
||||
getLocalAccount();
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
@OnClick({R.id.btn_get_verify_code, R.id.btn_login, R.id.tv_other_login, R.id.tv_forget_password, R.id.tv_user_protocol, R.id.tv_privacy_protocol})
|
||||
@OnClick({ R.id.btn_login,R.id.iv_code,R.id.btn_clear})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.btn_get_verify_code:
|
||||
if (etPhoneNumber.validate()) {
|
||||
getVerifyCode(etPhoneNumber.getEditValue());
|
||||
}
|
||||
case R.id.btn_clear:
|
||||
SettingUtils.clearPassword();
|
||||
etPassword.clear();
|
||||
break;
|
||||
case R.id.iv_code:
|
||||
getCatpureImage();
|
||||
break;
|
||||
case R.id.btn_login:
|
||||
if (etPhoneNumber.validate()) {
|
||||
if (etVerifyCode.validate()) {
|
||||
loginByVerifyCode(etPhoneNumber.getEditValue(), etVerifyCode.getEditValue());
|
||||
loginByVerifyCode(etPhoneNumber.getEditValue(), etPassword.getEditValue(), etVerifyCode.getEditValue());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.tv_other_login:
|
||||
XToastUtils.info("其他登录方式");
|
||||
break;
|
||||
case R.id.tv_forget_password:
|
||||
XToastUtils.info("忘记密码");
|
||||
break;
|
||||
case R.id.tv_user_protocol:
|
||||
XToastUtils.info("用户协议");
|
||||
break;
|
||||
case R.id.tv_privacy_protocol:
|
||||
XToastUtils.info("隐私政策");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
private void getVerifyCode(String phoneNumber) {
|
||||
// TODO: 2020/8/29 这里只是界面演示而已
|
||||
XToastUtils.warning("只是演示,验证码请随便输");
|
||||
mCountDownHelper.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据验证码登录
|
||||
*
|
||||
* @param phoneNumber 手机号
|
||||
* @param verifyCode 验证码
|
||||
*/
|
||||
private void loginByVerifyCode(String phoneNumber, String verifyCode) {
|
||||
// TODO: 2020/8/29 这里只是界面演示而已
|
||||
onLoginSuccess();
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录成功的处理
|
||||
*/
|
||||
private void onLoginSuccess() {
|
||||
String token = RandomUtils.getRandomNumbersAndLetters(16);
|
||||
if (TokenUtils.handleLoginSuccess(token)) {
|
||||
popToBack();
|
||||
ActivityUtils.startActivity(MainActivity.class);
|
||||
}
|
||||
TokenUtils.handleLoginSuccess(token);
|
||||
popToBack();
|
||||
ActivityUtils.startActivity(MainActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if (mCountDownHelper != null) {
|
||||
mCountDownHelper.recycle();
|
||||
}
|
||||
super.onDestroyView();
|
||||
/**
|
||||
* 获取本地存储的账号
|
||||
*/
|
||||
private void getLocalAccount(){
|
||||
etPhoneNumber.setText(SettingUtils.getUserName());
|
||||
etPassword.setText(SettingUtils.getPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取验证码
|
||||
*/
|
||||
private void getCatpureImage(){
|
||||
XHttp.get("/prod-api/captchaImage")
|
||||
.execute(new CallBackProxy<CaptchaImageApiResult<CaptureImage>, CaptureImage>(new TipRequestCallBack<CaptureImage>() {
|
||||
@Override
|
||||
public void onSuccess(CaptureImage image) throws Throwable {
|
||||
uuid=image.getUuid();
|
||||
byte[] decode = Base64.decode(image.getImg(), Base64.DEFAULT);
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(decode, 0, decode.length);
|
||||
imgVertifyCode.setImageBitmap(bitmap);
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP登录
|
||||
*
|
||||
* @param phoneNumber 手机号
|
||||
* @param verifyCode 验证码
|
||||
*/
|
||||
private void loginByVerifyCode(String phoneNumber,String password, String verifyCode) {
|
||||
XHttp.post("/prod-api/login")
|
||||
.upJson("{\"username\":\""+phoneNumber+"\",\"password\":\""+password+"\",\"code\":\""+verifyCode+"\",\"uuid\":\""+uuid+"\"}")
|
||||
.execute(new CallBackProxy<TokenApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String tokenResult) throws Throwable {
|
||||
SettingUtils.setAccount(etPhoneNumber.getEditValue(),etPassword.getEditValue());
|
||||
token=tokenResult;
|
||||
onLoginSuccess();
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
clearToken();
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment;
|
||||
|
||||
import android.view.View;
|
||||
@@ -6,6 +16,7 @@ import android.widget.TextView;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.core.webview.AgentWebActivity;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
@@ -21,6 +32,8 @@ import butterknife.BindView;
|
||||
|
||||
@Page(name = "消息")
|
||||
public class MessageFragment extends BaseFragment {
|
||||
@BindView(R.id.titlebar_min)
|
||||
TitleBar titleBarMin;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -29,26 +42,12 @@ public class MessageFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
com.xuexiang.xui.widget.actionbar.TitleBar titleBar = super.initTitle();
|
||||
titleBar.setCenterClickListener(new View.OnClickListener() {
|
||||
@SingleClick
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
}
|
||||
});
|
||||
titleBar.addAction(new com.xuexiang.xui.widget.actionbar.TitleBar.TextAction("菜单") {
|
||||
@SingleClick
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
|
||||
}
|
||||
});
|
||||
return titleBar;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
titleBarMin.setLeftClickListener(v -> popToBack());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2021 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.fragment;
|
||||
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.http.request.TokenApiResult;
|
||||
import com.kerwin.wumei.utils.TokenUtils;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.widget.dialog.DialogLoader;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperTextView;
|
||||
@@ -64,6 +64,23 @@ public class SettingsFragment extends BaseFragment implements SuperTextView.OnSu
|
||||
menuLogout.setOnSuperTextViewClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP退出登录
|
||||
*/
|
||||
private void logout(){
|
||||
XHttp.post("/prod-api/logout")
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String tokenResult) throws Throwable {
|
||||
XToastUtils.success("登出成功" );
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
@Override
|
||||
public void onClick(SuperTextView superTextView) {
|
||||
@@ -83,6 +100,7 @@ public class SettingsFragment extends BaseFragment implements SuperTextView.OnSu
|
||||
getString(R.string.lab_logout_confirm),
|
||||
getString(R.string.lab_yes),
|
||||
(dialog, which) -> {
|
||||
logout();
|
||||
dialog.dismiss();
|
||||
XUtil.getActivityLifecycleHelper().exit();
|
||||
TokenUtils.handleLogoutSuccess();
|
||||
|
||||
@@ -1,34 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
*****************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.Manifest;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.text.method.HideReturnsTransformationMethod;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.kerwin.wumei.MyApp;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.activity.AddDeviceActivity;
|
||||
import com.kerwin.wumei.activity.MainActivity;
|
||||
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.core.PageOption;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xui.widget.spinner.materialspinner.MaterialSpinner;
|
||||
import com.xuexiang.xui.widget.progress.CircleProgressView;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
|
||||
@Page(name = "WIFI网络配置")
|
||||
public class AddDeviceFragment extends BaseFragment {
|
||||
@Page(name = "智能配网")
|
||||
public class AddDeviceFragment extends BaseFragment implements CircleProgressView.CircleProgressUpdateListener {
|
||||
@BindView(R.id.advance_frame_layout)
|
||||
FrameLayout advanceFrameLayout;
|
||||
@BindView(R.id.advance_linear_layout)
|
||||
@@ -37,11 +48,24 @@ public class AddDeviceFragment extends BaseFragment {
|
||||
AppCompatImageView advanceIcon;
|
||||
@BindView(R.id.wifi_password_icon)
|
||||
AppCompatImageView wifiPasswordIcon;
|
||||
@BindView(R.id.progressView_circle_main)
|
||||
CircleProgressView progressViewCircleMain;
|
||||
@BindView(R.id.progress_text_main)
|
||||
TextView progressTextMain;
|
||||
@BindView(R.id.btn_config_cancle)
|
||||
SuperButton btnConfigCancle;
|
||||
@BindView(R.id.btn_return)
|
||||
SuperButton btnReturn;
|
||||
|
||||
private static final String TAG = AddDeviceFragment.class.getSimpleName();
|
||||
private static final int REQUEST_PERMISSION = 0x01;
|
||||
private EspTouchViewModel mViewModel;
|
||||
|
||||
private boolean bStart=false;
|
||||
|
||||
private Handler mHander=new Handler();
|
||||
private int mCount=0;
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
@@ -57,23 +81,30 @@ public class AddDeviceFragment extends BaseFragment {
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
progressViewCircleMain.setGraduatedEnabled(true);
|
||||
progressViewCircleMain.setProgressViewUpdateListener(this);
|
||||
|
||||
//智能配网
|
||||
mViewModel = ((AddDeviceActivity)this.getActivity()).GetMViewModel();
|
||||
mViewModel.ssidSpinner = findViewById(R.id.ssid_spinner);
|
||||
mViewModel.apPasswordEdit = findViewById(R.id.wifi_password_txt);
|
||||
mViewModel.packageModeGroup = findViewById(R.id.packageModeGroup);
|
||||
mViewModel.messageView = findViewById(R.id.messageView);
|
||||
mViewModel.confirmBtn = findViewById(R.id.add_device_next_btn);
|
||||
mViewModel.messageView = findViewById(R.id.txt_config_message);
|
||||
mViewModel.messageView.setText("");
|
||||
mViewModel.xsbDeviceCount = findViewById(R.id.xsb_device_count);
|
||||
mViewModel.xsbDeviceCount.setDefaultValue(1);
|
||||
mViewModel.confirmBtn = findViewById(R.id.btn_begin);
|
||||
mViewModel.confirmBtn.setOnClickListener(v ->
|
||||
{
|
||||
// ((AddDeviceActivity)this.getActivity()).executeEsptouch();
|
||||
PageOption.to(AddDeviceTwoFragment.class) //跳转的fragment
|
||||
.setAnim(CoreAnim.slide) //页面转场动画
|
||||
.setRequestCode(100) //请求码,用于返回结果
|
||||
.setAddToBackStack(true) //是否加入堆栈
|
||||
.putString("device_mac","0908070605040306")
|
||||
.open(this); //打开页面进行跳转
|
||||
|
||||
((AddDeviceActivity)this.getActivity()).executeEsptouch();
|
||||
|
||||
// PageOption.to(AddDeviceTwoFragment.class) //跳转的fragment
|
||||
// .setAnim(CoreAnim.slide) //页面转场动画
|
||||
// .setRequestCode(100) //请求码,用于返回结果
|
||||
// .setAddToBackStack(true) //是否加入堆栈
|
||||
// .putString("device_mac","0908070605040306")
|
||||
// .open(this); //打开页面进行跳转
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
@@ -98,6 +129,41 @@ public class AddDeviceFragment extends BaseFragment {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进度条开始更新
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
@Override
|
||||
public void onCircleProgressStart(View view) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 进度条更新结束
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
@Override
|
||||
public void onCircleProgressFinished(View view) {
|
||||
progressViewCircleMain.startProgressAnimation();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进度条更新中
|
||||
*
|
||||
* @param view
|
||||
* @param progress
|
||||
*/
|
||||
@Override
|
||||
public void onCircleProgressUpdate(View view, float progress) {
|
||||
|
||||
// progressTextMain.setText("10");
|
||||
|
||||
}
|
||||
|
||||
@@ -135,8 +201,92 @@ public class AddDeviceFragment extends BaseFragment {
|
||||
}
|
||||
});
|
||||
|
||||
btnConfigCancle.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View view){
|
||||
((AddDeviceActivity)getActivity()).interruptEspTouchTask();
|
||||
endCounter();
|
||||
}
|
||||
});
|
||||
|
||||
btnReturn.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View view){
|
||||
popToBack();
|
||||
endCounter();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
endCounter();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开计时器
|
||||
*/
|
||||
public void beginCounter(){
|
||||
progressViewCircleMain.startProgressAnimation();
|
||||
mHander.post(mCounter);
|
||||
showMessage("配网中...",true);
|
||||
mViewModel.confirmBtn.setEnabled(false);
|
||||
btnConfigCancle.setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭计时器
|
||||
*/
|
||||
public void endCounter(){
|
||||
mHander.removeCallbacks(mCounter);
|
||||
mViewModel.confirmBtn.setEnabled(true);
|
||||
btnConfigCancle.setEnabled(false);
|
||||
progressViewCircleMain.stopProgressAnimation();
|
||||
progressViewCircleMain.setProgressViewUpdateListener(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计时器
|
||||
*/
|
||||
private Runnable mCounter=new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int delay=300;
|
||||
if(mCount<30){
|
||||
mCount++;
|
||||
}else if(mCount<50){
|
||||
mCount++;
|
||||
delay=500;
|
||||
}else if(mCount<80){
|
||||
mCount++;
|
||||
delay=1000;
|
||||
}else if(mCount<90){
|
||||
mCount++;
|
||||
delay=3000;
|
||||
}else if(mCount<98){
|
||||
mCount++;
|
||||
delay=10000;
|
||||
}
|
||||
progressTextMain.setText(mCount + "");
|
||||
mHander.postDelayed(this, delay);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 消息提示
|
||||
* @param message
|
||||
* @param isSuccess
|
||||
*/
|
||||
public void showMessage(String message,boolean isSuccess){
|
||||
if(isSuccess){
|
||||
mViewModel.messageView.setTextColor(Color.argb(255, 103, 194, 58)); // 绿色
|
||||
}else{
|
||||
mViewModel.messageView.setTextColor(Color.argb(255, 245, 108, 108)); //红色
|
||||
}
|
||||
mViewModel.messageView.setText(message);
|
||||
mViewModel.messageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/***************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
***************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.Manifest;
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.core.webview.AgentWebActivity;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.adapter.FragmentAdapter;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.grouplist.XUIGroupListView;
|
||||
import com.xuexiang.xui.widget.tabbar.TabSegment;
|
||||
import com.xuexiang.xutil.app.AppUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
|
||||
@Page(name = "设备详情")
|
||||
public class DeviceDetailFragment extends BaseFragment {
|
||||
@BindView(R.id.titlebar_min)
|
||||
TitleBar titleBarMin;
|
||||
@BindView(R.id.tabSegment)
|
||||
TabSegment tabSegment;
|
||||
@BindView(R.id.contentViewPager)
|
||||
ViewPager contentViewPager;
|
||||
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_device_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
titleBarMin.setLeftClickListener(v -> popToBack());
|
||||
|
||||
Bundle arguments = getArguments();
|
||||
Long device_id = arguments.getLong("device_id");
|
||||
String device_num=arguments.getString("device_num");
|
||||
tabSegment.addTab(new TabSegment.Tab("设备"));
|
||||
tabSegment.addTab(new TabSegment.Tab("状态"));
|
||||
tabSegment.addTab(new TabSegment.Tab("配置"));
|
||||
|
||||
FragmentAdapter<BaseFragment> adapter = new FragmentAdapter<>(getChildFragmentManager());
|
||||
adapter.addFragment(new DeviceEditFragment(device_id,device_num), "");
|
||||
adapter.addFragment(new DeviceStatusFragment(device_id,device_num), "");
|
||||
adapter.addFragment(new DeviceSetFragment(device_id,device_num), "");
|
||||
|
||||
contentViewPager.setAdapter(adapter);
|
||||
contentViewPager.setCurrentItem(0, false);
|
||||
tabSegment.setupWithViewPager(contentViewPager, false);
|
||||
tabSegment.setMode(TabSegment.MODE_FIXED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.entity.DictData;
|
||||
import com.kerwin.wumei.entity.IotDevice;
|
||||
import com.kerwin.wumei.entity.IotDeviceStatus;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.callback.SimpleCallBack;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||
import com.xuexiang.xutil.net.JsonUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
@Page(name = "编辑设备")
|
||||
public class DeviceEditFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.et_device_name)
|
||||
MaterialEditText et_device_name;
|
||||
@BindView(R.id.et_device_remark)
|
||||
MaterialEditText et_device_remark;
|
||||
@BindView(R.id.txt_device_num)
|
||||
TextView txt_device_num;
|
||||
@BindView(R.id.txt_device_category)
|
||||
TextView txt_device_category;
|
||||
@BindView(R.id.txt_firmware_version)
|
||||
TextView txt_firmware_version;
|
||||
@BindView(R.id.txt_create_time)
|
||||
TextView txt_create_time;
|
||||
@BindView(R.id.sp_device_temperature)
|
||||
SuperButton sp_device_temperature;
|
||||
@BindView(R.id.update_device_temp_icon)
|
||||
AppCompatImageView update_temp_icon;
|
||||
|
||||
private Long deviceId=0L;
|
||||
private String deviceNum="";
|
||||
|
||||
public DeviceEditFragment(Long device_id,String device_num){
|
||||
deviceId=device_id;
|
||||
deviceNum=device_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
*/
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_device_edit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
getDevice(deviceId);
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
@OnClick({ R.id.btn_save,R.id.btn_cancle_edit,R.id.update_device_temp_icon})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.btn_save:
|
||||
updateDevice(buildDevice());
|
||||
break;
|
||||
case R.id.btn_cancle_edit:
|
||||
popToBack();
|
||||
break;
|
||||
case R.id.update_device_temp_icon:
|
||||
getNewStatusData();
|
||||
update_temp_icon.setVisibility(View.GONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建设备数据
|
||||
*/
|
||||
private IotDevice buildDevice(){
|
||||
IotDevice device=new IotDevice();
|
||||
device.setDeviceId(deviceId);
|
||||
device.setDeviceNum((String) txt_device_num.getText());
|
||||
device.setDeviceName(et_device_name.getEditValue());
|
||||
device.setRemark(et_device_remark.getEditValue());
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取最新设备信息
|
||||
*/
|
||||
private void getNewStatusData(){
|
||||
XHttp.get("/prod-api/system/status/getStatus/"+deviceNum)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) {
|
||||
getDeviceStatus(deviceId);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取设备状态
|
||||
*/
|
||||
private void getDeviceStatus(Long device_id){
|
||||
XHttp.get("/prod-api/system/status/new/"+device_id)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<IotDeviceStatus>() {
|
||||
@Override
|
||||
public void onSuccess(IotDeviceStatus status) throws Throwable {
|
||||
//更新温度
|
||||
sp_device_temperature.setText(status.getDeviceTemperature()+"℃");
|
||||
update_temp_icon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取设备信息
|
||||
*/
|
||||
private void getDevice(Long device_id){
|
||||
XHttp.get("/prod-api/system/device/"+device_id)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<IotDevice>() {
|
||||
@Override
|
||||
public void onSuccess(IotDevice device) throws Throwable {
|
||||
//绑定数据
|
||||
Log.d("deviceName:",device.getDeviceName());
|
||||
et_device_name.setText(device.getDeviceName());
|
||||
et_device_remark.setText(device.getRemark());
|
||||
txt_device_num.setText(device.getDeviceNum());
|
||||
txt_device_category.setText(device.getCategoryName());
|
||||
txt_firmware_version.setText("v"+device.getFirmwareVersion());
|
||||
txt_create_time.setText(device.getCreateTime());
|
||||
sp_device_temperature.setText(device.getDeviceTemp()+"℃");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP更新设备信息
|
||||
*/
|
||||
private void updateDevice(IotDevice device){
|
||||
if(!hasToken()) return;
|
||||
XHttp.put("/prod-api/system/device")
|
||||
.upJson(JsonUtil.toJson(device))
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
Log.d("response:",response);
|
||||
XToastUtils.success("数据保存成功");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,61 @@
|
||||
/****************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
****************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.kerwin.wumei.activity.LoginActivity;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.entity.DictData;
|
||||
import com.kerwin.wumei.entity.IotCategory;
|
||||
import com.kerwin.wumei.entity.IotDevice;
|
||||
import com.kerwin.wumei.entity.IotDeviceSet;
|
||||
import com.kerwin.wumei.entity.IotDeviceStatus;
|
||||
import com.kerwin.wumei.entity.IotGroup;
|
||||
import com.kerwin.wumei.fragment.LoginFragment;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.ListApiResult;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.callback.SimpleCallBack;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.adapter.simple.AdapterItem;
|
||||
import com.xuexiang.xui.utils.WidgetUtils;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.popupwindow.popup.XUISimplePopup;
|
||||
import com.xuexiang.xutil.display.ViewUtils;
|
||||
import com.xuexiang.xui.widget.toast.XToast;
|
||||
import com.xuexiang.xutil.app.ActivityUtils;
|
||||
import com.xuexiang.xutil.net.JsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.google.android.material.tabs.TabLayout.MODE_SCROLLABLE;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
@Page(name = "设备")
|
||||
public class DeviceFragment extends BaseFragment implements TabLayout.OnTabSelectedListener{
|
||||
|
||||
@BindView(R.id.tab_layout)
|
||||
TabLayout tabLayout;
|
||||
@BindView(R.id.view_pager)
|
||||
@@ -46,7 +72,6 @@ public class DeviceFragment extends BaseFragment implements TabLayout.OnTabSelec
|
||||
// mAdapter.addFragment(2, SimpleTabFragment.newInstance("动态加入"), "动态加入");
|
||||
// mAdapter.removeFragment(2);
|
||||
// mAdapter.notifyDataSetChanged();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -65,27 +90,14 @@ public class DeviceFragment extends BaseFragment implements TabLayout.OnTabSelec
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mAdapter = new FragmentStateViewPager2Adapter(this);
|
||||
tabLayout.setTabMode(MODE_SCROLLABLE);
|
||||
tabLayout.addOnTabSelectedListener(this);
|
||||
viewPager.setAdapter(mAdapter);
|
||||
// 设置缓存的数量
|
||||
viewPager.setOffscreenPageLimit(1);
|
||||
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(mAdapter.getPageTitle(position))).attach();
|
||||
|
||||
// 动态加载选项卡内容
|
||||
for (String page : MultiPage.getPageNames()) {
|
||||
mAdapter.addFragment(SimpleTabFragment.newInstance(page), page);
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
viewPager.setCurrentItem(0, false);
|
||||
WidgetUtils.setTabLayoutTextFont(tabLayout);
|
||||
//获取分组列表
|
||||
getGroupList(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
XToastUtils.toast("选中了:" + tab.getText());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,4 +109,198 @@ public class DeviceFragment extends BaseFragment implements TabLayout.OnTabSelec
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化设备列表
|
||||
* @param listener
|
||||
* @param groupList
|
||||
*/
|
||||
private void initDeviceListView(@NonNull TabLayout.OnTabSelectedListener listener,List<IotGroup> groupList){
|
||||
mAdapter = new FragmentStateViewPager2Adapter((Fragment) listener);
|
||||
tabLayout.setTabMode(MODE_SCROLLABLE);
|
||||
tabLayout.addOnTabSelectedListener(listener);
|
||||
viewPager.setAdapter(mAdapter);
|
||||
// 设置缓存的数量
|
||||
viewPager.setOffscreenPageLimit(10);
|
||||
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(mAdapter.getPageTitle(position))).attach();
|
||||
|
||||
// 动态加载选项卡内容
|
||||
for (IotGroup group: groupList) {
|
||||
mAdapter.addFragment(SimpleTabFragment.newInstance(group.getGroupId()), group.getGroupName());
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
viewPager.setCurrentItem(0, false);
|
||||
WidgetUtils.setTabLayoutTextFont(tabLayout);
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取分组列表
|
||||
*/
|
||||
private void getGroupList(@NonNull TabLayout.OnTabSelectedListener listener){
|
||||
XHttp.get("/prod-api/system/group/list?pageNum=1&pageSize=100")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<ListApiResult<List<IotGroup>>, List<IotGroup>>(new TipRequestCallBack<List<IotGroup>>() {
|
||||
@Override
|
||||
public void onSuccess(List<IotGroup> list) throws Throwable {
|
||||
List<IotGroup> groupList=list;
|
||||
IotGroup iotGroup=new IotGroup();
|
||||
iotGroup.setGroupId(0L);
|
||||
iotGroup.setGroupName("全部");
|
||||
iotGroup.setGroupOrder(0);
|
||||
groupList.add(0,iotGroup);
|
||||
|
||||
initDeviceListView(listener,groupList);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
List<IotGroup> groupList=new ArrayList<IotGroup>();
|
||||
IotGroup group=new IotGroup();
|
||||
group.setGroupId(0L);
|
||||
group.setGroupName("全部");
|
||||
groupList.add(group);
|
||||
initDeviceListView(listener,groupList);
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* HTTP获取触发源字典列表
|
||||
*/
|
||||
private void getTriggerSourceDic(){
|
||||
XHttp.get("/prod-api/system/dict/data/type/iot_trigger_source")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<List<DictData>>() {
|
||||
@Override
|
||||
public void onSuccess(List<DictData> response) {
|
||||
Log.d("group name:",response.get(0).getDictLabel());
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HTTP获取分组详情
|
||||
*/
|
||||
private void getGroup(Long groupId){
|
||||
if(!hasToken()) return;
|
||||
XHttp.get("/prod-api/system/group/"+groupId)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<IotGroup>(){
|
||||
@Override
|
||||
public void onSuccess(IotGroup response) throws Throwable {
|
||||
|
||||
Log.d("response:","response");
|
||||
XToastUtils.info("response");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP新增分组
|
||||
*/
|
||||
private void addGroup(IotGroup group){
|
||||
if(!hasToken()) return;
|
||||
XHttp.post("/prod-api/system/group")
|
||||
.upJson(JsonUtil.toJson(group))
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
|
||||
Log.d("response:","response");
|
||||
XToastUtils.info("response");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP编辑分组
|
||||
*/
|
||||
private void editGroup(IotGroup group){
|
||||
if(!hasToken()) return;
|
||||
XHttp.put("/prod-api/system/group")
|
||||
.upJson(JsonUtil.toJson(group))
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
Log.d("response:","response");
|
||||
XToastUtils.info("response");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP删除分组
|
||||
*/
|
||||
private void deleteGroup(Long groupId){
|
||||
if(!hasToken()) return;
|
||||
XHttp.delete("/prod-api/system/group/"+groupId)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
Log.d("response:","response");
|
||||
XToastUtils.info("response");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
/***************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
***************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.entity.DictData;
|
||||
import com.kerwin.wumei.entity.IotDevice;
|
||||
import com.kerwin.wumei.entity.IotDeviceSet;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.ListApiResult;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.callback.SimpleCallBack;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.utils.WidgetUtils;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.button.switchbutton.SwitchButton;
|
||||
import com.xuexiang.xui.widget.picker.XSeekBar;
|
||||
import com.xuexiang.xutil.net.JsonUtil;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
@Page(name = "编辑设备配置")
|
||||
public class DeviceSetFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.sb_radar)
|
||||
SwitchButton sb_radar;
|
||||
@BindView(R.id.sb_alarm)
|
||||
SwitchButton sb_alarm;
|
||||
@BindView(R.id.sb_rf_control)
|
||||
SwitchButton sb_rf_control;
|
||||
@BindView(R.id.sb_rf_learn)
|
||||
SwitchButton sb_rf_learn;
|
||||
@BindView(R.id.sb_rf_clear)
|
||||
SwitchButton sb_rf_clear;
|
||||
@BindView(R.id.sb_reset)
|
||||
SwitchButton sb_reset;
|
||||
@BindView(R.id.sb_open_ap)
|
||||
SwitchButton sb_open_ap;
|
||||
|
||||
@BindView(R.id.spinner_rf_func_one)
|
||||
Spinner spinner_rf_func_one;
|
||||
@BindView(R.id.spinner_rf_func_two)
|
||||
Spinner spinner_rf_func_two;
|
||||
@BindView(R.id.spinner_rf_func_three)
|
||||
Spinner spinner_rf_func_three;
|
||||
@BindView(R.id.spinner_rf_func_four)
|
||||
Spinner spinner_rf_func_four;
|
||||
|
||||
@BindView(R.id.xsb_radar_interval)
|
||||
XSeekBar xsb_radar_interval;
|
||||
|
||||
private Long deviceId=0L;
|
||||
private String deviceNum="";
|
||||
private List<DictData> rfFunctionList;
|
||||
private String[] rfFunctionStrings;
|
||||
|
||||
public DeviceSetFragment(Long device_id,String device_num){
|
||||
deviceId=device_id;
|
||||
deviceNum=device_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
*/
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_device_set;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
getRFFunctionDic();
|
||||
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
@OnClick({ R.id.btn_apply_set,R.id.btn_cancle_set})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.btn_apply_set:
|
||||
updateDeviceSet(buildDeviceSet());
|
||||
break;
|
||||
case R.id.btn_cancle_set:
|
||||
popToBack();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建设备配置数据
|
||||
*/
|
||||
private IotDeviceSet buildDeviceSet(){
|
||||
IotDeviceSet deviceSet=new IotDeviceSet();
|
||||
deviceSet.setDeviceId(deviceId);
|
||||
deviceSet.setDeviceNum(deviceNum);
|
||||
deviceSet.setIsHost(0); //不托管
|
||||
deviceSet.setIsRadar(sb_radar.isChecked()==true?1:0);
|
||||
deviceSet.setIsAlarm(sb_alarm.isChecked()==true?1:0);
|
||||
deviceSet.setIsRfLearn(sb_rf_learn.isChecked()==true?1:0);
|
||||
deviceSet.setIsRfClear(sb_rf_clear.isChecked()==true?1:0);
|
||||
deviceSet.setIsAp(sb_open_ap.isChecked()==true?1:0);
|
||||
deviceSet.setIsReset(sb_reset.isChecked()==true?1:0);
|
||||
deviceSet.setIsRfControl(sb_rf_control.isChecked()==true?1:0);
|
||||
deviceSet.setRadarInterval(xsb_radar_interval.getSelectedNumber());
|
||||
deviceSet.setRfOneFunc(getValueByDicString(spinner_rf_func_one.getSelectedItem().toString()));
|
||||
deviceSet.setRfTwoFunc(getValueByDicString(spinner_rf_func_two.getSelectedItem().toString()));
|
||||
deviceSet.setRfThreeFunc(getValueByDicString(spinner_rf_func_three.getSelectedItem().toString()));
|
||||
deviceSet.setRfFourFunc(getValueByDicString(spinner_rf_func_four.getSelectedItem().toString()));
|
||||
return deviceSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典标签获取字典值
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
private int getValueByDicString(String label){
|
||||
for(DictData dict:rfFunctionList){
|
||||
if(dict.getDictLabel().equals(label)){
|
||||
return dict.getDictValue();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典值获取索引
|
||||
*/
|
||||
private int getIndexByDicValue(int value){
|
||||
for(int i=0;i<rfFunctionList.size();i++)
|
||||
{
|
||||
if(rfFunctionList.get(i).getDictValue()==value){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取遥控按键功能字典列表
|
||||
*/
|
||||
private void getRFFunctionDic(){
|
||||
XHttp.get("/prod-api/system/dict/data/type/rf_function")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<List<DictData>>() {
|
||||
@Override
|
||||
public void onSuccess(List<DictData> list) {
|
||||
//绑定数据
|
||||
rfFunctionList=list;
|
||||
rfFunctionStrings=new String[rfFunctionList.size()];
|
||||
for(int i=0;i<rfFunctionList.size();i++){
|
||||
rfFunctionStrings[i]=rfFunctionList.get(i).getDictLabel();
|
||||
}
|
||||
WidgetUtils.initSpinnerStyle(spinner_rf_func_one, rfFunctionStrings);
|
||||
WidgetUtils.initSpinnerStyle(spinner_rf_func_two, rfFunctionStrings);
|
||||
WidgetUtils.initSpinnerStyle(spinner_rf_func_three, rfFunctionStrings);
|
||||
WidgetUtils.initSpinnerStyle(spinner_rf_func_four, rfFunctionStrings);
|
||||
//获取设备配置
|
||||
getDeviceSet(deviceId);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取设备配置
|
||||
*/
|
||||
private void getDeviceSet(Long device_id){
|
||||
XHttp.get("/prod-api/system/set/new/"+device_id)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<IotDeviceSet>() {
|
||||
@Override
|
||||
public void onSuccess(IotDeviceSet set) throws Throwable {
|
||||
//绑定数据
|
||||
Log.d("device num:",set.getDeviceNum());
|
||||
sb_radar.setChecked(set.getIsRadar()==1);
|
||||
sb_alarm.setChecked(set.getIsAlarm()==1);
|
||||
sb_rf_control.setChecked(set.getIsRfControl()==1);
|
||||
xsb_radar_interval.setDefaultValue(set.getRadarInterval());
|
||||
spinner_rf_func_one.setSelection(getIndexByDicValue(set.getRfOneFunc()));
|
||||
spinner_rf_func_two.setSelection(getIndexByDicValue(set.getRfTwoFunc()));
|
||||
spinner_rf_func_three.setSelection(getIndexByDicValue(set.getRfThreeFunc()));
|
||||
spinner_rf_func_four.setSelection(getIndexByDicValue(set.getRfFourFunc()));
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP更新设备配置
|
||||
*/
|
||||
private void updateDeviceSet(IotDeviceSet deviceSet){
|
||||
if(!hasToken()) return;
|
||||
XHttp.put("/prod-api/system/set")
|
||||
.upJson(JsonUtil.toJson(deviceSet))
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
Log.d("response:",response);
|
||||
XToastUtils.success("设备配置更新成功");
|
||||
sb_reset.setChecked(false);
|
||||
sb_open_ap.setChecked(false);
|
||||
sb_rf_clear.setChecked(false);
|
||||
sb_rf_learn.setChecked(false);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
/*****************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
*****************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.entity.DictData;
|
||||
import com.kerwin.wumei.entity.IotDeviceStatus;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.callback.SimpleCallBack;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xui.utils.WidgetUtils;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.button.switchbutton.SwitchButton;
|
||||
import com.xuexiang.xui.widget.dialog.MiniLoadingDialog;
|
||||
import com.xuexiang.xui.widget.picker.XSeekBar;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||
import com.xuexiang.xutil.net.JsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static android.R.layout.simple_spinner_item;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
@Page(name = "编辑设备状态")
|
||||
public class DeviceStatusFragment extends BaseFragment implements CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
@BindView(R.id.sb_relay)
|
||||
SwitchButton sb_relay;
|
||||
@BindView(R.id.sb_light)
|
||||
SwitchButton sb_light;
|
||||
@BindView(R.id.spinner_light_mode)
|
||||
Spinner spinner_light_mode;
|
||||
@BindView(R.id.xsb_fade_interval)
|
||||
XSeekBar xsb_fade_interval;
|
||||
@BindView(R.id.xsb_fade_time)
|
||||
XSeekBar xsb_fade_time;
|
||||
@BindView(R.id.xsb_brightness)
|
||||
XSeekBar xsb_brightness;
|
||||
@BindView(R.id.xsb_red)
|
||||
XSeekBar xsb_red;
|
||||
@BindView(R.id.xsb_green)
|
||||
XSeekBar xsb_green;
|
||||
@BindView(R.id.xsb_blue)
|
||||
XSeekBar xsb_blue;
|
||||
@BindView(R.id.sp_temperature)
|
||||
SuperButton sp_temperature;
|
||||
@BindView(R.id.sp_humidity)
|
||||
SuperButton sp_humidity;
|
||||
@BindView(R.id.frame_layout_loading_status)
|
||||
FrameLayout frame_layout_loading_status;
|
||||
|
||||
private Long deviceId=0L;
|
||||
private String deviceNum="";
|
||||
private List<DictData> lightModeList;
|
||||
private String[] lightModeStrings;
|
||||
|
||||
public DeviceStatusFragment(Long device_id,String device_num){
|
||||
deviceId=device_id;
|
||||
deviceNum=device_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
*/
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_device_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
getLightModeDic();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化监听
|
||||
*/
|
||||
@Override
|
||||
protected void initListeners() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
XToastUtils.toast("isChecked:" + isChecked);
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
@OnClick({ R.id.btn_apply_status,R.id.btn_cancle_status,R.id.frame_layout_loading_status})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.btn_apply_status:
|
||||
updateDeviceStatus(buildDeviceStatus());
|
||||
break;
|
||||
case R.id.btn_cancle_status:
|
||||
popToBack();
|
||||
break;
|
||||
case R.id.frame_layout_loading_status:
|
||||
getNewStatusData();
|
||||
frame_layout_loading_status.setVisibility(View.INVISIBLE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建设备状态数据
|
||||
*/
|
||||
private IotDeviceStatus buildDeviceStatus(){
|
||||
IotDeviceStatus deviceStatus=new IotDeviceStatus();
|
||||
deviceStatus.setDeviceId(deviceId);
|
||||
deviceStatus.setDeviceNum(deviceNum);
|
||||
deviceStatus.setRelayStatus(sb_relay.isChecked()==true?1:0);
|
||||
deviceStatus.setLightStatus(sb_light.isChecked()==true?1:0);
|
||||
deviceStatus.setLightMode(getValueByDicString(spinner_light_mode.getSelectedItem().toString()));
|
||||
deviceStatus.setLightInterval(xsb_fade_interval.getSelectedNumber());
|
||||
deviceStatus.setFadeTime(xsb_fade_time.getSelectedNumber());
|
||||
deviceStatus.setBrightness(xsb_brightness.getSelectedNumber());
|
||||
deviceStatus.setRed(xsb_red.getSelectedNumber());
|
||||
deviceStatus.setBlue(xsb_blue.getSelectedNumber());
|
||||
deviceStatus.setGreen(xsb_green.getSelectedNumber());
|
||||
deviceStatus.setTriggerSource(1); //0-无、1-按键、2.手机、3-浏览器、4-射频遥控、5-雷达、6-报警、7-定时
|
||||
return deviceStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典标签获取字典值
|
||||
*/
|
||||
private int getValueByDicString(String label){
|
||||
for(DictData dict:lightModeList){
|
||||
if(dict.getDictLabel().equals(label)){
|
||||
return dict.getDictValue();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典值获取索引
|
||||
*/
|
||||
private int getIndexByDicValue(int value){
|
||||
for(int i=0;i<lightModeList.size();i++)
|
||||
{
|
||||
if(lightModeList.get(i).getDictValue()==value){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取最新设备信息
|
||||
*/
|
||||
private void getNewStatusData(){
|
||||
XHttp.get("/prod-api/system/status/getStatus/"+deviceNum)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) {
|
||||
getDeviceStatus(deviceId);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取灯模式字典列表
|
||||
*/
|
||||
private void getLightModeDic(){
|
||||
XHttp.get("/prod-api/system/dict/data/type/light_mode")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<List<DictData>>() {
|
||||
@Override
|
||||
public void onSuccess(List<DictData> list) {
|
||||
lightModeList=list;
|
||||
lightModeStrings=new String[lightModeList.size()];
|
||||
for (int i=0;i<lightModeList.size();i++) {
|
||||
lightModeStrings[i]=lightModeList.get(i).getDictLabel();
|
||||
}
|
||||
WidgetUtils.initSpinnerStyle(spinner_light_mode, lightModeStrings);
|
||||
//获取设备状态
|
||||
getDeviceStatus(deviceId);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取设备状态
|
||||
*/
|
||||
private void getDeviceStatus(Long device_id){
|
||||
XHttp.get("/prod-api/system/status/new/"+device_id)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new SimpleCallBack<IotDeviceStatus>() {
|
||||
@Override
|
||||
public void onSuccess(IotDeviceStatus status) throws Throwable {
|
||||
//绑定数据
|
||||
Log.d("device num:",status.getDeviceNum());
|
||||
sb_relay.setChecked(status.getRelayStatus()==1);
|
||||
sb_light.setChecked(status.getLightStatus()==1);
|
||||
xsb_fade_interval.setDefaultValue(status.getLightInterval());
|
||||
xsb_fade_time.setDefaultValue(status.getFadeTime());
|
||||
xsb_red.setDefaultValue(status.getRed());
|
||||
xsb_green.setDefaultValue(status.getGreen());
|
||||
xsb_blue.setDefaultValue(status.getBlue());
|
||||
xsb_blue.setDefaultValue(status.getBrightness());
|
||||
sp_temperature.setText(status.getAirTemperature()+"℃");
|
||||
sp_humidity.setText(status.getAirHumidity()+"RH%");
|
||||
spinner_light_mode.setSelection(getIndexByDicValue(status.getLightMode()));
|
||||
frame_layout_loading_status.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP更新设备状态
|
||||
*/
|
||||
private void updateDeviceStatus(IotDeviceStatus deviceStatus){
|
||||
if(!hasToken()) return;
|
||||
XHttp.put("/prod-api/system/status")
|
||||
.upJson(JsonUtil.toJson(deviceStatus))
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
Log.d("response:",response);
|
||||
XToastUtils.success("设备状态更新成功");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}){});
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
/*****************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
*****************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
|
||||
@@ -1,34 +1,67 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.Manifest;
|
||||
import android.os.Build;
|
||||
import android.text.method.HideReturnsTransformationMethod;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.Log;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.kerwin.wumei.MyApp;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.activity.MainActivity;
|
||||
import com.kerwin.wumei.adapter.entity.EspTouchViewModel;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.core.webview.AgentWebActivity;
|
||||
import com.kerwin.wumei.entity.bo.CaptureImage;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.CaptchaImageApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.spinner.materialspinner.MaterialSpinner;
|
||||
|
||||
import java.util.List;
|
||||
import com.xuexiang.xui.widget.button.switchbutton.SwitchButton;
|
||||
import com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getApIp;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getIsHttps;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getServerPort;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getServerip;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.setApIp;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.setServeUrl;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
|
||||
|
||||
@Page(anim = CoreAnim.none)
|
||||
@Page(name = "用户信息")
|
||||
public class SceneFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.btn_connect_test)
|
||||
SuperButton btn_connect_test;
|
||||
@BindView(R.id.btn_save_serve)
|
||||
SuperButton btn_save_serve;
|
||||
@BindView(R.id.txt_message)
|
||||
TextView txt_message;
|
||||
@BindView(R.id.et_serve)
|
||||
MaterialEditText et_serve_ip;
|
||||
@BindView(R.id.et_port)
|
||||
MaterialEditText et_port;
|
||||
@BindView(R.id.sb_https)
|
||||
SwitchButton sb_https;
|
||||
@BindView(R.id.et_ap_address)
|
||||
MaterialEditText et_ap_address;
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
*/
|
||||
@@ -51,9 +84,89 @@ public class SceneFragment extends BaseFragment {
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() { }
|
||||
protected void initViews() {
|
||||
et_serve_ip.setText(getServerip());
|
||||
et_port.setText(getServerPort());
|
||||
sb_https.setChecked(getIsHttps());
|
||||
et_ap_address.setText(getApIp());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListeners() { }
|
||||
|
||||
@SingleClick
|
||||
@OnClick({ R.id.btn_save_serve,R.id.btn_connect_test,R.id.btn_open_ap})
|
||||
public void onViewClicked(View view) {
|
||||
if(!et_port.validate()) return;
|
||||
if(et_serve_ip.getEditValue().length()==0)
|
||||
{
|
||||
showMessage("服务端地址不能为空",false);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (view.getId()) {
|
||||
case R.id.btn_save_serve:
|
||||
setServeUrl(et_serve_ip.getEditValue(),et_port.getEditValue(),sb_https.isChecked());
|
||||
clearToken();
|
||||
showMessage("服务端地址信息存储成功,请重新启动APP!",true);
|
||||
break;
|
||||
case R.id.btn_connect_test:
|
||||
getCatpureImage();
|
||||
break;
|
||||
case R.id.btn_open_ap:
|
||||
if(et_ap_address.getEditValue()==null || et_ap_address.getEditValue().length()==0){
|
||||
XToastUtils.error("AP的地址不能为空");
|
||||
}else {
|
||||
AgentWebActivity.goWeb(getContext(), et_ap_address.getEditValue());
|
||||
setApIp(et_ap_address.getEditValue());
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private String buildServeString(){
|
||||
String address="";
|
||||
if(sb_https.isChecked()){
|
||||
address="https://";
|
||||
}else{
|
||||
address="http://";
|
||||
}
|
||||
return address+et_serve_ip.getEditValue()+":"+et_port.getEditValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HTTP获取验证码(用于连接测试)
|
||||
*/
|
||||
private void getCatpureImage(){
|
||||
XHttp.get(buildServeString() + "/prod-api/captchaImage")
|
||||
.execute(new CallBackProxy<CaptchaImageApiResult<CaptureImage>, CaptureImage>(new TipRequestCallBack<CaptureImage>() {
|
||||
@Override
|
||||
public void onSuccess(CaptureImage image) throws Throwable {
|
||||
String uuid=image.getUuid();
|
||||
showMessage("服务端连接成功",true);
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
showMessage("服务端连接失败\n"+"连接地址:"+buildServeString()+"\n错误提示:"+e.getMessage(),false);
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提示
|
||||
* @param message
|
||||
* @param isSuccess
|
||||
*/
|
||||
private void showMessage(String message,boolean isSuccess){
|
||||
if(isSuccess){
|
||||
txt_message.setTextColor(Color.argb(255, 103, 194, 58)); // 绿色
|
||||
}else{
|
||||
txt_message.setTextColor(Color.argb(255, 245, 108, 108)); //红色
|
||||
}
|
||||
txt_message.setText(message);
|
||||
txt_message.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
|
||||
@@ -1,151 +1,141 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.device;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.graphics.Color;
|
||||
import android.os.Vibrator;
|
||||
import android.text.method.HideReturnsTransformationMethod;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.vlayout.DelegateAdapter;
|
||||
import com.alibaba.android.vlayout.LayoutHelper;
|
||||
import com.alibaba.android.vlayout.VirtualLayoutManager;
|
||||
import com.alibaba.android.vlayout.layout.GridLayoutHelper;
|
||||
import com.alibaba.android.vlayout.layout.LinearLayoutHelper;
|
||||
import com.alibaba.android.vlayout.layout.StaggeredGridLayoutHelper;
|
||||
import com.alibaba.android.vlayout.layout.StickyLayoutHelper;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.adapter.base.broccoli.BroccoliSimpleDelegateAdapter;
|
||||
import com.kerwin.wumei.adapter.base.delegate.SimpleDelegateAdapter;
|
||||
import com.kerwin.wumei.adapter.base.delegate.SingleDelegateAdapter;
|
||||
import com.kerwin.wumei.adapter.entity.NewInfo;
|
||||
import com.kerwin.wumei.utils.DemoDataProvider;
|
||||
import com.kerwin.wumei.utils.RandomUtils;
|
||||
import com.kerwin.wumei.utils.Utils;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.entity.IotCategory;
|
||||
import com.kerwin.wumei.entity.IotDeviceStatus;
|
||||
import com.kerwin.wumei.entity.vo.IotDeviceVo;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.ListApiResult;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.xuexiang.xrouter.annotation.AutoWired;
|
||||
import com.xuexiang.xrouter.launcher.XRouter;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.base.XPageFragment;
|
||||
import com.xuexiang.xpage.core.PageOption;
|
||||
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
|
||||
import com.xuexiang.xui.adapter.simple.AdapterItem;
|
||||
import com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.button.SwitchIconView;
|
||||
import com.xuexiang.xui.widget.imageview.ImageLoader;
|
||||
import com.xuexiang.xui.widget.imageview.RadiusImageView;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||
import com.xuexiang.xutil.net.JsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import me.samlss.broccoli.Broccoli;
|
||||
|
||||
import static com.xuexiang.xui.utils.Utils.getScreenWidth;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
import static com.xuexiang.xutil.display.DensityUtils.dip2px;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2020/4/21 12:24 AM
|
||||
*/
|
||||
public class SimpleTabFragment extends Fragment {
|
||||
@Page(name = "设备")
|
||||
public class SimpleTabFragment extends BaseFragment {
|
||||
private static final String TAG = "SimpleTabFragment";
|
||||
|
||||
private static final String KEY_TITLE = "title";
|
||||
|
||||
// @BindView(R.id.tv_title)
|
||||
// TextView tvTitle;
|
||||
// @BindView(R.id.tv_explain)
|
||||
// TextView tvExplain;
|
||||
|
||||
@BindView(R.id.recyclerView)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.refreshLayout)
|
||||
SmartRefreshLayout refreshLayout;
|
||||
// @BindView(R.id.item_card_view)
|
||||
// CardView itemCardView;
|
||||
|
||||
private Unbinder mUnbinder;
|
||||
|
||||
private SimpleDelegateAdapter<NewInfo> mNewsAdapter;
|
||||
|
||||
@AutoWired(name = KEY_TITLE)
|
||||
String title;
|
||||
private SimpleDelegateAdapter<IotDeviceVo> deviceAdapter;
|
||||
private List<IotDeviceVo> devices=new ArrayList<IotDeviceVo>() {};
|
||||
private int pageNum=1;
|
||||
private int pageSize=10;
|
||||
private Long groupId=0L;
|
||||
|
||||
|
||||
public static SimpleTabFragment newInstance(String title) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(KEY_TITLE, title);
|
||||
public static SimpleTabFragment newInstance(Long groupId) {
|
||||
SimpleTabFragment fragment = new SimpleTabFragment();
|
||||
fragment.setArguments(args);
|
||||
fragment.groupId=groupId;
|
||||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_simple_tab;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
*/
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
initView();
|
||||
//Http获取设备列表
|
||||
getDeviceList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
Log.e(TAG, "onAttach:" + title);
|
||||
Log.e(TAG, "onAttach:" + groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
Log.e(TAG, "onDetach:" + title);
|
||||
Log.e(TAG, "onDetach:" + groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume:" + title);
|
||||
Log.e(TAG, "onResume:" + groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
Log.e(TAG, "onStop:" + title);
|
||||
Log.e(TAG, "onStop:" + groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
XRouter.getInstance().inject(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_simple_tab, container, false);
|
||||
mUnbinder = ButterKnife.bind(this, view);
|
||||
initView();
|
||||
return view;
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
// int randomNumber = RandomUtils.getRandom(10, 100);
|
||||
// Log.e(TAG, "initView, random number:" + randomNumber + ", " + title);
|
||||
// tvTitle.setText(String.format("这个是%s页面的内容", title));
|
||||
// tvExplain.setText(String.format("这个是页面随机生成的数字:%d", randomNumber));
|
||||
|
||||
|
||||
VirtualLayoutManager virtualLayoutManager = new VirtualLayoutManager(getContext());
|
||||
recyclerView.setLayoutManager(virtualLayoutManager);
|
||||
@@ -153,19 +143,14 @@ public class SimpleTabFragment extends Fragment {
|
||||
recyclerView.setRecycledViewPool(viewPool);
|
||||
viewPool.setMaxRecycledViews(0, 10);
|
||||
|
||||
//顶部按钮
|
||||
// SingleDelegateAdapter buttonAdapter = new SingleDelegateAdapter(R.layout.adapter_button_top_item) {
|
||||
// @Override
|
||||
// public void onBindViewHolder(@NonNull RecyclerViewHolder holder, int position) {
|
||||
// SuperButton superButton = holder.findViewById(R.id.device_item_all_open);
|
||||
// }
|
||||
// };
|
||||
|
||||
// 设备
|
||||
FragmentActivity activity=this.getActivity();
|
||||
mNewsAdapter = new BroccoliSimpleDelegateAdapter<NewInfo>(R.layout.adapter_device_card_view_list_item, new StaggeredGridLayoutHelper(2,0), DemoDataProvider.getEmptyNewInfo()) {
|
||||
XPageFragment fragment= this;
|
||||
deviceAdapter = new BroccoliSimpleDelegateAdapter<IotDeviceVo>(R.layout.adapter_device_card_view_list_item, new StaggeredGridLayoutHelper(2,0), devices) {
|
||||
@SuppressLint("ResourceType")
|
||||
@Override
|
||||
protected void onBindData(RecyclerViewHolder holder, NewInfo model, int position) {
|
||||
protected void onBindData(RecyclerViewHolder holder, IotDeviceVo device, int position) {
|
||||
if (device == null) {return;}
|
||||
|
||||
//设置item宽度,适配屏幕分辨率
|
||||
// CardView view=holder.findViewById(R.id.device_item_card_view);
|
||||
@@ -174,82 +159,229 @@ public class SimpleTabFragment extends Fragment {
|
||||
// ViewGroup.LayoutParams cardViewParams=view.getLayoutParams();
|
||||
// cardViewParams.width=(widthPixels-space)/2;
|
||||
|
||||
//设置开关按钮
|
||||
holder.text(R.id.device_item_title, device.getDeviceName());
|
||||
holder.text(R.id.device_item_temp, device.getDeviceTemperature()+"℃");
|
||||
holder.text(R.id.device_item_category, device.getCategoryName());
|
||||
|
||||
//图标设置状态
|
||||
SwitchIconView radarView=holder.findViewById(R.id.device_item_radar_icon);
|
||||
SwitchIconView alarmView=holder.findViewById(R.id.device_item_alarm_icon);
|
||||
SwitchIconView switchIconView=holder.findViewById(R.id.device_item_switch_button);
|
||||
holder.click(R.id.device_item_switch_button, v -> {
|
||||
SwitchIconView lightIconView=holder.findViewById(R.id.device_item_light_button);
|
||||
if(device.getIsRadar()!=1){ radarView.setIconEnabled(false);}
|
||||
if(device.getIsAlarm()!=1){ alarmView.setIconEnabled(false);}
|
||||
switchIconView.setIconEnabled(device.getRelayStatus()==1?true:false);
|
||||
lightIconView.setIconEnabled(device.getLightStatus()==1?true:false);
|
||||
|
||||
//根据分类显示图标
|
||||
AppCompatImageView stateView=holder.findViewById(R.id.device_item_category_icon);
|
||||
stateView.setImageDrawable(getResources().getDrawable((R.drawable.category)));
|
||||
|
||||
//显示网络信号:wifi信号强度(信号极好4格[-55—— 0],信号好3格[-70—— -55),信号一般2格[-85—— -70),信号差1格[-100—— -85))
|
||||
AppCompatImageView wifiView=holder.findViewById(R.id.device_item_wifi_icon);
|
||||
if(device.getRssi()>=-55){
|
||||
wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_4)));
|
||||
}else if(device.getRssi()>=70){
|
||||
wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_3)));
|
||||
}else if(device.getRssi()>=-85){
|
||||
wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_2)));
|
||||
}else if(device.getRssi()>=-100){
|
||||
wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_1)));
|
||||
}else{
|
||||
wifiView.setImageDrawable(getResources().getDrawable((R.drawable.wifi_0)));
|
||||
}
|
||||
|
||||
//设置状态
|
||||
FrameLayout flTitle=holder.findViewById(R.id.device_item_fl_title);
|
||||
if(device.getIsOnline()==1){
|
||||
holder.text(R.id.device_item_wifi, "在线");
|
||||
flTitle.setBackgroundColor(Color.argb(255, 201, 243, 218));
|
||||
}else{
|
||||
holder.text(R.id.device_item_wifi, "离线");
|
||||
flTitle.setBackgroundColor(Color.argb(255, 230, 230, 230));
|
||||
}
|
||||
|
||||
holder.click(R.id.device_item_light_button, v -> {
|
||||
if(device.getIsOnline()==0) return;
|
||||
// 更新灯状态
|
||||
updateDeviceStatus(buildDeviceLightStatus(device.getDeviceId(),
|
||||
device.getDeviceNum(),
|
||||
lightIconView.isIconEnabled()==true?0:1));
|
||||
//震动
|
||||
Vibrator vibrator = (Vibrator) activity.getSystemService(activity.VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(100);
|
||||
switchIconView.switchState();
|
||||
lightIconView.switchState(true);
|
||||
|
||||
});
|
||||
holder.click(R.id.device_item_switch_button, v -> {
|
||||
if(device.getIsOnline()==0) return;
|
||||
// 更新继电器状态
|
||||
updateDeviceStatus(buildDeviceRelayStatus(device.getDeviceId(),
|
||||
device.getDeviceNum(),
|
||||
switchIconView.isIconEnabled()==true?0:1));
|
||||
//震动
|
||||
Vibrator vibrator = (Vibrator) activity.getSystemService(activity.VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(100);
|
||||
switchIconView.switchState(true);
|
||||
|
||||
});
|
||||
holder.click(R.id.device_item_card_view, v -> {
|
||||
|
||||
PageOption.to(DeviceDetailFragment.class) //跳转的fragment
|
||||
.setAddToBackStack(true) //是否加入堆栈
|
||||
.putLong("device_id", device.getDeviceId()) //传递的参数
|
||||
.putString("device_num",device.getDeviceNum())
|
||||
.setNewActivity(true)
|
||||
.open(fragment); //打开页面进行跳转
|
||||
|
||||
});
|
||||
|
||||
AppCompatImageView stateView=holder.findViewById(R.id.device_item_state_icon);
|
||||
stateView.setImageDrawable(getResources().getDrawable((R.drawable.state_a)));
|
||||
|
||||
|
||||
if (model != null) {
|
||||
// holder.text(R.id.tv_user_name, model.getUserName());
|
||||
// holder.text(R.id.tv_tag, model.getTag());
|
||||
// holder.text(R.id.tv_title, model.getTitle());
|
||||
// holder.text(R.id.tv_summary, model.getSummary());
|
||||
// holder.text(R.id.tv_praise, model.getPraise() == 0 ? "点赞" : String.valueOf(model.getPraise()));
|
||||
// holder.text(R.id.tv_comment, model.getComment() == 0 ? "评论" : String.valueOf(model.getComment()));
|
||||
// holder.text(R.id.tv_read, "阅读量 " + model.getRead());
|
||||
// holder.image(R.id.iv_image, model.getImageUrl());
|
||||
//
|
||||
// holder.click(R.id.card_view, v -> Utils.goWeb(getContext(), model.getDetailUrl()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindBroccoli(RecyclerViewHolder holder, Broccoli broccoli) {
|
||||
// broccoli.addPlaceholders(
|
||||
// holder.findView(R.id.device_item_title),
|
||||
// holder.findView(R.id.device_item_title_icon),
|
||||
// holder.findView(R.id.device_item_time),
|
||||
// holder.findView(R.id.device_item_time_icon),
|
||||
// holder.findView(R.id.device_item_temperature),
|
||||
// holder.findView(R.id.device_item_humidity),
|
||||
// holder.findView(R.id.device_item_wifi),
|
||||
// holder.findView(R.id.device_item_wifi_icon),
|
||||
// holder.findView(R.id.device_item_state),
|
||||
// holder.findView(R.id.device_item_state_icon),
|
||||
// holder.findView(R.id.device_item_switch_button)
|
||||
// );
|
||||
broccoli.addPlaceholders(
|
||||
holder.findView(R.id.device_item_title),
|
||||
holder.findView(R.id.update_device_temp_icon),
|
||||
holder.findView(R.id.device_item_category),
|
||||
holder.findView(R.id.device_item_category_icon),
|
||||
holder.findView(R.id.device_item_wifi),
|
||||
holder.findView(R.id.device_item_wifi_icon),
|
||||
holder.findView(R.id.device_item_temp),
|
||||
holder.findView(R.id.device_item_temp_icon),
|
||||
holder.findView(R.id.device_item_alarm_icon),
|
||||
holder.findView(R.id.device_item_alarm),
|
||||
holder.findView(R.id.device_item_radar),
|
||||
holder.findView(R.id.device_item_radar_icon),
|
||||
holder.findView(R.id.device_item_switch_button),
|
||||
holder.findView(R.id.device_item_light_button)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
DelegateAdapter delegateAdapter = new DelegateAdapter(virtualLayoutManager);
|
||||
delegateAdapter.addAdapter(mNewsAdapter);
|
||||
delegateAdapter.addAdapter(deviceAdapter);
|
||||
recyclerView.setAdapter(delegateAdapter);
|
||||
|
||||
|
||||
//下拉刷新
|
||||
refreshLayout.setOnRefreshListener(refreshLayout -> {
|
||||
// TODO: 2020-02-25 这里只是模拟了网络请求
|
||||
refreshLayout.getLayout().postDelayed(() -> {
|
||||
mNewsAdapter.refresh(DemoDataProvider.getDemoNewInfos());
|
||||
refreshLayout.finishRefresh();
|
||||
pageNum=1;
|
||||
getDeviceList();
|
||||
}, 1000);
|
||||
});
|
||||
//上拉加载
|
||||
refreshLayout.setOnLoadMoreListener(refreshLayout -> {
|
||||
// TODO: 2020-02-25 这里只是模拟了网络请求
|
||||
refreshLayout.getLayout().postDelayed(() -> {
|
||||
mNewsAdapter.loadMore(DemoDataProvider.getDemoNewInfos());
|
||||
refreshLayout.finishLoadMore();
|
||||
pageNum=pageNum+1;
|
||||
getDeviceList();
|
||||
}, 1000);
|
||||
});
|
||||
refreshLayout.autoRefresh();//第一次进入触发自动刷新,演示效果
|
||||
// refreshLayout.autoRefresh();//第一次进入触发自动刷新
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建设备状态数据
|
||||
*/
|
||||
private IotDeviceStatus buildDeviceLightStatus(Long deviceId,String deviceNum,int lightStatus){
|
||||
IotDeviceStatus deviceStatus=new IotDeviceStatus();
|
||||
deviceStatus.setDeviceId(deviceId);
|
||||
deviceStatus.setDeviceNum(deviceNum);
|
||||
deviceStatus.setLightStatus(lightStatus);
|
||||
deviceStatus.setTriggerSource(1); //0-无、1-按键、2.手机、3-浏览器、4-射频遥控、5-雷达、6-报警、7-定时
|
||||
return deviceStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建设备状态数据
|
||||
*/
|
||||
private IotDeviceStatus buildDeviceRelayStatus(Long deviceId,String deviceNum,int relayStatus){
|
||||
IotDeviceStatus deviceStatus=new IotDeviceStatus();
|
||||
deviceStatus.setDeviceId(deviceId);
|
||||
deviceStatus.setDeviceNum(deviceNum);
|
||||
deviceStatus.setRelayStatus(relayStatus);
|
||||
deviceStatus.setTriggerSource(1); //0-无、1-按键、2.手机、3-浏览器、4-射频遥控、5-雷达、6-报警、7-定时
|
||||
return deviceStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP更新设备状态
|
||||
*/
|
||||
private void updateDeviceStatus(IotDeviceStatus deviceStatus){
|
||||
if(!hasToken()) return;
|
||||
XHttp.put("/prod-api/system/status")
|
||||
.upJson(JsonUtil.toJson(deviceStatus))
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String response) throws Throwable {
|
||||
Log.d("response:",response);
|
||||
XToastUtils.success("设备状态更新成功");
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取设备列表
|
||||
*/
|
||||
private void getDeviceList(){
|
||||
XHttp.get("/prod-api/system/device/list?"+"pageNum="+pageNum+"&pageSize="+pageSize+"&groupId="+groupId)
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<ListApiResult<List<IotDeviceVo>>, List<IotDeviceVo>>(new TipRequestCallBack<List<IotDeviceVo>>() {
|
||||
@Override
|
||||
public void onSuccess(List<IotDeviceVo> list) throws Throwable {
|
||||
if(pageNum==1) {
|
||||
deviceAdapter.refresh(list);
|
||||
refreshLayout.finishRefresh();
|
||||
}else {
|
||||
deviceAdapter.loadMore(list);
|
||||
refreshLayout.finishLoadMore();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取分类列表
|
||||
*/
|
||||
private void getCategoryList(){
|
||||
XHttp.get("/prod-api/system/category/list?pageNum=1&pageSize=100")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<ListApiResult<List<IotCategory>>, List<IotCategory>>(new TipRequestCallBack<List<IotCategory>>() {
|
||||
@Override
|
||||
public void onSuccess(List<IotCategory> list) throws Throwable {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if (mUnbinder != null) {
|
||||
mUnbinder.unbind();
|
||||
}
|
||||
super.onDestroyView();
|
||||
Log.e(TAG, "onDestroyView:" + title);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.news;
|
||||
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.vlayout.DelegateAdapter;
|
||||
import com.alibaba.android.vlayout.VirtualLayoutManager;
|
||||
import com.alibaba.android.vlayout.layout.GridLayoutHelper;
|
||||
import com.alibaba.android.vlayout.layout.LinearLayoutHelper;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.adapter.base.broccoli.BroccoliSimpleDelegateAdapter;
|
||||
import com.kerwin.wumei.adapter.base.delegate.SimpleDelegateAdapter;
|
||||
import com.kerwin.wumei.adapter.base.delegate.SingleDelegateAdapter;
|
||||
import com.kerwin.wumei.adapter.entity.NewInfo;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.utils.DemoDataProvider;
|
||||
import com.kerwin.wumei.utils.Utils;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
|
||||
import com.xuexiang.xui.adapter.simple.AdapterItem;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner;
|
||||
import com.xuexiang.xui.widget.imageview.ImageLoader;
|
||||
import com.xuexiang.xui.widget.imageview.RadiusImageView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import me.samlss.broccoli.Broccoli;
|
||||
|
||||
@Page(anim = CoreAnim.none)
|
||||
public class HomePageFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.webview_home)
|
||||
WebView webView;
|
||||
@BindView(R.id.refreshLayout)
|
||||
SmartRefreshLayout refreshLayout;
|
||||
|
||||
private SimpleDelegateAdapter<NewInfo> mNewsAdapter;
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
*/
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_home_page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
webView.loadUrl("http://wumei.live");
|
||||
//系统默认会通过手机浏览器打开网页,为了能够直接通过WebView显示网页,则必须设置
|
||||
webView.setWebViewClient(new WebViewClient(){
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
//使用WebView加载显示url
|
||||
view.loadUrl(url);
|
||||
//返回true
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// 支持js中alert弹窗提示
|
||||
webView.setWebChromeClient(new WebChromeClient());
|
||||
|
||||
//声明WebSettings子类
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
//如果访问的页面中要与Javascript交互,则webview必须设置支持Javascript
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //关闭webview中缓存
|
||||
webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片
|
||||
webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListeners() {
|
||||
//下拉刷新
|
||||
refreshLayout.setOnRefreshListener(refreshLayout -> {
|
||||
refreshLayout.getLayout().postDelayed(() -> {
|
||||
webView.reload();
|
||||
refreshLayout.finishRefresh();
|
||||
}, 1000);
|
||||
});
|
||||
//上拉加载
|
||||
refreshLayout.setOnLoadMoreListener(refreshLayout -> {
|
||||
// TODO: 2020-02-25 这里只是模拟了网络请求
|
||||
refreshLayout.getLayout().postDelayed(() -> {
|
||||
webView.reload();
|
||||
refreshLayout.finishLoadMore();
|
||||
}, 1000);
|
||||
});
|
||||
refreshLayout.autoRefresh();//第一次进入触发自动刷新,演示效果
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.news;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.profile;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.entity.User;
|
||||
import com.kerwin.wumei.entity.bo.CaptureImage;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.CaptchaImageApiResult;
|
||||
import com.kerwin.wumei.http.request.UserInfoApiResult;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xui.utils.ResUtils;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.button.switchbutton.SwitchButton;
|
||||
import com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText;
|
||||
import com.xuexiang.xui.widget.imageview.RadiusImageView;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperButton;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getIsHttps;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getServerPort;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.getServerip;
|
||||
import static com.kerwin.wumei.utils.SettingUtils.setServeUrl;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.clearToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.getToken;
|
||||
import static com.kerwin.wumei.utils.TokenUtils.hasToken;
|
||||
|
||||
|
||||
@Page(name = "账户信息")
|
||||
public class AccountFragment extends BaseFragment {
|
||||
@BindView(R.id.titlebar_min)
|
||||
TitleBar titleBarMin;
|
||||
|
||||
@BindView(R.id.txt_user_name)
|
||||
TextView txt_user_name;
|
||||
@BindView(R.id.txt_nick_name)
|
||||
TextView txt_nick_name;
|
||||
@BindView(R.id.txt_email)
|
||||
TextView txt_email;
|
||||
@BindView(R.id.txt_phone_num)
|
||||
TextView txt_phone_num;
|
||||
@BindView(R.id.txt_create_time)
|
||||
TextView txt_create_time;
|
||||
@BindView(R.id.txt_remark)
|
||||
TextView txt_remark;
|
||||
|
||||
@Override
|
||||
protected TitleBar initTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局的资源id
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_account;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
titleBarMin.setLeftClickListener(v -> popToBack());
|
||||
getUserInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListeners() { }
|
||||
|
||||
@SingleClick
|
||||
@OnClick({ R.id.btn_confirm})
|
||||
public void onViewClicked(View view) {
|
||||
popToBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP获取用户信息
|
||||
*/
|
||||
private void getUserInfo(){
|
||||
if(!hasToken()) return;
|
||||
XHttp.get("/prod-api/getInfo")
|
||||
.headers("Authorization","Bearer "+getToken())
|
||||
.execute(new CallBackProxy<UserInfoApiResult<User>, User>(new TipRequestCallBack<User>() {
|
||||
@Override
|
||||
public void onSuccess(User user) throws Throwable {
|
||||
txt_user_name.setText(user.getUserName());
|
||||
txt_nick_name.setText(user.getNickName());
|
||||
txt_email.setText(user.getEmail());
|
||||
txt_phone_num.setText(user.getPhonenumber());
|
||||
txt_remark.setText(user.getRemark());
|
||||
txt_create_time.setText(user.getCreateTime());
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if(e.getCode()==401){
|
||||
XToastUtils.info("匿名登录状态,功能受限");
|
||||
clearToken();
|
||||
}else{
|
||||
XToastUtils.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,47 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
package com.kerwin.wumei.fragment.profile;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.kerwin.wumei.core.BaseFragment;
|
||||
import com.kerwin.wumei.R;
|
||||
import com.kerwin.wumei.core.webview.AgentWebActivity;
|
||||
import com.kerwin.wumei.fragment.AboutFragment;
|
||||
import com.kerwin.wumei.fragment.FeedbackFragment;
|
||||
import com.kerwin.wumei.fragment.MessageFragment;
|
||||
import com.kerwin.wumei.fragment.SettingsFragment;
|
||||
import com.kerwin.wumei.http.callback.TipRequestCallBack;
|
||||
import com.kerwin.wumei.http.request.NoDataApiResult;
|
||||
import com.kerwin.wumei.utils.TokenUtils;
|
||||
import com.kerwin.wumei.utils.XToastUtils;
|
||||
import com.xuexiang.xaop.annotation.SingleClick;
|
||||
import com.xuexiang.xhttp2.XHttp;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xpage.annotation.Page;
|
||||
import com.xuexiang.xpage.enums.CoreAnim;
|
||||
import com.xuexiang.xpage.utils.Utils;
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar;
|
||||
import com.xuexiang.xui.widget.dialog.DialogLoader;
|
||||
import com.xuexiang.xui.widget.grouplist.XUIGroupListView;
|
||||
import com.xuexiang.xui.widget.imageview.RadiusImageView;
|
||||
import com.xuexiang.xui.widget.textview.supertextview.SuperTextView;
|
||||
import com.xuexiang.xutil.XUtil;
|
||||
import com.xuexiang.xutil.app.AppUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
@@ -22,14 +49,16 @@ import butterknife.BindView;
|
||||
public class ProfileFragment extends BaseFragment implements SuperTextView.OnSuperTextViewClickListener {
|
||||
@BindView(R.id.riv_head_pic)
|
||||
RadiusImageView rivHeadPic;
|
||||
@BindView(R.id.menu_settings)
|
||||
SuperTextView menuSettings;
|
||||
@BindView(R.id.menu_about)
|
||||
SuperTextView menuAbout;
|
||||
@BindView(R.id.menu_feedback)
|
||||
SuperTextView menuFeedback;
|
||||
@BindView(R.id.menu_message)
|
||||
SuperTextView menuMessage;
|
||||
@BindView(R.id.menu_logout)
|
||||
SuperTextView menuLogout;
|
||||
@BindView(R.id.about_list)
|
||||
XUIGroupListView mAboutGroupListView;
|
||||
@BindView(R.id.tv_copyright)
|
||||
TextView mCopyrightTextView;
|
||||
@BindView(R.id.menu_account)
|
||||
SuperTextView menuAccount;
|
||||
|
||||
/**
|
||||
* @return 返回为 null意为不需要导航栏
|
||||
@@ -54,32 +83,65 @@ public class ProfileFragment extends BaseFragment implements SuperTextView.OnSup
|
||||
*/
|
||||
@Override
|
||||
protected void initViews() {
|
||||
XUIGroupListView.newSection(getContext())
|
||||
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_author_github)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_author_github)))
|
||||
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> AgentWebActivity.goWeb(getContext(), getString(R.string.url_add_qq_group)))
|
||||
.addItemView(mAboutGroupListView.createItemView("版本:v"+AppUtils.getAppVersionName()), v -> XToastUtils.toast("官网下载最新版本"))
|
||||
.addTo(mAboutGroupListView);
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy", Locale.CHINA);
|
||||
String currentYear = dateFormat.format(new Date());
|
||||
mCopyrightTextView.setText(String.format(getResources().getString(R.string.about_copyright), currentYear));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListeners() {
|
||||
menuSettings.setOnSuperTextViewClickListener(this);
|
||||
menuAbout.setOnSuperTextViewClickListener(this);
|
||||
menuFeedback.setOnSuperTextViewClickListener(this);
|
||||
menuMessage.setOnSuperTextViewClickListener(this);
|
||||
menuLogout.setOnSuperTextViewClickListener(this);
|
||||
menuAccount.setOnSuperTextViewClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP退出登录
|
||||
*/
|
||||
private void logout(){
|
||||
XHttp.post("/prod-api/logout")
|
||||
.execute(new CallBackProxy<NoDataApiResult<String>, String>(new TipRequestCallBack<String>() {
|
||||
@Override
|
||||
public void onSuccess(String tokenResult) throws Throwable {
|
||||
XToastUtils.success("登出成功" );
|
||||
}
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
|
||||
}
|
||||
}){});
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
@Override
|
||||
public void onClick(SuperTextView view) {
|
||||
switch(view.getId()) {
|
||||
case R.id.menu_settings:
|
||||
openNewPage(SettingsFragment.class);
|
||||
break;
|
||||
case R.id.menu_about:
|
||||
openNewPage(AboutFragment.class);
|
||||
break;
|
||||
case R.id.menu_message:
|
||||
openNewPage(MessageFragment.class);
|
||||
break;
|
||||
case R.id.menu_feedback:
|
||||
openNewPage(FeedbackFragment.class);
|
||||
case R.id.menu_account:
|
||||
openNewPage(AccountFragment.class);
|
||||
break;
|
||||
case R.id.menu_logout:
|
||||
DialogLoader.getInstance().showConfirmDialog(
|
||||
getContext(),
|
||||
getString(R.string.lab_logout_confirm),
|
||||
getString(R.string.lab_yes),
|
||||
(dialog, which) -> {
|
||||
logout();
|
||||
dialog.dismiss();
|
||||
XUtil.getActivityLifecycleHelper().exit();
|
||||
TokenUtils.handleLogoutSuccess();
|
||||
},
|
||||
getString(R.string.lab_no),
|
||||
(dialog, which) -> dialog.dismiss()
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.callback;
|
||||
|
||||
import com.xuexiang.xhttp2.callback.SimpleCallBack;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xhttp2.model.XHttpRequest;
|
||||
import com.xuexiang.xutil.common.StringUtils;
|
||||
import com.xuexiang.xutil.common.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2018/8/8 上午10:23
|
||||
*/
|
||||
public abstract class NoTipRequestCallBack<T> extends SimpleCallBack<T> {
|
||||
/**
|
||||
* 记录一下请求的url,确定出错的请求是哪个请求
|
||||
*/
|
||||
private String mUrl;
|
||||
|
||||
public NoTipRequestCallBack() {
|
||||
|
||||
}
|
||||
|
||||
public NoTipRequestCallBack(XHttpRequest req) {
|
||||
this(req.getUrl());
|
||||
}
|
||||
|
||||
public NoTipRequestCallBack(String url) {
|
||||
mUrl = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if (!StringUtils.isEmpty(mUrl)) {
|
||||
Logger.e("网络请求的url:" + mUrl, e);
|
||||
} else {
|
||||
Logger.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.callback;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.xuexiang.xhttp2.callback.SimpleCallBack;
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xhttp2.model.XHttpRequest;
|
||||
import com.xuexiang.xutil.common.StringUtils;
|
||||
import com.xuexiang.xutil.common.logger.Logger;
|
||||
import com.xuexiang.xutil.tip.ToastUtils;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2018/8/8 上午10:20
|
||||
*/
|
||||
public abstract class TipRequestCallBack<T> extends SimpleCallBack<T> {
|
||||
|
||||
/**
|
||||
* 记录一下请求的url,确定出错的请求是哪个请求
|
||||
*/
|
||||
private String mUrl;
|
||||
|
||||
public TipRequestCallBack() {
|
||||
|
||||
}
|
||||
|
||||
public TipRequestCallBack(@NonNull XHttpRequest req) {
|
||||
this(req.getUrl());
|
||||
}
|
||||
|
||||
public TipRequestCallBack(String url) {
|
||||
mUrl = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
ToastUtils.toast(e.getDisplayMessage());
|
||||
if (!StringUtils.isEmpty(mUrl)) {
|
||||
Logger.e("网络请求的url:" + mUrl, e);
|
||||
} else {
|
||||
Logger.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.interceptor;
|
||||
|
||||
import com.xuexiang.xhttp2.interceptor.HttpLoggingInterceptor;
|
||||
import com.xuexiang.xhttp2.utils.HttpUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Connection;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import okhttp3.internal.http.HttpHeaders;
|
||||
|
||||
/**
|
||||
* 自定义日志拦截器【简单打印入参和出参】
|
||||
*
|
||||
* @author xuexiang
|
||||
* @since 2018/8/6 上午11:53
|
||||
*/
|
||||
public class CustomLoggingInterceptor extends HttpLoggingInterceptor {
|
||||
|
||||
public CustomLoggingInterceptor() {
|
||||
super("custom");
|
||||
setLevel(Level.PARAM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void logForRequest(Request request, Connection connection) throws IOException {
|
||||
RequestBody requestBody = request.body();
|
||||
boolean hasRequestBody = requestBody != null;
|
||||
Protocol protocol = connection != null ? connection.protocol() : Protocol.HTTP_1_1;
|
||||
|
||||
StringBuilder logBuilder = new StringBuilder();
|
||||
try {
|
||||
logBuilder.append("--> ")
|
||||
.append(request.method())
|
||||
.append(' ')
|
||||
.append(request.url())
|
||||
.append(' ')
|
||||
.append(protocol)
|
||||
.append("\r\n");
|
||||
if (hasRequestBody) {
|
||||
logBuilder.append("入参:");
|
||||
if (HttpUtils.isPlaintext(requestBody.contentType())) {
|
||||
logBuilder.append(bodyToString(request));
|
||||
} else {
|
||||
logBuilder.append("maybe [file part] , too large too print , ignored!");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
log(logBuilder.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Response logForResponse(Response response, long tookMs) {
|
||||
Response clone = response.newBuilder().build();
|
||||
ResponseBody responseBody = clone.body();
|
||||
log("<-- " + clone.code() + ' ' + clone.message() + ' ' + clone.request().url() + " (" + tookMs + "ms)");
|
||||
try {
|
||||
if (HttpHeaders.hasBody(clone)) {
|
||||
if (responseBody == null) {
|
||||
return response;
|
||||
}
|
||||
if (HttpUtils.isPlaintext(responseBody.contentType())) {
|
||||
String body = responseBody.string();
|
||||
log("\t出参:" + body);
|
||||
responseBody = ResponseBody.create(responseBody.contentType(), body);
|
||||
return response.newBuilder().body(responseBody).build();
|
||||
} else {
|
||||
log("\t出参: maybe [file part] , too large too print , ignored!");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.kerwin.wumei.entity.bo.CaptureImage;
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
|
||||
|
||||
public class CaptchaImageApiResult<T> extends ApiResult<T> {
|
||||
private String uuid;
|
||||
private String img;
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
public CaptchaImageApiResult<T> setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
public CaptchaImageApiResult<T> setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSuccess() {
|
||||
return getCode()==200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getData() {
|
||||
CaptureImage image=new CaptureImage();
|
||||
image.setImg(getImg());
|
||||
image.setUuid(getUuid());
|
||||
return (T) image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiResult{" +
|
||||
"code='" + CODE + '\'' +
|
||||
", msg='" + MSG + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", img=" + img +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2018/8/7 下午5:23
|
||||
*/
|
||||
public class CustomApiResult<T> extends ApiResult<T> {
|
||||
|
||||
private int errorCode;
|
||||
private String errorInfo;
|
||||
private T result;
|
||||
private long timeStamp;
|
||||
|
||||
public int getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public CustomApiResult<T> setErrorCode(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getErrorInfo() {
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
public CustomApiResult<T> setErrorInfo(String errorInfo) {
|
||||
this.errorInfo = errorInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public CustomApiResult<T> setResult(T result) {
|
||||
this.result = result;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public CustomApiResult<T> setTimeStamp(long timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg() {
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccess() {
|
||||
return errorCode == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getData() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiResult{" +
|
||||
"errorCode='" + errorCode + '\'' +
|
||||
", errorInfo='" + errorInfo + '\'' +
|
||||
", timeStamp='" + timeStamp + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.xuexiang.xhttp2.callback.CallBack;
|
||||
import com.xuexiang.xhttp2.callback.CallBackProxy;
|
||||
import com.xuexiang.xhttp2.callback.CallClazzProxy;
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
import com.xuexiang.xhttp2.request.GetRequest;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* 自定义请求的形式
|
||||
*
|
||||
* @author xuexiang
|
||||
* @since 2018/8/7 下午6:09
|
||||
*/
|
||||
public class CustomGetRequest extends GetRequest {
|
||||
|
||||
public CustomGetRequest(String url) {
|
||||
super(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Observable<T> execute(Type type) {
|
||||
return execute(new CallClazzProxy<CustomApiResult<T>, T>(type) {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Disposable execute(CallBack<T> callBack) {
|
||||
return execute(new CallBackProxy<CustomApiResult<T>, T>(callBack) {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
|
||||
public class ListApiResult<T> extends ApiResult<T> {
|
||||
|
||||
private T rows;
|
||||
private int total;
|
||||
|
||||
public T getRows() {
|
||||
return rows;
|
||||
}
|
||||
public ListApiResult<T> setRows(T rows) {
|
||||
this.rows = rows;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getTotal(){return total;}
|
||||
public ListApiResult<T> setTotal(int total){
|
||||
this.total=total;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccess() {
|
||||
return getCode() == 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getData() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiResult{" +
|
||||
"code='" + CODE + '\'' +
|
||||
", msg='" + MSG + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
|
||||
|
||||
public class NoDataApiResult<T> extends ApiResult<T> {
|
||||
|
||||
@Override
|
||||
public boolean isSuccess() {
|
||||
return getCode() == 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getData() {
|
||||
return (T) "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiResult{" +
|
||||
"code='" + CODE + '\'' +
|
||||
", msg='" + MSG + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
|
||||
|
||||
public class TokenApiResult<T> extends ApiResult<T> {
|
||||
|
||||
private T token= (T) "";
|
||||
|
||||
public T getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public TokenApiResult<T> setToken(T token) {
|
||||
this.token = token;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccess() {
|
||||
return getCode() == 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getData() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiResult{" +
|
||||
"code='" + CODE + '\'' +
|
||||
", msg='" + MSG + '\'' +
|
||||
", token=" + token +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
******************************************************************************/
|
||||
|
||||
package com.kerwin.wumei.http.request;
|
||||
|
||||
import com.xuexiang.xhttp2.model.ApiResult;
|
||||
|
||||
|
||||
public class UserInfoApiResult<T> extends ApiResult<T> {
|
||||
|
||||
private T user;
|
||||
|
||||
public T getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public UserInfoApiResult<T> setUser(T user) {
|
||||
this.user = user;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuccess() {
|
||||
return getCode() == 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getData() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiResult{" +
|
||||
"code='" + CODE + '\'' +
|
||||
", msg='" + MSG + '\'' +
|
||||
", user=" + user +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.subscriber;
|
||||
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xhttp2.model.XHttpRequest;
|
||||
import com.xuexiang.xhttp2.subsciber.BaseSubscriber;
|
||||
import com.xuexiang.xutil.common.StringUtils;
|
||||
import com.xuexiang.xutil.common.logger.Logger;
|
||||
|
||||
/**
|
||||
* 网络请求的订阅,只存储错误的日志
|
||||
*
|
||||
* @author xuexiang
|
||||
* @since 2018/8/2 下午3:37
|
||||
*/
|
||||
public abstract class NoTipRequestSubscriber<T> extends BaseSubscriber<T> {
|
||||
|
||||
/**
|
||||
* 记录一下请求的url,确定出错的请求是哪个请求
|
||||
*/
|
||||
private String mUrl;
|
||||
|
||||
public NoTipRequestSubscriber() {
|
||||
|
||||
}
|
||||
|
||||
public NoTipRequestSubscriber(XHttpRequest req) {
|
||||
this(req.getUrl());
|
||||
}
|
||||
|
||||
public NoTipRequestSubscriber(String url) {
|
||||
mUrl = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
if (!StringUtils.isEmpty(mUrl)) {
|
||||
Logger.e("网络请求的url:" + mUrl, e);
|
||||
} else {
|
||||
Logger.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.http.subscriber;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.xuexiang.xhttp2.exception.ApiException;
|
||||
import com.xuexiang.xhttp2.model.XHttpRequest;
|
||||
import com.xuexiang.xhttp2.subsciber.BaseSubscriber;
|
||||
import com.xuexiang.xutil.common.StringUtils;
|
||||
import com.xuexiang.xutil.common.logger.Logger;
|
||||
import com.xuexiang.xutil.tip.ToastUtils;
|
||||
|
||||
/**
|
||||
* 网络请求的订阅,toast提示
|
||||
*
|
||||
* @author xuexiang
|
||||
* @since 2018/8/2 下午3:42
|
||||
*/
|
||||
public abstract class TipRequestSubscriber<T> extends BaseSubscriber<T> {
|
||||
/**
|
||||
* 记录一下请求的url,确定出错的请求是哪个请求
|
||||
*/
|
||||
private String mUrl;
|
||||
|
||||
public TipRequestSubscriber() {
|
||||
|
||||
}
|
||||
|
||||
public TipRequestSubscriber(@NonNull XHttpRequest req) {
|
||||
this(req.getUrl());
|
||||
}
|
||||
|
||||
public TipRequestSubscriber(String url) {
|
||||
mUrl = url;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError(ApiException e) {
|
||||
ToastUtils.toast(e.getDisplayMessage());
|
||||
if (!StringUtils.isEmpty(mUrl)) {
|
||||
Logger.e("网络请求的url:" + mUrl, e);
|
||||
} else {
|
||||
Logger.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class DemoDataProvider {
|
||||
@MemoryCache
|
||||
public static List<NewInfo> getEmptyNewInfo() {
|
||||
List<NewInfo> list = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
list.add(new NewInfo());
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.utils;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2018/8/3 下午3:59
|
||||
*/
|
||||
public final class DialogUtils {
|
||||
|
||||
private DialogUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
|
||||
public static AlertDialog getConfirmDialog(Context context, String title, String message, DialogInterface.OnClickListener yesListener) {
|
||||
return new AlertDialog.Builder(context)
|
||||
.setTitle(title)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.yes, yesListener)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author xuexiang
|
||||
* @since 2018/8/3 下午6:47
|
||||
*/
|
||||
public class HProgressDialogUtils {
|
||||
private static ProgressDialog sHorizontalProgressDialog;
|
||||
|
||||
private HProgressDialogUtils() {
|
||||
throw new UnsupportedOperationException("cannot be instantiated");
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void showHorizontalProgressDialog(Context context, String msg, boolean isShowSize) {
|
||||
cancel();
|
||||
|
||||
if (sHorizontalProgressDialog == null) {
|
||||
sHorizontalProgressDialog = new ProgressDialog(context);
|
||||
sHorizontalProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||
sHorizontalProgressDialog.setCancelable(false);
|
||||
if (isShowSize) {
|
||||
sHorizontalProgressDialog.setProgressNumberFormat("%2dMB/%1dMB");
|
||||
}
|
||||
|
||||
}
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
sHorizontalProgressDialog.setMessage(msg);
|
||||
}
|
||||
sHorizontalProgressDialog.show();
|
||||
|
||||
}
|
||||
|
||||
public static void setMax(long total) {
|
||||
if (sHorizontalProgressDialog != null) {
|
||||
sHorizontalProgressDialog.setMax(((int) total) / (1024 * 1024));
|
||||
}
|
||||
}
|
||||
|
||||
public static void cancel() {
|
||||
if (sHorizontalProgressDialog != null) {
|
||||
sHorizontalProgressDialog.dismiss();
|
||||
sHorizontalProgressDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setProgress(int current) {
|
||||
if (sHorizontalProgressDialog == null) {
|
||||
return;
|
||||
}
|
||||
sHorizontalProgressDialog.setProgress(current);
|
||||
if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
|
||||
sHorizontalProgressDialog.dismiss();
|
||||
sHorizontalProgressDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setProgress(long current) {
|
||||
if (sHorizontalProgressDialog == null) {
|
||||
return;
|
||||
}
|
||||
sHorizontalProgressDialog.setProgress(((int) current) / (1024 * 1024));
|
||||
if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
|
||||
sHorizontalProgressDialog.dismiss();
|
||||
sHorizontalProgressDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void onLoading(long total, long current) {
|
||||
if (sHorizontalProgressDialog == null) {
|
||||
return;
|
||||
}
|
||||
if (current == 0) {
|
||||
sHorizontalProgressDialog.setMax(((int) total) / (1024 * 1024));
|
||||
}
|
||||
sHorizontalProgressDialog.setProgress(((int) current) / (1024 * 1024));
|
||||
if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
|
||||
sHorizontalProgressDialog.dismiss();
|
||||
sHorizontalProgressDialog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.utils;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.xuexiang.xrouter.facade.service.SerializationService;
|
||||
import com.xuexiang.xrouter.launcher.XRouter;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2018/8/3 下午2:54
|
||||
*/
|
||||
public final class RouterUtils {
|
||||
|
||||
private RouterUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
|
||||
public static Bundle getBundle(String key, Object value) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(key, XRouter.getInstance().navigation(SerializationService.class).object2Json(value));
|
||||
return bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入依赖
|
||||
*
|
||||
* @param target
|
||||
*/
|
||||
public static void inject(@NonNull Object target) {
|
||||
XRouter.getInstance().inject(target);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kerwin.wumei.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.kerwin.wumei.R;
|
||||
import com.xuexiang.xutil.XUtil;
|
||||
import com.xuexiang.xutil.data.BaseSPUtil;
|
||||
|
||||
/**
|
||||
* @author xuexiang
|
||||
* @since 2018/7/16 下午3:38
|
||||
*/
|
||||
public class SettingSPUtils extends BaseSPUtil {
|
||||
|
||||
private static SettingSPUtils sInstance;
|
||||
|
||||
private SettingSPUtils(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public static SettingSPUtils getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (SettingSPUtils.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SettingSPUtils(XUtil.getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getApiURL() {
|
||||
return getString(getString(R.string.service_api_key), getString(R.string.default_service_api));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean setApiURL(String apiUrl) {
|
||||
return putString(getString(R.string.service_api_key), apiUrl);
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,14 @@ public final class SettingUtils {
|
||||
private SettingUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
|
||||
private static final String IS_FIRST_OPEN_KEY = "is_first_open_key";
|
||||
|
||||
private static final String IS_AGREE_PRIVACY_KEY = "is_agree_privacy_key";
|
||||
|
||||
private static final String USER_NAME="user_name";
|
||||
private static final String PASSWORD="password";
|
||||
private static final String SERVERIP="serve_ip";
|
||||
private static final String SERVERPORT="serve_port";
|
||||
private static final String ISHTTPS="is_https";
|
||||
private static final String APIP="ap_ip";
|
||||
/**
|
||||
* 是否是第一次启动
|
||||
*/
|
||||
@@ -48,6 +51,100 @@ public final class SettingUtils {
|
||||
MMKVUtils.put(IS_FIRST_OPEN_KEY, isFirstOpen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户名和密码
|
||||
*/
|
||||
public static void setAccount(String userName,String password){
|
||||
MMKVUtils.put(USER_NAME,userName);
|
||||
MMKVUtils.put(PASSWORD,password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置服务端地址
|
||||
*/
|
||||
public static void setServeUrl(String serveIp, String servePort, Boolean isHttps){
|
||||
MMKVUtils.put(SERVERIP,serveIp);
|
||||
MMKVUtils.put(SERVERPORT,servePort);
|
||||
MMKVUtils.put(ISHTTPS,isHttps);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务端地址
|
||||
*/
|
||||
public static String getServeUrl(){
|
||||
String address="";
|
||||
if(getIsHttps()){
|
||||
address="https://";
|
||||
}else{
|
||||
address="http://";
|
||||
}
|
||||
address=address+getServerip()+":"+getServerPort();
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置设备AP地址
|
||||
* @return
|
||||
*/
|
||||
public static void setApIp(String apIp){
|
||||
MMKVUtils.put(APIP,apIp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备AP地址
|
||||
* @return
|
||||
*/
|
||||
public static String getApIp(){
|
||||
return MMKVUtils.getString(APIP,"192.168.4.1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务端ip
|
||||
* @return
|
||||
*/
|
||||
public static String getServerip(){
|
||||
return MMKVUtils.getString(SERVERIP,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务端端口
|
||||
* @return
|
||||
*/
|
||||
public static String getServerPort(){
|
||||
return MMKVUtils.getString(SERVERPORT,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否使用https
|
||||
* @return
|
||||
*/
|
||||
public static Boolean getIsHttps(){
|
||||
return MMKVUtils.getBoolean(ISHTTPS,false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户名
|
||||
* @return
|
||||
*/
|
||||
public static String getUserName(){
|
||||
return MMKVUtils.getString(USER_NAME,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录密码
|
||||
* @return
|
||||
*/
|
||||
public static String getPassword(){
|
||||
return MMKVUtils.getString(PASSWORD,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空登录密码
|
||||
*/
|
||||
public static void clearPassword(){
|
||||
MMKVUtils.put(PASSWORD,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 是否同意隐私政策
|
||||
*/
|
||||
|
||||
@@ -34,13 +34,13 @@ public final class TokenUtils {
|
||||
|
||||
private static String sToken;
|
||||
|
||||
private static final String KEY_TOKEN = "com.xuexiang.templateproject.utils.KEY_TOKEN";
|
||||
private static final String KEY_TOKEN = "com.kerwin.wumei.utils.KEY_TOKEN";
|
||||
|
||||
private TokenUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
|
||||
private static final String KEY_PROFILE_CHANNEL = "github";
|
||||
private static final String KEY_PROFILE_CHANNEL = "gitee";
|
||||
|
||||
/**
|
||||
* 初始化Token信息
|
||||
@@ -80,7 +80,7 @@ public final class TokenUtils {
|
||||
setToken(token);
|
||||
return true;
|
||||
} else {
|
||||
XToastUtils.error("登录失败!");
|
||||
// XToastUtils.error("匿名用户");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public final class TokenUtils {
|
||||
MobclickAgent.onProfileSignOff();
|
||||
//登出时,清除账号信息
|
||||
clearToken();
|
||||
XToastUtils.success("登出成功!");
|
||||
// XToastUtils.success("登出成功!");
|
||||
//跳转到登录页
|
||||
ActivityUtils.startActivity(LoginActivity.class);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.kerwin.wumei.utils.update.CustomUpdateFailureListener;
|
||||
import com.kerwin.wumei.utils.update.XHttpUpdateHttpServiceImpl;
|
||||
import com.xuexiang.xupdate.XUpdate;
|
||||
import com.xuexiang.xupdate.utils.UpdateUtils;
|
||||
import com.xuexiang.xutil.common.StringUtils;
|
||||
|
||||
/**
|
||||
* XUpdate 版本更新 SDK 初始化
|
||||
@@ -42,6 +43,7 @@ public final class XUpdateInit {
|
||||
/**
|
||||
* 应用版本更新的检查地址
|
||||
*/
|
||||
// TODO: 2021/5/26 需要开启版本更新功能的话,就需要配置一下版本更新的地址
|
||||
private static final String KEY_UPDATE_URL = "";
|
||||
|
||||
public static void init(Application application) {
|
||||
@@ -67,7 +69,21 @@ public final class XUpdateInit {
|
||||
* 进行版本更新检查
|
||||
*/
|
||||
public static void checkUpdate(Context context, boolean needErrorTip) {
|
||||
XUpdate.newBuild(context).updateUrl(KEY_UPDATE_URL).update();
|
||||
checkUpdate(context, KEY_UPDATE_URL, needErrorTip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行版本更新检查
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param url 版本更新检查的地址
|
||||
* @param needErrorTip 是否需要错误的提示
|
||||
*/
|
||||
private static void checkUpdate(Context context, String url, boolean needErrorTip) {
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
return;
|
||||
}
|
||||
XUpdate.newBuild(context).updateUrl(url).update();
|
||||
XUpdate.get().setOnUpdateFailureListener(new CustomUpdateFailureListener(needErrorTip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public class GuideTipsDialog extends BaseDialog implements View.OnClickListener,
|
||||
mTvNext = findViewById(R.id.tv_next);
|
||||
|
||||
if (cbIgnore != null) {
|
||||
cbIgnore.setChecked(isIgnoreTips());
|
||||
cbIgnore.setOnCheckedChangeListener(this);
|
||||
}
|
||||
if (ivClose != null) {
|
||||
|
||||
BIN
android/app/src/main/res/drawable-hdpi/alarm.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 5.0 KiB |
BIN
android/app/src/main/res/drawable-hdpi/image.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
android/app/src/main/res/drawable-hdpi/light_on.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
android/app/src/main/res/drawable-hdpi/lock.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
android/app/src/main/res/drawable-hdpi/radar.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
android/app/src/main/res/drawable-hdpi/radar_bg.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
android/app/src/main/res/drawable-hdpi/relay.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
android/app/src/main/res/drawable-hdpi/set.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
android/app/src/main/res/drawable-hdpi/switch_c.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
android/app/src/main/res/drawable-hdpi/title.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
android/app/src/main/res/drawable-hdpi/update.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
android/app/src/main/res/drawable-hdpi/user.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
android/app/src/main/res/drawable-hdpi/wifi_0.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
android/app/src/main/res/drawable-hdpi/wifi_1.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
android/app/src/main/res/drawable-hdpi/wifi_2.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
android/app/src/main/res/drawable-hdpi/wifi_3.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
android/app/src/main/res/drawable-hdpi/wifi_4.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
@@ -23,4 +23,4 @@
|
||||
<path
|
||||
android:fillColor="#707070"
|
||||
android:pathData="M512,0c281.6,0 512,230.4 512,512s-230.4,512 -512,512 -512,-230.4 -512,-512 230.4,-512 512,-512zM627.2,505.6c44.8,-38.4 76.8,-89.6 76.8,-153.6 0,-108.8 -83.2,-192 -192,-192s-192,83.2 -192,192c0,64 32,115.2 76.8,153.6 -102.4,44.8 -172.8,147.2 -172.8,262.4 0,19.2 12.8,32 32,32s32,-12.8 32,-32c0,-121.6 102.4,-224 224,-224s224,102.4 224,224c0,19.2 12.8,32 32,32s32,-12.8 32,-32c0,-115.2 -70.4,-217.6 -172.8,-262.4zM512,480c-70.4,0 -128,-57.6 -128,-128s57.6,-128 128,-128 128,57.6 128,128 -57.6,128 -128,128z" />
|
||||
</vector>
|
||||
</vector>
|
||||
@@ -1,4 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -10,43 +20,47 @@
|
||||
android:id="@+id/device_item_card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
app:cardBackgroundColor="@color/xui_config_color_white"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
app:cardBackgroundColor="@color/cardview_light_background"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/device_item_fl_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginRight="5dp">
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="#C9F3DA">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/device_item_title_icon"
|
||||
android:layout_width="@dimen/config_margin_24dp"
|
||||
android:layout_height="@dimen/config_margin_24dp"
|
||||
android:id="@+id/update_device_temp_icon"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:tint="@color/toast_normal_tint_color"
|
||||
app:srcCompat="@drawable/water_valve" />
|
||||
android:layout_marginTop="2dp"
|
||||
android:tint="@color/white"
|
||||
app:srcCompat="@drawable/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginStart="14dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingTop="3dp"
|
||||
android:singleLine="true"
|
||||
android:text="雷达感应灯08"
|
||||
android:text="智能报警灯"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -56,41 +70,43 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom|start|left"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="5dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/device_item_time_icon"
|
||||
android:layout_width="@dimen/config_margin_12dp"
|
||||
android:layout_height="@dimen/config_margin_12dp"
|
||||
android:id="@+id/device_item_category_icon"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="bottom"
|
||||
app:srcCompat="@drawable/time_b" />
|
||||
android:tint="@color/primary"
|
||||
app:srcCompat="@drawable/category" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_time"
|
||||
android:id="@+id/device_item_category"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/config_margin_14dp"
|
||||
android:layout_marginStart="@dimen/config_margin_16dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="08:45"
|
||||
android:text="智能灯"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="10sp" />
|
||||
android:textSize="12sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
@@ -98,90 +114,100 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="@dimen/config_margin_12dp"
|
||||
android:layout_height="@dimen/config_margin_12dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:tint="@color/danger"
|
||||
app:srcCompat="@drawable/temperature" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/config_margin_14dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="15℃"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="@dimen/config_margin_12dp"
|
||||
android:layout_height="@dimen/config_margin_12dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="45dp"
|
||||
android:tint="@color/danger"
|
||||
app:srcCompat="@drawable/humidity" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_humidity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="58dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="60%"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="10sp" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/device_item_wifi_icon"
|
||||
android:layout_width="@dimen/config_margin_12dp"
|
||||
android:layout_height="@dimen/config_margin_12dp"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="bottom"
|
||||
app:srcCompat="@drawable/wifi" />
|
||||
app:srcCompat="@drawable/wifi_2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_wifi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/config_margin_14dp"
|
||||
android:layout_marginStart="@dimen/config_margin_16dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="在线"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="10sp" />
|
||||
android:textSize="12sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/device_item_state_icon"
|
||||
android:layout_width="@dimen/config_margin_12dp"
|
||||
android:layout_height="@dimen/config_margin_12dp"
|
||||
android:id="@+id/device_item_temp_icon"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="45dp"
|
||||
app:srcCompat="@drawable/state_b" />
|
||||
android:layout_marginStart="48dp"
|
||||
android:tint="@color/success"
|
||||
app:srcCompat="@drawable/temperature" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_state"
|
||||
android:id="@+id/device_item_temp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="58dp"
|
||||
android:layout_marginStart="62dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="打开"
|
||||
android:text="23℃"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="10sp" />
|
||||
android:textSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginBottom="15dp">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SwitchIconView
|
||||
android:id="@+id/device_item_radar_icon"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="bottom"
|
||||
app:siv_disabled_color="@color/info"
|
||||
app:siv_no_dash="true"
|
||||
app:siv_tint_color="@color/danger"
|
||||
app:srcCompat="@drawable/radar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_radar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/config_margin_16dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="雷达"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.SwitchIconView
|
||||
android:id="@+id/device_item_alarm_icon"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="48dp"
|
||||
app:siv_disabled_color="@color/info"
|
||||
app:siv_no_dash="true"
|
||||
app:siv_tint_color="@color/danger"
|
||||
app:srcCompat="@drawable/alarm" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/device_item_alarm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="62dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="报警"
|
||||
android:textColor="@color/xui_config_color_pure_black"
|
||||
android:textSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -189,19 +215,45 @@
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom|right">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SwitchIconView
|
||||
android:id="@+id/device_item_switch_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:padding="8dp"
|
||||
app:siv_animation_duration="500"
|
||||
app:siv_disabled_alpha=".5"
|
||||
app:siv_disabled_color="@color/info"
|
||||
app:siv_enabled="false"
|
||||
app:siv_no_dash="true"
|
||||
app:siv_tint_color="@color/toast_error_color"
|
||||
app:srcCompat="@drawable/power" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SwitchIconView
|
||||
android:id="@+id/device_item_light_button"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="53dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:paddingTop="@dimen/config_padding_12dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingBottom="@dimen/config_padding_12dp"
|
||||
app:siv_animation_duration="500"
|
||||
app:siv_disabled_alpha=".5"
|
||||
app:siv_disabled_color="@color/info"
|
||||
app:siv_enabled="false"
|
||||
app:siv_no_dash="true"
|
||||
app:siv_tint_color="@color/danger"
|
||||
app:srcCompat="@drawable/light_on" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.SwitchIconView
|
||||
android:id="@+id/device_item_switch_button"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="53dp"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:paddingTop="@dimen/config_padding_16dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingBottom="@dimen/config_padding_16dp"
|
||||
app:siv_animation_duration="500"
|
||||
app:siv_disabled_alpha=".5"
|
||||
app:siv_disabled_color="@color/info"
|
||||
app:siv_enabled="false"
|
||||
app:siv_no_dash="true"
|
||||
app:siv_tint_color="@color/danger"
|
||||
app:srcCompat="@drawable/switch_c" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -81,11 +81,13 @@
|
||||
android:id="@+id/cb_ignore"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/icon_checkbox" />
|
||||
android:button="@drawable/icon_checkbox"
|
||||
android:scaleX="0.8"
|
||||
android:scaleY="0.8" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_marginStart="@dimen/config_margin_8dp"
|
||||
android:layout_marginStart="@dimen/config_margin_4dp"
|
||||
android:text="@string/tip_ignore_message" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -1,26 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout style="@style/PullDownStyle">
|
||||
<com.xuexiang.xui.widget.actionbar.TitleBar
|
||||
android:id="@+id/titlebar_min"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-25dp"
|
||||
app:tb_actionPadding="0dp"
|
||||
app:tb_barHeight="56dp"
|
||||
app:tb_sideTextPadding="20dp"
|
||||
app:tb_titleText="关于" />
|
||||
|
||||
|
||||
<androidx.core.widget.NestedScrollView style="@style/ScrollViewStyle">
|
||||
|
||||
@@ -33,9 +39,9 @@
|
||||
android:paddingBottom="25dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="187dp"
|
||||
android:layout_height="57dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:contentDescription="Logo"
|
||||
app:srcCompat="@drawable/logo" />
|
||||
|
||||
@@ -47,6 +53,15 @@
|
||||
android:textColor="@color/xui_config_color_gray_3"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_autho"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textColor="@color/xui_config_color_gray_3"
|
||||
android:textSize="12sp"
|
||||
tools:text="Author:kerwinci Site:www.wumei.live" />
|
||||
|
||||
<com.xuexiang.xui.widget.grouplist.XUIGroupListView
|
||||
android:id="@+id/about_list"
|
||||
android:layout_width="match_parent"
|
||||
@@ -63,12 +78,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/xui_config_color_gray_7" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
</LinearLayout>
|
||||
194
android/app/src/main/res/layout/fragment_account.xml
Normal file
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.xuexiang.xui.widget.actionbar.TitleBar
|
||||
android:id="@+id/titlebar_min"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-25dp"
|
||||
app:tb_actionPadding="0dp"
|
||||
app:tb_barHeight="56dp"
|
||||
app:tb_sideTextPadding="20dp"
|
||||
app:tb_titleText="账户信息" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:foregroundGravity="center_horizontal"
|
||||
app:srcCompat="@drawable/user" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="用户名称:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="admin" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="用户昵称:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_nick_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="物美智能" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="电子邮箱:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_email"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="164770707@qq.com" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="电话号码:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_phone_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="15888888888" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="创建时间:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_create_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="127.0.0.1" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="备注信息:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_remark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="2021-08-08" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="确定"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/colorAccent" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,29 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/xui_config_color_white"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<androidx.core.widget.NestedScrollView style="@style/ScrollViewStyle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:animationCache="false"
|
||||
android:background="#FFFFFF">
|
||||
|
||||
<com.xuexiang.xui.widget.progress.CircleProgressView
|
||||
android:id="@+id/progressView_circle_main"
|
||||
android:layout_width="220dp"
|
||||
android:layout_height="220dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
app:cpv_animate_type="AccelerateDecelerateInterpolator"
|
||||
app:cpv_circle_broken="false"
|
||||
app:cpv_end_color="#80006DFE"
|
||||
app:cpv_end_progress="100"
|
||||
app:cpv_isFilled="false"
|
||||
app:cpv_isGraduated="false"
|
||||
app:cpv_isTracked="true"
|
||||
app:cpv_progress_duration="3000"
|
||||
app:cpv_progress_textColor="#0D006DFE"
|
||||
app:cpv_progress_textSize="48sp"
|
||||
app:cpv_progress_textVisibility="false"
|
||||
app:cpv_progress_width="16dp"
|
||||
app:cpv_scaleZone_width="3dp"
|
||||
app:cpv_start_color="@color/cardview_light_background"
|
||||
app:cpv_start_progress="0"
|
||||
app:cpv_track_color="#FAFAFF"
|
||||
app:cpv_track_width="26dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progress_text_main"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="48sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="%"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="32sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_device_title"
|
||||
style="@style/TextStyle.Title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="WIFI网络设置"
|
||||
android:textSize="24sp" />
|
||||
android:id="@+id/txt_config_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:text="消息提示"
|
||||
android:textColor="@color/danger" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -43,6 +112,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="?attr/xui_config_content_spacing_vertical"
|
||||
android:enabled="false"
|
||||
android:text="请选择WIFI网络" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -85,7 +155,8 @@
|
||||
android:layout_height="42dp"
|
||||
android:gravity="center_vertical"
|
||||
android:inputType="textMultiLine"
|
||||
android:text="目前仅支持2.4GHz的WIFI网络"
|
||||
android:text="提示:目前仅支持2.4GHz的WIFI网络"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<RadioButton
|
||||
@@ -97,7 +168,6 @@
|
||||
android:text="记住密码"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
@@ -128,7 +198,35 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
android:visibility="gone">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_device_num_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="42dp"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="设备数量:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_device_count"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="115dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/colorAccent"
|
||||
app:xsb_insideRangeLineStrokeWidth="5dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_max="32"
|
||||
app:xsb_min="1"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/packageModeGroup"
|
||||
@@ -152,21 +250,48 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/esptouch1_package_multicast" />
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/messageView"
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top"
|
||||
android:textColor="@android:color/holo_red_dark" />
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/add_device_next_btn"
|
||||
style="@style/SuperButton.Primary.Login"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="下一步" />
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_return"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:text="返回"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_5" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_config_cancle"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="90dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:enabled="false"
|
||||
android:text="取消"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_2" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_begin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="180dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="开始配网"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/colorAccent" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,4 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
||||
41
android/app/src/main/res/layout/fragment_device_detail.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.xuexiang.xui.widget.actionbar.TitleBar
|
||||
android:id="@+id/titlebar_min"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-25dp"
|
||||
app:tb_actionPadding="0dp"
|
||||
app:tb_barHeight="56dp"
|
||||
app:tb_sideTextPadding="20dp"
|
||||
app:tb_titleText="设备详情" />
|
||||
|
||||
<com.xuexiang.xui.widget.tabbar.TabSegment
|
||||
android:id="@+id/tabSegment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/xui_config_color_white" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/contentViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fitsSystemWindows="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
224
android/app/src/main/res/layout/fragment_device_edit.xml
Normal file
@@ -0,0 +1,224 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/config_margin_10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingEnd="@dimen/config_padding_20dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="名称:" />
|
||||
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_device_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="60dp"
|
||||
android:hint="请输入设备名称"
|
||||
android:inputType="text"
|
||||
app:met_clearButton="false"
|
||||
app:met_errorMessage="名称有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="设备名称" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="备注:" />
|
||||
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_device_remark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="60dp"
|
||||
android:hint="请输入备注"
|
||||
android:inputType="textMultiLine|textImeMultiLine"
|
||||
app:met_clearButton="false"
|
||||
app:met_errorMessage="备注有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="备注" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="设备编号:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_device_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="7CDFA1049ADA" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="设备分类:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_device_category"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="智能灯" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="固件版本:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_firmware_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="v1.0" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="创建时间:" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_create_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="2021-06-08" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="设备温度:" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/sp_device_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="23.78℃"
|
||||
app:sCornersRadius="10dp"
|
||||
app:sSolidColor="@color/app_color_theme_5" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/update_device_temp_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginStart="150dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:tint="@color/app_color_theme_5"
|
||||
app:srcCompat="@drawable/update"
|
||||
tools:visibility="visible" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_cancle_edit"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:text="取消"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_2" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="110dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="保存"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/colorAccent" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
337
android/app/src/main/res/layout/fragment_device_set.xml
Normal file
@@ -0,0 +1,337 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/config_margin_10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingRight="5dp">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="雷达感应:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_radar"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="70dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="关开" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="160dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="报警:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_alarm"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="200dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="关开" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="雷达感应间隔/s:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_radar_interval"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="90dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/app_color_theme_5"
|
||||
app:xsb_insideRangeLineStrokeWidth="5dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_isShowRuler="false"
|
||||
app:xsb_max="60"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="15sp"
|
||||
app:xsb_outsideRangeLineColor="#f0f0f0"
|
||||
app:xsb_outsideRangeLineStrokeWidth="5dp"
|
||||
app:xsb_rulerColor="@color/xui_config_color_gray_4" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="射频遥控:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_rf_control"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="按键一:" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_rf_func_one"
|
||||
style="@style/SpinnerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="按键二:" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_rf_func_two"
|
||||
style="@style/SpinnerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="按键三:" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_rf_func_three"
|
||||
style="@style/SpinnerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="按键四:" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_rf_func_four"
|
||||
style="@style/SpinnerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView13"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="以下是特殊功能,建议独立使用"
|
||||
android:textColor="@color/danger" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="遥控配对:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_rf_learn"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="70dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="160dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="遥控清码:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_rf_clear"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="230dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView14"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="打开AP:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_open_ap"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="70dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="160dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="重 启:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_reset"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="230dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_cancle_set"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:text="取消"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_2" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_apply_set"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="110dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="应用"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/colorAccent" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
389
android/app/src/main/res/layout/fragment_device_status.xml
Normal file
@@ -0,0 +1,389 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/config_margin_10dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingLeft="@dimen/config_padding_5dp"
|
||||
android:paddingEnd="@dimen/config_padding_5dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="继电器:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_relay"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="60dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="150dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="灯状态:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_light"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="210dp"
|
||||
app:swb_textOff="关"
|
||||
app:swb_textOn="开" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="彩灯模式:" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_light_mode"
|
||||
style="@style/SpinnerStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="渐变间隔/ms:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_fade_interval"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/app_color_theme_5"
|
||||
app:xsb_insideRangeLineStrokeWidth="5dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_max="1500"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="渐变时间/ms:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_fade_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/app_color_theme_5"
|
||||
app:xsb_insideRangeLineStrokeWidth="5dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_max="1500"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingLeft="@dimen/config_padding_5dp"
|
||||
android:paddingEnd="@dimen/config_padding_5dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView9"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="亮 度:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_brightness"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/app_color_theme_5"
|
||||
app:xsb_insideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_isShowRuler="false"
|
||||
app:xsb_max="100"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp"
|
||||
app:xsb_outsideRangeLineColor="#f0f0f0"
|
||||
app:xsb_outsideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_rulerColor="@color/xui_config_color_gray_4" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="红 色:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_red"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/danger"
|
||||
app:xsb_insideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_isShowRuler="false"
|
||||
app:xsb_max="255"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp"
|
||||
app:xsb_outsideRangeLineColor="#f0f0f0"
|
||||
app:xsb_outsideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_rulerColor="@color/xui_config_color_gray_4" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="绿 色:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_green"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/success"
|
||||
app:xsb_insideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_isShowRuler="false"
|
||||
app:xsb_max="255"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp"
|
||||
app:xsb_outsideRangeLineColor="#f0f0f0"
|
||||
app:xsb_outsideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_rulerColor="@color/xui_config_color_gray_4" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="31dp"
|
||||
android:text="蓝 色:" />
|
||||
|
||||
<com.xuexiang.xui.widget.picker.XSeekBar
|
||||
android:id="@+id/xsb_blue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="0dp"
|
||||
app:xsb_insideRangeLineColor="@color/colorAccent"
|
||||
app:xsb_insideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_isShowBubble="true"
|
||||
app:xsb_isShowRuler="false"
|
||||
app:xsb_max="255"
|
||||
app:xsb_min="0"
|
||||
app:xsb_numberTextColor="#ffffff"
|
||||
app:xsb_numberTextSize="12sp"
|
||||
app:xsb_outsideRangeLineColor="#f0f0f0"
|
||||
app:xsb_outsideRangeLineStrokeWidth="10dp"
|
||||
app:xsb_rulerColor="@color/xui_config_color_gray_4" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/config_margin_10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingLeft="@dimen/config_padding_5dp"
|
||||
android:paddingEnd="@dimen/config_padding_5dp">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_layout_loading_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/update_device_temp_icon"
|
||||
android:layout_width="@dimen/config_margin_14dp"
|
||||
android:layout_height="@dimen/config_margin_14dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:tint="@color/app_color_theme_5"
|
||||
app:srcCompat="@drawable/update" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="单击获取最新温湿度"
|
||||
android:textColor="@color/app_color_theme_5"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="温度:" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/sp_temperature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="23.78℃"
|
||||
app:sCornersRadius="10dp"
|
||||
app:sSolidColor="@color/app_color_theme_5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="150dp"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="湿度:" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/sp_humidity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="190dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="39.68RH%"
|
||||
app:sCornersRadius="10dp"
|
||||
app:sSolidColor="@color/app_color_theme_5" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_cancle_status"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:text="取消"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_2" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_apply_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="110dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="应用"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/colorAccent" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
@@ -1,5 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
53
android/app/src/main/res/layout/fragment_home_page.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/xui_config_color_white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/refreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srlEnableAutoLoadMore="true"
|
||||
app:srlEnableLoadMore="true">
|
||||
|
||||
|
||||
|
||||
<com.scwang.smartrefresh.header.MaterialHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"/>
|
||||
|
||||
<!-- 注意修改包名时,这里也需要修改 -->
|
||||
<com.kerwin.wumei.widget.MaterialFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,19 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
@@ -24,8 +10,8 @@
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="181dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:srcCompat="@drawable/logo" />
|
||||
|
||||
@@ -61,22 +47,17 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="36dp"
|
||||
android:hint="@string/tip_please_input_phone_number"
|
||||
android:inputType="number"
|
||||
android:hint="请输入账号"
|
||||
android:inputType="text"
|
||||
app:met_clearButton="true"
|
||||
app:met_errorMessage="@string/tip_phone_number_error"
|
||||
app:met_errorMessage="账号有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="@string/title_phone_number"
|
||||
app:met_regexp="@string/regex_phone_number" />
|
||||
|
||||
app:met_floatingLabelText="登录账号" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_verify_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -86,21 +67,19 @@
|
||||
app:srcCompat="@drawable/ic_password" />
|
||||
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_verify_code"
|
||||
android:id="@+id/et_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="36dp"
|
||||
android:hint="@string/hint_please_input_verify_code"
|
||||
android:inputType="number"
|
||||
android:hint="请输入密码"
|
||||
android:inputType="textPassword"
|
||||
app:met_clearButton="false"
|
||||
app:met_errorMessage="@string/tip_verify_code_error"
|
||||
app:met_errorMessage="密码有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="@string/lab_verify_code"
|
||||
app:met_maxCharacters="4"
|
||||
app:met_regexp="@string/regex_verify_code" />
|
||||
app:met_floatingLabelText="密码" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.roundbutton.RoundButton
|
||||
android:id="@+id/btn_get_verify_code"
|
||||
android:id="@+id/btn_clear"
|
||||
style="@style/RoundButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -109,7 +88,7 @@
|
||||
android:paddingTop="3dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="@string/action_get_verify_code"
|
||||
android:text="清除"
|
||||
android:textColor="@color/selector_round_button_main_theme_color"
|
||||
android:textSize="13sp"
|
||||
app:rb_borderColor="@color/selector_round_button_main_theme_color"
|
||||
@@ -118,44 +97,41 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_verify_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<com.xuexiang.xui.widget.alpha.XUIAlphaTextView
|
||||
android:id="@+id/tv_other_login"
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_gravity="start"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="其他登录方式"
|
||||
android:textColor="@color/xui_config_color_primary_text"
|
||||
tools:visibility="invisible" />
|
||||
<ImageView
|
||||
android:id="@+id/iv_code"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:background="#E3E0E0" />
|
||||
|
||||
<com.xuexiang.xui.widget.alpha.XUIAlphaTextView
|
||||
android:id="@+id/tv_forget_password"
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_gravity="end"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="忘记密码"
|
||||
android:textColor="@color/xui_config_color_primary_text"
|
||||
tools:visibility="invisible" />
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_verify_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="110dp"
|
||||
android:hint="请输入验证码"
|
||||
android:inputType="number"
|
||||
app:met_clearButton="false"
|
||||
app:met_errorMessage="验证码有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="验证码" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_login"
|
||||
style="@style/SuperButton.Primary.Login"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/title_login_register" />
|
||||
android:text="登录" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -172,29 +148,9 @@
|
||||
<TextView
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="登陆/注册代表您已阅读并同意"
|
||||
android:text="物美智能(wumei-smart) - 快速搭建自己的智能家居系统"
|
||||
android:textColor="@color/xui_config_color_primary_text" />
|
||||
|
||||
<com.xuexiang.xui.widget.alpha.XUIAlphaTextView
|
||||
android:id="@+id/tv_user_protocol"
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="用户协议"
|
||||
android:textColor="?attr/colorAccent" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="和"
|
||||
android:textColor="@color/xui_config_color_primary_text" />
|
||||
|
||||
<com.xuexiang.xui.widget.alpha.XUIAlphaTextView
|
||||
android:id="@+id/tv_privacy_protocol"
|
||||
style="@style/TextStyle.Explain"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="隐私政策"
|
||||
android:textColor="?attr/colorAccent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- app:tb_leftImageResource="@drawable/icon_back_white"-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.xuexiang.xui.widget.actionbar.TitleBar
|
||||
android:id="@+id/titlebar_min"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-25dp"
|
||||
app:tb_actionPadding="0dp"
|
||||
app:tb_barHeight="56dp"
|
||||
app:tb_sideTextPadding="20dp"
|
||||
app:tb_titleText="消息" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextStyle.Title"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/menu_message" />
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="暂无消息" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,32 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (C) 2019 xuexiangjys(xuexiangjys@163.com)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout style="@style/PullDownStyle">
|
||||
|
||||
<androidx.core.widget.NestedScrollView style="@style/ScrollViewStyle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
@@ -47,6 +41,7 @@
|
||||
</com.xuexiang.xui.widget.textview.supertextview.SuperTextView>
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
android:id="@+id/menu_account"
|
||||
style="@style/InfoItem.Account"
|
||||
app:sLeftTextString="账号" />
|
||||
|
||||
@@ -55,31 +50,36 @@
|
||||
style="@style/InfoItem.Account"
|
||||
app:sLeftTextString="消息" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
style="@style/InfoItem.Account"
|
||||
app:sDividerLineType="none"
|
||||
app:sLeftTextString="收藏" />
|
||||
|
||||
<com.xuexiang.xui.widget.grouplist.XUIGroupListView
|
||||
android:id="@+id/about_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
android:id="@+id/menu_feedback"
|
||||
style="@style/InfoItem.Account"
|
||||
android:layout_marginTop="20dp"
|
||||
app:sLeftTextString="意见反馈" />
|
||||
android:id="@+id/menu_logout"
|
||||
style="@style/InfoItem"
|
||||
android:layout_marginTop="16dp"
|
||||
app:sCenterTextColor="@color/xui_config_color_red"
|
||||
app:sCenterTextString="退出登录"
|
||||
app:sDividerLineType="none" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
android:id="@+id/menu_settings"
|
||||
style="@style/InfoItem.Account"
|
||||
app:sLeftTextString="设置" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
|
||||
android:id="@+id/menu_about"
|
||||
style="@style/InfoItem.Account"
|
||||
app:sDividerLineType="none"
|
||||
app:sLeftTextString="关于" />
|
||||
<TextView
|
||||
android:id="@+id/tv_copyright"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="@color/xui_config_color_gray_7" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,35 +1,235 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/xui_config_color_white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/refreshLayout"
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:srlEnableAutoLoadMore="true"
|
||||
app:srlEnableLoadMore="true">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.header.MaterialHeader
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/config_margin_10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingEnd="@dimen/config_padding_20dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
<TextView
|
||||
android:id="@+id/textView16"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="服务端配置"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="地址/域名:" />
|
||||
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_serve"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="38dp"
|
||||
android:hint="请输入服务端地址,例如:192.168.0.100"
|
||||
android:inputType="text"
|
||||
app:met_clearButton="true"
|
||||
app:met_errorMessage="输入的服务地址有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="服务端地址" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="端口:" />
|
||||
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_port"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="38dp"
|
||||
android:hint="请输入端口号,例如:80"
|
||||
android:inputType="number"
|
||||
app:met_clearButton="true"
|
||||
app:met_errorMessage="输入的端口有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="服务端口" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="使用HTTPS:" />
|
||||
|
||||
<com.xuexiang.xui.widget.button.switchbutton.SwitchButton
|
||||
android:id="@+id/sb_https"
|
||||
style="@style/SwitchButtonStyle"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="90dp"
|
||||
app:swb_textOff="否"
|
||||
app:swb_textOn="是" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txt_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="端口:"
|
||||
android:visibility="invisible" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_connect_test"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="连接测试"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_2" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_save_serve"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="110dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="保存"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/colorAccent" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
tools:listitem="@layout/adapter_news_card_view_list_item" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@color/cardview_light_background"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/config_padding_20dp"
|
||||
android:paddingEnd="@dimen/config_padding_20dp">
|
||||
|
||||
<!-- 注意修改包名时,这里也需要修改 -->
|
||||
<com.kerwin.wumei.widget.MaterialFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/textView17"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="AP配置"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
<View
|
||||
android:id="@+id/divider4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView18"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="需要设备支持并启动AP,手机连接设备wifi热点"
|
||||
android:textColor="@color/danger"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="60dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/config_margin_18dp"
|
||||
android:text="设备AP地址:" />
|
||||
|
||||
<com.xuexiang.xui.widget.edittext.materialedittext.MaterialEditText
|
||||
android:id="@+id/et_ap_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="38dp"
|
||||
android:layout_marginEnd="130dp"
|
||||
android:inputType="text"
|
||||
app:met_clearButton="true"
|
||||
app:met_errorMessage="输入有误"
|
||||
app:met_floatingLabel="normal"
|
||||
app:met_floatingLabelText="设备地址"
|
||||
tools:text="192.168.4.1" />
|
||||
|
||||
<com.xuexiang.xui.widget.textview.supertextview.SuperButton
|
||||
android:id="@+id/btn_open_ap"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="42dp"
|
||||
android:text="打开"
|
||||
app:sCornersRadius="5dp"
|
||||
app:sSolidColor="@color/app_color_theme_5" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
@@ -1,5 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- *************************************************
|
||||
* 作者:kerwincui
|
||||
* 时间:2021-06-08
|
||||
* 邮箱:164770707@qq.com
|
||||
* 源码地址:https://gitee.com/kerwincui/wumei-smart
|
||||
* author: kerwincui
|
||||
* create: 2021-06-08
|
||||
* email:164770707@qq.com
|
||||
* source:https://github.com/kerwincui/wumei-smart
|
||||
************************************************** -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||