version:2.0
fix: update:通知变化时更新
This commit is contained in:
@@ -44,7 +44,6 @@ import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.aios.BuildConfig;
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.activity.APPListActivity;
|
||||
import com.uiui.aios.activity.CodeActivity;
|
||||
import com.uiui.aios.activity.EmergencyActivity;
|
||||
import com.uiui.aios.activity.weather.WeatherActivity;
|
||||
import com.uiui.aios.adapter.NotificationAdapter;
|
||||
@@ -54,6 +53,7 @@ import com.uiui.aios.bean.AlarmItem;
|
||||
import com.uiui.aios.utils.AmapManager;
|
||||
import com.uiui.aios.utils.ApkUtils;
|
||||
import com.uiui.aios.utils.AppUtil;
|
||||
import com.uiui.aios.utils.SchemeUtils;
|
||||
import com.uiui.aios.utils.Utils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -75,38 +75,34 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
// @BindView(R.id.cl_alarm)
|
||||
// ConstraintLayout cl_alarm;
|
||||
|
||||
@BindView(R.id.cl_wifi)
|
||||
ConstraintLayout cl_wifi;
|
||||
@BindView(R.id.qr_code)
|
||||
ConstraintLayout qr_code;
|
||||
// @BindView(R.id.cl_wifi)
|
||||
// ConstraintLayout cl_wifi;
|
||||
@BindView(R.id.cl_sos)
|
||||
ConstraintLayout cl_soso;
|
||||
@BindView(R.id.cl_allapp)
|
||||
ConstraintLayout cl_allapp;
|
||||
@BindView(R.id.cl_weather)
|
||||
ConstraintLayout cl_weather;
|
||||
@BindView(R.id.cl_battery)
|
||||
ConstraintLayout cl_battery;
|
||||
// @BindView(R.id.tv_add)
|
||||
// @BindView(R.id.cl_battery)
|
||||
// ConstraintLayout cl_battery;
|
||||
// @BindView(R.id.tv_add)
|
||||
// TextView tv_add;
|
||||
@BindView(R.id.tv_battery)
|
||||
TextView tv_battery;
|
||||
// @BindView(R.id.tv_battery)
|
||||
// TextView tv_battery;
|
||||
@BindView(R.id.tv_location)
|
||||
TextView tv_location;
|
||||
@BindView(R.id.iv_pic)
|
||||
ImageView iv_pic;
|
||||
@BindView(R.id.tv_temp)
|
||||
TextView tv_temp;
|
||||
@BindView(R.id.cpv)
|
||||
CircleProgressView cpv;
|
||||
@BindView(R.id.iv_charging)
|
||||
ImageView iv_charging;
|
||||
// @BindView(R.id.cpv)
|
||||
// CircleProgressView cpv;
|
||||
// @BindView(R.id.iv_charging)
|
||||
// ImageView iv_charging;
|
||||
@BindView(R.id.rv_noti)
|
||||
RecyclerView rv_noti;
|
||||
// @BindView(R.id.rv_clock)
|
||||
// @BindView(R.id.rv_clock)
|
||||
// RecyclerView rv_clock;
|
||||
@BindView(R.id.wifi_ssid)
|
||||
TextView wifi_ssid;
|
||||
// @BindView(R.id.wifi_ssid)
|
||||
// TextView wifi_ssid;
|
||||
@BindView(R.id.iv_sos)
|
||||
ImageView iv_sos;
|
||||
@BindView(R.id.rv_sos)
|
||||
@@ -114,6 +110,14 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
@BindView(R.id.iv_note_nodata)
|
||||
ImageView iv_note_nodata;
|
||||
|
||||
@BindView(R.id.cl_health)
|
||||
ConstraintLayout mClHealth;
|
||||
@BindView(R.id.cl_tongue)
|
||||
ConstraintLayout mClTongue;
|
||||
@BindView(R.id.cl_face)
|
||||
ConstraintLayout mClFace;
|
||||
@BindView(R.id.cl_hand)
|
||||
ConstraintLayout mClHand;
|
||||
|
||||
private String TAG = CustomFragment.class.getSimpleName();
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
@@ -121,7 +125,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
private View rootView;
|
||||
private List<AlarmItem> alarmItemList;
|
||||
private NotificationAdapter notificationAdapter;
|
||||
// private AlarmClockAdapter alarmClockAdapter;
|
||||
// private AlarmClockAdapter alarmClockAdapter;
|
||||
private SOSNnmberAdapter sosNnmberAdapter;
|
||||
private MMKV mmkv;
|
||||
private Context mContext;
|
||||
@@ -177,18 +181,17 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
wifi_ssid.setText("WiFi未连接");
|
||||
// wifi_ssid.setText("WiFi未连接");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
if (networkType == NetworkUtils.NetworkType.NETWORK_WIFI) {
|
||||
wifi_ssid.setText(getConnectWifiSsid());
|
||||
// wifi_ssid.setText(getConnectWifiSsid());
|
||||
} else {
|
||||
wifi_ssid.setText("WiFi未连接");
|
||||
// wifi_ssid.setText("WiFi未连接");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +242,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
|
||||
int elec = (level * 100) / scale;
|
||||
Log.i(TAG, "electricity:=" + elec + "%");
|
||||
tv_battery.setText(elec + "%");
|
||||
// tv_battery.setText(elec + "%");
|
||||
} else if (Intent.ACTION_POWER_CONNECTED.equals(action)
|
||||
|| Intent.ACTION_POWER_DISCONNECTED.equals(action)
|
||||
|| Intent.ACTION_BATTERY_LOW.equals(action)
|
||||
@@ -285,13 +288,13 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
|
||||
private void initView() {
|
||||
Log.e(TAG, "initView: " + Utils.getBatteryLevel(getActivity()));
|
||||
tv_battery.setText(Utils.getBatteryLevel(getActivity()) + "%");
|
||||
cpv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
killBackgroundApp();
|
||||
}
|
||||
});
|
||||
// tv_battery.setText(Utils.getBatteryLevel(getActivity()) + "%");
|
||||
// cpv.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// killBackgroundApp();
|
||||
// }
|
||||
// });
|
||||
// cl_alarm.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
@@ -302,16 +305,10 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
rv_noti.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
rv_noti.setAdapter(notificationAdapter);
|
||||
if (isWifiConnect()) {
|
||||
wifi_ssid.setText(getConnectWifiSsid());
|
||||
// wifi_ssid.setText(getConnectWifiSsid());
|
||||
} else {
|
||||
wifi_ssid.setText("WiFi未连接");
|
||||
// wifi_ssid.setText("WiFi未连接");
|
||||
}
|
||||
cl_wifi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); //直接进入手机中的wifi网络设置界面
|
||||
}
|
||||
});
|
||||
// alarmClockAdapter = new AlarmClockAdapter();
|
||||
// rv_clock.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
// rv_clock.setAdapter(alarmClockAdapter);
|
||||
@@ -327,35 +324,54 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
getActivity().startActivity(intent);
|
||||
}
|
||||
});
|
||||
cl_allapp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getActivity().startActivity(new Intent(getActivity(), APPListActivity.class));
|
||||
}
|
||||
});
|
||||
cl_weather.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(getActivity(), WeatherActivity.class));
|
||||
}
|
||||
});
|
||||
cl_battery.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
|
||||
ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(powerUsageIntent, 0);
|
||||
// check that the Battery app exists on this device
|
||||
if (resolveInfo != null) {
|
||||
startActivity(powerUsageIntent);
|
||||
}
|
||||
}
|
||||
});
|
||||
qr_code.setOnClickListener(new View.OnClickListener() {
|
||||
// cl_battery.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
|
||||
// ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(powerUsageIntent, 0);
|
||||
//// check that the Battery app exists on this device
|
||||
// if (resolveInfo != null) {
|
||||
// startActivity(powerUsageIntent);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
mClHealth.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getActivity(), CodeActivity.class));
|
||||
// startActivity(new Intent(getActivity(), CodeActivity.class));
|
||||
// SchemeUtils.openScheme(getActivity(), SchemeUtils.SCHEME_TONGUE);
|
||||
}
|
||||
});
|
||||
mClTongue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// startActivity(new Intent(getActivity(), CodeActivity.class));
|
||||
// startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); //直接进入手机中的wifi网络设置界面
|
||||
SchemeUtils.openScheme(getActivity(), SchemeUtils.SCHEME_TONGUE);
|
||||
}
|
||||
});
|
||||
mClFace.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// startActivity(new Intent(getActivity(), CodeActivity.class));
|
||||
SchemeUtils.openScheme(getActivity(), SchemeUtils.SCHEME_FACE);
|
||||
}
|
||||
});
|
||||
mClHand.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// startActivity(new Intent(getActivity(), CodeActivity.class));
|
||||
// getActivity().startActivity(new Intent(getActivity(), APPListActivity.class));
|
||||
SchemeUtils.openScheme(getActivity(), SchemeUtils.SCHEME_HAND);
|
||||
}
|
||||
});
|
||||
|
||||
// setAlarm();
|
||||
refreshMemory();
|
||||
}
|
||||
@@ -479,7 +495,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
WeatherHourlyBean.HourlyBean now = hourly.get(0);
|
||||
String imageName = "he" + now.getIcon();
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()){
|
||||
if (isAdded()) {
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", getActivity().getPackageName());
|
||||
Log.e(TAG, "onSuccess: " + resId);
|
||||
if (resId == 0) {
|
||||
@@ -530,8 +546,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
long avail = AppUtil.getAvailMemory(mContext);
|
||||
long total = AppUtil.getTotalMemory(mContext);
|
||||
int x = (int) (((total - avail) / (double) total) * 100);
|
||||
cpv.setProgressColor(mShaderColors);
|
||||
cpv.showAnimation(0, x, 1000);
|
||||
// cpv.setProgressColor(mShaderColors);
|
||||
// cpv.showAnimation(0, x, 1000);
|
||||
float x2 = (((total - avail) / (float) total));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user