|
@@ -44,6 +44,7 @@ import com.edufound.reader.cusview.CusToast;
|
|
|
import com.edufound.reader.receiver.HomeKeyEventReceiver;
|
|
|
import com.edufound.reader.receiver.NetworkChangeReceiver;
|
|
|
import com.edufound.reader.receiver.ShowFollowReceiver;
|
|
|
+import com.edufound.reader.receiver.ShowPageLoadingReceiver;
|
|
|
import com.edufound.reader.util.Consts;
|
|
|
import com.edufound.reader.util.DeviceUuidFactory;
|
|
|
import com.edufound.reader.util.EfunboxUtil;
|
|
@@ -86,6 +87,9 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
|
|
|
View mFirstIntoView;
|
|
|
|
|
|
+ ImageView pageLoading;
|
|
|
+ boolean pageLoadingShow = false;
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
@@ -126,7 +130,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
//注册小红花广播
|
|
|
ShowFollowReceiver.registerReceiver(this);
|
|
|
ShowFollowReceiver.registerObserver(showFollow);
|
|
|
-
|
|
|
+ ShowPageLoadingReceiver.registerReceiver(this);
|
|
|
+ ShowPageLoadingReceiver.registerObserver(pageLoadingReceiver);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -142,6 +147,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
NetworkChangeReceiver.unRegisterObserver(NetStateChangeObserver);
|
|
|
ShowFollowReceiver.unRegisterReceiver(this);
|
|
|
ShowFollowReceiver.unRegisterObserver(showFollow);
|
|
|
+ ShowPageLoadingReceiver.unRegisterReceiver(this);
|
|
|
+ ShowPageLoadingReceiver.unRegisterObserver(pageLoadingReceiver);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -229,6 +236,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
public void onDisconnect() {
|
|
|
//断网了
|
|
|
onGetDisconnect();
|
|
|
+// CusToast.getInstance(Consts.getmApplicAtion()).show("网络异常,请检查网络。", 2000);
|
|
|
Toast.makeText(Consts.getmApplicAtion(), "网络异常,请检查网络。", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
|
|
@@ -309,19 +317,28 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
params.topMargin = SizeUtils.dp2px(Consts.getmApplicAtion().getBaseContext(), 80);
|
|
|
if (Integer.valueOf(message.arg1) % 2 == 0) {
|
|
|
//双数
|
|
|
- params.rightMargin = SizeUtils.dp2px(Consts.getmApplicAtion().getBaseContext(), 30);
|
|
|
} else {
|
|
|
- params.rightMargin = SizeUtils.dp2px(Consts.getmApplicAtion().getBaseContext(), 70);
|
|
|
+ params.rightMargin = SizeUtils.dp2px(Consts.getmApplicAtion().getBaseContext(), 20);
|
|
|
+ params.rightMargin = SizeUtils.dp2px(Consts.getmApplicAtion().getBaseContext(), 60);
|
|
|
}
|
|
|
|
|
|
imageView.setLayoutParams(params);
|
|
|
getRootView().addView(imageView);
|
|
|
- ObjectAnimator mRotationImgAnim = ObjectAnimator.ofFloat(imageView, "translationY", 0, -200);
|
|
|
- mRotationImgAnim.setDuration(1500);
|
|
|
+ ObjectAnimator mTranslationY = ObjectAnimator.ofFloat(imageView, "translationY", 0, -200);
|
|
|
+ mTranslationY.setDuration(1500);
|
|
|
ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(imageView, "alpha", 1f, 0f);
|
|
|
alphaAnim.setDuration(1500);
|
|
|
+ ObjectAnimator mRotationImgAnim = ObjectAnimator.ofFloat(imageView, "rotation", 0.0F, 359.0F);
|
|
|
+ mRotationImgAnim.setRepeatCount(-1);
|
|
|
+ mRotationImgAnim.setDuration(1000);
|
|
|
+ ObjectAnimator scaleXAnim = ObjectAnimator.ofFloat(imageView, "scaleX", 1f, 2f);
|
|
|
+ ObjectAnimator scaleYAnim = ObjectAnimator.ofFloat(imageView, "scaleY", 1f, 2f);
|
|
|
+ scaleXAnim.setDuration(1000);
|
|
|
+ scaleYAnim.setDuration(1000);
|
|
|
+ LinearInterpolator rotation_interpolator = new LinearInterpolator();
|
|
|
+ mRotationImgAnim.setInterpolator(rotation_interpolator); //设置匀速旋转,不卡顿 icon_anim.start();
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
|
- animatorSet.play(mRotationImgAnim).with(alphaAnim);
|
|
|
+ animatorSet.play(mTranslationY).with(alphaAnim).with(mRotationImgAnim).with(scaleXAnim).with(scaleYAnim);
|
|
|
animatorSet.addListener(new AnimatorListenerAdapter() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
@@ -386,6 +403,36 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public void showPageLoading() {
|
|
|
+ if (pageLoading == null) {
|
|
|
+ pageLoading = new ImageView(this);
|
|
|
+ pageLoading.setImageResource(R.drawable.page_loading);
|
|
|
+ FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(SizeUtils.dp2px(this, 60), SizeUtils.dp2px(this, 60));
|
|
|
+ params.gravity = Gravity.CENTER;
|
|
|
+ pageLoading.setLayoutParams(params);
|
|
|
+ ObjectAnimator mRotationImgAnim = ObjectAnimator.ofFloat(pageLoading, "rotation", 0.0F, 359.0F);
|
|
|
+ mRotationImgAnim.setRepeatCount(-1);
|
|
|
+ mRotationImgAnim.setDuration(1000);
|
|
|
+ mRotationImgAnim.start();
|
|
|
+ }
|
|
|
+ if (pageLoadingShow) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getRootView().addView(pageLoading);
|
|
|
+ pageLoadingShow = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void hidePageLoading() {
|
|
|
+ if (pageLoading == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pageLoadingShow) {
|
|
|
+ getRootView().removeView(pageLoading);
|
|
|
+ pageLoadingShow = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public Gson getGson() {
|
|
|
return mGson;
|
|
|
}
|
|
@@ -479,6 +526,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
botHandleIntent(intent, customData);
|
|
|
return;
|
|
|
}
|
|
|
+ Logger.e("intent:" + intent.name);
|
|
|
if (BotRegisterListener.isNoLoginIntent(intent)) {
|
|
|
//不是获取手机号
|
|
|
Logger.e("不是获取手机号--不是获取手机号:" + intent.name + "---" + intent.slots.toString());
|
|
@@ -550,10 +598,12 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
@Override
|
|
|
public void onFailure(HttpInfo info) throws IOException {
|
|
|
Logger.e("手机号注册失败:" + info.getRetDetail());
|
|
|
+// CusToast.getInstance(topActivity).show("注册失败", 2000);
|
|
|
Toast.makeText(topActivity, "注册失败", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
+// CusToast.getInstance(topActivity).show("手机号不正确", 2000);
|
|
|
Toast.makeText(topActivity, "手机号不正确", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
}
|
|
@@ -635,4 +685,16 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|
|
showFollowCountAnim(intent.getStringExtra("follow_count"));
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ ShowPageLoadingReceiver.PageLoading pageLoadingReceiver = new ShowPageLoadingReceiver.PageLoading() {
|
|
|
+ @Override
|
|
|
+ public void show(Intent intent) {
|
|
|
+ showPageLoading();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void hide(Intent intent) {
|
|
|
+ hidePageLoading();
|
|
|
+ }
|
|
|
+ };
|
|
|
}
|