v1.1
更换key,发布
This commit is contained in:
@@ -26,12 +26,14 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.baidu.location.BDAbstractLocationListener;
|
||||
import com.baidu.location.BDLocation;
|
||||
import com.baidu.location.LocationClient;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -111,8 +113,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
ConstraintLayout cl_ai;
|
||||
@BindView(R.id.cl_appstore)
|
||||
ConstraintLayout cl_appstore;
|
||||
@BindView(R.id.cl_exit)
|
||||
ConstraintLayout cl_exit;
|
||||
// @BindView(R.id.cl_exit)
|
||||
// ConstraintLayout cl_exit;
|
||||
|
||||
|
||||
// @BindView(R.id.cl_battery)
|
||||
@@ -152,7 +154,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
|
||||
private String TAG = CustomFragment.class.getSimpleName();
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
private int[] mShaderColors = new int[]{0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f};
|
||||
private int[] mShaderColors = new int[]{0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300};
|
||||
private int[] mShaderColorsRed = new int[]{0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000};
|
||||
private View rootView;
|
||||
private List<AlarmItem> alarmItemList;
|
||||
@@ -456,12 +458,12 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
ApkUtils.openApp(mContext, "com.uiuios.appstore");
|
||||
}
|
||||
});
|
||||
cl_exit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showPassword();
|
||||
}
|
||||
});
|
||||
// cl_exit.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// showPassword();
|
||||
// }
|
||||
// });
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
@@ -687,15 +689,25 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
}
|
||||
|
||||
private void initAmap() {
|
||||
AmapManager.getInstance().startLocation(new AMapLocationListener() {
|
||||
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
|
||||
locationClient.stop();
|
||||
locationClient.start();
|
||||
locationClient.registerLocationListener(new BDAbstractLocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(AMapLocation aMapLocation) {
|
||||
if (aMapLocation.getErrorCode() == 0) {
|
||||
String city = aMapLocation.getCity();
|
||||
tv_location.setText(city);
|
||||
getweather(aMapLocation.getLongitude(), aMapLocation.getLatitude());
|
||||
} else {
|
||||
|
||||
public void onReceiveLocation(BDLocation bdLocation) {
|
||||
Log.e(TAG, "onReceiveLocation: ");
|
||||
switch (bdLocation.getLocType()) {
|
||||
case BDLocation.TypeGpsLocation:// GPS定位结果
|
||||
case BDLocation.TypeNetWorkLocation:// 网络定位结果
|
||||
case BDLocation.TypeOffLineLocation:// 离线定位结果
|
||||
String city = bdLocation.getCity();
|
||||
tv_location.setText(city);
|
||||
getweather(bdLocation.getLongitude(), bdLocation.getLatitude());
|
||||
break;
|
||||
default:
|
||||
BDLocation location = AmapManager.getInstance().getNowMapLocation();
|
||||
getweather(location.getLongitude(), location.getLatitude());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -816,6 +828,20 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
// iv_pic.setImageDrawable(mContext.getDrawable(resId));
|
||||
tv_temp.setText(now.getTemp() + "℃");
|
||||
tv_weather.setText(now.getText());
|
||||
String iconDay = weatherBean.getNow().getIcon();
|
||||
Log.e("getweather", "onSuccess: iconDay = " + iconDay);
|
||||
switch (iconDay) {
|
||||
case "100":
|
||||
case "150":
|
||||
cl_weather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun));
|
||||
break;
|
||||
case "102":
|
||||
case "152":
|
||||
cl_weather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sunny));
|
||||
break;
|
||||
default:
|
||||
cl_weather.setBackground(ContextCompat.getDrawable(mContext, R.drawable.background_weather_rain));
|
||||
}
|
||||
} else {
|
||||
//在此查看返回数据失败的原因
|
||||
Code code = weatherBean.getCode();
|
||||
|
||||
Reference in New Issue
Block a user