BasePresent.java
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.sunvote.txpad.base;
import android.content.Context;
import java.text.SimpleDateFormat;
/**
* Created by Elvis on 2017/9/12.
* Email:Eluis@psunsky.com
* 版权所有:长沙中天电子设计开发有限公司
* Description:ETest
*/
public class BasePresent<M extends BaseModel,V extends BaseView> {
protected SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static final String SUCCESS = "0" ;
protected M model;
public void setModel(M model) {
this.model = model;
}
public M getModel() {
return model;
}
protected V view ;
public RxManager mRxManager = new RxManager();
public void setView(V view) {
this.view = view;
}
public V getView() {
return view;
}
public void init(){}
public void onDestroy(){
mRxManager.clear();
}
public void onCreate(Context context){
}
/**
* 秒转时间字符串
* @param time
* @return
*/
public String intToTimeString(int time){
int modeSec = time % 60 ;
String modeSecStr = null ;
if(modeSec == 0){
modeSecStr = "00" ;
}else if(modeSec < 10){
modeSecStr = "0" + modeSec ;
}else{
modeSecStr = "" + modeSec ;
}
int present = time / 60 ;
String pStr = null ;
if(present == 0){
pStr = "00" ;
}else if(present < 10) {
pStr = "0" + present ;
}else{
pStr = "" + present ;
}
return pStr + ":" + modeSecStr ;
}
}