Blame view

C5/app/src/main/java/com/sunvote/xpadapp/fragments/MeetingWelcomeFragment.java 2.31 KB
fac86401   孙向锦   初始化C5 Vote
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
  package com.sunvote.xpadapp.fragments;
  
  import com.sunvote.util.LogUtil;
  import com.sunvote.xpadapp.R;
  import com.sunvote.xpadapp.base.SuperBaseFragment;
  
  import android.app.FragmentManager;
  import android.app.FragmentTransaction;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.View.OnClickListener;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class MeetingWelcomeFragment extends SuperBaseFragment {
  
  	private TextView tv;
  	long lastTapTime;
  	int tapCount;
  	
  	@Override
  	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  		LogUtil.d("MeetingWelcome", "onCreateView");
  		View view = inflater.inflate(R.layout.fragment_welcome, container, false);
  
  		
  		
  		tv = (TextView) view.findViewById(R.id.welcome_title);
  		View adminView = (View)view.findViewById(R.id.welcome_btn_admin);
  		adminView.setOnClickListener(new OnClickListener() {
  
  			@Override
  			public void onClick(View v) {
  				if (System.currentTimeMillis() - lastTapTime > 400) {
  					tapCount = 0;
  					LogUtil.d("OfflineFragment", "tapCount:0");
  				} else {
  					tapCount++;
  					LogUtil.d("OfflineFragment", "tapCount:" + tapCount);
  				}
  				lastTapTime = System.currentTimeMillis();
  				if (tapCount >= 9) {
  					tapCount = 0;
  					showAdmin();
  				}
  			}
  		});
  		// String sname = mMainActivity.meetingInfo.meetingTitle;
  		//tv.setTextColor(Color.RED);
  		
  		if(mMainActivity.meetingInfo!=null && mMainActivity.meetingInfo.meetingTitle !=null){
  			tv.setText(mMainActivity.meetingInfo.meetingTitle);
  
  		}else{
  			Toast.makeText(getActivity(), "会议" + mMainActivity.meetingId + "不存在,请下载会议资料", Toast.LENGTH_LONG).show();
  		}
  		return view;
  	}
  	
  	private void showAdmin(){
  		FragmentManager fm = getFragmentManager();
  		FragmentTransaction tx = fm.beginTransaction();
  		AdminFragment fAdmin = new AdminFragment();
  		tx.add(R.id.frame_content, fAdmin, "admin");
  		tx.addToBackStack(null);
  		tx.commitAllowingStateLoss();
  	}
  
  	boolean isAttach = false;
  
  	@Override
  	public void onResume() {
  		super.onResume();
  		isAttach = true;
  	}
  
  	@Override
  	public void onPause() {
  		super.onPause();
  		isAttach = false;
  	}
  
  	public void setMeeting(){
  		if(isAttach) {
  			tv.setText(mMainActivity.meetingInfo.meetingTitle);
  		}
  	}
  }