@Override public void bindView(View view, Context context, Cursor c) { if (view == null) { view = CommonAndroid.initView(context, R.layout.service_list_item, null); } if (positionSelection == c.getPosition()) { view.setBackgroundResource(R.color.servicelist_first); // R.color.servicelist_first } else { view.setBackgroundResource(android.R.color.transparent); } ImageView img = CommonAndroid.getView(view, R.id.img); TextView text_1 = CommonAndroid.getView(view, R.id.text_1); TextView text_2 = CommonAndroid.getView(view, R.id.text_2); CommonAndroid.setText(text_1, c, ServiceList.title); CommonAndroid.setText(text_2, c, ServiceList.subtitle); ImageLoaderUtils.getInstance(context) .displayImageHome(CommonAndroid.getString(c, ServiceList.thumbnail), img); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { view = CommonAndroid.initView(mContext, R.layout.service_list_item_z, null); } ico_indi_gray = (ImageView) view.findViewById(R.id.ico_indi_gray); if (positionSelection == position) { view.setBackgroundResource(R.color.servicelist_first); ico_indi_gray.setImageDrawable(myIcon_select); } else { view.setBackgroundResource(android.R.color.transparent); ico_indi_gray.setImageDrawable(myIcon_unselect); } ImageView img = CommonAndroid.getView(view, R.id.img); TextView text_1 = CommonAndroid.getView(view, R.id.text_1); text_1.setText(listData.get(position).getTitle()); ImageLoaderUtils.getInstance(parent.getContext()) .displayImageHome(listData.get(position).getThumbnail(), img); return view; }
@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(); }