loading迁移common

This commit is contained in:
liujing
2020-09-23 19:28:32 +08:00
parent 044edc9e58
commit 1989ea703c
23 changed files with 54 additions and 54 deletions

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
interface Animation {

View File

@@ -1,13 +1,12 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
public class V2XAnimationManager implements Animation {
public class AnimationManager implements Animation {
private static final String TAG = "V2XAnimationManager";
private ProgressBar targetImageView;

View File

@@ -1,7 +1,7 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
import com.mogo.module.v2x.R;
import com.mogo.module.common.R;
public class AnimationResources {
public static final int loadingRes[] = {

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
import android.graphics.drawable.AnimationDrawable;

View File

@@ -1,37 +1,36 @@
package com.mogo.module.v2x.view;
package com.mogo.module.common.view;
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.ProgressBar;
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;
import com.mogo.module.common.R;
import com.mogo.module.common.animation.AnimationResources;
import com.mogo.module.common.animation.AnimationManager;
public class V2XNetworkLoadingView extends RelativeLayout {
public class NetworkLoadingView extends RelativeLayout {
private ProgressBar loadView;
private TextView textView;
private V2XAnimationManager v2XAnimationManager;
private AnimationManager mAnimationManager;
public Button refresButton;
private String loadingText = "正在获取信息…";
public V2XNetworkLoadingView(Context context) {
public NetworkLoadingView(Context context) {
super(context);
}
public V2XNetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.v2x_network_loading_item, this);
LayoutInflater.from(context).inflate(R.layout.network_loading_item, this);
initView();
/*
添加动画图片资源
@@ -39,12 +38,12 @@ public class V2XNetworkLoadingView extends RelativeLayout {
setLoadingImage(AnimationResources.loadingRes);
}
public V2XNetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void initView() {
v2XAnimationManager = new V2XAnimationManager();
mAnimationManager = new AnimationManager();
loadView = findViewById(R.id.loading_imageview);
textView = findViewById(R.id.loading_text);
refresButton = findViewById(R.id.refresh_button);
@@ -57,12 +56,12 @@ public class V2XNetworkLoadingView extends RelativeLayout {
}
public void setLoadingImage(int[] resources) {
v2XAnimationManager.animationWithTarget(loadView, resources, 100);
mAnimationManager.animationWithTarget(loadView, resources, 100);
}
public void start() {
if (v2XAnimationManager != null) {
v2XAnimationManager.start();
if (mAnimationManager != null) {
mAnimationManager.start();
this.setVisibility(View.VISIBLE);
}
if (refresButton != null) {
@@ -74,15 +73,15 @@ public class V2XNetworkLoadingView extends RelativeLayout {
}
public void stop() {
if (v2XAnimationManager != null) {
v2XAnimationManager.stop();
if (mAnimationManager != null) {
mAnimationManager.stop();
this.setVisibility(GONE);
}
}
public void stopWithError(String errormsg, int showRefreshButton) {
if (v2XAnimationManager != null) {
v2XAnimationManager.soptWithError();
if (mAnimationManager != null) {
mAnimationManager.soptWithError();
}
if (textView != null) {
textView.setText(errormsg);

View File

@@ -45,7 +45,7 @@
android:layout_centerHorizontal="true"
android:layout_gravity="top|center"
android:layout_marginTop="@dimen/dp_40"
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
android:background="@drawable/module_dw_common_corner_bkg_light"
android:gravity="center"
android:text="刷新"
android:textColor="#FFFFFF"

View File

@@ -2,4 +2,7 @@
<resources>
<dimen name="heart_ratingbar_width">17px</dimen>
<dimen name="heart_ratingbar_height">14px</dimen>
<dimen name="v2x_panel_loading_top">120px</dimen>
<dimen name="v2x_share_btn_width">150px</dimen>
<dimen name="v2x_share_btn_height">48px</dimen>
</resources>

View File

@@ -1056,5 +1056,7 @@
<dimen name="module_common_shadow_width_pos">10px</dimen>
<dimen name="heart_ratingbar_width">31.9px</dimen>
<dimen name="heart_ratingbar_height">26px</dimen>
<dimen name="v2x_panel_loading_top">300px</dimen>
<dimen name="v2x_share_btn_width">281px</dimen>
<dimen name="v2x_share_btn_height">90px</dimen>
</resources>

View File

@@ -2,4 +2,5 @@
<resources>
<color name="module_commons_dlg_bkg">#7f000000</color>
<color name="module_commons_wm_dialog_text_textColor">#FFFFFF</color>
<color name="v2x_FFF_666">#FFFFFF</color>
</resources>

View File

@@ -1047,4 +1047,8 @@
<dimen name="module_common_shadow_width_pos">8px</dimen>
<dimen name="heart_ratingbar_width">16px</dimen>
<dimen name="heart_ratingbar_height">20px</dimen>
<dimen name="v2x_panel_loading_top">120px</dimen>
<dimen name="v2x_share_btn_width">150px</dimen>
<dimen name="v2x_share_btn_height">48px</dimen>
</resources>

View File

@@ -24,7 +24,7 @@ import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.network.V2XShareNetworkModel;
import com.mogo.module.v2x.presenter.ShareEventsPresenter;
import com.mogo.module.v2x.utils.ThreadUtils;
import com.mogo.module.v2x.view.V2XNetworkLoadingView;
import com.mogo.module.common.view.NetworkLoadingView;
import java.util.ArrayList;
@@ -39,7 +39,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
private V2XShareNetworkModel v2XShareNetworkModel;
//动画
private V2XNetworkLoadingView loadingView;
private NetworkLoadingView loadingView;
@Override
protected int getLayoutId() {
@@ -182,9 +182,13 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
private void animatioonAcction(int visible) {
if (visible == View.VISIBLE) {
loadingView.start();
if (loadingView != null) {
loadingView.start();
}
} else {
loadingView.stop();
if (loadingView != null) {
loadingView.stop();
}
}
}

View File

@@ -15,7 +15,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -39,11 +38,8 @@ import com.mogo.module.v2x.adapter.V2XSurroundingAdapter;
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
import com.mogo.module.v2x.listener.SurroundingItemClickListener;
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
import com.mogo.module.v2x.utils.animation.AnimationResources;
import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
import com.mogo.module.v2x.view.SurroundingEventView;
import com.mogo.module.v2x.view.SurroundingMarginDecoration;
import com.mogo.module.v2x.view.V2XNetworkLoadingView;
import com.mogo.module.common.view.NetworkLoadingView;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.utils.WorkThreadHandler;
@@ -75,7 +71,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
private SurroundingEventPresenter surroundingEventPresenter;
private List<SurroundingConstruction> poiInfosList = new ArrayList<>();
private IMogoServiceApis mApis;
private V2XNetworkLoadingView mloadingImage;
private NetworkLoadingView mloadingImage;
@Override

View File

@@ -10,7 +10,7 @@
android:layout_width="@dimen/v2x_share_btn_width"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
android:background="@drawable/module_dw_common_corner_bkg_light"
android:gravity="center"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"

View File

@@ -137,7 +137,7 @@
</RelativeLayout>
</RelativeLayout>
<com.mogo.module.v2x.view.V2XNetworkLoadingView
<com.mogo.module.common.view.NetworkLoadingView
android:id="@+id/loading_iv"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -56,7 +56,7 @@
android:layout_width="@dimen/v2x_share_btn_width"
android:layout_height="@dimen/v2x_share_btn_height"
android:layout_toRightOf="@id/center"
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
android:background="@drawable/module_dw_common_corner_bkg_light"
android:gravity="center"
android:text="刷新"
android:textColor="#FFFFFF"

View File

@@ -13,13 +13,13 @@
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
<com.mogo.module.v2x.view.V2XNetworkLoadingView
<com.mogo.module.common.view.NetworkLoadingView
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>
</com.mogo.module.common.view.NetworkLoadingView>
</RelativeLayout>

View File

@@ -50,7 +50,7 @@
android:layout_height="@dimen/v2x_share_btn_height"
android:layout_marginStart="@dimen/dp_60"
android:layout_marginTop="@dimen/dp_60"
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
android:background="@drawable/module_dw_common_corner_bkg_light"
android:gravity="center"
android:text="刷新"
android:textColor="#FFFFFF"

View File

@@ -66,8 +66,6 @@
<dimen name="module_v2x_panel_icon_cor">16px</dimen>
<dimen name="share_empty_icon_width">117px</dimen>
<dimen name="v2x_loading_ani_width">50px</dimen>
<dimen name="v2x_share_btn_width">150px</dimen>
<dimen name="v2x_share_btn_height">48px</dimen>
<dimen name="v2x_index_rating_top">17px</dimen>
<dimen name="share_top_text_size">16px</dimen>
<dimen name="share_des_num_size">36px</dimen>
@@ -78,7 +76,7 @@
<dimen name="share_btn_middle_padding">29px</dimen>
<dimen name="v2x_panel_btn_translationY">-8px</dimen>
<dimen name="module_v2x_panel_tab_height">84px</dimen>
<dimen name="v2x_panel_loading_top">120px</dimen>
<dimen name="share_item_text_size">16px</dimen>
<dimen name="share_item_padding">20px</dimen>
</resources>

View File

@@ -64,8 +64,6 @@
<dimen name="module_v2x_panel_width">140px</dimen>
<dimen name="share_empty_icon_width">219px</dimen>
<dimen name="v2x_loading_ani_width">100px</dimen>
<dimen name="v2x_share_btn_width">281px</dimen>
<dimen name="v2x_share_btn_height">90px</dimen>
<dimen name="v2x_index_rating_top">28px</dimen>
<dimen name="share_top_text_size">28px</dimen>
<dimen name="share_des_num_size">67.5px</dimen>
@@ -77,7 +75,6 @@
<dimen name="v2x_panel_btn_translationY">-10px</dimen>
<dimen name="v2x_panel_btn_image_width">114px</dimen>
<dimen name="module_v2x_panel_tab_height">158px</dimen>
<dimen name="v2x_panel_loading_top">300px</dimen>
<dimen name="share_item_text_size">26px</dimen>
<dimen name="share_item_padding">25px</dimen>

View File

@@ -13,7 +13,6 @@
<color name="v2x_FFF_999">#FFFFFF</color>
<color name="v2x_FFF_333">#FFFFFF</color>
<color name="v2x_ff6163_333">#ff616381</color>
<color name="v2x_FFF_666">#FFFFFF</color>
<color name="v2x_555A_F5F5">#555A75</color>
<color name="v2x_000_FFF">#000000</color>
<color name="v2x_FFF_2896FF">#FFF</color>

View File

@@ -61,8 +61,6 @@
<dimen name="module_v2x_panel_icon_cor">16px</dimen>
<dimen name="share_empty_icon_width">117px</dimen>
<dimen name="v2x_loading_ani_width">200px</dimen>
<dimen name="v2x_share_btn_width">150px</dimen>
<dimen name="v2x_share_btn_height">48px</dimen>
<dimen name="v2x_index_rating_top">17px</dimen>
<dimen name="share_top_text_size">16px</dimen>
<dimen name="share_des_num_size">36px</dimen>
@@ -73,6 +71,6 @@
<dimen name="share_btn_middle_padding">29px</dimen>
<dimen name="v2x_panel_btn_translationY">-8px</dimen>
<dimen name="module_v2x_panel_tab_height">84px</dimen>
<dimen name="v2x_panel_loading_top">120px</dimen>
</resources>