package com.sheep.gamegroup.view.activity;

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sheep.gamegroup.absBase.BaseActivity;
import com.sheep.gamegroup.di.components.DaggerWithdrawalResultComponent;
import com.sheep.gamegroup.di.modules.WithdrawalResultModule;
import com.sheep.gamegroup.presenter.WithdrawalResultContract;
import com.sheep.gamegroup.presenter.WithdrawalResultPresenter;
import com.sheep.gamegroup.util.ActivityManager;
import com.sheep.gamegroup.util.GlideImageLoader;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.SheepApp;
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;

import java.util.Locale;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 提现结果页面
 * Created by ljy on 2018/3/18.
 */

public class WithdrawalResultAct extends BaseActivity implements WithdrawalResultContract.View {
    Activity activity;
    @BindView(R.id.withdrawal_image_iv)
    ImageView withdrawal_image_iv;
    @BindView(R.id.withdrawal_success_sure_tv)
    TextView withdrawalSuccessSureTv;

    @Inject
    WithdrawalResultPresenter presenter;
    @BindView(R.id.withdrawal_success_money_tv)
    TextView withdrawalSuccessMoneyTv;

    private float amount;

    @Override
    protected int getLayoutId() {
        return R.layout.withdrawal_success_layout;
    }

    @Override
    public void initView() {
        GlideImageLoader.setImage(withdrawal_image_iv, "http://cdngame.kuaifazs.com/yellow_yang.png");
        activity = this;
        amount = getIntent().getFloatExtra(Float.class.getSimpleName(), 0);
        withdrawalSuccessMoneyTv.setText(String.format(Locale.CHINA, "+%.1f元", amount));
        TitleBarUtils.getInstance()
                .setShowOrHide(this, true)
                .setTitle(activity, "提现审核中")
                .setTitleFinish(activity);
        DaggerWithdrawalResultComponent.builder()
                .netComponent(SheepApp.getInstance().getNetComponent())
                .withdrawalResultModule(new WithdrawalResultModule(this))
                .build()
                .inject(this);
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {
    }

    @OnClick({R.id.withdrawal_success_sure_tv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.withdrawal_success_sure_tv:
                ActivityManager.getInstance().endActivity(WithdrawalAct.class);
                finish();
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityManager.getInstance().endActivity(WithdrawalAct.class);
    }

}
