NoFileFragment.java 1.93 KB
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();
	}
}