Blame view

app/src/main/java/com/sunvote/xpadapp/fragments/NoFileFragment.java 1.93 KB
27983dbe   孙向锦   project init
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
  package com.sunvote.xpadapp.fragments;
  
  import com.sunvote.xpadapp.R;
  
  import android.app.Fragment;
  import android.app.FragmentManager;
  import android.app.FragmentTransaction;
  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) {
  		Log.d("MeetingWelcome", "onCreateView");
  		View view = inflater.inflate(R.layout.fragment_no_file, container, false);
  
  		tv = (TextView) view.findViewById(R.id.fragment_no_file_title);
  
  		// 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_meeting_id)+meetingId);
  
  		View adminView = (View)view.findViewById(R.id.nofile_btn_admin);
  		adminView.setOnClickListener(new View.OnClickListener() {
  
  			@Override
  			public void onClick(View v) {
  				if(System.currentTimeMillis()-lastTapTime > 500){
  					tapCount =0;
  					Log.d("OfflineFragment", "tapCount:0");
  				}else{
  					tapCount++;
  					Log.d("OfflineFragment", "tapCount:"+tapCount);
  				}
  				lastTapTime = System.currentTimeMillis();
  				if(tapCount>=9){
  					tapCount=0;
  					showAdmin();
  				}
  			}
  		});
  		return view;
  	}
  
  	private void showAdmin(){
  
  		FragmentManager fm = getFragmentManager();
  		FragmentTransaction tx = fm.beginTransaction();
  		AdminFragment fAdmin = new AdminFragment();
  		tx.setCustomAnimations(android.R.animator.fade_in,android.R.animator.fade_out);
  		tx.add(R.id.frame_content, fAdmin, "admin");
  		tx.addToBackStack(null);
  		tx.commitAllowingStateLoss();
  	}
  }