opt ui
This commit is contained in:
@@ -12,6 +12,7 @@ import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.view.FrameAnimImageView;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -27,6 +28,8 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
private CheckedTextView ctvAutopilotStatus;
|
||||
private FrameLayout flStationPanelContainer;
|
||||
|
||||
private FrameAnimImageView fivNoticeHead;
|
||||
|
||||
private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
|
||||
// 此处做一个代理,处理一下共有情况
|
||||
hideSlidePanel();
|
||||
@@ -47,9 +50,11 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
tvNotice = findViewById(R.id.module_mogo_och_notice);
|
||||
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
|
||||
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
|
||||
fivNoticeHead = findViewById(R.id.module_mogo_och_notice_head);
|
||||
|
||||
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
|
||||
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
|
||||
fivNoticeHead.setAnimRes(sHappy1);
|
||||
|
||||
checkCallView(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isCallViewShow());
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("Och", StatusDescriptor.CALL_VIEW, callViewListener);
|
||||
@@ -78,10 +83,14 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
public void showNotice(String notice) {
|
||||
tvNotice.setText(notice);
|
||||
tvNotice.setVisibility(View.VISIBLE);
|
||||
fivNoticeHead.setVisibility(View.VISIBLE);
|
||||
fivNoticeHead.startAnim();
|
||||
}
|
||||
|
||||
public void hideNotice(){
|
||||
tvNotice.setVisibility(View.GONE);
|
||||
fivNoticeHead.setVisibility(View.GONE);
|
||||
fivNoticeHead.stopAnim();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,4 +122,36 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
* @return 站点面板view
|
||||
*/
|
||||
public abstract int getStationPanelViewId();
|
||||
|
||||
private final int[] sHappy1 = {
|
||||
R.drawable.ic_happy1_00000,
|
||||
R.drawable.ic_happy1_00001,
|
||||
R.drawable.ic_happy1_00002,
|
||||
R.drawable.ic_happy1_00003,
|
||||
R.drawable.ic_happy1_00004,
|
||||
R.drawable.ic_happy1_00005,
|
||||
R.drawable.ic_happy1_00006,
|
||||
R.drawable.ic_happy1_00007,
|
||||
R.drawable.ic_happy1_00008,
|
||||
R.drawable.ic_happy1_00009,
|
||||
R.drawable.ic_happy1_00010,
|
||||
R.drawable.ic_happy1_00011,
|
||||
R.drawable.ic_happy1_00012,
|
||||
R.drawable.ic_happy1_00013,
|
||||
R.drawable.ic_happy1_00014,
|
||||
R.drawable.ic_happy1_00015,
|
||||
R.drawable.ic_happy1_00016,
|
||||
R.drawable.ic_happy1_00017,
|
||||
R.drawable.ic_happy1_00018,
|
||||
R.drawable.ic_happy1_00019,
|
||||
R.drawable.ic_happy1_00020,
|
||||
R.drawable.ic_happy1_00021,
|
||||
R.drawable.ic_happy1_00022,
|
||||
R.drawable.ic_happy1_00023,
|
||||
R.drawable.ic_happy1_00024,
|
||||
R.drawable.ic_happy1_00025,
|
||||
R.drawable.ic_happy1_00026,
|
||||
R.drawable.ic_happy1_00027,
|
||||
R.drawable.ic_happy1_00028
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.och.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* 帧动画ImageView封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class FrameAnimImageView extends androidx.appcompat.widget.AppCompatImageView implements Handler.Callback {
|
||||
public static final long FRAME_INTERVAL = 50L;
|
||||
private final static int MSG_LOOP = 3003;
|
||||
|
||||
public FrameAnimImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FrameAnimImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FrameAnimImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private int[] animRes;
|
||||
private int animPos;
|
||||
private boolean isInAnim = false;
|
||||
|
||||
private final Handler animHandler = new Handler(this);
|
||||
|
||||
public void setAnimRes(int[] animRes) {
|
||||
this.animRes = animRes;
|
||||
}
|
||||
|
||||
public void startAnim() {
|
||||
isInAnim = true;
|
||||
animHandler.sendEmptyMessage(MSG_LOOP);
|
||||
}
|
||||
|
||||
public void stopAnim() {
|
||||
isInAnim = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
stopAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (isInAnim && animRes != null) {
|
||||
if (animPos >= animRes.length) {
|
||||
animPos = 0;
|
||||
}
|
||||
setImageResource(animRes[animPos++]);
|
||||
animHandler.sendEmptyMessageDelayed(MSG_LOOP, FRAME_INTERVAL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class SlidePanelView extends View {
|
||||
textPaint.setShader(textGradient);
|
||||
textPaint.getFontMetrics(blockTextMetrics);
|
||||
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.ic_block);
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.module_och_base_slide_block);
|
||||
blockWidth = bmBlock.getWidth();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user