KeypadTestChoice10Fragment.java
3.13 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package com.sunvote.xpadapp.fragments;
import com.sunvote.util.LogUtil;
import com.sunvote.xpadapp.R;
import com.sunvote.xpadapp.base.BaseFragment;
import com.sunvote.xpadcomm.XPadApi;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
public class KeypadTestChoice10Fragment extends BaseFragment implements View.OnClickListener {
Button btn1;
Button btn2;
Button btn3;
Button btn4;
Button btn5;
Button btn6;
Button btn7;
Button btn8;
Button btn9;
Button btn10;
TextView tvInfo;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LogUtil.d("KeypadTestFragment", "onCreateView");
View view = inflater.inflate(R.layout.fragment_choice10_test, container, false);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
;
}
});
tvInfo = (TextView)view.findViewById(R.id.keypad_test_choice10_info);
btn1 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_1);
btn1.setOnClickListener(this);
btn2 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_2);
btn2.setOnClickListener(this);
btn3 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_3);
btn3.setOnClickListener(this);
btn4 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_4);
btn4.setOnClickListener(this);
btn5 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_5);
btn5.setOnClickListener(this);
btn6 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_6);
btn6.setOnClickListener(this);
btn7 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_7);
btn7.setOnClickListener(this);
btn8 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_8);
btn8.setOnClickListener(this);
btn9 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_9);
btn9.setOnClickListener(this);
btn10 = (Button) view.findViewById(R.id.keypad_test_choice10_btn_10);
btn10.setOnClickListener(this);
ImageButton btnBack = (ImageButton) view.findViewById(R.id.choice10_btnback);
btnBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
goBack();
}
});
return view;
}
@Override
public void onClick(View v) {
Button btn =(Button) v;
tvInfo.setText( getString(R.string.sent) + " " + btn.getText().toString());
long tmVal = (long) (System.currentTimeMillis()-mMainActivity.startVoteTime)/20 ;
String str =btn.getText().toString() +","+ String.valueOf(tmVal) ;
mMainActivity.presenter.submitVote( XPadApi.AnsType_Select,str);
}
private void goBack() {
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.setCustomAnimations(android.R.animator.fade_in,android.R.animator.fade_out);
//tx.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
tx.remove(this);
tx.commit();
}
}