@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v; v = inflater.inflate(R.layout.fragment_news, container, false); mFlipView = (FlipView) v.findViewById(R.id.flip_view); mAdapter = new FlipAdapter(getActivity(), (new NewsList().newsList)); mFlipView.setAdapter(mAdapter); mFlipView.peakNext(false); mFlipView.setOverFlipMode(OverFlipMode.RUBBER_BAND); return v; }
@Override public void init(View view) { // initHeader(view, R.id.header, R.string.menu_service_list, // R.string.menu_service_list_j, R.drawable.icon_back, 0); myIcon_select = getResources().getDrawable(R.drawable.ico_indi_gray2); myIcon_unselect = getResources().getDrawable(R.drawable.ico_indi_gray); txtTitleHeader = (HeaderView) view.findViewById(R.id.header); setting = new Setting(getActivity()); txtTitleHeader.initHeader(title, title); ImageButton btnBack = (ImageButton) view.findViewById(R.id.header_btn_left); btnBack.setImageResource(R.drawable.icon_back); btnBack.setOnClickListener(this); ImageButton btnRight = (ImageButton) view.findViewById(R.id.header_btn_right); btnRight.setVisibility(View.INVISIBLE); loading = CommonAndroid.getView(view, R.id.loading); list = CommonAndroid.getView(view, R.id.list); list.setOnItemClickListener(this); flip = CommonAndroid.getView(view, R.id.flip); flip.setOnTouchListener( new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) { SkyMainActivity.sm.setSlidingEnabled(false); SkyMainActivity.sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE); } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) { SkyMainActivity.sm.setSlidingEnabled(true); SkyMainActivity.sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE); } return false; } }); flip.setOnFlipListener( new FlipView.OnFlipListener() { @Override public void onFlippedToPage(FlipView v, int position, long id) { if (galleryAdapter != null) { galleryAdapter.setPositionSelection(position); /*int color = getActivity().getResources().getColor(R.color.color_focus_lion); // list.getChildAt(position).setBackgroundColor(color); for (int i = 0; i < 3; i++) { if (i == position) { list.getChildAt(i).setBackgroundColor(getResources().getColor(R.color.servicelist_first));//color_gray Log.i(TAG, "===> " + position); }else{ list.getChildAt(i).setBackgroundColor(getResources().getColor(android.R.color.transparent)); } }*/ } if (position == 0) { SkyMainActivity.sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); } } }); // updateData(); callApi(); }