删除开箱子无用代码
This commit is contained in:
@@ -839,27 +839,10 @@
|
||||
<activity
|
||||
android:name=".treasure_box.activity.TreasureBoxActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.BoxPrizeRecordActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.BoxPrizeActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.BoxHelpActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
|
||||
<activity
|
||||
android:name=".treasure_box.activity.TreasureBoxHonourActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.HonourBoxPrizeRecordActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.HonourBoxPrizeActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
<activity
|
||||
android:name=".treasure_box.activity.HonourBoxHelpActivity"
|
||||
android:theme="@style/box_activity" />
|
||||
|
||||
<activity android:name=".ui.setting.VerifyPhoneActivity" />
|
||||
<activity android:name=".ui.setting.ModifyPwdActivity" />
|
||||
|
@@ -23,4 +23,12 @@
|
||||
<item name="bubbleBackgroundPressColor">@color/bubbleView_dark_press_background</item>
|
||||
</style>
|
||||
|
||||
<style name="box_activity" parent="MyMaterialTheme">
|
||||
<item name="android:windowBackground">#80000000</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@@ -12,7 +12,8 @@
|
||||
<!--<item name="android:windowFullscreen">true</item>-->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges
|
||||
</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:statusBarColor" tools:targetApi="lollipop">@color/transparent</item>
|
||||
|
||||
@@ -135,7 +136,7 @@
|
||||
<item name="android:windowExitAnimation">@anim/anim_top_out</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="dialog_activity_close_inside" parent="dialogactivity">
|
||||
<!-- 外部区域不可关闭弹框 -->
|
||||
<item name="android:windowCloseOnTouchOutside">false</item>
|
||||
@@ -161,24 +162,11 @@
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
|
||||
<style name="box_activity" parent="Theme.AppCompat.Dialog">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<!--设置dialog的背景-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--设置Dialog的windowFrame框为无-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--设置无标题-->
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--是否半透明-->
|
||||
<style name="box_activity" parent="MyMaterialTheme">
|
||||
<item name="android:windowBackground">#80000000</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!--设置窗口内容不覆盖-->
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<!--设置动画,在这里使用让它继承系统的Animation.Dialog-->
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<!--背景是否模糊显示-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
</style>
|
||||
|
||||
<style name="dialog_web_view_activity" parent="Theme.AppCompat.Dialog">
|
||||
@@ -457,7 +445,8 @@
|
||||
</style>
|
||||
|
||||
<style name="TranslucentNoTitle" parent="android:style/Theme.Dialog">
|
||||
<item name="android:windowBackground">@android:color/transparent</item> <!-- 设置window背景透明,也就是去边框 -->
|
||||
<item name="android:windowBackground">@android:color/transparent
|
||||
</item> <!-- 设置window背景透明,也就是去边框 -->
|
||||
</style>
|
||||
|
||||
<style name="seekbarAppearance" parent="Base.Widget.AppCompat.SeekBar">
|
||||
|
@@ -1,60 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.databinding.ActivityBoxHelpBinding;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.treasure_box.model.BoxModel;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
|
||||
|
||||
@ActLayoutRes(R.layout.activity_box_help)
|
||||
public class BoxHelpActivity extends BaseBindingActivity<ActivityBoxHelpBinding> {
|
||||
|
||||
|
||||
public static void start(Context context, int height, int width) {
|
||||
Intent starter = new Intent(context, BoxHelpActivity.class);
|
||||
starter.putExtra("height", height);
|
||||
starter.putExtra("width", width);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void init() {
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.getRoot().getLayoutParams();
|
||||
layoutParams.width = getIntent().getIntExtra("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
layoutParams.height = getIntent().getIntExtra("height", ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.getRoot().setLayoutParams(layoutParams);
|
||||
mBinding.setClick(this);
|
||||
BoxModel.get()
|
||||
.getRule()
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError(throwable -> toast(throwable.getMessage()))
|
||||
.subscribe(configImgUrl -> ImageLoadUtils.loadImage(this, configImgUrl.getRuleUrl(), mBinding.ivContent));
|
||||
//被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.ib_close:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yizhuan.erban.BR;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.bindadapter.BaseAdapter;
|
||||
import com.yizhuan.erban.databinding.ActivityBoxPrizeBinding;
|
||||
import com.yizhuan.erban.treasure_box.widget.PrizeVm;
|
||||
import com.yizhuan.treasure_box.model.IBoxModel;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
|
||||
/**
|
||||
* <p> 开箱子奖池</p>
|
||||
*
|
||||
*/
|
||||
@ActLayoutRes(R.layout.activity_box_prize)
|
||||
public class BoxPrizeActivity extends BaseBindingActivity<ActivityBoxPrizeBinding> implements SwipeRefreshLayout.OnRefreshListener{
|
||||
|
||||
private BaseAdapter<PrizeInfo> adapter;
|
||||
private PrizeVm prizeVm;
|
||||
|
||||
public static void start(Context context, int height, int width) {
|
||||
Intent starter = new Intent(context, BoxPrizeActivity.class);
|
||||
starter.putExtra("height", height);
|
||||
starter.putExtra("width", width);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.getRoot().getLayoutParams();
|
||||
layoutParams.width = getIntent().getIntExtra("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
layoutParams.height = getIntent().getIntExtra("height", ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.getRoot().setLayoutParams(layoutParams);
|
||||
prizeVm = new PrizeVm(IBoxModel.BOX_TYPE_NORMAL);
|
||||
mBinding.setViewmodel(prizeVm);
|
||||
adapter = new BaseAdapter<>(R.layout.list_item_price, BR.prizeRecord);
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mBinding.recyclerView.setAdapter(adapter);
|
||||
mBinding.swipeRefresh.setOnRefreshListener(this);
|
||||
loadData(false);
|
||||
mBinding.setClick(this);
|
||||
//被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.ib_close:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void loadData(boolean isLoad) {
|
||||
prizeVm.loadData(isLoad)
|
||||
.compose(bindToLifecycle())
|
||||
.doAfterTerminate(() -> {
|
||||
if (adapter.getItemCount() == 0) showNoData();
|
||||
else hideStatus();
|
||||
}).subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
loadData(false);
|
||||
}
|
||||
|
||||
}
|
@@ -1,97 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.common.ViewPagerAdapter;
|
||||
import com.yizhuan.erban.databinding.ActivityBoxPrizeRecordBinding;
|
||||
import com.yizhuan.erban.treasure_box.fragment.PrizeRecordFragment;
|
||||
import com.yizhuan.erban.treasure_box.fragment.PrizeRecordSecondFragment;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 开箱子奖品记录</p>
|
||||
*
|
||||
*/
|
||||
@ActLayoutRes(R.layout.activity_box_prize_record)
|
||||
public class BoxPrizeRecordActivity extends BaseBindingActivity<ActivityBoxPrizeRecordBinding> {
|
||||
|
||||
public static void start(Context context, int height,int width) {
|
||||
Intent starter = new Intent(context, BoxPrizeRecordActivity.class);
|
||||
starter.putExtra("height", height);
|
||||
starter.putExtra("width", width);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
//getWindow().setLayout((int) (ScreenUtil.screenWidth * 0.98f), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(PrizeRecordFragment.newInstance(PrizeRecordFragment.TIME));
|
||||
list.add(PrizeRecordSecondFragment.newInstance(PrizeRecordSecondFragment.WORTH));
|
||||
String[] titles = {"中奖时间", "奖品价值"};
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.getRoot().getLayoutParams();
|
||||
layoutParams.height = getIntent().getIntExtra("height", ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
layoutParams.width = getIntent().getIntExtra("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
mBinding.getRoot().setLayoutParams(layoutParams);
|
||||
mBinding.setClick(this);
|
||||
mBinding.segTab.setTabData(titles);
|
||||
mBinding.viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), list, titles));
|
||||
mBinding.segTab.setOnTabSelectListener(new OnTabSelectListener() {
|
||||
@Override
|
||||
public void onTabSelect(int position) {
|
||||
mBinding.viewpager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselect(int position) {
|
||||
}
|
||||
});
|
||||
mBinding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
mBinding.segTab.setCurrentTab(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.ib_close:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.databinding.ActivityBoxHelpBinding;
|
||||
import com.yizhuan.erban.databinding.ActivityHonourBoxHelpBinding;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.treasure_box.model.BoxModel;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
|
||||
|
||||
@ActLayoutRes(R.layout.activity_honour_box_help)
|
||||
public class HonourBoxHelpActivity extends BaseBindingActivity<ActivityHonourBoxHelpBinding> {
|
||||
|
||||
|
||||
public static void start(Context context, int height, int width) {
|
||||
Intent starter = new Intent(context, HonourBoxHelpActivity.class);
|
||||
starter.putExtra("height", height);
|
||||
starter.putExtra("width", width);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void init() {
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.getRoot().getLayoutParams();
|
||||
layoutParams.width = getIntent().getIntExtra("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
layoutParams.height = getIntent().getIntExtra("height", ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.getRoot().setLayoutParams(layoutParams);
|
||||
mBinding.setClick(this);
|
||||
BoxModel.get()
|
||||
.getRule()
|
||||
.compose(bindToLifecycle())
|
||||
.doOnError(throwable -> toast(throwable.getMessage()))
|
||||
.subscribe(configImgUrl -> ImageLoadUtils.loadImage(this, configImgUrl.getRuleUrl(), mBinding.ivContent));
|
||||
//被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.ib_close:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yizhuan.erban.BR;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.bindadapter.BaseAdapter;
|
||||
import com.yizhuan.erban.databinding.ActivityHonourBoxPrizeBinding;
|
||||
import com.yizhuan.erban.treasure_box.widget.PrizeVm;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
import com.yizhuan.treasure_box.model.IBoxModel;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
|
||||
/**
|
||||
* <p> 开箱子奖池</p>
|
||||
*
|
||||
*/
|
||||
@ActLayoutRes(R.layout.activity_honour_box_prize)
|
||||
public class HonourBoxPrizeActivity extends BaseBindingActivity<ActivityHonourBoxPrizeBinding> implements SwipeRefreshLayout.OnRefreshListener{
|
||||
|
||||
private BaseAdapter<PrizeInfo> adapter;
|
||||
private PrizeVm prizeVm;
|
||||
|
||||
public static void start(Context context, int height, int width) {
|
||||
Intent starter = new Intent(context, HonourBoxPrizeActivity.class);
|
||||
starter.putExtra("height", height);
|
||||
starter.putExtra("width", width);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.getRoot().getLayoutParams();
|
||||
layoutParams.width = getIntent().getIntExtra("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
layoutParams.height = getIntent().getIntExtra("height", ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.getRoot().setLayoutParams(layoutParams);
|
||||
prizeVm = new PrizeVm(IBoxModel.BOX_TYPE_HONOUR);
|
||||
mBinding.setViewmodel(prizeVm);
|
||||
adapter = new BaseAdapter<>(R.layout.list_item_honour_price, BR.prizeRecord);
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mBinding.recyclerView.setAdapter(adapter);
|
||||
mBinding.swipeRefresh.setOnRefreshListener(this);
|
||||
loadData(false);
|
||||
mBinding.setClick(this);
|
||||
//被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.ib_close:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void loadData(boolean isLoad) {
|
||||
prizeVm.loadData(isLoad)
|
||||
.compose(bindToLifecycle())
|
||||
.doAfterTerminate(() -> {
|
||||
if (adapter.getItemCount() == 0) showNoData();
|
||||
else hideStatus();
|
||||
}).subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
loadData(false);
|
||||
}
|
||||
|
||||
}
|
@@ -1,97 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.common.ViewPagerAdapter;
|
||||
import com.yizhuan.erban.databinding.ActivityHonourBoxPrizeRecordBinding;
|
||||
import com.yizhuan.erban.treasure_box.fragment.PrizeRecordFragment;
|
||||
import com.yizhuan.erban.treasure_box.fragment.PrizeRecordSecondFragment;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 开箱子奖品记录</p>
|
||||
*
|
||||
*/
|
||||
@ActLayoutRes(R.layout.activity_honour_box_prize_record)
|
||||
public class HonourBoxPrizeRecordActivity extends BaseBindingActivity<ActivityHonourBoxPrizeRecordBinding> {
|
||||
|
||||
public static void start(Context context, int height,int width) {
|
||||
Intent starter = new Intent(context, HonourBoxPrizeRecordActivity.class);
|
||||
starter.putExtra("height", height);
|
||||
starter.putExtra("width", width);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
//getWindow().setLayout((int) (ScreenUtil.screenWidth * 0.98f), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(PrizeRecordFragment.newInstance(PrizeRecordFragment.TIME));
|
||||
list.add(PrizeRecordSecondFragment.newInstance(PrizeRecordSecondFragment.WORTH));
|
||||
String[] titles = {"中奖时间", "奖品价值"};
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.getRoot().getLayoutParams();
|
||||
layoutParams.height = getIntent().getIntExtra("height", ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
layoutParams.width = getIntent().getIntExtra("width", ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
mBinding.getRoot().setLayoutParams(layoutParams);
|
||||
mBinding.setClick(this);
|
||||
mBinding.segTab.setTabData(titles);
|
||||
mBinding.viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), list, titles));
|
||||
mBinding.segTab.setOnTabSelectListener(new OnTabSelectListener() {
|
||||
@Override
|
||||
public void onTabSelect(int position) {
|
||||
mBinding.viewpager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselect(int position) {
|
||||
}
|
||||
});
|
||||
mBinding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
mBinding.segTab.setCurrentTab(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//被踢出房间退出
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.filter(roomEvent -> roomEvent.getEvent() == RoomEvent.KICK_OUT_ROOM)
|
||||
.subscribe(roomEvent -> finish());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.ib_close:
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -60,7 +60,7 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
getWindow().setGravity(Gravity.CENTER);
|
||||
subscribeEvent();
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -10,7 +10,6 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
|
||||
@@ -60,7 +59,7 @@ public class TreasureBoxHonourActivity extends BaseBindingActivity<ActivityTreas
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.screenHeight);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
getWindow().setGravity(Gravity.CENTER);
|
||||
subscribeEvent();
|
||||
}
|
||||
|
@@ -1,14 +1,7 @@
|
||||
package com.yizhuan.erban.treasure_box.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.DownloadManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
@@ -16,9 +9,13 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
|
@@ -1,94 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.yizhuan.erban.BR;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingFragment;
|
||||
import com.yizhuan.erban.bindadapter.BaseAdapter;
|
||||
import com.yizhuan.erban.databinding.FragmentRecyclerViewBindNoBgBinding;
|
||||
import com.yizhuan.erban.treasure_box.widget.PrizeRecordVm;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
|
||||
@ActLayoutRes(R.layout.fragment_recycler_view_bind_no_bg)
|
||||
public class PrizeRecordFragment extends BaseBindingFragment<FragmentRecyclerViewBindNoBgBinding> implements SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener {
|
||||
private BaseAdapter<PrizeInfo> adapter;
|
||||
private PrizeRecordVm prizeRecordVm;
|
||||
public static final String TIME = "time";
|
||||
public static final String WORTH = "worth";
|
||||
private View mBottomView;
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
String type = getArguments().getString("type", TIME);
|
||||
prizeRecordVm = new PrizeRecordVm(mBinding, type);
|
||||
adapter = new BaseAdapter<>(R.layout.list_item_price_record, BR.prizeRecord);
|
||||
mBinding.setViewmodel(prizeRecordVm);
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
if (getActivity() != null) {
|
||||
mBottomView = View.inflate(getActivity(), R.layout.layout_bills_bottom, null);
|
||||
TextView tv_bills_bottom_tips = mBottomView.findViewById(R.id.tv_bills_bottom_tips);
|
||||
tv_bills_bottom_tips.getLayoutParams().height = UIUtil.dip2px(getActivity(), 43);
|
||||
tv_bills_bottom_tips.setTextColor(getResources().getColor(R.color.white_transparent_30));
|
||||
adapter.addFooterView(mBottomView);
|
||||
}
|
||||
|
||||
mBinding.recyclerView.setAdapter(adapter);
|
||||
mBinding.swipeRefresh.setOnRefreshListener(this);
|
||||
loadData(false);
|
||||
adapter.setOnLoadMoreListener(this, mBinding.recyclerView);
|
||||
|
||||
}
|
||||
|
||||
private void loadData(boolean isLoad) {
|
||||
prizeRecordVm.loadData(isLoad)
|
||||
.compose(bindToLifecycle())
|
||||
.doAfterTerminate(() -> {
|
||||
if (adapter.getItemCount() == adapter.getFooterLayoutCount()){
|
||||
// showNoData(XChatConstants.EMPTY_RECORD_AND_THREE_MONTHS_TIPSS);
|
||||
mBinding.llEmptyContent.setVisibility(View.VISIBLE);
|
||||
if (mBottomView != null) {
|
||||
adapter.removeFooterView(mBottomView);
|
||||
}
|
||||
} else {
|
||||
if (mBottomView != null) {
|
||||
adapter.setFooterView(mBottomView);
|
||||
}
|
||||
mBinding.llEmptyContent.setVisibility(View.GONE);
|
||||
hideStatus();
|
||||
}
|
||||
}).subscribe();
|
||||
}
|
||||
|
||||
public static PrizeRecordFragment newInstance(String type) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("type", type);
|
||||
PrizeRecordFragment fragment = new PrizeRecordFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadData() {
|
||||
loadData(false);
|
||||
showLoading();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
loadData(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
loadData(true);
|
||||
}
|
||||
}
|
@@ -1,94 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.yizhuan.erban.BR;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseBindingFragment;
|
||||
import com.yizhuan.erban.bindadapter.BaseAdapter;
|
||||
import com.yizhuan.erban.databinding.FragmentRecyclerViewBindNoBgBinding;
|
||||
import com.yizhuan.erban.treasure_box.widget.PrizeRecordVm;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
|
||||
@ActLayoutRes(R.layout.fragment_recycler_view_bind_no_bg)
|
||||
public class PrizeRecordSecondFragment extends BaseBindingFragment<FragmentRecyclerViewBindNoBgBinding> implements SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener {
|
||||
private BaseAdapter<PrizeInfo> adapter;
|
||||
private PrizeRecordVm prizeRecordVm;
|
||||
public static final String TIME = "time";
|
||||
public static final String WORTH = "worth";
|
||||
private View mBottomView;
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
String type = getArguments().getString("type", TIME);
|
||||
prizeRecordVm = new PrizeRecordVm(mBinding, type);
|
||||
adapter = new BaseAdapter<>(R.layout.list_item_price_record_second, BR.prizeRecord);
|
||||
mBinding.setViewmodel(prizeRecordVm);
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
if (getActivity() != null) {
|
||||
mBottomView = View.inflate(getActivity(), R.layout.layout_bills_bottom, null);
|
||||
TextView tv_bills_bottom_tips = mBottomView.findViewById(R.id.tv_bills_bottom_tips);
|
||||
tv_bills_bottom_tips.getLayoutParams().height = UIUtil.dip2px(getActivity(), 43);
|
||||
tv_bills_bottom_tips.setTextColor(getResources().getColor(R.color.white_transparent_30));
|
||||
adapter.addFooterView(mBottomView);
|
||||
}
|
||||
|
||||
mBinding.recyclerView.setAdapter(adapter);
|
||||
mBinding.swipeRefresh.setOnRefreshListener(this);
|
||||
loadData(false);
|
||||
adapter.setOnLoadMoreListener(this, mBinding.recyclerView);
|
||||
|
||||
}
|
||||
|
||||
private void loadData(boolean isLoad) {
|
||||
prizeRecordVm.loadData(isLoad)
|
||||
.compose(bindToLifecycle())
|
||||
.doAfterTerminate(() -> {
|
||||
if (adapter.getItemCount() == adapter.getFooterLayoutCount()){
|
||||
// showNoData(XChatConstants.EMPTY_RECORD_AND_THREE_MONTHS_TIPSS);
|
||||
mBinding.llEmptyContent.setVisibility(View.VISIBLE);
|
||||
if (mBottomView != null) {
|
||||
adapter.removeFooterView(mBottomView);
|
||||
}
|
||||
} else {
|
||||
if (mBottomView != null) {
|
||||
adapter.setFooterView(mBottomView);
|
||||
}
|
||||
mBinding.llEmptyContent.setVisibility(View.GONE);
|
||||
hideStatus();
|
||||
}
|
||||
}).subscribe();
|
||||
}
|
||||
|
||||
public static PrizeRecordSecondFragment newInstance(String type) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("type", type);
|
||||
PrizeRecordSecondFragment fragment = new PrizeRecordSecondFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadData() {
|
||||
loadData(false);
|
||||
showLoading();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
loadData(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
loadData(true);
|
||||
}
|
||||
}
|
@@ -1,90 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.widget;
|
||||
|
||||
import android.animation.Keyframe;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.view.View;
|
||||
|
||||
public class AnimHelper {
|
||||
|
||||
public static ObjectAnimator shake(View view) {
|
||||
|
||||
PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
|
||||
Keyframe.ofFloat(0f, 1f),
|
||||
Keyframe.ofFloat(.1f, .9f),
|
||||
Keyframe.ofFloat(.2f, .9f),
|
||||
Keyframe.ofFloat(.3f, 1.1f),
|
||||
Keyframe.ofFloat(.4f, 1.1f),
|
||||
Keyframe.ofFloat(.5f, 1.1f),
|
||||
Keyframe.ofFloat(.6f, 1.1f),
|
||||
Keyframe.ofFloat(.7f, 1.1f),
|
||||
Keyframe.ofFloat(.8f, 1.1f),
|
||||
Keyframe.ofFloat(.9f, 1.1f),
|
||||
Keyframe.ofFloat(1f, 1f)
|
||||
);
|
||||
|
||||
PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y,
|
||||
Keyframe.ofFloat(0f, 1f),
|
||||
Keyframe.ofFloat(.1f, .9f),
|
||||
Keyframe.ofFloat(.2f, .9f),
|
||||
Keyframe.ofFloat(.3f, 1.1f),
|
||||
Keyframe.ofFloat(.4f, 1.1f),
|
||||
Keyframe.ofFloat(.5f, 1.1f),
|
||||
Keyframe.ofFloat(.6f, 1.1f),
|
||||
Keyframe.ofFloat(.7f, 1.1f),
|
||||
Keyframe.ofFloat(.8f, 1.1f),
|
||||
Keyframe.ofFloat(.9f, 1.1f),
|
||||
Keyframe.ofFloat(1f, 1f)
|
||||
);
|
||||
|
||||
PropertyValuesHolder pvhRotate = PropertyValuesHolder.ofKeyframe(View.ROTATION,
|
||||
Keyframe.ofFloat(0f, 0f),
|
||||
Keyframe.ofFloat(.1f, -3f),
|
||||
Keyframe.ofFloat(.2f, -3f),
|
||||
Keyframe.ofFloat(.3f, 3f),
|
||||
Keyframe.ofFloat(.4f, -3f),
|
||||
Keyframe.ofFloat(.5f, 3f),
|
||||
Keyframe.ofFloat(.6f, -3f),
|
||||
Keyframe.ofFloat(.7f, 3f),
|
||||
Keyframe.ofFloat(.8f, -3f),
|
||||
Keyframe.ofFloat(.9f, 3f),
|
||||
Keyframe.ofFloat(1f, 0)
|
||||
);
|
||||
|
||||
return ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhRotate).
|
||||
setDuration(1000);
|
||||
}
|
||||
|
||||
public static ObjectAnimator createMicro8Anim(View view) {
|
||||
|
||||
PropertyValuesHolder pvhScaleX = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
|
||||
Keyframe.ofFloat(0f, 0f),
|
||||
Keyframe.ofFloat(1f, 1f)
|
||||
);
|
||||
|
||||
PropertyValuesHolder pvhScaleY = PropertyValuesHolder.ofKeyframe(View.SCALE_Y,
|
||||
Keyframe.ofFloat(0f, 0f),
|
||||
Keyframe.ofFloat(1f, 1f)
|
||||
);
|
||||
PropertyValuesHolder pvhAlpha = PropertyValuesHolder.ofKeyframe(View.ALPHA,
|
||||
Keyframe.ofFloat(0f, 0f),
|
||||
Keyframe.ofFloat(0.6f, 0.3f),
|
||||
Keyframe.ofFloat(0.99f, 0.6f),
|
||||
Keyframe.ofFloat(1f, 0f)
|
||||
);
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, pvhScaleX, pvhScaleY, pvhAlpha);
|
||||
animator.setDuration(340);
|
||||
/* animator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
ViewGroup viewGroup = (ViewGroup) view1.getParent();
|
||||
if (viewGroup != null) viewGroup.removeView(view1);
|
||||
}
|
||||
});*/
|
||||
return animator;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,131 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
|
||||
public class PrizeCover extends View {
|
||||
|
||||
|
||||
private Context context;
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
private ArrayList<PrizeFactor> arrayList;
|
||||
private boolean isStart = true;
|
||||
private ArrayList<PrizeInfo> cacheList;
|
||||
private Disposable disposable;
|
||||
private int prizeSize = ScreenUtil.dip2px(50);
|
||||
|
||||
public PrizeCover(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public PrizeCover(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
this.context = context;
|
||||
arrayList = new ArrayList<>();
|
||||
cacheList = new ArrayList<>();
|
||||
looperPrize();
|
||||
}
|
||||
|
||||
|
||||
private void looperPrize() {
|
||||
disposable = Observable.interval(0, 200, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.filter(aLong -> cacheList.size() > 0)
|
||||
.subscribe(aLong -> {
|
||||
String url = cacheList.get(0).getPrizeImgUrl();
|
||||
if (cacheList.size() > 0) cacheList.remove(0);
|
||||
if (!TextUtils.isEmpty(url))
|
||||
GlideApp.with(context)
|
||||
.asBitmap()
|
||||
.override(prizeSize)
|
||||
.load(url)
|
||||
.error(R.drawable.icon_gold)
|
||||
.placeholder(R.drawable.icon_gold)
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
arrayList.add(new PrizeFactor(resource, mWidth, mHeight));
|
||||
start();
|
||||
}
|
||||
});
|
||||
}
|
||||
, e -> looperPrize());//出错了继续looper......
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
}
|
||||
|
||||
public void addPrize(List<PrizeInfo> prizeInfos) {
|
||||
if (ListUtils.isListEmpty(prizeInfos)) return;
|
||||
cacheList.addAll(prizeInfos);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
isStart = true;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
isStart = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
super.draw(canvas);
|
||||
if (!isStart) return;
|
||||
Iterator<PrizeFactor> iterator = arrayList.iterator();
|
||||
isStart = false;
|
||||
while (iterator.hasNext()) {
|
||||
isStart = true;
|
||||
PrizeFactor prizeFactor = iterator.next();
|
||||
if (System.currentTimeMillis() - prizeFactor.getCreateTime() > 2000) {
|
||||
iterator.remove();
|
||||
} else {
|
||||
prizeFactor.move(canvas);
|
||||
}
|
||||
}
|
||||
if (isStart){
|
||||
invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (disposable != null) disposable.dispose();
|
||||
}
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.widget;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
|
||||
public class PrizeFactor {
|
||||
private float scale = 0f;
|
||||
private float px, py;//起点坐标
|
||||
private Matrix matrix;
|
||||
private Bitmap bitmap;
|
||||
private double dx, dy;//终点坐标
|
||||
private double lx, ly;//每帧移动的距离
|
||||
private double ss;//每帧增加的scale
|
||||
private long createTime;
|
||||
private double count = 45;//动画开始到结束所需要的帧数
|
||||
private Paint paint;
|
||||
private int alpha = 6;
|
||||
|
||||
public PrizeFactor(Bitmap fgBitmap, int width, int height) {
|
||||
matrix = new Matrix();
|
||||
paint = new Paint();
|
||||
bitmap = fgBitmap;
|
||||
px = width / 2;
|
||||
py = height - 150;
|
||||
dx = Math.random() * (width - bitmap.getWidth());
|
||||
dy = Math.random() * (height / 2 - bitmap.getHeight() / 2);
|
||||
lx = (dx - px) / count;
|
||||
ly = (dy - py) / count;
|
||||
ss = 1 / count;
|
||||
createTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void move(Canvas canvas) {
|
||||
matrix.reset();
|
||||
matrix.preTranslate(px, py);
|
||||
if ((lx > 0 && dx > px) || (lx < 0 && dx < px)) px += lx;
|
||||
if (dy < py) py += ly;//由于只会向上移动,所以ly只有小于0的情况
|
||||
if (scale < 1) {
|
||||
matrix.preScale(scale, scale);
|
||||
scale += ss;
|
||||
}
|
||||
if (alpha < 256) {
|
||||
paint.setAlpha(alpha);
|
||||
alpha += 10;
|
||||
}
|
||||
canvas.drawBitmap(bitmap, matrix, paint);
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.widget;
|
||||
|
||||
import com.yizhuan.erban.base.BaseMsListViewModel;
|
||||
import com.yizhuan.erban.databinding.FragmentRecyclerViewBindNoBgBinding;
|
||||
import com.yizhuan.erban.utils.UserUtils;
|
||||
import com.yizhuan.treasure_box.model.BoxModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
|
||||
/**
|
||||
* Created by huangmeng1 on 2018/5/9.
|
||||
*/
|
||||
|
||||
public class PrizeRecordVm extends BaseMsListViewModel<FragmentRecyclerViewBindNoBgBinding, PrizeInfo> {
|
||||
|
||||
private String sortType;
|
||||
|
||||
public PrizeRecordVm(FragmentRecyclerViewBindNoBgBinding mBinding, String sortType) {
|
||||
super(mBinding);
|
||||
this.sortType = sortType;
|
||||
pageSize = 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ServiceResult<List<PrizeInfo>>> getSingle() {
|
||||
return BoxModel.get().getPrizeRecord(page, pageSize, sortType, UserUtils.getUserUid());
|
||||
}
|
||||
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
package com.yizhuan.erban.treasure_box.widget;
|
||||
|
||||
import com.yizhuan.erban.base.BaseListViewModel;
|
||||
import com.yizhuan.treasure_box.model.BoxModel;
|
||||
import com.yizhuan.treasure_box.model.IBoxModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.treasure_box.bean.PrizeInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* Created by huangmeng1 on 2018/5/9.
|
||||
*/
|
||||
|
||||
public class PrizeVm extends BaseListViewModel<PrizeInfo> {
|
||||
|
||||
private int boxType;
|
||||
|
||||
public PrizeVm(int boxType) {
|
||||
this.boxType = boxType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ServiceResult<List<PrizeInfo>>> getSingle() {
|
||||
if (boxType == IBoxModel.BOX_TYPE_NORMAL) {
|
||||
return BoxModel.get().getPrizes()
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
} else if (boxType == IBoxModel.BOX_TYPE_HONOUR) {
|
||||
return BoxModel.get().getHonourBoxJackpotInfo()
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
} else {
|
||||
return Single.never();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user