public void onEvent(GetTvEvent<AppreciatetvList> event) {
    aList = event.result;

    // 处理List返回内容
    if (aList == null) return;

    // init frequency
    List<Appreciatetv> list = aList.getLists();
    List<CategoryData> datas = list.get(list.size() - 1).getData();
    mFrequencys.clear();
    for (CategoryData data : datas) {
      mFrequencys.add(data.getCategoryurl());
    }

    setViewsVisiable(View.VISIBLE);

    mProgressBar.setVisibility(View.GONE);

    mListViewAdapter.updateData(aList.getLists());
    Appreciatetv tv = (Appreciatetv) mListViewAdapter.getItem(0);
    if (tv != null) {
      mGalleryAdapter.updateData(tv.getData());
      mGallery.setSelection(Integer.MAX_VALUE / 2 - 1);
    }

    mListView.requestFocus();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_goods_info);

    // 取得传过来的map对象
    map = App.map;
    init();

    getDetail(); // 获取数据

    DetailAdapter adapter = new DetailAdapter(list, this);
    g.setAdapter(adapter);
    g.setSelection(0);
    g.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            /*
             * 自定义dailog CustomDialog dia = new
             * CustomDialog(GoodsInfoActivity.this, list,
             * R.style.custom_dialog); dia.setPosition(position);
             * dia.show();
             */

            Intent i = new Intent(GoodsInfoActivity.this, ShowActivity.class);
            i.putExtra("position", position);
            i.putExtra("Arr", pathArr);
            i.putExtra("id", 1);
            startActivity(i);
            overridePendingTransition(R.anim.alpha_before, R.anim.alpha_ago);
          }
        });
  }
예제 #3
0
    private void ini() {
      setWidth(LayoutParams.MATCH_PARENT);
      setHeight(LayoutParams.MATCH_PARENT);
      setAnimationStyle(R.style.popupwindow_anim);
      gallery = (Gallery) resource.findViewById(R.id.img_show_gallery);
      postionTV = (TextView) resource.findViewById(R.id.img_show_pos);
      galleryAdapter = new GalleryAdapter();
      gallery.setAdapter(galleryAdapter);
      gallery.setSelection(pos, true);
      postionTV.setText(pos + 1 + "/" + imgList.size());
      gallery.setOnItemClickListener(
          new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              ImgShow.this.dismiss();
              IsImgShow = false;
            }
          });
      gallery.setOnItemSelectedListener(
          new OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
              postionTV.setText(position + 1 + "/" + imgList.size());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {}
          });
    }
예제 #4
0
 @Override
 public void handleMessage(Message msg) {
   // TODO Auto-generated method stub
   super.handleMessage(msg);
   switch (msg.what) {
     case INIT_FINISH:
       mGallery.setVerticalFadingEdgeEnabled(false);
       mGallery.setHorizontalFadingEdgeEnabled(false);
       mGallery.setAdapter(new GalleryAdapter(mContext, imagesPath));
       mGallery.setSelection(index);
       break;
     default:
       break;
   }
 }
예제 #5
0
        @Override
        public void onClick(Calendar calendar) {

          long aDayInMilliSecond = 60 * 60 * 24 * 1000; // 一天的毫秒數
          long dayDiff =
              (calendar.getTimeInMillis() - (_calendar.getTimeInMillis())) / aDayInMilliSecond;

          if (dayDiff == 0
              && calendar.get(Calendar.DAY_OF_YEAR) != _calendar.get(Calendar.DAY_OF_YEAR)) {
            dayDiff += 1;
          }

          dateViewpager.setSelection((int) (today_index + dayDiff));

          closeCal((int) (today_index + dayDiff), true);
        }
