version:1.0.6
update: bugfixes:修改样式,删除无用类
This commit is contained in:
@@ -33,6 +33,7 @@ import com.xxpatx.os.databinding.FragmentContactHomeBinding;
|
||||
import com.xxpatx.os.dialog.EditContactDialog;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
import com.xxpatx.os.utils.ScreenUtils;
|
||||
import com.xxpatx.os.utils.TimeUtils;
|
||||
import com.xxpatx.os.view.EquallyDividedItemDecoration;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -77,21 +78,17 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
|
||||
SPAN_COUNT = 2;
|
||||
}
|
||||
mViewDataBinding.rvContact.setLayoutManager(new GridLayoutManager(getContext(), SPAN_COUNT));
|
||||
EquallyDividedItemDecoration equallyDividedItemDecoration = new EquallyDividedItemDecoration(SPAN_COUNT, ScreenUtils.dip2px(mContext, 6));
|
||||
mViewDataBinding.rvContact.addItemDecoration(equallyDividedItemDecoration);
|
||||
// EquallyDividedItemDecoration equallyDividedItemDecoration = new EquallyDividedItemDecoration(SPAN_COUNT, 2);
|
||||
// mViewDataBinding.rvContact.addItemDecoration(equallyDividedItemDecoration);
|
||||
mViewDataBinding.rvContact.setAdapter(mContactAdapter);
|
||||
setTime();
|
||||
initAmap();
|
||||
}
|
||||
|
||||
private void setTime() {
|
||||
long time = System.currentTimeMillis();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
||||
Date date = new Date(time);
|
||||
mViewDataBinding.tvTime.setText(sdf.format(date));
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM月-dd日");
|
||||
Date date2 = new Date(time);
|
||||
mViewDataBinding.tvData.setText(sdf2.format(date2) + "\t" + DayUtils.getWeek());
|
||||
mViewDataBinding.tvTime.setText(TimeUtils.getNowTime(mContext));
|
||||
mViewDataBinding.tvData.setText(TimeUtils.getDateWeek());
|
||||
mViewDataBinding.tvWeek.setText(DayUtils.getWeek());
|
||||
}
|
||||
|
||||
private void initAmap() {
|
||||
@@ -147,12 +144,12 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()) {
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
Log.e(TAG, "onSuccess: " + resId);
|
||||
if (resId == 0) {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
} else {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
}
|
||||
// Log.e(TAG, "onSuccess: " + resId);
|
||||
// if (resId == 0) {
|
||||
// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
// } else {
|
||||
// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
// }
|
||||
mViewDataBinding.tvTemp.setText(hourlyBean.getTemp() + "℃");
|
||||
}
|
||||
}
|
||||
@@ -177,7 +174,7 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("week", String.class)
|
||||
.get("date", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
@@ -185,6 +182,15 @@ public class ContactFragment extends BaseMvvmFragment<ContactViewModel, Fragment
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("week", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvWeek.setText(s);
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.getContactList().observe(this, new Observer<List<Contact>>() {
|
||||
@Override
|
||||
public void onChanged(List<Contact> contacts) {
|
||||
|
||||
@@ -1,936 +0,0 @@
|
||||
package com.xxpatx.os.fragment.custom;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.qweather.sdk.bean.base.Code;
|
||||
import com.qweather.sdk.bean.base.Lang;
|
||||
import com.qweather.sdk.bean.base.Unit;
|
||||
import com.qweather.sdk.bean.weather.WeatherDailyBean;
|
||||
import com.qweather.sdk.bean.weather.WeatherHourlyBean;
|
||||
import com.qweather.sdk.bean.weather.WeatherNowBean;
|
||||
import com.qweather.sdk.view.QWeather;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.alarm.port.PortAlarmActivity;
|
||||
import com.xxpatx.os.activity.code.FamilySpaceActivity;
|
||||
import com.xxpatx.os.activity.contact.ContactActivity;
|
||||
import com.xxpatx.os.activity.control.ControlActivity;
|
||||
import com.xxpatx.os.activity.emergency.EmergencyActivity;
|
||||
import com.xxpatx.os.activity.quickapp.QuickAppActivity;
|
||||
import com.xxpatx.os.activity.weather.WeatherActivity;
|
||||
import com.xxpatx.os.adapter.NotificationAdapter;
|
||||
import com.xxpatx.os.adapter.SOSNnmberAdapter;
|
||||
import com.xxpatx.os.alarm.AlarmClockData;
|
||||
import com.xxpatx.os.alarm.AlarmUtils;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.bean.AlarmItem;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.bean.HealthCode;
|
||||
import com.xxpatx.os.bean.SnInfo;
|
||||
import com.xxpatx.os.bean.UserAvatarInfo;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentCustomBinding;
|
||||
import com.xxpatx.os.dialog.PasswordDialog;
|
||||
import com.xxpatx.os.dialog.SingleDialog;
|
||||
import com.xxpatx.os.manager.AmapManager;
|
||||
import com.xxpatx.os.manager.RemoteManager;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.network.UrlAddress;
|
||||
import com.xxpatx.os.push.PushManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.AppUtil;
|
||||
import com.xxpatx.os.utils.BitmapUtils;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
import com.xxpatx.os.utils.NetStateUtils;
|
||||
import com.xxpatx.os.utils.SchemeUtils;
|
||||
import com.xxpatx.os.utils.Utils;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link CustomFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class CustomFragment extends BaseMvvmFragment<CustomViewModel, FragmentCustomBinding> implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
|
||||
private static final String TAG = "CustomFragment";
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
private int[] mShaderColors = new int[]{0xFF05d192, 0xFF05d192, 0xFF05d192, 0xFF05d192, 0xFF05d192, 0xFF05d192, 0xFF05d192};
|
||||
private int[] mShaderColorsRed = new int[]{0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000};
|
||||
|
||||
private List<AlarmItem> alarmItemList;
|
||||
private NotificationAdapter notificationAdapter;
|
||||
// private AlarmClockAdapter alarmClockAdapter;
|
||||
private SOSNnmberAdapter sosNnmberAdapter;
|
||||
|
||||
private Activity mContext;
|
||||
private ContentResolver mCRv;
|
||||
|
||||
public CustomFragment() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static CustomFragment newInstance() {
|
||||
CustomFragment fragment = new CustomFragment();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public void setAlarmItem(List<AlarmItem> alarmItem) {
|
||||
this.alarmItemList = alarmItem;
|
||||
// setAlarm();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_custom;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mContext = getActivity();
|
||||
mCRv = mContext.getContentResolver();
|
||||
mViewModel.setCtx(getCtx());
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView(Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData(Bundle savedInstanceState) {
|
||||
mViewModel.getUserAvatarInfoData().observe(this, new Observer<UserAvatarInfo>() {
|
||||
@Override
|
||||
public void onChanged(UserAvatarInfo userAvatarInfo) {
|
||||
if (userAvatarInfo != null) {
|
||||
if (TextUtils.isEmpty(userAvatarInfo.getSn_name())) {
|
||||
mViewDataBinding.tvName.setText("未设置");
|
||||
} else {
|
||||
mViewDataBinding.tvName.setText(userAvatarInfo.getSn_name());
|
||||
}
|
||||
} else {
|
||||
mViewDataBinding.tvName.setText("未设置");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
Log.e(TAG, "fetchData: ");
|
||||
initData();
|
||||
AmapManager.getInstance().startLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
mViewDataBinding.wifiSsid.setText("WiFi未连接");
|
||||
mViewDataBinding.ivWifi.setImageDrawable(mContext.getDrawable(R.drawable.wifi_disconnect));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
if (networkType == NetworkUtils.NetworkType.NETWORK_WIFI) {
|
||||
mViewDataBinding.ivWifi.setImageDrawable(mContext.getDrawable(R.drawable.wifi_connect));
|
||||
if (isNetworkOnline1()) {
|
||||
mViewDataBinding.wifiSsid.setText("已连接");
|
||||
} else {
|
||||
mViewDataBinding.wifiSsid.setText("未连接");
|
||||
}
|
||||
} else {
|
||||
mViewDataBinding.wifiSsid.setText("WiFi未连接");
|
||||
mViewDataBinding.ivWifi.setImageDrawable(mContext.getDrawable(R.drawable.wifi_disconnect));
|
||||
}
|
||||
}
|
||||
|
||||
private String getConnectWifiSsid() {
|
||||
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||
Log.e("wifiInfo", wifiInfo.toString());
|
||||
Log.e("SSID", wifiInfo.getSSID());
|
||||
return wifiInfo.getSSID().replace("\"", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查wifi是否处开连接状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isWifiConnect() {
|
||||
ConnectivityManager connManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo mWifiInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
return mWifiInfo.isConnected();
|
||||
}
|
||||
|
||||
public boolean isNetworkOnline1() {
|
||||
boolean isOnline = false;
|
||||
try {
|
||||
ConnectivityManager manager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkCapabilities capabilities = manager.getNetworkCapabilities(manager.getActiveNetwork()); // need ACCESS_NETWORK_STATE permission
|
||||
isOnline = capabilities != null && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return isOnline;
|
||||
}
|
||||
|
||||
private RefreshBroadcastReceiver mRefreshBroadcastReceiver;
|
||||
|
||||
private void registerRefreshReceiver() {
|
||||
if (mRefreshBroadcastReceiver == null) {
|
||||
mRefreshBroadcastReceiver = new RefreshBroadcastReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(QuickAppActivity.QUICK_APP_REFRESH_KEY);
|
||||
mContext.registerReceiver(mRefreshBroadcastReceiver, filter);
|
||||
}
|
||||
|
||||
class RefreshBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.e(TAG, "onReceive: " + intent.getAction());
|
||||
setQuickApp();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerAlarmClockReceiver() {
|
||||
if (null == mAlarmClockReceiver) {
|
||||
mAlarmClockReceiver = new AlarmClockReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(PushManager.SET_ALARMCLOCK);
|
||||
mContext.registerReceiver(mAlarmClockReceiver, filter);
|
||||
}
|
||||
|
||||
private AlarmClockReceiver mAlarmClockReceiver;
|
||||
|
||||
private class AlarmClockReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
Log.e(TAG, "onReceive: " + action);
|
||||
if (PushManager.SET_ALARMCLOCK.equals(action)) {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getAlarmClock();
|
||||
}
|
||||
}, 3456);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void registerBatteryReceiver() {
|
||||
if (null == batteryReceiver) {
|
||||
batteryReceiver = new BatteryReceiver();
|
||||
}
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||
filter.addAction(Intent.ACTION_BATTERY_LOW);
|
||||
filter.addAction(Intent.ACTION_BATTERY_OKAY);
|
||||
filter.addAction(Intent.ACTION_POWER_CONNECTED);
|
||||
filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
|
||||
mContext.registerReceiver(batteryReceiver, filter);
|
||||
}
|
||||
|
||||
private BatteryReceiver batteryReceiver;
|
||||
|
||||
private class BatteryReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
|
||||
//你可以读到充电状态,如果在充电,可以读到是usb还是交流电
|
||||
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
|
||||
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
|
||||
status == BatteryManager.BATTERY_STATUS_FULL;
|
||||
// 当前电量
|
||||
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
|
||||
// 最大电量
|
||||
int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
|
||||
int elec = (level * 100) / scale;
|
||||
Log.i(TAG, "electricity:=" + elec + "%");
|
||||
mViewDataBinding.tvBattery.setText(elec + "%");
|
||||
notifyBattery(level, scale, status, isCharging);
|
||||
} else if (Intent.ACTION_POWER_CONNECTED.equals(action)
|
||||
|| Intent.ACTION_POWER_DISCONNECTED.equals(action)
|
||||
|| Intent.ACTION_BATTERY_LOW.equals(action)
|
||||
|| Intent.ACTION_BATTERY_OKAY.equals(action)
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyBattery(int level, int scale, int status, boolean isCharging) {
|
||||
Bitmap bitmap = BitmapUtils.getbatteryIcon(mContext, BitmapFactory.decodeResource(getResources(), R.drawable.battery_icon), level, isCharging);
|
||||
mViewDataBinding.ivBattery.setImageBitmap(bitmap);
|
||||
}
|
||||
|
||||
//监听时间和日期变化
|
||||
public void registerTimeReceiver() {
|
||||
mTimeChangedReceiver = new TimeChangedReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_DATE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_TIME_CHANGED);
|
||||
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
||||
filter.addAction(Intent.ACTION_TIME_TICK);
|
||||
mContext.registerReceiver(mTimeChangedReceiver, filter);
|
||||
}
|
||||
|
||||
private TimeChangedReceiver mTimeChangedReceiver;
|
||||
|
||||
private class TimeChangedReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (Intent.ACTION_DATE_CHANGED.equals(intent.getAction())) {
|
||||
Log.e(TAG, "TimeChangedReceiver:" + "data changed");
|
||||
} else if (Intent.ACTION_TIME_CHANGED.equals(intent.getAction())) {
|
||||
Log.e(TAG, "TimeChangedReceiver:" + "time changed");
|
||||
} else if (Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
|
||||
Log.e(TAG, "TimeChangedReceiver:" + "timezone changed");
|
||||
} else if (Intent.ACTION_TIME_TICK.equals(intent.getAction())) {
|
||||
Log.e(TAG, "TimeChangedReceiver:" + "time tick");
|
||||
}
|
||||
setTiem();
|
||||
}
|
||||
}
|
||||
|
||||
private void setTiem() {
|
||||
long time = System.currentTimeMillis();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
||||
Date date = new Date(time);
|
||||
mViewDataBinding.tvTime.setText(sdf.format(date));
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM月-dd日");
|
||||
Date date2 = new Date(time);
|
||||
mViewDataBinding.tvData.setText(sdf2.format(date2) + "\t" + getWeek());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 根据日期取得星期几
|
||||
*/
|
||||
public static String getWeek() {
|
||||
Date date = new Date();
|
||||
String[] weeks = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
int weekIndex = cal.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
if (weekIndex < 0) {
|
||||
weekIndex = 0;
|
||||
}
|
||||
return weeks[weekIndex];
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
Log.e(TAG, "initView: " + Utils.getBatteryLevel(mContext));
|
||||
registerRefreshReceiver();
|
||||
registerBatteryReceiver();
|
||||
registerAlarmClockReceiver();
|
||||
registerTimeReceiver();
|
||||
mViewDataBinding.wifiSsid.requestFocus();
|
||||
setTiem();
|
||||
if (Settings.Global.getInt(mCRv, "is_aihealth", 0) == 1) {
|
||||
mViewDataBinding.clAppstore.setVisibility(View.GONE);
|
||||
mViewDataBinding.clAi.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mViewDataBinding.clAppstore.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.clAi.setVisibility(View.GONE);
|
||||
}
|
||||
mViewDataBinding.cpv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
killBackgroundApp();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clGuard.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getAlarm();
|
||||
}
|
||||
});
|
||||
notificationAdapter = new NotificationAdapter();
|
||||
notificationAdapter.setOnClickListener(new NotificationAdapter.OnClickListener() {
|
||||
@Override
|
||||
public void onClick() {
|
||||
getAlarm();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.rvNoti.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getAlarm();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.rvNoti.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
mViewDataBinding.rvNoti.setAdapter(notificationAdapter);
|
||||
if (isWifiConnect()) {
|
||||
mViewDataBinding.ivWifi.setImageDrawable(mContext.getDrawable(R.drawable.wifi_connect));
|
||||
if (isNetworkOnline1()) {
|
||||
mViewDataBinding.wifiSsid.setText("已连接");
|
||||
} else {
|
||||
mViewDataBinding.wifiSsid.setText("未连接");
|
||||
}
|
||||
} else {
|
||||
mViewDataBinding.wifiSsid.setText("WiFi未连接");
|
||||
mViewDataBinding.ivWifi.setImageDrawable(mContext.getDrawable(R.drawable.wifi_disconnect));
|
||||
}
|
||||
sosNnmberAdapter = new SOSNnmberAdapter();
|
||||
mViewDataBinding.rvSos.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
mViewDataBinding.rvSos.setAdapter(sosNnmberAdapter);
|
||||
mViewDataBinding.clSos.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
checkSosNumber();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clWeather.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clClean.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
killBackgroundApp();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clHealth.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getHealthCode();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clContact.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
checkContact();
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clAi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openScheme(SchemeUtils.SCHEME_HAND);
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clApp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (TextUtils.isEmpty(quickAppPackagesName)) {
|
||||
int is_quick = Settings.Global.getInt(mContext.getContentResolver(), QuickAppActivity.QUICK_APP_ENABLED_KEY, 0);
|
||||
if (is_quick == 0) {
|
||||
startActivity(new Intent(mContext, QuickAppActivity.class));
|
||||
}
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, quickAppPackagesName);
|
||||
}
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clApp.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
int is_quick = Settings.Global.getInt(mContext.getContentResolver(), QuickAppActivity.QUICK_APP_ENABLED_KEY, 0);
|
||||
if (is_quick == 0) {
|
||||
startActivity(new Intent(mContext, QuickAppActivity.class));
|
||||
} else {
|
||||
Toaster.show("已在小程序设置");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clAppstore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ApkUtils.openPackage(mContext, "com.uiui.videoplayer", "com.uiui.videoplayer.activity.main.OldMainActivity");
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clWifi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clActivation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ApkUtils.openPackage(mContext, "com.xxpatx.sn");
|
||||
}
|
||||
});
|
||||
mViewDataBinding.clControl.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(mContext, ControlActivity.class));
|
||||
}
|
||||
});
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
private void showPassword() {
|
||||
PasswordDialog passwordDialog = new PasswordDialog(mContext);
|
||||
passwordDialog.setTitle("请输入密码退出关怀系统");
|
||||
passwordDialog.setOnClickBottomListener(new PasswordDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
if ("666666".equals(passwordDialog.getPassword())) {
|
||||
Utils.openLauncher3(mContext);
|
||||
passwordDialog.dismiss();
|
||||
} else {
|
||||
Toaster.show("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
passwordDialog.dismiss();
|
||||
}
|
||||
});
|
||||
passwordDialog.show();
|
||||
passwordDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
passwordDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
passwordDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
}
|
||||
|
||||
private void checkSosNumber() {
|
||||
NetInterfaceManager.getInstance().getContactList(new NetInterfaceManager.ContactCallback() {
|
||||
@Override
|
||||
public void setContact(List<Contact> contactList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmergencyContact(List<Contact> emergencyContact) {
|
||||
if (emergencyContact == null || emergencyContact.size() == 0) {
|
||||
showNoData("温馨提示", "请在小程序上面设置紧急联系人");
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||
// intent.putExtra("setting_sos", phone);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmpty() {
|
||||
showNoData("温馨提示", "请在小程序上面设置紧急联系人");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkContact() {
|
||||
startActivity(new Intent(mContext, ContactActivity.class));
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
mViewModel.getSnInfo();
|
||||
initAmap();
|
||||
getAlarmCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
initAmap();
|
||||
setSosNumber();
|
||||
setQuickApp();
|
||||
}
|
||||
|
||||
private String quickAppPackagesName;
|
||||
|
||||
private void setQuickApp() {
|
||||
quickAppPackagesName = Settings.Global.getString(mCRv, QuickAppActivity.QUICK_APP_KEY);
|
||||
Log.e(TAG, "setQuickApp: " + quickAppPackagesName);
|
||||
if (!TextUtils.isEmpty(quickAppPackagesName)) {
|
||||
ApplicationInfo applicationInfo = null;
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
applicationInfo = pm.getApplicationInfo(quickAppPackagesName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (applicationInfo != null) {
|
||||
mViewDataBinding.ivApp.setImageDrawable(applicationInfo.loadIcon(pm));
|
||||
}
|
||||
} else {
|
||||
mViewDataBinding.ivApp.setImageDrawable(mContext.getDrawable(R.drawable.home_quick_app));
|
||||
}
|
||||
}
|
||||
|
||||
private void openScheme(String uri) {
|
||||
int is_health = mMMKV.decodeInt("is_health", 0);
|
||||
if (is_health == 0) {
|
||||
Toaster.show("AI健康功能已关闭");
|
||||
return;
|
||||
}
|
||||
SingleDialog dialog = new SingleDialog(mContext);
|
||||
dialog.setTitle("温馨提示")
|
||||
.setMessage("网络不可用")
|
||||
.setPositive("确定")
|
||||
// .setNegtive("拒绝")
|
||||
// .setSingle(true)
|
||||
.setOnClickBottomListener(new SingleDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
// dialog.setCancelable(false);
|
||||
if (!NetStateUtils.isNetworkConnected(mContext)) {
|
||||
dialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
NetInterfaceManager.getInstance().getSnInfo(new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
if (snInfo == null || TextUtils.isEmpty(snInfo.getMobile())) {
|
||||
dialog.setMessage("绑定手机才能使用");
|
||||
dialog.show();
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, "com.uiui.health");
|
||||
SchemeUtils.openScheme(mContext, uri);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setSosNumber() {
|
||||
// String jsonString = mCacheHelper.getAsString(UrlAddress.GET_SETTINGS);
|
||||
// //为 "" 是已经请求成功的
|
||||
// if (jsonString == null) {
|
||||
// // rvSos.setVisibility(View.GONE);
|
||||
//// iv_sos.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// Gson gson = new Gson();
|
||||
// Type type = new TypeToken<List<Contact>>() {
|
||||
// }.getType();
|
||||
// List<Contact> setting_sos = gson.fromJson(jsonString, type);
|
||||
// if (setting_sos == null || setting_sos.size() == 0) {
|
||||
// // rvSos.setVisibility(View.VISIBLE);
|
||||
//// iv_sos.setVisibility(View.GONE);
|
||||
// sosNnmberAdapter.setPhoneNumberList(setting_sos);
|
||||
// } else {
|
||||
// // rvSos.setVisibility(View.GONE);
|
||||
//// iv_sos.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void initAmap() {
|
||||
String city = AmapManager.getInstance().getCity();
|
||||
mViewDataBinding.tvLocation.setText(city);
|
||||
getweather(AmapManager.getInstance().getLocationTude());
|
||||
}
|
||||
|
||||
private void getAlarm() {
|
||||
startActivity(new Intent(mContext, PortAlarmActivity.class));
|
||||
}
|
||||
|
||||
private void getAlarmCache() {
|
||||
String jsonString = mMMKV.decodeString(UrlAddress.GET_ALARM_CLOCK);
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<AlarmClockData>>() {
|
||||
}.getType();
|
||||
List<AlarmClockData> list = gson.fromJson(jsonString, type);
|
||||
if (list == null || list.size() == 0) {
|
||||
mViewDataBinding.rvNoti.setVisibility(View.GONE);
|
||||
mViewDataBinding.ivNoteNodata.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
notificationAdapter.setDataList(list.subList(0, 1));
|
||||
mViewDataBinding.rvNoti.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.ivNoteNodata.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void getAlarmClock() {
|
||||
NetInterfaceManager.getInstance().getAlarmClock(new NetInterfaceManager.AlarmClockCallback() {
|
||||
@Override
|
||||
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||
AlarmClockData alarmClockData = AlarmUtils.getInstance().getRecentAlarmClock();
|
||||
List<AlarmClockData> data = new ArrayList<>();
|
||||
if (alarmClockData != null) {
|
||||
data.add(alarmClockData);
|
||||
notificationAdapter.setDataList(data);
|
||||
mViewDataBinding.rvNoti.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.ivNoteNodata.setVisibility(View.GONE);
|
||||
} else {
|
||||
mViewDataBinding.rvNoti.setVisibility(View.GONE);
|
||||
mViewDataBinding.ivNoteNodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlarmClockEmpty() {
|
||||
mViewDataBinding.rvNoti.setVisibility(View.GONE);
|
||||
mViewDataBinding.ivNoteNodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showNoData(String title, String msg) {
|
||||
SingleDialog dialog = new SingleDialog(mContext);
|
||||
dialog.setTitle(title)
|
||||
.setMessage(msg)
|
||||
.setPositive("确定")
|
||||
// .setNegtive("拒绝")
|
||||
// .setSingle(true)
|
||||
.setOnClickBottomListener(new SingleDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
// dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void getHealthCode() {
|
||||
NetInterfaceManager.getInstance().getHealthCode(new NetInterfaceManager.HealthCodeCallback() {
|
||||
@Override
|
||||
public void setHealthCode(List<HealthCode> healthCode) {
|
||||
startActivity(new Intent(mContext, FamilySpaceActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void noData() {
|
||||
showNoData("温馨提示", "请在小程序上设置健康码");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String nowString;
|
||||
|
||||
private void getweather(String location) {
|
||||
Log.e(TAG, "getweather: " + location);
|
||||
/**
|
||||
* 实况天气数据
|
||||
* @param location 所查询的地区,可通过该地区名称、ID、IP和经纬度进行查询经纬度格式:经度,纬度
|
||||
* (英文,分隔,十进制格式,北纬东经为正,南纬西经为负)
|
||||
* @param lang (选填)多语言,可以不使用该参数,默认为简体中文
|
||||
* @param unit (选填)单位选择,公制(m)或英制(i),默认为公制单位
|
||||
* @param listener 网络访问结果回调
|
||||
*/
|
||||
QWeather.getWeatherNow(mContext, location, Lang.ZH_HANS, Unit.METRIC, new QWeather.OnResultWeatherNowListener() {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getWeatherNow", "onError: " + e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(WeatherNowBean weatherBean) {
|
||||
Log.d("getWeatherNow", "onSuccess: " + new Gson().toJson(weatherBean));
|
||||
//先判断返回的status是否正确,当status正确时获取数据,若status不正确,可查看status对应的Code值找到原因
|
||||
if (Code.OK == weatherBean.getCode()) {
|
||||
WeatherNowBean.NowBaseBean now = weatherBean.getNow();
|
||||
// String imageName = "he" + now.getIcon();
|
||||
// int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
// ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
nowString = now.getText();
|
||||
mViewDataBinding.tvTemp.setText(now.getTemp() + "℃");
|
||||
mViewDataBinding.tvWeather.setText(now.getText());
|
||||
String iconDay = weatherBean.getNow().getIcon();
|
||||
Log.e("getweather", "onSuccess: iconDay = " + iconDay);
|
||||
switch (iconDay) {
|
||||
case "100":
|
||||
case "150":
|
||||
case "102":
|
||||
case "152":
|
||||
if (DayUtils.isNight()) {
|
||||
// mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun));
|
||||
} else {
|
||||
// mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun_night));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// mViewDataBinding.clWeather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_rain));
|
||||
}
|
||||
} else {
|
||||
//在此查看返回数据失败的原因
|
||||
Code code = weatherBean.getCode();
|
||||
Log.d("getWeatherNow", "failed code: " + code);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
QWeather.getWeather24Hourly(mContext, location, new QWeather.OnResultWeatherHourlyListener() {
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
Log.e("getWeather24Hourly", "onError: " + throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(WeatherHourlyBean weatherHourlyBean) {
|
||||
Log.d("getWeather24Hourly", "onSuccess: " + new Gson().toJson(weatherHourlyBean));
|
||||
if (Code.OK == weatherHourlyBean.getCode()) {
|
||||
List<WeatherHourlyBean.HourlyBean> hourly = weatherHourlyBean.getHourly();
|
||||
if (hourly != null && hourly.size() != 0) {
|
||||
WeatherHourlyBean.HourlyBean now = hourly.get(0);
|
||||
String imageName = "he" + now.getIcon();
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()) {
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
Log.e(TAG, "onSuccess: " + resId);
|
||||
if (resId == 0) {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
} else {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
}
|
||||
mViewDataBinding.tvTemp.setText(now.getTemp() + "℃");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//在此查看返回数据失败的原因
|
||||
Code code = weatherHourlyBean.getCode();
|
||||
Log.e("getWeather24Hourly", "failed code: " + code);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
QWeather.getWeather7D(mContext, location, new QWeather.OnResultWeatherDailyListener() {
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
Log.e("getWeather", "onError: " + throwable.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(WeatherDailyBean weatherDailyBean) {
|
||||
String jsonString = new Gson().toJson(weatherDailyBean);
|
||||
Log.d("getWeather", "onSuccess: " + jsonString);
|
||||
mMMKV.encode(CommonConfig.WEATHER_DAILY_KEY, jsonString);
|
||||
List<WeatherDailyBean.DailyBean> dailyBeans = weatherDailyBean.getDaily();
|
||||
if (dailyBeans != null && dailyBeans.size() != 0) {
|
||||
WeatherDailyBean.DailyBean dailyBean = weatherDailyBean.getDaily().get(0);
|
||||
mViewDataBinding.tvWeather.setText(nowString + "\t" + dailyBean.getTempMin() + "℃ - " + dailyBean.getTempMax() + "℃");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void killBackgroundApp() {
|
||||
List<String> pkgList = ApkUtils.queryFilterAppList(mContext);
|
||||
for (String pkg : pkgList) {
|
||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)) continue;
|
||||
killBackgroundProcesses(pkg);
|
||||
}
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
private void killBackgroundProcesses(String packageName) {
|
||||
RemoteManager.getInstance().killBackgroundProcesses(packageName);
|
||||
}
|
||||
|
||||
private void refreshMemory() {
|
||||
long avail = AppUtil.getAvailMemory(mContext);
|
||||
long total = AppUtil.getTotalMemory(mContext);
|
||||
int x = (int) (((total - avail) / (double) total) * 100);
|
||||
if (x > 80) {
|
||||
mViewDataBinding.cpv.setProgressColor(mShaderColorsRed);
|
||||
} else {
|
||||
mViewDataBinding.cpv.setProgressColor(mShaderColors);
|
||||
}
|
||||
mViewDataBinding.cpv.showAnimation(0, x, 1000);
|
||||
float x2 = (((total - avail) / (float) total));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
if (batteryReceiver != null) {
|
||||
mContext.unregisterReceiver(batteryReceiver);
|
||||
}
|
||||
if (mAlarmClockReceiver != null) {
|
||||
mContext.unregisterReceiver(mAlarmClockReceiver);
|
||||
}
|
||||
if (mTimeChangedReceiver != null) {
|
||||
mContext.unregisterReceiver(mTimeChangedReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.xxpatx.os.fragment.custom;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||
import com.xxpatx.os.bean.UserAvatarInfo;
|
||||
import com.xxpatx.os.databinding.FragmentCustomBinding;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
|
||||
public class CustomViewModel extends BaseViewModel<FragmentCustomBinding, FragmentEvent> {
|
||||
|
||||
@Override
|
||||
public FragmentCustomBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
private MutableLiveData<UserAvatarInfo> mUserAvatarInfoData =new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<UserAvatarInfo> getUserAvatarInfoData() {
|
||||
return mUserAvatarInfoData;
|
||||
}
|
||||
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getUserAvatarInfo(getLifecycle(), new NetInterfaceManager.UserAvatarInfoCallback() {
|
||||
@Override
|
||||
public void setUserAvatarInfo(UserAvatarInfo info) {
|
||||
mUserAvatarInfoData.setValue(info);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,14 @@ import android.hardware.camera2.CameraAccessException;
|
||||
import android.hardware.camera2.CameraManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.hjq.toast.Toaster;
|
||||
@@ -28,14 +26,10 @@ import com.qweather.sdk.bean.weather.WeatherNowBean;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.emergency.EmergencyActivity;
|
||||
import com.xxpatx.os.activity.addicon.AddIconActivity;
|
||||
import com.xxpatx.os.activity.alarm.port.PortAlarmActivity;
|
||||
import com.xxpatx.os.activity.contact.ContactActivity;
|
||||
import com.xxpatx.os.activity.dailyapp.DailyAppActivity;
|
||||
import com.xxpatx.os.activity.setting.SettingActivity;
|
||||
import com.xxpatx.os.activity.weather.WeatherActivity;
|
||||
import com.xxpatx.os.adapter.HomeAppAdapter;
|
||||
import com.xxpatx.os.alarm.AlarmClockData;
|
||||
import com.xxpatx.os.alarm.AlarmUtils;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
@@ -49,16 +43,14 @@ import com.xxpatx.os.manager.RemoteManager;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.push.PushManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.AppUtil;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
import com.xxpatx.os.view.RecyclerViewSpacesItemDecoration;
|
||||
import com.xxpatx.os.utils.TimeUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -258,13 +250,13 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
String imageName = "he" + hourlyBean.getIcon();
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()) {
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
Log.e(TAG, "onSuccess: " + resId);
|
||||
if (resId == 0) {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
} else {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
}
|
||||
// int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
// Log.e(TAG, "onSuccess: " + resId);
|
||||
// if (resId == 0) {
|
||||
// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
// } else {
|
||||
// mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
// }
|
||||
mViewDataBinding.tvTemp.setText(hourlyBean.getTemp() + "℃");
|
||||
}
|
||||
}
|
||||
@@ -289,7 +281,7 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("week", String.class)
|
||||
.get("date", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
@@ -297,6 +289,14 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("week", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvWeek.setText(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
@@ -380,10 +380,6 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
}
|
||||
|
||||
private void getAlarm() {
|
||||
startActivity(new Intent(mContext, PortAlarmActivity.class));
|
||||
}
|
||||
|
||||
private void checkSosNumber() {
|
||||
NetInterfaceManager.getInstance().getContactList(new NetInterfaceManager.ContactCallback() {
|
||||
@Override
|
||||
@@ -456,13 +452,9 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
|
||||
private void setTime() {
|
||||
long time = System.currentTimeMillis();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
||||
Date date = new Date(time);
|
||||
mViewDataBinding.tvTime.setText(sdf.format(date));
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM月-dd日");
|
||||
Date date2 = new Date(time);
|
||||
mViewDataBinding.tvData.setText(sdf2.format(date2) + "\t" + getWeek());
|
||||
mViewDataBinding.tvTime.setText(TimeUtils.getNowTime(mContext));
|
||||
mViewDataBinding.tvData.setText(TimeUtils.getDateWeek());
|
||||
mViewDataBinding.tvWeek.setText(DayUtils.getWeek());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -496,28 +488,25 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void edit(View view) {
|
||||
startActivity(new Intent(mContext, AddIconActivity.class));
|
||||
public void toSn(View view) {
|
||||
if (!ApkUtils.openPackage(mContext, "com.xxpatx.sn")) {
|
||||
Toaster.show("打开失败,请检查应用是否安装");
|
||||
}
|
||||
}
|
||||
|
||||
public void getAlarmClock(View view) {
|
||||
getAlarm();
|
||||
public void addContact(View view) {
|
||||
startActivity(new Intent(mContext, AddWechatContactActivity.class));
|
||||
}
|
||||
|
||||
public void toWeather(View view) {
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
public void openWifi(View view) {
|
||||
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
||||
}
|
||||
|
||||
public void toVideoplayer(View view) {
|
||||
ApkUtils.openPackage(mContext, "com.xxpatx.jtxc", "com.xxpatx.jtxc.activity.main.MainActivity");
|
||||
public void openNetwork(View view) {
|
||||
startActivity(new Intent(Settings.ACTION_DATA_USAGE_SETTINGS));
|
||||
}
|
||||
|
||||
public void openSettings(View view) {
|
||||
// startActivity(new Intent(Settings.ACTION_SETTINGS));
|
||||
startActivity(new Intent(mContext, SettingActivity.class));
|
||||
}
|
||||
|
||||
public void openFlash(View v) {
|
||||
public void openFlash(View view) {
|
||||
try {
|
||||
String cameraId = cameraManager.getCameraIdList()[0];
|
||||
cameraManager.setTorchMode(cameraId, !flashing);
|
||||
@@ -530,26 +519,21 @@ public class HomeFragment extends BaseMvvmFragment<HomeViewModel, FragmentHomeBi
|
||||
}
|
||||
}
|
||||
|
||||
public void openCalendar(View view) {
|
||||
ApkUtils.openApp(mContext, "cn.etouch.ecalendar");
|
||||
}
|
||||
|
||||
public void toWeather(View view) {
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
}
|
||||
|
||||
public void openSettings(View view) {
|
||||
startActivity(new Intent(mContext, SettingActivity.class));
|
||||
}
|
||||
|
||||
public void killApp(View view) {
|
||||
killBackgroundApp();
|
||||
}
|
||||
|
||||
public void toSos(View view) {
|
||||
checkSosNumber();
|
||||
}
|
||||
|
||||
public void toContact(View view) {
|
||||
startActivity(new Intent(mContext, ContactActivity.class));
|
||||
}
|
||||
|
||||
public void toAppstore(View view) {
|
||||
if (!ApkUtils.openPackage(mContext, "com.xxpatx.store")) {
|
||||
Toaster.show("打开失败,请检查应用是否安装");
|
||||
}
|
||||
}
|
||||
|
||||
public void dailyApp(View view) {
|
||||
startActivity(new Intent(getCtx(), DailyAppActivity.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,8 @@ import android.view.View;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.selectnumber.SelectNumberActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.contact.ContactActivity;
|
||||
import com.xxpatx.os.activity.records.RecordsActivity;
|
||||
import com.xxpatx.os.activity.selectnumber.SelectNumberActivity;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.FragmentDialerNewBinding;
|
||||
@@ -194,13 +192,11 @@ public class DialerFragment extends BaseMvvmFragment<DialerViewModel, FragmentDi
|
||||
}
|
||||
|
||||
public void toContact(View view) {
|
||||
Intent intent = new Intent(mContext, ContactActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
public void toRecord(View view) {
|
||||
Intent intent = new Intent(mContext, RecordsActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
public void add(View view) {
|
||||
|
||||
@@ -1,321 +0,0 @@
|
||||
package com.xxpatx.os.fragment.second;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.uiui.video.bean.VideoInfo;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.adapter.KnowledgeVideoAdapter;
|
||||
import com.xxpatx.os.adapter.LivenVideoAdapter;
|
||||
import com.xxpatx.os.adapter.NewArticleAdapter;
|
||||
import com.xxpatx.os.adapter.NewGoodsAdapter;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.bean.ArticleInfo;
|
||||
import com.xxpatx.os.bean.GoodsInfo;
|
||||
import com.xxpatx.os.bean.ServeBean;
|
||||
import com.xxpatx.os.databinding.FragmentSecondBinding;
|
||||
import com.xxpatx.os.utils.GlideLoadUtils;
|
||||
import com.xxpatx.os.utils.JGYUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A simple {@link androidx.fragment.app.Fragment} subclass.
|
||||
* Use the {@link SecondFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class SecondFragment extends BaseMvvmFragment<SecondViewModel, FragmentSecondBinding> implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = "SecondFragment";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private NewGoodsAdapter mNewGoodsAdapter;
|
||||
private NewArticleAdapter mNewArticleAdapter;
|
||||
private LivenVideoAdapter mLivenVideoAdapter;
|
||||
private KnowledgeVideoAdapter mKnowledgeVideoAdapter;
|
||||
|
||||
private int mCurrentGoodsIndex = 0;
|
||||
private boolean mGoodsScrolling = false;
|
||||
private Handler mGoodsHandler;
|
||||
private Runnable mGoodsRunnable;
|
||||
|
||||
private int mCurrentArticleIndex = 0;
|
||||
private boolean mArticleScrolling = false;
|
||||
private Handler mArticleHandler;
|
||||
private Runnable mArticleRunnable;
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
if (JGYUtils.getInstance().isScreenOn()) {
|
||||
initData();
|
||||
}
|
||||
}
|
||||
|
||||
public SecondFragment() {
|
||||
|
||||
}
|
||||
|
||||
public static SecondFragment newInstance(String param1, String param2) {
|
||||
SecondFragment fragment = new SecondFragment();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
Log.e(TAG, "fetchData: ");
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_second;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mContext = getActivity();
|
||||
mViewModel.setCtx(getCtx());
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView(Bundle bundle) {
|
||||
mNewGoodsAdapter = new NewGoodsAdapter();
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
mViewDataBinding.rvGoods.setLayoutManager(linearLayoutManager);
|
||||
mViewDataBinding.rvGoods.setAdapter(mNewGoodsAdapter);
|
||||
LinearSnapHelper snapHelper = new LinearSnapHelper();
|
||||
snapHelper.attachToRecyclerView(mViewDataBinding.rvGoods);
|
||||
mViewDataBinding.rvGoods.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
Log.i("rvGoods", "onScrollStateChanged: newState = " + newState);
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
mGoodsScrolling = false;
|
||||
// 获取当前滚动到的条目位置
|
||||
int firstIndex = linearLayoutManager.findFirstVisibleItemPosition();
|
||||
Log.i("rvGoods", "onScrollStateChanged: firstIndex = " + firstIndex);
|
||||
Log.i("rvGoods", "onScrollStateChanged: mCurrentGoodsIndex = " + mCurrentGoodsIndex);
|
||||
mCurrentGoodsIndex = firstIndex + 1;
|
||||
} else {
|
||||
mGoodsScrolling = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
}
|
||||
});
|
||||
|
||||
mNewArticleAdapter = new NewArticleAdapter();
|
||||
LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager2.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
mViewDataBinding.rvArticle.setLayoutManager(linearLayoutManager2);
|
||||
mViewDataBinding.rvArticle.setAdapter(mNewArticleAdapter);
|
||||
LinearSnapHelper snapHelper2 = new LinearSnapHelper();
|
||||
snapHelper2.attachToRecyclerView(mViewDataBinding.rvArticle);
|
||||
mViewDataBinding.rvArticle.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
Log.i("rvArticle", "onScrollStateChanged: newState = " + newState);
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
mArticleScrolling = false;
|
||||
// 获取当前滚动到的条目位置
|
||||
int firstIndex = linearLayoutManager2.findFirstVisibleItemPosition();
|
||||
Log.i("rvArticle", "onScrollStateChanged: firstIndex = " + firstIndex);
|
||||
Log.i("rvArticle", "onScrollStateChanged: mCurrentArticleIndex = " + mCurrentArticleIndex);
|
||||
mCurrentArticleIndex = firstIndex + 1;
|
||||
} else {
|
||||
mArticleScrolling = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
}
|
||||
});
|
||||
|
||||
mGoodsHandler = new Handler();
|
||||
mGoodsRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mNewGoodsAdapter.getItemCount() == 0 || mGoodsScrolling) {
|
||||
return;
|
||||
}
|
||||
Log.i(TAG, "run: " + mNewGoodsAdapter.getItemCount());
|
||||
if (mNewGoodsAdapter.getItemCount() <= mCurrentGoodsIndex) {
|
||||
mCurrentGoodsIndex = 0;
|
||||
} else {
|
||||
mCurrentGoodsIndex++;
|
||||
}
|
||||
mViewDataBinding.rvGoods.smoothScrollToPosition(mCurrentGoodsIndex);
|
||||
mGoodsHandler.postDelayed(this, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
mArticleHandler = new Handler();
|
||||
mArticleRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mNewArticleAdapter.getItemCount() == 0 || mArticleScrolling) {
|
||||
return;
|
||||
}
|
||||
if (mNewArticleAdapter.getItemCount() <= mCurrentArticleIndex) {
|
||||
mCurrentArticleIndex = 0;
|
||||
} else {
|
||||
mCurrentArticleIndex++;
|
||||
}
|
||||
mViewDataBinding.rvArticle.smoothScrollToPosition(mCurrentArticleIndex);
|
||||
mArticleHandler.postDelayed(this, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
mLivenVideoAdapter = new LivenVideoAdapter();
|
||||
LinearLayoutManager linearLayoutManager3 = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager3.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
mViewDataBinding.rvLiven.setLayoutManager(linearLayoutManager3);
|
||||
mViewDataBinding.rvLiven.setAdapter(mLivenVideoAdapter);
|
||||
LinearSnapHelper snapHelper3 = new LinearSnapHelper();
|
||||
snapHelper3.attachToRecyclerView(mViewDataBinding.rvLiven);
|
||||
|
||||
mKnowledgeVideoAdapter = new KnowledgeVideoAdapter();
|
||||
LinearLayoutManager linearLayoutManager4 = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager4.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
mViewDataBinding.rvKnowledge.setLayoutManager(linearLayoutManager4);
|
||||
mViewDataBinding.rvKnowledge.setAdapter(mKnowledgeVideoAdapter);
|
||||
LinearSnapHelper snapHelper4 = new LinearSnapHelper();
|
||||
snapHelper4.attachToRecyclerView(mViewDataBinding.rvKnowledge);
|
||||
|
||||
mViewDataBinding.clService.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// startActivity(new Intent(mContext, OrderListActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData(Bundle savedInstanceState) {
|
||||
mViewModel.getGoodsListData().observe(this, new Observer<List<GoodsInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<GoodsInfo> goodsInfos) {
|
||||
if (goodsInfos != null && goodsInfos.size() != 0) {
|
||||
mNewGoodsAdapter.setGoodsInfoList(goodsInfos);
|
||||
mGoodsHandler.removeCallbacks(mGoodsRunnable);
|
||||
mGoodsHandler.postDelayed(mGoodsRunnable, 3000);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
mViewModel.getArticleInfoListData().observe(this, new Observer<List<ArticleInfo>>() {
|
||||
@Override
|
||||
public void onChanged(List<ArticleInfo> articleInfos) {
|
||||
if (articleInfos != null && articleInfos.size() != 0) {
|
||||
mNewArticleAdapter.setArticleBeanList(articleInfos);
|
||||
mArticleHandler.removeCallbacks(mArticleRunnable);
|
||||
mArticleHandler.postDelayed(mArticleRunnable, 3000);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
mViewModel.getVideoInfoListData().observe(this, new Observer<ArrayList<VideoInfo>>() {
|
||||
@Override
|
||||
public void onChanged(ArrayList<VideoInfo> videoInfos) {
|
||||
mLivenVideoAdapter.setLivenVideoList(videoInfos);
|
||||
}
|
||||
});
|
||||
mViewModel.getKnowledgeVideoInfoListData().observe(this, new Observer<ArrayList<VideoInfo>>() {
|
||||
@Override
|
||||
public void onChanged(ArrayList<VideoInfo> videoInfos) {
|
||||
mKnowledgeVideoAdapter.setLivenVideoList(videoInfos);
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.getServeBeanData().observe(this, new Observer<ServeBean>() {
|
||||
@Override
|
||||
public void onChanged(ServeBean serveBean) {
|
||||
if (serveBean != null) {
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, serveBean.getImage(), mViewDataBinding.ivServe, R.drawable.enterprise_wechat);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
mViewModel.getGoods();
|
||||
mViewModel.getArticle();
|
||||
mViewModel.getLivenVideoList();
|
||||
mViewModel.getKnowledgeVideoList();
|
||||
mViewModel.getServe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
}
|
||||
|
||||
private String getTime(long second) {
|
||||
long ms = second * 1000L;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
|
||||
Date date = new Date(ms);
|
||||
String time = sdf.format(date);
|
||||
Log.e(TAG, "getTime: " + time);
|
||||
return time;
|
||||
}
|
||||
|
||||
private void openApp(int position) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
/*知道要跳转应用的包命与目标Activity*/
|
||||
ComponentName componentName = new ComponentName("com.uiui.city", "com.uiui.city.activity.OldMainActivity");
|
||||
intent.putExtra("position", position);
|
||||
intent.setComponent(componentName);
|
||||
intent.putExtra("", "");//这里Intent传值
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "openApp: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
package com.xxpatx.os.fragment.second;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.uiui.video.bean.VideoInfo;
|
||||
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||
import com.xxpatx.os.bean.ArticleInfo;
|
||||
import com.xxpatx.os.bean.ArticleList;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.GoodsInfo;
|
||||
import com.xxpatx.os.bean.GoodsList;
|
||||
import com.xxpatx.os.bean.ServeBean;
|
||||
import com.xxpatx.os.databinding.FragmentSecondBinding;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class SecondViewModel extends BaseViewModel<FragmentSecondBinding, FragmentEvent> {
|
||||
|
||||
@Override
|
||||
public FragmentSecondBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
private MutableLiveData< List<GoodsInfo> > mGoodsListData =new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<List<GoodsInfo>> getGoodsListData() {
|
||||
return mGoodsListData;
|
||||
}
|
||||
|
||||
public void getGoods() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getGoodsListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<GoodsList>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getGoods", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<GoodsList> listBaseResponse) {
|
||||
Log.e("getGoods", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
GoodsList goodsList = listBaseResponse.data;
|
||||
List<GoodsInfo> goodsInfos = goodsList.getData();
|
||||
if (goodsInfos != null && goodsInfos.size() != 0) {
|
||||
mGoodsListData.setValue(goodsInfos);
|
||||
} else {
|
||||
mGoodsListData.setValue(null);
|
||||
}
|
||||
} else {
|
||||
mGoodsListData.setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getGoods", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getGoods", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private MutableLiveData<List<ArticleInfo>> mArticleInfoListData =new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<List<ArticleInfo>> getArticleInfoListData() {
|
||||
return mArticleInfoListData;
|
||||
}
|
||||
|
||||
public void getArticle() {
|
||||
NetInterfaceManager.getInstance().getArticleListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<ArticleList>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getArticle", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<ArticleList> listBaseResponse) {
|
||||
Log.e("getArticle", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
ArticleList articleList = listBaseResponse.data;
|
||||
List<ArticleInfo> articleInfoList = articleList.getData();
|
||||
if (articleInfoList != null && articleInfoList.size() != 0) {
|
||||
articleInfoList.sort((o1, o2) -> Integer.compare(o2.getWeight(), o1.getWeight()));
|
||||
mArticleInfoListData.setValue(articleInfoList);
|
||||
} else {
|
||||
mArticleInfoListData.setValue(null);
|
||||
}
|
||||
} else {
|
||||
mArticleInfoListData.setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getArticle", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getArticle", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private MutableLiveData<ArrayList<VideoInfo> > mVideoInfoListData =new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<ArrayList<VideoInfo>> getVideoInfoListData() {
|
||||
return mVideoInfoListData;
|
||||
}
|
||||
|
||||
public void getLivenVideoList() {
|
||||
NetInterfaceManager.getInstance().getLivenVideoListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<ArrayList<VideoInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getLivenVideoList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<ArrayList<VideoInfo>> listBaseResponse) {
|
||||
Log.e("getLivenVideoList", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
ArrayList<VideoInfo> videoInfoArrayList = listBaseResponse.data;
|
||||
videoInfoArrayList.sort((o1, o2) -> Integer.compare(o2.getWeight(), o1.getWeight()));
|
||||
mVideoInfoListData.setValue(videoInfoArrayList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getLivenVideoList", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getLivenVideoList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private MutableLiveData<ArrayList<VideoInfo> > mKnowledgeVideoInfoListData =new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<ArrayList<VideoInfo>> getKnowledgeVideoInfoListData() {
|
||||
return mKnowledgeVideoInfoListData;
|
||||
}
|
||||
|
||||
public void getKnowledgeVideoList() {
|
||||
NetInterfaceManager.getInstance().getKnowledgeVideoListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<ArrayList<VideoInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getKnowledgeVideoList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<ArrayList<VideoInfo>> listBaseResponse) {
|
||||
Log.e("getKnowledgeVideoList", "onNext: " + listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
ArrayList<VideoInfo> videoInfoArrayList = listBaseResponse.data;
|
||||
videoInfoArrayList.sort((o1, o2) -> Integer.compare(o2.getWeight(), o1.getWeight()));
|
||||
mKnowledgeVideoInfoListData.setValue(videoInfoArrayList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getKnowledgeVideoList", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getKnowledgeVideoList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private MutableLiveData<ServeBean> mServeBeanData =new MutableLiveData<>();
|
||||
|
||||
public MutableLiveData<ServeBean> getServeBeanData() {
|
||||
return mServeBeanData;
|
||||
}
|
||||
|
||||
public void getServe() {
|
||||
NetInterfaceManager.getInstance().getServeObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<ServeBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getServe", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<ServeBean> serveBeanBaseResponse) {
|
||||
Log.e("getServe", "onNext: " + serveBeanBaseResponse);
|
||||
if (serveBeanBaseResponse.code == 200) {
|
||||
ServeBean serveBean = serveBeanBaseResponse.data;
|
||||
if (serveBean != null) {
|
||||
mServeBeanData.setValue(serveBean);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getServe", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getServe", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,11 @@ import com.qweather.sdk.bean.weather.WeatherNowBean;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.alarm.port.PortAlarmActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.dailyapp.DailyAppActivity;
|
||||
import com.xxpatx.os.activity.emergency.EmergencyActivity;
|
||||
import com.xxpatx.os.activity.setting.SettingActivity;
|
||||
import com.xxpatx.os.activity.weather.WeatherActivity;
|
||||
import com.xxpatx.os.base.mvvm.fragment.BaseMvvmFragment;
|
||||
import com.xxpatx.os.bean.MapBean;
|
||||
@@ -31,6 +35,7 @@ import com.xxpatx.os.databinding.FragmentSettingsBinding;
|
||||
import com.xxpatx.os.manager.AmapManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.DayUtils;
|
||||
import com.xxpatx.os.utils.TimeUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -66,7 +71,6 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e(TAG, "onConnected: " + networkType);
|
||||
initAmap();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,85 +107,9 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
mViewDataBinding.tvLocation2.setText(mapBean.getAddress());
|
||||
}
|
||||
});
|
||||
LiveEventBus
|
||||
.get("getWeatherNowKey", WeatherNowBean.NowBaseBean.class)
|
||||
.observe(this, new Observer<WeatherNowBean.NowBaseBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable WeatherNowBean.NowBaseBean nowBaseBean) {
|
||||
mViewDataBinding.tvTemp.setText(nowBaseBean.getTemp() + "℃");
|
||||
if (DayUtils.isNight()) {
|
||||
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_night));
|
||||
} else {
|
||||
switch (nowBaseBean.getIcon()) {
|
||||
default:
|
||||
case "100":
|
||||
case "150":
|
||||
//晴
|
||||
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather));
|
||||
break;
|
||||
case "102":
|
||||
case "152":
|
||||
//少云
|
||||
// mViewDataBinding.clWeather.setBackground(mContext.getDrawable(R.drawable.custom_bg_weather_rain));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// mViewDataBinding.tvWeather.setText(nowBaseBean.getText());
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("getWeather24HourlyKey", WeatherHourlyBean.HourlyBean.class)
|
||||
.observe(this, new Observer<WeatherHourlyBean.HourlyBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable WeatherHourlyBean.HourlyBean hourlyBean) {
|
||||
String imageName = "he" + hourlyBean.getIcon();
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()) {
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", mContext.getPackageName());
|
||||
Log.e(TAG, "onSuccess: " + resId);
|
||||
if (resId == 0) {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(R.drawable.he100));
|
||||
} else {
|
||||
mViewDataBinding.ivPic.setImageDrawable(mContext.getDrawable(resId));
|
||||
}
|
||||
mViewDataBinding.tvTemp.setText(hourlyBean.getTemp() + "℃");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("getWeather7DKey", WeatherDailyBean.DailyBean.class)
|
||||
.observe(this, new Observer<WeatherDailyBean.DailyBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable WeatherDailyBean.DailyBean dailyBean) {
|
||||
mViewDataBinding.tvWeather.setText(dailyBean.getTempMin() + "℃ - " + dailyBean.getTempMax() + "℃");
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("time", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvTime.setText(s);
|
||||
}
|
||||
});
|
||||
|
||||
LiveEventBus
|
||||
.get("week", String.class)
|
||||
.observe(this, new Observer<String>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable String s) {
|
||||
mViewDataBinding.tvData.setText(s);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
initAmap();
|
||||
setTime();
|
||||
getLocation();
|
||||
}
|
||||
|
||||
@@ -191,8 +119,6 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
Log.e(TAG, "onResume: ");
|
||||
mViewModel.init();
|
||||
registerReceivers();
|
||||
String district = mMMKV.decodeString(CommonConfig.MANUALLY_SELECT_LOCATION_DISTRICT, CommonConfig.DEFAULT_LOCATION_DISTRICT);
|
||||
mViewDataBinding.tvLocation.setText(district);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,36 +138,10 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
}
|
||||
|
||||
private void unregisterReceivers() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void setTime() {
|
||||
long time = System.currentTimeMillis();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
||||
Date date = new Date(time);
|
||||
mViewDataBinding.tvTime.setText(sdf.format(date));
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM月-dd日");
|
||||
Date date2 = new Date(time);
|
||||
mViewDataBinding.tvData.setText(sdf2.format(date2) + "\t" + DayUtils.getWeek());
|
||||
}
|
||||
|
||||
|
||||
private void initAmap() {
|
||||
boolean manual = mMMKV.decodeBool(CommonConfig.MANUALLY_SELECT_LOCATION_KEY, false);
|
||||
|
||||
if (!manual) {
|
||||
LiveEventBus.get(CommonConfig.AMAP_LOCATION_MAP_BEAN, MapBean.class)
|
||||
.observe(this, new Observer<MapBean>() {
|
||||
@Override
|
||||
public void onChanged(@Nullable MapBean mapBean) {
|
||||
mViewDataBinding.tvLocation.setText(mapBean.getDistrict());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void getLocation() {
|
||||
String addr = mMMKV.decodeString(CommonConfig.MAP_ADDRESS_KEY);
|
||||
if (TextUtils.isEmpty(addr) || "nullnull".equals(addr) || "null".equals(addr)) {
|
||||
@@ -254,27 +154,30 @@ public class SettingsFragment extends BaseMvvmFragment<SettingsViewModel, Fragme
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
public void toSn(View view) {
|
||||
if (!ApkUtils.openPackage(mContext, "com.xxpatx.sn")) {
|
||||
public void openSettings(View view) {
|
||||
startActivity(new Intent(mContext, SettingActivity.class));
|
||||
}
|
||||
|
||||
public void toVideoplayer(View view) {
|
||||
ApkUtils.openPackage(mContext, "com.xxpatx.jtxc", "com.xxpatx.jtxc.activity.main.MainActivity");
|
||||
}
|
||||
|
||||
public void openAlarmClock(View view) {
|
||||
startActivity(new Intent(mContext, PortAlarmActivity.class));
|
||||
}
|
||||
|
||||
public void openEmergency(View view) {
|
||||
startActivity(new Intent(mContext, EmergencyActivity.class));
|
||||
}
|
||||
|
||||
public void toAppstore(View view) {
|
||||
if (!ApkUtils.openPackage(mContext, "com.xxpatx.store")) {
|
||||
Toaster.show("打开失败,请检查应用是否安装");
|
||||
}
|
||||
}
|
||||
|
||||
public void addContact(View view) {
|
||||
startActivity(new Intent(mContext, AddWechatContactActivity.class));
|
||||
}
|
||||
|
||||
public void openWifi(View view) {
|
||||
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
||||
}
|
||||
|
||||
public void openNetwork(View view) {
|
||||
startActivity(new Intent(Settings.ACTION_DATA_USAGE_SETTINGS));
|
||||
// startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS));
|
||||
}
|
||||
|
||||
public void toWeather(View view) {
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
public void dailyApp(View view) {
|
||||
startActivity(new Intent(getCtx(), DailyAppActivity.class));
|
||||
}
|
||||
|
||||
public void getAddress(View view) {
|
||||
|
||||
Reference in New Issue
Block a user