Blame view

C5/app/src/main/java/com/sunvote/xpadapp/fragments/NoFileFragment.java 2.46 KB
fac86401   孙向锦   初始化C5 Vote
1
2
3
  package com.sunvote.xpadapp.fragments;
  
  import com.sunvote.util.LogUtil;
75386c29   孙向锦   选举结果UI修改
4
  import com.sunvote.xpadapp.MainActivity;
fac86401   孙向锦   初始化C5 Vote
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
  import com.sunvote.xpadapp.R;
  
  import android.app.Activity;
  import android.app.Fragment;
  import android.app.FragmentManager;
  import android.app.FragmentTransaction;
  import android.content.Context;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  public class NoFileFragment extends Fragment {
  	private TextView tv;
  	public int meetingId;
  
  	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_no_file, container, false);
  
  		tv = (TextView) view.findViewById(R.id.fragment_no_file_title);
75386c29   孙向锦   选举结果UI修改
33
  		((MainActivity)getActivity()).setBackgroundColor(Color.parseColor("#450603"));
fac86401   孙向锦   初始化C5 Vote
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
  		// String sname = mMainActivity.meetingInfo.meetingTitle;
  		tv.setText(String.format( getString(R.string.no_file_tips),meetingId));
  
  		TextView tv2 =  (TextView) view.findViewById(R.id.fragment_no_file_title_2);
  		tv2.setText(getString(R.string.no_file_tips_download));
  
  		View adminView = (View)view.findViewById(R.id.fragment_online_btn_admin);
  		adminView.setOnClickListener(new View.OnClickListener() {
  
  			@Override
  			public void onClick(View v) {
  				if (System.currentTimeMillis() - lastTapTime > 500) {
  					tapCount = 0;
  					LogUtil.d("OfflineFragment", "tapCount:0");
  				} else {
  					tapCount++;
  					LogUtil.d("OfflineFragment", "tapCount:" + tapCount);
  				}
  				lastTapTime = System.currentTimeMillis();
  				if (tapCount >= 9) {
  					tapCount = 0;
  					showAdmin();
  				}
  			}
  		});
  		return view;
  	}
  
  	private boolean isAttach = false ;
  
  	@Override
  	public void onResume() {
  		super.onResume();
  		isAttach = true;
  	}
  
  	@Override
  	public void onPause() {
  		super.onPause();
  		isAttach = false;
  	}
  
  	public void setMeetingId(int meetingId) {
  		this.meetingId = meetingId;
  		if(isAttach){
  			if(tv != null){
  				tv.setText(String.format( getString(R.string.no_file_tips),meetingId));
  			}
  		}
  	}
  
  	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();
  	}
  }