Esempio n. 1
0
 private void initData(
     List<Map<String, Object>> list,
     List<Map<String, Object>> cache_list,
     final List<Map<String, Object>> cache_top,
     int index,
     ListView mListView,
     Gallery mGallery) {
   if (ConnectionUtil.isConnet(mContext)) {
     if (cache_list.size() > 0) {
       adapter =
           new NewsListAdapter(mContext, R.layout.activity_item, viewId, cache_list, dataName);
       mListView.setAdapter(adapter);
     } else {
       new CarNewsListTask(this).execute((String) list.get(index).get("link"));
     }
     if (cache_top.size() > 0) {
       mGallery.setAdapter(new TopAdapter(mContext, activity, cache_top));
     } else {
       new TopListTask(this).execute((String) list.get(index).get("typeid"));
     }
   } else {
     adapter = new NewsListAdapter(mContext, R.layout.activity_item, viewId, cache_list, dataName);
     mListView.setAdapter(adapter);
     mGallery.setAdapter(new TopAdapter(mContext, activity, cache_top));
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_tv_1, container, false);
    mListViewLayout = v.findViewById(R.id.list_layout);
    mGalleryLayout = v.findViewById(R.id.tv_gallery_layout);
    mListCover = v.findViewById(R.id.list_cover);
    mTvLeft = v.findViewById(R.id.tv_left);
    mTvRight = v.findViewById(R.id.tv_right);

    mListView = (ListView) v.findViewById(R.id.tv_list);
    mListViewAdapter = new ListViewAdapter(getActivity());
    mListView.setAdapter(mListViewAdapter);
    mListView.setOnItemSelectedListener(this);
    mListView.setOnItemClickListener(this);

    mGallery = (Gallery) v.findViewById(R.id.tv_gallery);
    mGalleryAdapter = new GalleryAdapter(getActivity());
    mGallery.setAdapter(mGalleryAdapter);

    mProgressBar = (ProgressBar) v.findViewById(R.id.loading);

    setViewsVisiable(View.GONE);

    init();

    return v;
  }
Esempio n. 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) {}
          });
    }
  private void init() {
    // 取得诸控件
    // initTopBarForLeft(good.getTitle());
    bar = (ActionBar) findViewById(R.id.headbar);
    bar.setTitleAndLeftButton(R.drawable.back, "详情");
    bar.setOnLeftButtonClickListener(
        new onLeftButtonClickListener() {

          @Override
          public void onClick() {
            finish();
          }
        });

    // btnchat = (Button) findViewById(R.id.chat);
    chat = (LinearLayout) findViewById(R.id.chat);
    comment = (LinearLayout) findViewById(R.id.ping);
    comment_text = (EditText) findViewById(R.id.good_pinglun);
    commentlist = (ListView) findViewById(R.id.pinglun);
    data = new ArrayList<Comment>();
    adapter = new GoodsCommentAdapter(getApplication(), data);
    commentlist.addHeaderView(createListHeadView());
    commentlist.setAdapter(adapter);
    nickname.setText(good.getUser().getNick()); // 昵称
    good_createtime.setText(good.getCreatedAt()); // 物品发表时间
    gallery.setAdapter(galleryAdpter = new GalleryAdpter(mApplication, good.getPicture()));
    user = good.getUser(); // 获得商品的发表用户
    goodTitle.setText(good.getTitle());
    goodPrice.setText("   ¥" + good.getPrice());
    goodContent.setText(good.getContent());
    head.setImageUrl(good.getUser().getAvatar());
    gridViewPic.setAdapter(new myAdapter(this, good.getPicture()));
    getComment();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (LauncherLog.DEBUG) {
      LauncherLog.d(TAG, "onCreateView: mEmbedded = " + mEmbedded + ", container = " + container);
    }
    findWallpapers();

    /* If this fragment is embedded in the layout of this activity, then we should
     * generate a view to display. Otherwise, a dialog will be created in
     * onCreateDialog()
     */
    if (mEmbedded) {
      View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
      view.setBackground(mWallpaperDrawable);

      final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
      gallery.setCallbackDuringFling(false);
      gallery.setOnItemSelectedListener(this);
      gallery.setAdapter(new ImageAdapter(getActivity()));

      View setButton = view.findViewById(R.id.set);
      setButton.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              selectWallpaper(gallery.getSelectedItemPosition());
            }
          });
      return view;
    }
    return null;
  }
