码迷,mamicode.com
首页 > 其他好文 > 详细

MainActivity

时间:2019-08-04 19:41:47      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:str   ota   tla   ssd   inject   handle   and   jmh   etc   

package com.test.mvp.mvpdemo.mvp.v5.view;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.widget.TextView;
import android.widget.Toast;

import com.test.mvp.mvpdemo.R;
import com.test.mvp.mvpdemo.mvp.v5.MainContract;
import com.test.mvp.mvpdemo.mvp.v5.basemvp.BaseActivity;
import com.test.mvp.mvpdemo.mvp.v5.inject.InjectPresenter;
import com.test.mvp.mvpdemo.mvp.v5.presenter.MainPresenter;

/**
* MVP 的写法,Version 5: 依赖注入,解决多个 Presenter 的问题
*
* @author 神探丶威威猫
* @blog https://blog.csdn.net/smile_running
* @warning 点个赞哦,评个论哦
*/
public class MainActivity extends BaseActivity<MainContract.IMainPresenter> implements MainContract.IMainView {

private TextView tv;

@InjectPresenter
private MainPresenter mPresenter;

@Override
protected void initLayout(@Nullable Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
}

@Override
protected void initViews() {
tv = $(R.id.tv);
}

@Override
protected void initData() {
// getPresenter().handlerData();
mPresenter.handlerData();
}

@Override
protected MainContract.IMainPresenter setPresenter() {
return null;
}

@Override
public void showDialog() {
ProgressDialog dialog = new ProgressDialog(getContext());
dialog.show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
dialog.dismiss(http://www.amjmh.com/v/BIBRGZ_558768/);
}
}, 1500);
}

@Override
public void succes(String content) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getContext(), "" + content, Toast.LENGTH_SHORT).show();
tv.setText(content);
}
});
}
}
--------------------- 

MainActivity

标签:str   ota   tla   ssd   inject   handle   and   jmh   etc   

原文地址:https://www.cnblogs.com/hyhy904/p/11299069.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!