管灌系统巡查员智能手机App
zuoxiao
2024-09-20 13b3e727a6c252887cea8aa6b0856c967f036731
app/src/main/java/com/dayu/pipirrapp/fragment/OrderFragment.java
File was renamed from app/src/main/java/com/dayu/pipirrapp/fragment/MainFragment.java
@@ -1,7 +1,6 @@
package com.dayu.pipirrapp.fragment;
import android.os.Bundle;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -10,18 +9,18 @@
import androidx.annotation.Nullable;
import androidx.lifecycle.Observer;
import com.dayu.pipirrapp.bean.LatLonBean;
import com.dayu.pipirrapp.bean.WeatherResponse;
import com.dayu.pipirrapp.bean.db.LatLonBean;
import com.dayu.pipirrapp.bean.net.WeatherResponse;
import com.dayu.pipirrapp.databinding.FragmentMainBinding;
import com.dayu.pipirrapp.net.ApiManager;
import com.dayu.pipirrapp.utils.ImageUtils;
import com.dayu.pipirrapp.utils.MyJsonParser;
import com.dayu.pipirrapp.utils.SharedPreferencesHelper;
import com.dayu.pipirrapp.view.TitleBar;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.tencent.bugly.crashreport.CrashReport;
import java.util.Calendar;
import java.util.Date;
import retrofit2.Call;
import retrofit2.Callback;
@@ -33,7 +32,7 @@
 * Time: 10:12
 * 备注:首页
 */
public class MainFragment extends BaseFragment {
public class OrderFragment extends BaseFragment {
    FragmentMainBinding binding;
    WeatherResponse weatherResponse;
@@ -42,7 +41,7 @@
        @Override
        public void onChanged(LatLonBean latLonBean) {
            String jsonStr = SharedPreferencesHelper.getInstance(MainFragment.this.getActivity()).get("WeatherResponse", "");
            String jsonStr = SharedPreferencesHelper.getInstance(OrderFragment.this.getActivity()).get("WeatherResponse", "");
            weatherResponse = MyJsonParser.getBeanFromJson(jsonStr, WeatherResponse.class);
            if (weatherResponse == null) {
                weatherResponse = new WeatherResponse();
@@ -62,7 +61,7 @@
                        if (response.isSuccessful()) {
                            weatherResponse.setResults(response.body().getResults());
                            SharedPreferencesHelper.getInstance(MainFragment.this.getActivity()).put("WeatherResponse", weatherResponse);
                            SharedPreferencesHelper.getInstance(OrderFragment.this.getActivity()).put("WeatherResponse", weatherResponse);
                            setWeatherData(weatherResponse);
                        }
                    }
@@ -107,8 +106,6 @@
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = FragmentMainBinding.inflate(inflater, container, false);
        //获取到经纬度后获取天气信息
        LiveEventBus
                .get("location", LatLonBean.class)
@@ -117,5 +114,9 @@
        return binding.getRoot();
    }
    @Override
    public void onStart() {
        super.onStart();
        new TitleBar(OrderFragment.this.getActivity()).setTitleText("工单");
    }
}