예제 #6
0
 /**
  * Actions launched after giveTo animation
  *
  * @param placePlayer Player position
  * @param vToMove CardView to move
  */
 public void endAnim(int placePlayer, CardView vToMove) {
   if (placePlayer != 0) {
     playerViews.get(placePlayer).getPlayer().addCard(vToMove.getCard());
     playerViews.get(placePlayer).setPlayer(playerViews.get(placePlayer).getPlayer(), false);
   } else {
     GA.user.addCard(vToMove.getCard());
     Gallery gallery =
         (Gallery)
             GameActivity.getActivity().findViewById(R.id.playerview_slider_board_cardgallery);
     SliderbarCardGallery adapter = (SliderbarCardGallery) gallery.getAdapter();
     adapter.notifyDataSetChanged();
     gallery.setSelection(GA.user.getNumberOfCards() - 1);
     HandView handView = (HandView) GameActivity.getActivity().findViewById(R.id.handview);
     handView.updateView(true);
   }
   this.removeView(vToMove);
 }
  public void onActivityCreated(Bundle savedInstanceState) {
    Log.i("onActivityCreated", "child");
    super.onCreate(savedInstanceState);
    PrepArrows();
    Gallery gallery = (Gallery) getView().findViewById(R.id.gallery);
    gallery.setAdapter(new ImageAdapter(this.getActivity().getBaseContext(), mImageIds));
    gallery.setHorizontalFadingEdgeEnabled(true);

    gallery.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
            int i = parent.getCount();
            Log.i("OnItemSelected", Integer.toString(position) + " / " + Integer.toString(i));
            for (int x = 0; x < i; x++) {
              View vv = parent.getChildAt(x);
              if (vv != null) {
                vv.setAlpha(128);
                vv.setBackgroundResource(0);
              }
            }

            v.setAlpha(255);
            parent.invalidate();

            ToggleArrows(position);

            // Update the CSDL Summary
            UpdateGUI(position);
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {
            Log.i("onNothingSelected", "Nothing selected?");
            int i = parent.getCount();
            for (int x = 0; x < i; x++) {
              parent.getChildAt(x).setAlpha(128);
              parent.getChildAt(x).setBackgroundResource(0);
            }
          }
        });

    // Set this after the listener to cheat on setting the alpha
    gallery.setSelection(4, true);
  }
  // TODO
  // int[] channels = {58437, 77937, 110500, 112937, 58437, 77937, 110500, 58437, 77937, 110500};
  @Override
  public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (parent == mListView) {
      //            Log.d("shine", "list onItemSelected pos=" + position);
      Appreciatetv tv = (Appreciatetv) mListViewAdapter.getItem(position);
      if (tv != null) {
        mGallery.removeAllViewsInLayout();
        mGalleryAdapter.updateData(tv.getData());
        mGalleySelectedPosition = Integer.MAX_VALUE / 2 - 1;
        mGallery.setSelection(mGalleySelectedPosition);

        mListSelected = position;
        mListViewAdapter.notifyDataSetChanged();
      }

    } else {
      CategoryData data = mGalleryAdapter.getItem(position);
      mGalleySelectedPosition = position;
      mGalleryAdapter.notifyDataSetChanged();
    }
  }
 private void init() {
   // 判断照片的数量,根据数量选择控件显示,1张图片用ImageView显示,多张用Gallery显示
   if (mKXApplication.mAlbumList.size() > 1) {
     mDisplaySingle.setVisibility(View.GONE);
     mDisplay.setVisibility(View.VISIBLE);
     mCurrentPosition = 0;
     mAdapter = new GalleryAdapter();
     mDisplay.setAdapter(mAdapter);
     mDisplay.setSelection(mCurrentPosition);
   } else if (mKXApplication.mAlbumList.size() == 1) {
     mDisplaySingle.setVisibility(View.VISIBLE);
     mDisplay.setVisibility(View.GONE);
     mCurrentPosition = 0;
     mCurrentPath = mKXApplication.mAlbumList.get(mCurrentPosition).get("image_path");
     mDisplaySingle.setImageBitmap(mKXApplication.getPhoneAlbum(mCurrentPath));
   }
   // 获取地理位置数据
   getLocation();
   // 显示默认地理位置、相册
   mLocation.setText(mKXApplication.mMyLocationResults.get(mLocationPosition).getName());
   mAlbum.setText(mAlbums[mAlbumPosition]);
 }
예제 #10
0
  /** 初始化可左右滑动的图片Adapter */
  private void initPicAdapter(String imgs[]) {
    for (int i = 0; i < imgs.length; i++) {
      ImageView iv = new ImageView(getBaseContext());
      LayoutParams lp = (LayoutParams) iv.getLayoutParams();
      if (null == lp) {
        lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      }
      iv.setImageResource(R.drawable.dot_grey2x);
      lp.rightMargin = 5;
      iv.setLayoutParams(lp);
      frame_dian.addView(iv);
      imgViews.add(iv);
    }

    for (int h = 0; h < imgs.length; h++) {
      ImageView imageView_pic = new ImageView(this);
      String url = imgs[h];
      bitmapUtilsPic.display(imageView_pic, url);
      viewlist.add(imageView_pic);
    }

    if (null == picAdapter) {
      picAdapter = new GroupBuyImageAdapter(PindanDetailActivity.this, imgs);
      gallery.setAdapter(picAdapter);
      gallery.setSelection(0);
      gallery.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              // 不显示大图片
              if (null == pagerAdapter) {
                pagerAdapter = new BigPicAdapter(viewlist, handler);
                pagerImage.setAdapter(pagerAdapter);
              }
              pagerImage.setCurrentItem(position);
              content_all.setVisibility(View.INVISIBLE);
              pagerLayout.setVisibility(View.VISIBLE);
              pagerLayout.startAnimation(animationsmall_big);
            }
          });
      gallery.setOnItemSelectedListener(
          new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {

              for (int i = 0; i < imgViews.size(); i++) {
                if (i == position) {
                  ((ImageView) frame_dian.getChildAt(i)).setImageResource(R.drawable.dot_yellow2x);
                } else {
                  ((ImageView) frame_dian.getChildAt(i)).setImageResource(R.drawable.dot_grey2x);
                }
              }
            }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {}
          });
    } else {
      picAdapter.notifyDataSetChanged();
    }
  }
예제 #11
0
  private void setHeaderView() {

    calendarsAdapter = (new CalendarAdapter(mContext, calendars));

    dateViewpager.setAdapter(calendarsAdapter);

    // 只讓最後停下來的地方有Callback
    //        dateViewpager.setCallbackDuringFling(false);
    dateViewpager.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

            currentIndex = i;

            Calendar dateCalendar = calendars.get(i);

            monthText.setText(String.format("%tb", dateCalendar.getTime()));

            int pre2 = i - 2;
            int next2 = i + 2;

            if (pre2 >= 0) {
              Calendar preDateCalendar = calendars.get(pre2);
              if (preDateCalendar.get(Calendar.MONTH) != dateCalendar.get(Calendar.MONTH)) {
                Animation animation =
                    AnimationUtils.loadAnimation(mContext, android.R.anim.fade_in);
                preMonth.setText(String.format("%tb", preDateCalendar.getTime()));
                preMonth.startAnimation(animation);
              } else {
                Animation animation =
                    AnimationUtils.loadAnimation(mContext, android.R.anim.fade_out);
                preMonth.setText("");
                preMonth.startAnimation(animation);
              }
            }

            if (next2 < calendars.size()) {
              Calendar nextDateCalendar = calendars.get(next2);
              if (nextDateCalendar.get(Calendar.MONTH) != dateCalendar.get(Calendar.MONTH)) {
                Animation animation =
                    AnimationUtils.loadAnimation(mContext, android.R.anim.fade_in);
                nextMonth.setText(String.format("%tb", nextDateCalendar.getTime()));
                nextMonth.startAnimation(animation);
              } else {
                Animation animation =
                    AnimationUtils.loadAnimation(mContext, android.R.anim.fade_out);
                nextMonth.setText("");
                nextMonth.startAnimation(animation);
              }
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });

    dateViewpager.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {

            // 手指放下時,所有顏色都回歸正常
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
              calendarsAdapter.setClickIndex(-1);
              calendarsAdapter.notifyDataSetChanged();
            }

            if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
              new Thread(
                      new Runnable() {
                        @Override
                        public void run() {
                          try {
                            int index = 0;
                            while (true) {
                              index = currentIndex;
                              Thread.sleep(300);
                              if (index == currentIndex) {
                                handler.sendEmptyMessage(index);
                                break;
                              } else {
                              }
                            }
                          } catch (InterruptedException e) {
                            e.printStackTrace();
                          }
                        }
                      })
                  .start();
            }

            return false;
          }
        });

    // 預設今天的活動為主
    dateViewpager.setSelection(today_index);

    // 取得今天活動列表
    handler.sendEmptyMessage(today_index);

    // 展開日歷
    calendar_open.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            refreshCalendar(calendars.get(dateViewpager.getSelectedItemPosition()));
            calendarLayout.setVisibility(View.VISIBLE);

            //                Animation in_Anim = AnimationUtils.loadAnimation(mContext,
            // getResourseIdByName(mContext.getPackageName(),"anim","slide_in_top"));

            Animation in_Anim = AnimationUtils.loadAnimation(mContext, R.anim.slide_in_top);

            in_Anim.setAnimationListener(
                new Animation.AnimationListener() {
                  @Override
                  public void onAnimationStart(Animation animation) {}

                  @Override
                  public void onAnimationEnd(Animation animation) {
                    calendarLayout.clearAnimation();
                  }

                  @Override
                  public void onAnimationRepeat(Animation animation) {}
                });

            calendarLayout.startAnimation(in_Anim);
          }
        });
  }
 @Override
 protected void initData() {
   sitList.setAdapter(new PatientZWZD04Adapter(this));
   sitList.setSelection(2);
   sitList.setOnItemSelectedListener(this);
 }