package com.ibm.bmcc.eam;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import com.ibm.bmcc.eam.utils.LogUtil;
public abstract class TFragment extends Fragment implements OnTouchListener, OnClickListener {
private final static String tag = "TFragment";
protected EAMPortyAcy mActivity;
@Override
public void onAttach(Activity activity) {
// LogUtil.e(tag, getClass().getSimpleName() + "->onAttach");
super.onAttach(activity);
mActivity = (EAMPortyAcy) activity;
}
@Override
public void onCreate(Bundle savedInstanceState) {
// LogUtil.w(tag, getClass().getSimpleName() + "->onCreate");
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// LogUtil.e(tag, getClass().getSimpleName() + "->onCreateView");
// mActivity.btn_refresh.setOnClickListener(this);
// mActivity.btn_back.setOnClickListener(this);
return super.onCreateView(inflater, container, savedInstanceState);
}
// @Override
// public void onClick(View v) {
// switch (v.getId()) {
// case :
//
// break;
//
// default:
// break;
// }
//
// }
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// LogUtil.e(tag, getClass().getSimpleName() + "->onActivityCreated");
super.onActivityCreated(savedInstanceState);
}
@Override
public void onStart() {
// LogUtil.e(tag, getClass().getSimpleName() + "->onStart");
super.onStart();
}
@Override
public void onResume() {
// mActivity.setBackMessage(null);
// LogUtil.e(tag, getClass().getSimpleName() + "->onResume");
super.onResume();
}
@Override
public void onPause() {
// LogUtil.e(tag, getClass().getSimpleName() + "->onPause");
super.onPause();
}
@Override
public void onStop() {
// LogUtil.e(tag, getClass().getSimpleName() + "->onStop");
super.onStop();
}
@Override
public void onDestroyView() {
// LogUtil.e(tag, getClass().getSimpleName() + "->onDestroyView");
super.onDestroyView();
}
@Override
public void onDestroy() {
// LogUtil.e(tag, getClass().getSimpleName() + "->onDestroy");
super.onDestroy();
}
@Override
public void onDetach() {
// LogUtil.e(tag, getClass().getSimpleName() + "->onDetach");
super.onDetach();
}
@Override
public void onSaveInstanceState(Bundle outState) {
// LogUtil.e(tag, getClass().getSimpleName() + "->onSaveInstanceState");
super.onSaveInstanceState(outState);
}
@Override
public void onViewStateRestored(Bundle savedInstanceState) {
// LogUtil.e(tag, getClass().getSimpleName() + "->onViewStateRestored");
super.onViewStateRestored(savedInstanceState);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// LogUtil.e(tag, getClass().getSimpleName() + "->onViewCreated");
view.setOnTouchListener(this);
super.onViewCreated(view, savedInstanceState);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
return true;
}
@Override
public void startActivity(Intent intent) {
super.startActivity(intent);
}
@Override
public void startActivityForResult(Intent intent, int requestCode) {
super.startActivityForResult(intent, requestCode);
}
/**
* 为子视图添加一个Fragment
*
* @param f
* @param addToBackStack
*/
public void addFragment(Fragment f, boolean addToBackStack) {
mActivity.addFragment(f, addToBackStack);
}
/**
* 为子视图添加一个Fragment
*
* @param f
* @param addToBackStack
*/
public void addFragment(Fragment f, boolean addToBackStack,String tag) {
mActivity.addFragment(f, addToBackStack,tag);
}
/**
* 为子视图替换一个Fragment
*
* @param f
* @param addToBackStack
*/
public void replaceFragment(Fragment f, boolean addToBackStack) {
mActivity.replaceFragment(f, addToBackStack);
}
public void setTitle(String title) {
mActivity.setPortyTitle(title);
}
public void showRightBtn() {
mActivity.showRightBtn();
}
public void dismissRightBtn() {
mActivity.dismissRightBtn();
}
public void changeRightBtnText(String s){
mActivity.changeRightBtnText(s);
}
// public void popTitle(){
// mActivity.popTitle();
// }
//
public void popFragment() {
mActivity.popFragment();
}
public void showDialog(){
mActivity.showProgress();
}
public void dismissDialog(){
mActivity.dismissProgress();
}
public void showMessage(CharSequence text) {
mActivity.showMessage(text);
}
}
Fragment Base Class
最新推荐文章于 2024-02-07 16:20:19 发布