error界面
This commit is contained in:
@@ -32,7 +32,7 @@ public class V2XShareEventsFragment extends MvpFragment implements AdapterCallba
|
||||
private static final String TAG = "ShareEventsFragment";
|
||||
private RecyclerView recyclerView;
|
||||
private V2XShareEventAdapter adapter;
|
||||
private ArrayList dataArrayList = new ArrayList();
|
||||
private ArrayList dataArrayList;
|
||||
private int pageNum = 1;
|
||||
private V2XShareNetworkModel v2XShareNetworkModel;
|
||||
|
||||
@@ -66,10 +66,10 @@ public class V2XShareEventsFragment extends MvpFragment implements AdapterCallba
|
||||
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
loadingView = mRootView.findViewById(R.id.network_loading_imageview);
|
||||
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
loadingView.start();
|
||||
getShareEventResponse();
|
||||
}
|
||||
|
||||
@@ -77,9 +77,20 @@ public class V2XShareEventsFragment extends MvpFragment implements AdapterCallba
|
||||
* 获取热心指数,分享列表等分享内容
|
||||
* */
|
||||
private void getShareEventResponse() {
|
||||
if (CheckUtils.isNetworkConnected(getContext()) == false) {
|
||||
Log.d(TAG, "网络异常");
|
||||
}
|
||||
animatioonAcction(View.VISIBLE);
|
||||
dataArrayList = new ArrayList();
|
||||
|
||||
// if (CheckUtils.isNetworkConnected(getContext()) == false) {
|
||||
// loadingView.networkError("获取失败");
|
||||
// loadingView.refresButton.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// getShareEventResponse();
|
||||
// }
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
v2XShareNetworkModel.getShareEventResponse(pageNum, 10, new V2XRefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
@@ -110,6 +121,7 @@ public class V2XShareEventsFragment extends MvpFragment implements AdapterCallba
|
||||
* 我的分享列表数据处理
|
||||
* */
|
||||
private void loadSuccessWithShareEventList(Object result) {
|
||||
animatioonAcction(View.GONE);
|
||||
V2XShareEventItem resultData = (V2XShareEventItem) result;
|
||||
V2XShareEventLoadMoreItem item = new V2XShareEventLoadMoreItem();
|
||||
if (resultData != null && resultData.getResult() != null) {
|
||||
@@ -146,7 +158,7 @@ public class V2XShareEventsFragment extends MvpFragment implements AdapterCallba
|
||||
dataArrayList.add(item);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
animatioonAcction(View.INVISIBLE);
|
||||
|
||||
}
|
||||
|
||||
private void animatioonAcction(int visible) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.utils.animation.AnimationResources;
|
||||
import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
|
||||
@@ -17,7 +20,7 @@ public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
private ImageView loadView;
|
||||
private TextView textView;
|
||||
private V2XAnimationManager v2XAnimationManager;
|
||||
|
||||
public Button refresButton;
|
||||
|
||||
public V2XNetworkLoadingView(Context context) {
|
||||
|
||||
@@ -39,6 +42,7 @@ public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
v2XAnimationManager = new V2XAnimationManager();
|
||||
loadView = findViewById(R.id.loading_imageview);
|
||||
textView = findViewById(R.id.loading_text);
|
||||
refresButton = findViewById(R.id.refresh_button);
|
||||
}
|
||||
|
||||
public void setLoadingText(String text) {
|
||||
@@ -56,6 +60,9 @@ public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
v2XAnimationManager.start();
|
||||
this.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (refresButton != null) {
|
||||
refresButton.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -65,5 +72,18 @@ public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void networkError(String errormsg) {
|
||||
if (v2XAnimationManager != null) {
|
||||
v2XAnimationManager.stop();
|
||||
}
|
||||
if (textView != null) {
|
||||
textView.setText(errormsg);
|
||||
}
|
||||
if (refresButton != null) {
|
||||
refresButton.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="bottom"
|
||||
android:alpha="0.7"
|
||||
android:textColor="#FFFFFF"
|
||||
android:layout_marginTop="12.6px"
|
||||
android:textSize="18px"
|
||||
android:text="你还没有分享过道路事件,快去试试吧" />
|
||||
android:text="你还没有分享过道路事件,快去试试吧"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/share_event_button"
|
||||
|
||||
@@ -13,19 +13,20 @@
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"></androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
<!-- <RelativeLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_centerInParent="true">-->
|
||||
|
||||
<!-- -->
|
||||
<!-- </RelativeLayout>-->
|
||||
<com.mogo.module.v2x.view.V2XNetworkLoadingView
|
||||
android:id="@+id/network_loading_imageview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<com.mogo.module.v2x.view.V2XNetworkLoadingView
|
||||
android:id="@+id/network_loading_imageview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
</com.mogo.module.v2x.view.V2XNetworkLoadingView>
|
||||
</RelativeLayout>
|
||||
</com.mogo.module.v2x.view.V2XNetworkLoadingView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -5,30 +5,37 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
<ImageView
|
||||
android:id="@+id/loading_imageview"
|
||||
android:layout_width="200px"
|
||||
android:layout_height="200px"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="133px"
|
||||
android:background="@drawable/v_to_x_loading_car0000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loading_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical">
|
||||
android:layout_below="@id/loading_imageview"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="top|center"
|
||||
android:alpha="0.7"
|
||||
android:text="正在获取信息…"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18px" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/loading_imageview"
|
||||
android:layout_width="200px"
|
||||
android:layout_height="200px"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/v_to_x_loading_car0000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loading_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/loading_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="top|center"
|
||||
android:alpha="0.7"
|
||||
android:text="正在获取信息…"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18px" />
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/refresh_button"
|
||||
android:layout_width="150px"
|
||||
android:layout_height="48px"
|
||||
android:layout_below="@id/loading_text"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="top|center"
|
||||
android:layout_marginTop="34px"
|
||||
android:background="@drawable/bg_v2x_event_live_show"
|
||||
android:text="刷新"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="18px" />
|
||||
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user