添加部分动画
This commit is contained in:
@@ -4,12 +4,13 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -50,6 +51,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
|
||||
// private ConstraintLayout mArrivedEndCL;
|
||||
private View mArrivedEndView;
|
||||
private View ochShadowLayout;
|
||||
private TaxiPassengerCheckView mArrivedCheckView;
|
||||
private TextView mArrivedEndStation;
|
||||
private TextView tvPleaseScore;
|
||||
@@ -85,6 +87,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
// mArrivedEndCL = findViewById(R.id.taxi_p_arrive_end_bg);
|
||||
mArrivedEndView = LayoutInflater.from(getContext()).inflate(R.layout.taxi_p_arrived_end_panel,null);
|
||||
mArrivedEndStation = mArrivedEndView.findViewById(R.id.arrived_end_station);
|
||||
ochShadowLayout = mArrivedEndView.findViewById(R.id.och_shadow_layout);
|
||||
tvPleaseScore = mArrivedEndView.findViewById(R.id.tv_please_score);
|
||||
|
||||
mArrivedCheckView = new TaxiPassengerCheckView(getContext());
|
||||
@@ -120,9 +123,17 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
tvPleaseScore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getPresenter().arrivedAndScore(2);
|
||||
//getPresenter().arrivedAndScore(2);
|
||||
showOrHideArrivedEndLayout(false,"北京");
|
||||
}
|
||||
});
|
||||
findViewById(R.id.iv_temp).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOrHideArrivedEndLayout(true,"北京");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,8 +273,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
*/
|
||||
public void showOrHideArrivedEndLayout(boolean isShow, String arrivedEndStation){
|
||||
if (isShow){
|
||||
// mArrivedEndCL.setVisibility(View.VISIBLE);
|
||||
OverlayViewUtils.showOverlayView(getActivity(),mArrivedEndView);
|
||||
OverlayViewUtils.showOverlayView(getActivity(),mArrivedEndView, R.style.och_window_anim_alpha);
|
||||
Animation trAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.left_to_right);
|
||||
ochShadowLayout.startAnimation(trAnimation);
|
||||
mArrivedEndStation.setText(arrivedEndStation);
|
||||
}else {
|
||||
// mArrivedEndCL.setVisibility(View.GONE);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="500" android:fromAlpha="0" android:toAlpha="1" />
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" android:startOffset="500" >
|
||||
<translate
|
||||
android:duration="1000"
|
||||
android:fromXDelta="-110%"
|
||||
android:toXDelta="0"/>
|
||||
</set>
|
||||
@@ -5,9 +5,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/taxi_p_arrive_end_panel_bg"
|
||||
android:id="@+id/cl_content"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
android:id="@+id/och_shadow_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_109"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
android:background="@drawable/taxi_p_switch_map_bg" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_temp"
|
||||
android:layout_width="300px"
|
||||
android:layout_height="76px"
|
||||
android:layout_gravity="center"
|
||||
|
||||
@@ -36,4 +36,8 @@
|
||||
<item name="android:textSize">@dimen/dp_56</item>
|
||||
</style>
|
||||
|
||||
<style name="och_window_anim_alpha">
|
||||
<item name="android:windowEnterAnimation">@anim/alpha_hide_show</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -23,10 +23,14 @@ public class OverlayViewUtils {
|
||||
*/
|
||||
private static View lastOverlayView;
|
||||
|
||||
public static void showOverlayView(Activity context, View overlayView){
|
||||
showOverlayView(context,overlayView,-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加覆盖View在Activity上面
|
||||
*/
|
||||
public static void showOverlayView(Activity context, View overlayView) {
|
||||
public static void showOverlayView(Activity context, View overlayView,int ani) {
|
||||
if (applicationContext == null) {
|
||||
applicationContext = context.getApplicationContext();
|
||||
}
|
||||
@@ -50,7 +54,9 @@ public class OverlayViewUtils {
|
||||
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
|
||||
// 没有边界限制,允许窗口扩展到屏幕外
|
||||
params.flags = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
|
||||
|
||||
if(ani!=-1){
|
||||
params.windowAnimations = ani;
|
||||
}
|
||||
|
||||
// 如果正在展示中,并且lastOverlayView不为null,先做移除操作,保证覆盖在最上面的View只有一个,防止叠加导致无法移除
|
||||
if (lastOverlayView != null) {
|
||||
|
||||
Reference in New Issue
Block a user