Esempio n. 6
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.vietchu);
   toolbar = (Toolbar) findViewById(R.id.toolbar);
   toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_left_arrow));
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent i = new Intent(vietchu.this, GameS.class);
           startActivity(i);
           finish();
         }
       });
   toolbar.setTitle("Bé tập viết chữ");
   Gallery gallery = (Gallery) findViewById(R.id.gallery1);
   gallery.setAdapter(new ImageAdapter(getApplicationContext()));
   //	gallery.setAdapter(new ImageAdapter(getApplicationContext();
   gesture = (GestureOverlayView) findViewById(R.id.gestureOverlayView1);
   vietlai = (Button) findViewById(R.id.btn_vietlai);
   vietlai.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           gesture.cancelClearAnimation();
           gesture.clear(true);
         }
       });
 }
  /** Called when the activity is first created. */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
    currentView = 0;

    mGestureSensor = new CameraGestureSensor(this);
    mGestureSensor.addGestureListener(this);
    mGestureSensor.enableClickByColor(true);
    mGestureSensor.addClickListener(this);

    mOpenCVInitiated = false;

    imageView = (ImageView) findViewById(R.id.ImageView01);
    imageView.setImageResource(pics[currentView]);

    ga = (Gallery) findViewById(R.id.Gallery01);
    ga.setAdapter(new ImageAdapter(this));
    ga.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapter, View givenView, int index, long arg3) {
            Toast.makeText(getBaseContext(), "A click was recieved!", Toast.LENGTH_SHORT).show();
            imageView.setImageResource(pics[index]);
            currentView = index;
          }
        });
  }
Esempio n. 8
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_image_gallery, container, false);
    final TParkInfo_LocEntity tParkInfo_LocEntity =
        (TParkInfo_LocEntity) getActivity().getIntent().getSerializableExtra("parkinfo");
    ; // 从当前Activity中获得
    imageUrls = new String[tParkInfo_LocEntity.parkInfo.imgUrlArray.size()];

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_stub)
            .showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_empty)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    Gallery gallery = (Gallery) view.findViewById(R.id.gallery);

    gallery.setAdapter(new ImageGalleryAdapter());
    gallery.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
          }
        });
    return view;
  }
  @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);
          }
        });
  }
Esempio n. 10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_principal);

    Gallery minhaGaleria = (Gallery) findViewById(R.id.galeriaImagem);
    minhaGaleria.setAdapter(new AdaptadorImagens(this));
  }
Esempio n. 11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.to_do_gallery);

    Gallery tagViews = (Gallery) findViewById(R.id.to_do_tag_list);

    tagViews.setAdapter(new ImageAdapter());
  }
Esempio n. 12
0
 public void setImages(String[] pics) {
   adapter.setFiles(pics);
   if (resourceId != -1) {
     ((Gallery) container.$form().findViewById(resourceId)).setAdapter(adapter);
     ((Gallery) container.$form().findViewById(resourceId)).requestLayout();
   } else {
     view.setAdapter(adapter);
     view.requestLayout();
   }
 }
Esempio n. 13
0
 public ImageGallery(ComponentContainer container, String[] picnames, int[] basestyle) {
   super(container);
   view = new Gallery(container.$context());
   adapter = new ImageAdapter(container.$context(), basestyle);
   adapter.setFiles(picnames);
   view.setAdapter(adapter);
   view.setOnItemClickListener(this);
   container.$add(this);
   view.requestLayout();
 }
Esempio n. 14
0
 public void setPicSize(int width, int height) {
   adapter.setWidth(width);
   adapter.setHeight(height);
   if (resourceId != -1) {
     ((Gallery) container.$form().findViewById(resourceId)).setAdapter(adapter);
     ((Gallery) container.$form().findViewById(resourceId)).requestLayout();
   } else {
     view.setAdapter(adapter);
     view.requestLayout();
   }
 }
Esempio n. 15
0
 public ImageGallery(
     ComponentContainer container, String[] picnames, int[] basestyle, int resourceId) {
   super(container, resourceId);
   view = null;
   Gallery view = (Gallery) container.$form().findViewById(resourceId);
   adapter = new ImageAdapter(container.$context(), basestyle);
   adapter.setFiles(picnames);
   view.setAdapter(adapter);
   view.setOnItemClickListener(this);
   view.requestLayout();
 }
Esempio n. 16
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Getting gallery from XML
    Gallery mGallery = (Gallery) findViewById(R.id.my_gallery);

    // Creating a custom adapter to set the gallery items
    MyAdapter adapter = new MyAdapter(getBaseContext());
    mGallery.setAdapter(adapter);
  }
Esempio n. 17
0
 @Override
 public void onTopListGetted(Top[] top) {
   final List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
   for (TopListEntity.Top t : top) {
     if (t != null) {
       Map<String, Object> map = new HashMap<String, Object>();
       map.put(dataName[0], t.id == null ? "" : t.id);
       map.put(dataName[1], t.title == null ? "" : t.title);
       map.put(dataName[3], t.link == null ? "" : t.link);
       map.put(dataName[4], t.image == null ? "" : t.image);
       list.add(map);
     }
   }
   if (currentPage == 1) {
     mGallery1.setAdapter(new TopAdapter(mContext, activity, list));
     FileRWUtil.writeObjToFile(list, CarUrl.TOP_FIRST_LIST);
   } else if (currentPage == 2) {
     mGallery2.setAdapter(new TopAdapter(mContext, activity, list));
     FileRWUtil.writeObjToFile(list, CarUrl.TOP_SECOND_LIST);
   }
 }
Esempio n. 18
0
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
   super.onActivityCreated(savedInstanceState);
   mAdapter = new ImagesAdapter(getApplication());
   mGallery.setAdapter(mAdapter);
   mGallery.setOnItemClickListener(this);
   mLoadImagesIndicator.setOnClickListener(this);
   if (mData.size() > 0
       && mPreferences.getBoolean(PREFERENCE_KEY_LOAD_MORE_AUTOMATICALLY, false)) {
     show();
   }
 }
Esempio n. 19
0
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.image);
		title=(TextView) findViewById(R.id.logo);
		
		
		GameSave = getSharedPreferences("cn.Arthur.Game.ClothesHeartCG", 0);
		ReadTimes = GameSave.getInt("ReadTimes", 0);
		if (ReadTimes>1000) isUnlock=true;
		ImageList = getImagesFromSD();
		
		/**
		 * xml获取Switcher 
		 */
		mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
		mSwitcher.setFactory(this);

		mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.slide_in_left));

		mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.slide_out_right));

		/**
		 * xml获取Gallery
		 */
		Gallery g = (Gallery) findViewById(R.id.mygallery);

		
		if(ImageList == null || ImageList.size() == 0)
			return;
		
		/**
		 * 创建适配器,注册适配器
		 */
		g.setAdapter(new ImageAdapter(this, ImageList));

		g.setOnItemSelectedListener(this);

		/**
		 * 点击事件监听器
		 */
		g.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				
			}
		});
		SpotManager.getInstance(this).showSpotAds(this);
	}
Esempio n. 20
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;
   }
 }
Esempio n. 21
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.icon_change);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon);

    String[] projection = {MediaStore.Images.Thumbnails._ID};
    mCursor =
        managedQuery(
            MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
            projection,
            null,
            null,
            MediaStore.Images.Thumbnails.IMAGE_ID);
    mIDFieldIndex = mCursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);

    imageSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    imageSwitcher.setFactory(this);
    imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
    imageSwitcher.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String[] projection = {MediaStore.Images.Media.DATA};
            Cursor cursor =
                managedQuery(
                    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, null);
            int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            cursor.moveToPosition(mPosition);
            String path = cursor.getString(columnIndex);
            if (path != null) {
              Intent data = new Intent();
              data.putExtra("path", path);
              setResult(RESULT_OK, data);
            }
            cursor.close();
            finish();
          }
        });

    Gallery gallery = (Gallery) findViewById(R.id.gallery);
    gallery.setAdapter(new ExternalImagesAdapter());
    gallery.setOnItemSelectedListener(this);
  }
  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);
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    findWallpapers();

    setContentView(R.layout.wallpaper_chooser);

    mGallery = (Gallery) findViewById(R.id.gallery);
    mGallery.setAdapter(new ImageAdapter(this));
    mGallery.setOnItemSelectedListener(this);
    mGallery.setCallbackDuringFling(false);

    findViewById(R.id.set).setOnClickListener(this);

    mImageView = (ImageView) findViewById(R.id.wallpaper);
  }
Esempio n. 25
0
  /**
   * On the start of the activity use the selected photo and compare to the next closest photo by
   * default and then allow the user to select the second photo to compare to
   *
   * @param savedInstanceState all extras passed from the previous intents
   */
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setCount(0);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.photo_comp);

    Vector<String> group = new Vector<String>();
    Vector<PhotoEntry> photo = new Vector<PhotoEntry>();

    Bundle extra = getIntent().getExtras();

    final int photoId = (Integer) extra.get("photo");

    photoEntry = PhotoApplication.getPhotoByID(photoId);
    group.add(photoEntry.getGroup());

    groupText = (TextView) findViewById(R.id.comp_group);
    groupText.setText(photoEntry.getGroup().toString());

    photo = PhotoApplication.getPhotosByValues(group, null);

    photoThumbIds = new Bitmap[photo.size()];
    for (int i = 0; i < photo.size(); i++) {

      photoThumbIds[i] = photo.elementAt(i).getThumbnail();
    }

    photoImageIds = new Bitmap[photo.size()];
    for (int i = 0; i < photo.size(); i++) {

      photoThumbIds[i] = photo.elementAt(i).getBitmap();
    }

    firstPhoto = (ImageView) findViewById(R.id.Photo1);
    secondPhoto = (ImageView) findViewById(R.id.Photo2);

    Gallery compGallery = (Gallery) findViewById(R.id.compGallery);

    compGallery.setAdapter(new ImageAdapter(this));
    compGallery.setOnItemSelectedListener(this);
  }
Esempio n. 26
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photo);
    Gallery g = (Gallery) findViewById(R.id.gallery);

    // 添加一个ImageAdapter并设置给Gallery对象
    g.setAdapter(new ImageAdapter(this, getSD()));

    // 设置一个itemclickListener事件
    g.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub

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

    imageSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    imageSwitcher.setFactory(this);
    imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));

    Gallery gallery = (Gallery) findViewById(R.id.gallery);
    gallery.setAdapter(new ImageAdapter(getBaseContext()));
    gallery.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            imageSwitcher.setImageResource(imageIDs[position]);
          }
        });
  }
Esempio n. 28
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.albums);

    city = getIntent().getExtras();

    albumName = city.get("albumName").toString();

    ((TextView) findViewById(R.id.albumNameTV)).setText(albumName);
    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
  }
 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]);
 }
Esempio n. 30
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.galleryactivity);

    Gallery gallery = (Gallery) findViewById(R.id.gallery1);
    selectedImage = (ImageView) findViewById(R.id.imageView1);
    gallery.setSpacing(1);
    gallery.setAdapter(new GalleryImageAdapter(this));

    // clicklistener for Gallery
    gallery.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            // TODO Auto-generated method stub
            // Toast.makeText(GalleryActivity.this, "Your selected position = " + position,
            // Toast.LENGTH_SHORT).show();
            // show the selected Image
            selectedImage.setImageResource(mImageIds[position]);
          }
        });
  }