Commit 5feeebb8 by sikang

添加审核假界面

parent 2df5abe6
......@@ -121,6 +121,9 @@
<!--活动中心-->
<activity android:name="com.common.activity.MessageListActivity" />
<!--Hook Activity-->
<activity android:name="com.common.activity.ReviewHookActivity" />
<!--<receiver-->
<!--tools:node="remove"-->
<!--android:name="com.kochava.base.ReferralReceiver">-->
......
......@@ -41,7 +41,8 @@ import java.io.Serializable;
public class AgreementPolicyActivity extends BaseActivity {
public enum Type implements Serializable {
AGREEMENT_POLICY,
AGREEMENT_KSP
AGREEMENT_KSP,
AGREEMENT_HOOK
}
......@@ -113,6 +114,11 @@ public class AgreementPolicyActivity extends BaseActivity {
setResult(RESULT_OK);
finish();
break;
case AGREEMENT_HOOK:
PreferencesManager.get().setPolicyStatus(true);
setResult(RESULT_OK);
finish();
break;
}
} else {
DialogFactory.showMessageDialog(AgreementPolicyActivity.this, getString(R.string.check_the_checkbox));
......@@ -129,6 +135,12 @@ public class AgreementPolicyActivity extends BaseActivity {
policyUrl = Gateway.getKSPUrl();
}
//假协议
if (agreementType == Type.AGREEMENT_HOOK) {
webView.loadUrl("file:///android_asset/web/privacy.html");
return;
}
if (!TextUtils.isEmpty(policyUrl)) {
webView.loadUrl(policyUrl);
}
......@@ -145,10 +157,10 @@ public class AgreementPolicyActivity extends BaseActivity {
}
public void loadUrlWithParams(WebView webView,String url){
public void loadUrlWithParams(WebView webView, String url) {
String[] urls = url.split("\\?");
if(urls.length>1){
String [] params = urls[1].split("&");
if (urls.length > 1) {
String[] params = urls[1].split("&");
}
}
......
package com.common.activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.common.base.BaseActivity;
import com.common.bean.ProductBean;
import com.common.widget.PenetrateFrameLayout;
import com.common.widget.TopBar;
import com.facebook.accountkit.AccountKitError;
import com.facebook.accountkit.AccountKitLoginResult;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import tech.starwin.LibConfig;
import tech.starwin.R;
import tech.starwin.impl.OnEventClickListener;
import tech.starwin.mvp.ui.adapter.ReviewProductAdapter;
import tech.starwin.utils.LoginManager;
import tech.starwin.utils.context_utils.ActivityJumper;
import tech.starwin.utils.ui_utils.UIHelper;
/**
* Created by SiKang on 2019-07-26.
*/
public class ReviewHookActivity extends BaseActivity {
RecyclerView mProcuctRv;
List<ProductBean> productList;
ReviewProductAdapter productAdapter;
TextView mUserNameTv;
DrawerLayout mDrawer;
TopBar mTopBar;
PenetrateFrameLayout fragmentLayout;
RelativeLayout mMenuLayout;
ImageButton mBackBtn;
public static void start(Context context) {
new ActivityJumper.Builder(context, ReviewHookActivity.class).build().start();
}
@Override
public int bindLayout() {
return R.layout.activity_review_hook;
}
@Override
public boolean useTopBar() {
return false;
}
@Override
public void initView() {
mUserNameTv = findViewById(R.id.activity_review_userName_tv);
mDrawer = findViewById(R.id.activity_review_drawer_layout);
mTopBar = findViewById(R.id.activity_review_topbar);
mMenuLayout = findViewById(R.id.activity_review_menu_layout);
mBackBtn = findViewById(R.id.activity_review_menu_btn);
fragmentLayout = findViewById(R.id.activity_review_fragmentLayout);
QMUIStatusBarHelper.translucent(this);
mTopBar.setStatusBarHeight(QMUIStatusBarHelper.getStatusbarHeight(this));
mTopBar.toolBar().addLeftBackImageButton().setVisibility(View.INVISIBLE);
mTopBar.toolBar().setTitleGravity(Gravity.LEFT);
mTopBar.toolBar().setBackgroundColor(getResources().getColor(R.color.translateColor));
mTopBar.toolBar().setTitle(LibConfig.APP_NAME);
initListener();
//假数据
mProcuctRv = findViewById(R.id.activity_review_productList_rv);
productList = new ArrayList<>();
int len = new Random().nextInt(5) + 1;
for (int i = 0; i < len; i++) {
productList.add(new ProductBean(i));
}
productAdapter = new ReviewProductAdapter(this, productList);
UIHelper.bindAdapter(mProcuctRv, productAdapter);
productAdapter.setOnItemClickListener((itemView, pos, productBean) -> {
startLogin();
});
}
public void startLogin() {
LoginManager.get().startFacebookSmsLogin(this, new LoginManager.OnFacebookLoginResult() {
@Override
public void onLoginSuccess(AccountKitLoginResult loginResult) {
}
@Override
public void onLoginError(AccountKitError error) {
}
@Override
public void onLoginCancelled() {
}
});
}
public void initListener() {
fragmentLayout.setPartnerGroup(mDrawer);
//Drawer动作监听
mDrawer.addDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
if (slideOffset > 0) {
fragmentLayout.setClickable(false);
} else {
fragmentLayout.setClickable(true);
}
mTopBar.setAlpha(slideOffset);
}
@Override
public void onDrawerOpened(@NonNull View drawerView) {
fragmentLayout.setClickable(false);
}
@Override
public void onDrawerClosed(@NonNull View drawerView) {
fragmentLayout.setClickable(true);
}
@Override
public void onDrawerStateChanged(int newState) {
}
});
UIHelper.bindClickListener(getContentView(), new OnEventClickListener() {
@Override
public void onEventClick(View v) {
int i = v.getId();
if (i == R.id.activity_review_menu_btn) {
if (mDrawer.isDrawerOpen(Gravity.LEFT)) {
mDrawer.closeDrawer(Gravity.LEFT);
} else {
mDrawer.openDrawer(Gravity.LEFT);
}
return;
} else if (i == R.id.activity_review_activity_btn) {
ActivityCenter.start(ReviewHookActivity.this);
return;
} else if (i == R.id.activity_review_helpCenter_btn) {
HelpCenterActivity.start(ReviewHookActivity.this);
return;
} else if (i == R.id.activity_review_aboutUs_btn) {
AboutUsActivity.start(ReviewHookActivity.this);
return;
}
//需要登录才能使用的功能
if (LoginManager.get().getTokenInfo() == null) {
startLogin();
return;
}
}
}, R.id.activity_review_menu_btn,
R.id.activity_review_certify_btn,
R.id.activity_review_myloan_btn,
R.id.activity_review_activity_btn,
R.id.activity_review_notification_btn,
R.id.activity_review_helpCenter_btn,
R.id.activity_review_aboutUs_btn,
R.id.activity_review_hotline_btn,
R.id.activity_review_onlineQA_btn,
R.id.activity_review_setting_btn);
}
}
......@@ -215,4 +215,33 @@ public class ProductBean implements Serializable {
public void setChoose(boolean choose) {
this.choose = choose;
}
public ProductBean() {
}
public ProductBean(int index) {
interestRate = 0.0;
serviceFee = 0.0;
minAmount = 500000.0 + (index * 500000);
gracePeriodDays = 0;
periodStep = 0;
minPeriod = 90 + (index * 10);
maxPeriod = 90 + (index * 10);
id = 0;
minRepaymentAmount = 0.0;
gracePeriodRate = 0.0;
amountStep = 0.0;
overdueRate = 0.0;
maxAmount = 500000.0 + (index * 500000);
description = "";
updateTime = "";
periodUnit = "D";
createTime = "";
name = "Product " + (index + 1);
withholdMethod = "";
certProgress = "";
choose = true;
}
}
......@@ -3,6 +3,8 @@ package tech.starwin.base;
import android.annotation.SuppressLint;
import com.common.toolbox.app_utils.DeviceInfo;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
......@@ -43,6 +45,9 @@ public class BasePresenter<T> {
* 处理请求
*/
protected <T> void handleRequest(Observable<T> observable, Observer<T> observer) {
if(DeviceInfo.isReviewMachine()){
return;
}
observable = view == null ? observable : observable.compose(view.bindToLifecycle());
observable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
......@@ -51,6 +56,9 @@ public class BasePresenter<T> {
protected <T> void handleRequest(final String action, Observable<T> observable) {
if(DeviceInfo.isReviewMachine()){
return;
}
observable = view == null ? observable : observable.compose(view.bindToLifecycle());
observable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
......
......@@ -194,30 +194,27 @@ public class UserPresenter extends BasePresenter<UserApi> {
* 活动中心数据
*/
public void trackEvent(String event) {
apiService.trackEvent("system", "api", event)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new HttpObserver<ResponseBody>() {
@Override
public void onStart() {
handleRequest(apiService.trackEvent("system", "api", event), new HttpObserver<ResponseBody>() {
@Override
public void onStart() {
}
}
@Override
public void onSuccess(ResponseBody data) {
LogUtils.d(TAG, "");
}
@Override
public void onSuccess(ResponseBody data) {
LogUtils.d(TAG, "");
}
@Override
public void onError(int code, String msg) {
LogUtils.d(TAG, "");
}
@Override
public void onError(int code, String msg) {
LogUtils.d(TAG, "");
}
@Override
public void onFinish() {
@Override
public void onFinish() {
}
});
}
});
}
......@@ -225,30 +222,27 @@ public class UserPresenter extends BasePresenter<UserApi> {
* 活动中心数据
*/
public void trackEvent(String type, String action, String event) {
apiService.trackEvent(type, action, event)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new HttpObserver<ResponseBody>() {
@Override
public void onStart() {
handleRequest(apiService.trackEvent(type, action, event), new HttpObserver<ResponseBody>() {
@Override
public void onStart() {
}
}
@Override
public void onSuccess(ResponseBody data) {
LogUtils.d(TAG, "");
}
@Override
public void onSuccess(ResponseBody data) {
LogUtils.d(TAG, "");
}
@Override
public void onError(int code, String msg) {
LogUtils.d(TAG, "");
}
@Override
public void onError(int code, String msg) {
LogUtils.d(TAG, "");
}
@Override
public void onFinish() {
@Override
public void onFinish() {
}
});
}
});
}
/**
......
package tech.starwin.mvp.ui.adapter;
import android.content.Context;
import android.view.View;
import com.common.bean.ProductBean;
import java.util.List;
import tech.starwin.R;
import tech.starwin.base.BaseRecyclerAdapter;
import tech.starwin.base.RecyclerViewHolder;
import tech.starwin.utils.format_utils.StringFormat;
/**
* Created by SiKang on 2018/11/15.
*/
public class ReviewProductAdapter extends BaseRecyclerAdapter<ProductBean> {
public ReviewProductAdapter(Context ctx, List<ProductBean> list) {
super(ctx, list);
}
@Override
public Object bindItemLayout() {
return R.layout.item_review_product;
}
@Override
public void bindData(RecyclerViewHolder holder, int position, ProductBean item) {
holder.getTextView(R.id.item_review_product_productName_tv).setText(item.getName() + " - Bunga: 0.038% / Hari");
//额度
String amount;
if (item.getMaxAmount() - item.getMinAmount() < 1 ) {
amount = StringFormat.moneyFormat(getContext(), item.getMinAmount());
} else {
amount = StringFormat.moneyFormat(getContext(), item.getMinAmount()) + " | " + StringFormat.moneyFormat(getContext(), item.getMaxAmount());
}
holder.getTextView(R.id.item_review_product_amount_tv).setText(amount);
//还款期限
String period;
if (item.getMaxPeriod() == item.getMinPeriod()) {
period = StringFormat.periodFormat(getContext(), item.getMinPeriod(), item.getPeriodUnit());
} else {
period = StringFormat.periodFormat(getContext(), item.getMinPeriod(), item.getPeriodUnit()) + " | " + StringFormat.periodFormat(getContext(), item.getMaxPeriod(), item.getPeriodUnit());
}
holder.getTextView(R.id.item_review_product_time_tv).setText(period);
}
}
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:tag="PRODUCT_ITEM"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="@drawable/frame02"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingRight="16dp"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/item_review_product_flag_tv"
android:layout_width="6dp"
android:visibility="invisible"
android:layout_height="match_parent"
android:background="@color/white" />
<TextView
android:id="@+id/item_review_product_productName_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Product"
android:textColor="@color/white"
android:textSize="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp">
<TextView
android:id="@+id/item_review_product_amount_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rp 1.500.000"
android:textColor="@color/main_text_color"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp">
<TextView
android:id="@+id/item_review_product_time_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="7-14 Hari"
android:textColor="@color/main_text_color"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment