예제 #1
0
  public static void initImageLoaderConfig(Context context) {
    try {
      File cacheDir =
          StorageUtils.getOwnCacheDirectory(
              context, CommonUtil.getSavePath(SysConstant.FILE_SAVE_TYPE_IMAGE));
      File reserveCacheDir = StorageUtils.getCacheDirectory(context);

      int maxMemory = (int) (Runtime.getRuntime().maxMemory());
      // 使用最大可用内存值的1/8作为缓存的大小。
      int cacheSize = maxMemory / 8;
      DisplayMetrics metrics = new DisplayMetrics();
      WindowManager mWm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
      mWm.getDefaultDisplay().getMetrics(metrics);

      IMImageLoaderConfig =
          new ImageLoaderConfiguration.Builder(context)
              .memoryCacheExtraOptions(metrics.widthPixels, metrics.heightPixels)
              .threadPriority(Thread.NORM_PRIORITY - 2)
              //                    .denyCacheImageMultipleSizesInMemory()
              .memoryCache(new UsingFreqLimitedMemoryCache(cacheSize))
              .diskCacheFileNameGenerator(new Md5FileNameGenerator())
              .tasksProcessingOrder(QueueProcessingType.LIFO)
              .diskCacheExtraOptions(metrics.widthPixels, metrics.heightPixels, null)
              .diskCache(
                  new UnlimitedDiscCache(cacheDir, reserveCacheDir, new Md5FileNameGenerator()))
              .diskCacheSize(1024 * 1024 * 1024)
              .diskCacheFileCount(1000)
              .build();

      IMImageLoadInstance = ImageLoader.getInstance();
      IMImageLoadInstance.init(IMImageLoaderConfig);
    } catch (Exception e) {
      logger.e(e.toString());
    }
  }
예제 #2
0
  private void initImageLoader() {
    try {
      String CACHE_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + "/.temp_tmp";
      new File(CACHE_DIR).mkdirs();

      File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(), CACHE_DIR);

      DisplayImageOptions defaultOptions =
          new DisplayImageOptions.Builder()
              .cacheOnDisc(true)
              .imageScaleType(ImageScaleType.EXACTLY)
              .bitmapConfig(Bitmap.Config.RGB_565)
              .build();
      ImageLoaderConfiguration.Builder builder =
          new ImageLoaderConfiguration.Builder(getBaseContext())
              .defaultDisplayImageOptions(defaultOptions)
              .discCache(new UnlimitedDiscCache(cacheDir))
              .memoryCache(new WeakMemoryCache());

      ImageLoaderConfiguration config = builder.build();
      imageLoader = ImageLoader.getInstance();
      imageLoader.init(config);

    } catch (Exception e) {

    }
  }
예제 #3
0
  public HomePageWode3Adapter(Context context, UserModel user) {
    this.context = context;
    this.user = user;
    imageLoader = ImageLoader.getInstance();

    imageLoader.init(ImageLoaderConfiguration.createDefault(context));
  }
  static void updateAppWidget(
      Context context, final AppWidgetManager appWidgetManager, final int appWidgetId) {
    final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);

    ImageSize minImageSize = new ImageSize(70, 70); // 70 - approximate size of ImageView in widget
    ImageLoader.getInstance()
        .loadImage(
            context,
            IMAGES[0],
            minImageSize,
            optionsWithFakeDisplayer,
            new SimpleImageLoadingListener() {
              @Override
              public void onLoadingComplete(Bitmap loadedImage) {
                views.setImageViewBitmap(R.id.image_left, loadedImage);
                appWidgetManager.updateAppWidget(appWidgetId, views);
              }
            });
    ImageLoader.getInstance()
        .loadImage(
            context,
            IMAGES[1],
            minImageSize,
            optionsWithFakeDisplayer,
            new SimpleImageLoadingListener() {
              @Override
              public void onLoadingComplete(Bitmap loadedImage) {
                views.setImageViewBitmap(R.id.image_right, loadedImage);
                appWidgetManager.updateAppWidget(appWidgetId, views);
              }
            });
  }
예제 #5
0
  private void configImageLoader() {
    File cacheDir = StorageUtils.getCacheDirectory(getApplicationContext());
    if (cacheDir == null) {
      cacheDir = Environment.getDownloadCacheDirectory();
    }

    // TODO config image resolution cache for low end devices

    DisplayImageOptions options = getDefaultDisplayOptionsBuilder().build();
    int maxWidth = 800;
    int maxHeight = 480;
    int threadPoolSize = 1;

    ImageLoaderConfiguration.Builder builder =
        new ImageLoaderConfiguration.Builder(getApplicationContext())
            .threadPoolSize(threadPoolSize)
            .memoryCacheExtraOptions(maxWidth, maxHeight)
            .memoryCache(new LRULimitedMemoryCache(3 * 1024 * 1024))
            .diskCacheExtraOptions(maxWidth, maxHeight, null)
            .diskCache(new LimitedAgeDiskCache(cacheDir, 3600 * 24 * 7))
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator())
            .imageDownloader(new BaseImageDownloader(getApplicationContext()))
            .defaultDisplayImageOptions(options);

    ImageLoaderConfiguration config = builder.build();
    ImageLoader mImageLoader = ImageLoader.getInstance();
    mImageLoader.init(config);
  }
예제 #6
0
  @Override
  public View getView(int i, View view, ViewGroup viewGroup) {
    View row = view;
    MessageRoomItemHolder holder = null;

    if (row == null) {
      LayoutInflater layoutInflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = layoutInflater.inflate(R.layout.messages_room_item, viewGroup, false);
      holder = new MessageRoomItemHolder(row);
      row.setTag(holder);

    } else {
      holder = (MessageRoomItemHolder) row.getTag();
    }
    MessageRoomBean message_bean = listOfConversations.get(i);
    if (isCustomer) {
      loader.displayImage(listOfEventsImage.get(i), holder.customerOrEventImage);
    } else if (message_bean.getCustomerImageFacebookUrl() != null
        && !message_bean.getCustomerImageFacebookUrl().isEmpty()) {
      Picasso.with(context)
          .load(message_bean.getCustomerImageFacebookUrl())
          .into(holder.customerOrEventImage);
    } else if (message_bean.getCustomerImage() != null) {
      loader.displayImage(message_bean.getCustomerImage(), holder.customerOrEventImage);
    }
    holder.messageBody.setText(message_bean.getLastMessage());
    holder.customerOrEventName.setText(message_bean.getCustomer_id());
    holder.customerOrEventImage.setTag(message_bean);
    holder.customerOrEventName.setTag(message_bean);
    holder.messageBody.setTag(message_bean);

    return row;
  }
예제 #7
0
  @SuppressLint("SetJavaScriptEnabled")
  private void initView() {
    // TODO Auto-generated method stub
    product_detail_listview_image = (ImageView) findViewById(R.id.product_detail_listview_image);
    product_detail_listview_text_name =
        (TextView) findViewById(R.id.product_detail_listview_text_name);
    product_detail_listview_text_price =
        (TextView) findViewById(R.id.product_detail_listview_text_price);
    product_detail_listview_text_describe =
        (TextView) findViewById(R.id.product_detail_listview_text_describe);
    productWebView = (WebView) findViewById(R.id.product_webview);
    WebSettings webSettings = productWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

    webViewUtil = new WebViewUtil();

    imageLoader = ImageLoader.getInstance();
    imageLoader.init(ImageLoaderConfiguration.createDefault(this));
    options =
        new DisplayImageOptions.Builder()
            .displayer(new RoundedBitmapDisplayer(0xff000000, 10))
            .cacheInMemory()
            .cacheOnDisc()
            .build();

    product_detail_listview_text_name.setText(product.getProductName());
    product_detail_listview_text_price.setText(product.getProductPrice());
    product_detail_listview_text_describe.setText(product.getProductDescribe());
    imageLoader.displayImage(product.getImageUrl(), product_detail_listview_image, options);
  }
예제 #8
0
 /**
  * 删除缓存的图片
  *
  * @param url 缓存的图片的地址
  */
 public static void removeMemoryCache(String url) {
   if (TextUtils.isEmpty(url)) {
     return;
   }
   DiskCacheUtils.removeFromCache(url, ImageLoader.getInstance().getDiskCache());
   MemoryCacheUtils.removeFromCache(url, ImageLoader.getInstance().getMemoryCache());
 }
예제 #9
0
  public void parse(TimeLineModel data) {
    this.mData = data;
    if (data.hasPics || data.hasRepostPics) {
      mPic.setVisibility(GONE);
      mGridView.setVisibility(VISIBLE);
      mGridView.setAdapter(new GridPicsAdapter(getContext(), data.pics));
      LayoutParams lp = (LayoutParams) mCommentCount.getLayoutParams();
      lp.addRule(BELOW, R.id.timeline_listitem_picgrid);
      mCommentCount.setLayoutParams(lp);
    } else {
      mGridView.setVisibility(GONE);
      LayoutParams lp = (LayoutParams) mCommentCount.getLayoutParams();
      lp.addRule(BELOW, R.id.timeline_listitem_pic);
      mCommentCount.setLayoutParams(lp);
      if (data.hasPic || data.hasRepostPic) {
        mPic.setVisibility(VISIBLE);
        mPic.setGif(TextUtils.isGifLink(data.pics.get(0)));
        if (NetworkUtils.isWifi(getContext())) {
          ImageLoader.getInstance()
              .displayImage(data.pics.get(0).replace("thumbnail", "bmiddle"), mPic);
        } else {
          ImageLoader.getInstance().displayImage(data.pics.get(0), mPic);
        }
      } else {
        mPic.setVisibility(GONE);
      }
    }
    if (data.topics.size() == 0) {
      mTopic.setVisibility(INVISIBLE);
    } else {
      mTopic.setVisibility(VISIBLE);
      mTopic.setText(data.topics.get(0));
    }
    if (data.hasRepost) {
      mLine.setVisibility(VISIBLE);
      mRepostName.setVisibility(VISIBLE);
      mRepostText.setVisibility(VISIBLE);
      mRepostName.setText(data.repostName);
      mRepostText.setText(data.repostText);
    } else {
      mLine.setVisibility(GONE);
      mRepostName.setVisibility(GONE);
      mRepostText.setVisibility(GONE);
    }
    if (data.commentCount != 0) {
      mCommentCount.setText(data.commentCount + "");
    } else {
      mCommentCount.setText("评论");
    }
    if (data.repostCount != 0) {
      mRepostCount.setText(data.repostCount + "");
    } else {
      mRepostCount.setText("转发");
    }

    mText.setText(data.text);
    mName.setText(data.name);
    mTime.setText(data.time);
    ImageLoader.getInstance().displayImage(data.headUrl, mHead, mOptions);
  }
예제 #10
0
 /**
  * 给ImageView加载普通图片
  *
  * @param uri 图片资源所对应的URI
  * @param imageView 需要加载到的ImageView容器
  * @param options 自定义的Display
  * @param outsideLoadingListener 加载事件监听器
  * @param progressListener 进度监听器
  */
 private void loadImage(
     String uri,
     ImageView imageView,
     DisplayImageOptions options,
     ImageLoadingListener outsideLoadingListener,
     ImageLoadingProgressListener progressListener) {
   // use image cache
   String fileName = fileHandler.getFileNameInUrl(uri);
   String fullPath = mImageCacheDir + fileName;
   if (fileHandler.isFileExists(fullPath)) {
     imageLoader.displayImage(
         ImageLoaderHelper.URI_PREFIX_FILE + fullPath,
         imageView,
         options,
         outsideLoadingListener,
         progressListener);
   } else {
     imageLoader.displayImage(
         uri,
         imageView,
         options,
         new SaveCacheImageLoadingListener(fullPath, outsideLoadingListener),
         progressListener);
   }
 }
예제 #11
0
 public void init(Context context) {
   try {
     if (!ImageLoader.getInstance().isInited()) { // 未初始化则初始化
       // 默认缓存路径
       String cache_path = "";
       cache_path += PreferencesUtils.getString(context, "sys_path_sd_card");
       cache_path += PreferencesUtils.getString(context, "sys_path_app_folder");
       cache_path += PreferencesUtils.getString(context, "sys_path_cache");
       File cache = new File(cache_path);
       if (!cache.exists()) cache.mkdirs();
       // --
       ImageLoaderConfiguration.Builder config_builder =
           new ImageLoaderConfiguration.Builder(context);
       config_builder.threadPoolSize(3);
       config_builder.diskCacheSize(700 * 1024 * 1024);
       config_builder.diskCache(new UnlimitedDiscCache(cache));
       config_builder.diskCacheFileNameGenerator(new Md5FileNameGenerator());
       config_builder.tasksProcessingOrder(QueueProcessingType.FIFO);
       config_builder.imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000));
       // config_builder.writeDebugLogs();
       // --
       // ImageLoader.getInstance().destroy();
       ImageLoader.getInstance().init(config_builder.build());
     }
   } catch (Exception e) {
   }
 }
 public FriendListAdapter(FriendListFragment mContext, List<FriendModel> friendsList) {
   this.mContext = mContext;
   this.friendsList = friendsList;
   imageLoader = ImageLoader.getInstance();
   ImageLoaderConfiguration ilc = ImageLoaderConfiguration.createDefault(mContext);
   imageLoader.init(ilc);
 }
예제 #13
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    final Image image = getItem(position);

    if (convertView == null) {
      convertView =
          LayoutInflater.from(getContext()).inflate(R.layout.gallery_image_layout, parent, false);
    }

    ImageLoader imageLoader = ImageLoader.getInstance();

    ImageView IVGalleryImage = (ImageView) convertView.findViewById(R.id.IVGalleryImage);
    imageLoader.displayImage(image.getThumbURL(), IVGalleryImage);

    IVGalleryImage.setClickable(true);
    IVGalleryImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            State.setImage(image);
            Intent intent = new Intent(context, ImageActivity.class);
            context.startActivity(intent);
          }
        });

    return convertView;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_profile_detail, container, false);

    // Initializes an imageView
    imgview = ((ImageView) rootView.findViewById(R.id.imageDetail));
    if (mItem.picurl != "") {

      // Fills the imageView with universalImageLoader
      ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity()).build();
      imageLoader = ImageLoader.getInstance();
      imageLoader.init(config);
      imageLoader.loadImage(
          mItem.picurl,
          new SimpleImageLoadingListener() {
            @Override
            public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
              imgview.setImageBitmap(loadedImage);
            }
          });
    } else imgview.setImageResource(R.drawable.nopic);
    if (mItem != null) {
      ((TextView) rootView.findViewById(R.id.textUsername)).setText('[' + mItem.username + ']');
      ((TextView) rootView.findViewById(R.id.textMajor)).setText(mItem.dept);
      ((TextView) rootView.findViewById(R.id.textBoxNum)).setText(mItem.boxno);
      ((TextView) rootView.findViewById(R.id.textPhone)).setText(mItem.phonenum);
      ((TextView) rootView.findViewById(R.id.textAddress)).setText(mItem.campusaddress);
      ((TextView) rootView.findViewById(R.id.textName))
          .setText(mItem.lastName + " " + mItem.firstName);
      // ((TextView) rootView.findViewById(R.id.textAll)).setText(mItem.toString());
    }
    return rootView;
  }
예제 #15
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    ImageLoaderConfiguration conf = new ImageLoaderConfiguration.Builder(getActivity()).build();
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(conf);

    adapter = new FriendsArrayAdapter(getActivity(), R.layout.row_friends, imageLoader, this);
    setListAdapter(adapter);

    realm = Realm.getInstance(getActivity());

    RealmResults<Friend> results = realm.allObjects(Friend.class); // TODO: Run async

    if (results.size() > 0) {
      if (!compact) {
        getListView().setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.GONE);
      }
      adapter.update(results);
    }

    refreshFriends(); // TODO: Timeout on the refresh rate?
  }
예제 #16
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView =
        (ViewGroup) inflater.inflate(R.layout.fragment_sale_skidkaonline, container, false);
    setHasOptionsMenu(true);
    setRetainInstance(true);

    sale = getArguments().getParcelable(CURRENT_SALE_TAG);

    progressBar = (CircularProgressView) rootView.findViewById(R.id.fragment_sale_progressbar);
    imageView = (SubsamplingScaleImageView) rootView.findViewById(R.id.fragment_sale_imageview);
    imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
    imageView.setMaxScale(getResources().getDimension(R.dimen.image_maximum_scale));

    File smallFile = ImageLoader.getInstance().getDiskCache().get(sale.getSmallImageUrl());
    if (smallFile != null) {
      imageView.setImage(ImageSource.uri(smallFile.getAbsolutePath()));
      loadBigImage();
    } else {
      ImageLoader.getInstance()
          .loadImage(
              sale.getSmallImageUrl(),
              null,
              UIL.getScaleImageOptions(),
              new ImageLoadingListener() {
                @Override
                public void onLoadingStarted(String s, View view) {
                  progressBar.setVisibility(View.VISIBLE);
                }

                @Override
                public void onLoadingFailed(String s, View view, FailReason failReason) {
                  progressBar.setVisibility(View.GONE);
                }

                @Override
                public void onLoadingComplete(String s, View view, Bitmap bitmap) {
                  File smallFile =
                      ImageLoader.getInstance().getDiskCache().get(sale.getSmallImageUrl());
                  if (smallFile != null) {
                    imageView.setImage(ImageSource.uri(smallFile.getAbsolutePath()));
                  }
                  bitmap.recycle();
                  loadBigImage();
                }

                @Override
                public void onLoadingCancelled(String s, View view) {}
              },
              new ImageLoadingProgressListener() {
                @Override
                public void onProgressUpdate(String s, View view, int progress, int size) {
                  progressBar.setProgress(progress * 500 / size);
                }
              });
    }
    return rootView;
  }
예제 #17
0
 public static void loadImage(String path, ImageLoadingListener listener) {
   ImageLoader loader = ImageLoader.getInstance();
   try {
     loader.loadImage(path, DEFAULT_DISPLAY_IMAGE_OPTIONS, listener);
   } catch (OutOfMemoryError e) {
     e.printStackTrace();
   }
 }
예제 #18
0
 public NotificationAdapter(
     Context context, List<ListNotificationResponse.ListNotification> list) {
   inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   this.list = list;
   imageLoader = ImageLoader.getInstance();
   imageLoader.init(ImageLoaderConfiguration.createDefault(context));
   options = ImageLoaderInitializer.getDisplayImageOptionWithFade();
 }
예제 #19
0
    @Override
    protected void onPostExecute(Void result) {
      super.onPostExecute(result);

      ImageLoader.getInstance().clearDiskCache();
      ImageLoader.getInstance().clearMemoryCache();
      adapter.notifyDataSetChanged();
      progressDialog.dismiss();
    }
예제 #20
0
 public static void displayRoundImage(ImageView view, String path, ImageLoadingListener listener) {
   ImageLoader loader = ImageLoader.getInstance();
   try {
     loader.displayImage(path, view, ROUND_DISPLAY_IMAGE_OPTIONS, listener);
   } catch (OutOfMemoryError e) {
     e.printStackTrace();
     loader.clearMemoryCache();
   }
 }
예제 #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photo_lview);
    //		UtilMethod.showProgressDialog(PhotoLView.this);
    ImageLoader imageLoader = ImageLoader.getInstance();
    DisplayImageOptions options =
        new DisplayImageOptions.Builder()
            .showImageForEmptyUri(R.drawable.default_photo)
            .cacheInMemory(false)
            .cacheOnDisc(false)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();
    path = getIntent().getStringExtra("photo_path");
    type = getIntent().getStringExtra("type");
    LinearLayout linearRight = (LinearLayout) findViewById(R.id.topbar_linear2);
    LinearLayout linearLeft = (LinearLayout) findViewById(R.id.topbar_linear1);
    if ("0".equals(type)) {
      linearRight.setVisibility(View.VISIBLE);
      linearRight.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View arg0) {
              // TODO Auto-generated method stub
              Intent data = new Intent();
              data.putExtra("sendImg", path);
              setResult(Activity.RESULT_OK, data);
              finish();
            }
          });
    } else {
      linearRight.setVisibility(View.INVISIBLE);
    }
    TextView tView = (TextView) findViewById(R.id.topbar_tv);
    tView.setText("个人图像");
    ImageView photo_img = (ImageView) findViewById(R.id.large_photo);
    linearLeft.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    try {
      if ("0".equals(type)) {
        imageLoader.displayImage("file://" + path, photo_img, options);
      } else {
        imageLoader.displayImage(path, photo_img, options);
      }
      //			UtilMethod.dismissProgressDialog(PhotoLView.this);
    } catch (Exception e) {
      // TODO: handle exception
      Toast.makeText(PhotoLView.this, "文件没有找到", 2000).show();
    }
  }
예제 #22
0
  /** 初始化ImageLoader,在Application中执行 */
  @Override
  public void initImageLoader() {
    initUIL();

    if (imageLoader == null) imageLoader = ImageLoader.getInstance();
    if (!imageLoader.isInited()) imageLoader.init(defaultUilLoader);

    mImageCacheDir = fileHandler.getCacheDirByType(CacheDir.IMAGE);
  }
  @Override
  protected void onActivityResult(int arg1, int arg0, Intent arg2) {
    super.onActivityResult(arg1, arg0, arg2);

    if (arg1 == REQUEST_CODE && arg0 == RESULT_OK) {
      if (mList != null) {
        mList.clear();
      }
      mImageUri = arg2.getData();
      if (mImageUri != null) {
        String path = getImagePath(mImageUri);
        mList.add(path);
        imageLoader.displayImage(
            mList.get(0).replace("/mnt", "file:/"), user_manager_user_head, options);
      }

    } else if (arg1 == REQUEST_CODE1 && arg0 == Activity.RESULT_OK) {
      if (mList != null) {
        mList.clear();
      }
      if (file != null && file.exists()) {
        mList.add(file.getPath());
        imageLoader.displayImage(
            mList.get(0).replace("/mnt", "file:/"), user_manager_user_head, options);
      }
    }

    if (arg0 == MyConstants.REQUEST_NICKNAME) {
      nicknameTextView.setText(arg2.getExtras().getString("nickname"));
    }
    if (arg0 == MyConstants.REQUEST_PASSWORD) {
      if (arg2.getExtras().getString("password") != null) {
        user_manager_alter_passwd_stub.setText(arg2.getExtras().getString("password"));
        pwchange = true;
      }
    }
    if (arg0 == MyConstants.REQUEST_NAME) {
      user_manager_tv_name.setText(arg2.getExtras().getString("name"));
    }
    if (arg0 == MyConstants.REQUEST_PHONENUB) {
      user_manager_tv_phonnumber.setText(arg2.getExtras().getString("phonenub"));
    }
    if (arg0 == MyConstants.REQUEST_EMAIL) {
      user_manager_tv_qq.setText(arg2.getExtras().getString("email"));
    }
    if (arg0 == MyConstants.REQUEST_ADDRESS) {
      user_manager_tv_address.setText(arg2.getExtras().getString("address"));
    }
    if (arg0 == MyConstants.REQUEST_NET) {
      user_manager_tv_net.setText(arg2.getExtras().getString("net"));
    }

    if (arg0 == MyConstants.REQUEST_COMPANY) {
      user_manager_tv_company.setText(arg2.getExtras().getString("company"));
    }
  }
예제 #24
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    View row = convertView;
    ImageHolder holder = null; // מחזיק שורה

    if (row == null) {
      // מקשרים לתצוגה
      LayoutInflater inflater = ((Activity) context).getLayoutInflater();
      // קישור לשורה בקמל
      row = inflater.inflate(R.layout.row_movie_search, parent, false);

      // המחזיק אליו פונים לשני המקומות
      holder = new ImageHolder();
      // בשביל הטקסט
      holder.ObjectName = (TextView) row.findViewById(R.id.textViewnamemovie);
      holder.ObjectId = (TextView) row.findViewById(R.id.textViewidmovie);

      // בשביל הפונוט
      Typeface font =
          Typeface.createFromAsset(getContext().getAssets(), "fonts/CinzelDecorative-Regular.ttf");
      holder.ObjectName.setTypeface(font);

      // Objectliner בשביל צבע שורה
      holder.Objectliner = (LinearLayout) row.findViewById(R.id.LinearLayoutrow);
      // כל שורה זוגית נצבע בלבן
      if (position % 2 == 0) {
        holder.Objectliner.setBackgroundColor(0xffffffff);
      }

      // בשביל התמונה
      holder.Objectimage = (ImageView) row.findViewById(R.id.imageViewpic);
      row.setTag(holder);
    } else {
      holder = (ImageHolder) row.getTag();
    }
    // לתמונה מהקלאס
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).build();
    ImageLoader.getInstance().init(config);
    DisplayImageOptions option =
        new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisc(true).build();

    // קישור לתוכן
    Movie movie = ListObject.get(position);
    holder.ObjectName.setText(movie.getSubject());
    holder.ObjectId.setText(movie.getMovieid());

    // בשביל התמונה
    ImageLoader.getInstance().displayImage(movie.getUrlImage(), holder.Objectimage, option);

    // לאנמציה
    Animation animation = AnimationUtils.loadAnimation(context, R.anim.push_left_in);
    row.startAnimation(animation);

    return row;
  }
  public StickyGridAdapter(Activity activity, List<PictureItem> hasHeaderIdList) {

    this.mActivity = activity;
    mInflater = LayoutInflater.from(mActivity);
    this.hasHeaderIdList = hasHeaderIdList;
    mImageLoader = ImageLoader.getInstance();
    ImageLoaderConfiguration configuration = ImageLoaderConfiguration.createDefault(mActivity);
    if (!mImageLoader.isInited()) {
      mImageLoader.init(configuration);
    }
  }
예제 #26
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder2 viewHolder2 = null;
    if (convertView == null) {
      viewHolder2 = new ViewHolder2();
      convertView = LayoutInflater.from(context).inflate(R.layout.item_system_news, null);
      viewHolder2.time2 = (TextView) convertView.findViewById(R.id.tv_ptimes);
      viewHolder2.title = (TextView) convertView.findViewById(R.id.tv_titles);
      viewHolder2.desc = (TextView) convertView.findViewById(R.id.tv_desc);
      viewHolder2.image = (ImageView) convertView.findViewById(R.id.iv_imgs);
      viewHolder2.rl_tt = (RelativeLayout) convertView.findViewById(R.id.rl_yuanw);
      convertView.setTag(viewHolder2);
    } else {
      viewHolder2 = (ViewHolder2) convertView.getTag();
    }
    final SystemNewsEntity entity = list.get(position);
    viewHolder2.time2.setText(entity.getAdd_time());
    viewHolder2.title.setText(entity.getTitle());
    viewHolder2.desc.setText(entity.getContent());
    String imgs = entity.getPicture();
    final String url = entity.getLinkurl();
    /** 图片要经过处理的 */
    ImageLoader imageLoader = null;

    // 图片
    if (imageLoader == null) {
      imageLoader = MyApplication.getInstance().getImageLoader();
    }

    DisplayImageOptions options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.mipmap.logo)
            .showImageForEmptyUri(R.mipmap.logo)
            .showImageOnFail(R.mipmap.logo)
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(200))
            .build();
    imageLoader.displayImage(imgs, viewHolder2.image, options);
    viewHolder2.rl_tt.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            T.ss("查看原文");
            //  Uri uri = Uri.parse(url);
            Intent intent = new Intent(context, WebActivity.class);
            intent.putExtra("url", entity.getLinkurl());
            intent.putExtra("title", "系统消息");
            context.startActivity(intent);
          }
        });
    return convertView;
  }
예제 #27
0
 /**
  * 显示url地址的图片到targetView
  *
  * @param url 本地/网络图片地址
  * @param targetView 目标View
  * @param displayOptions 图片配置
  */
 public static void displayImage(
     String url, ImageView targetView, DisplayImageOptions displayOptions) {
   String newUrl = url;
   if (!TextUtils.isEmpty(url) && new File(url).exists()) {
     newUrl = LOCAL_URL_PATH_SYMBOL + url;
   }
   if (displayOptions == null) {
     ImageLoader.getInstance().displayImage(newUrl, targetView);
   } else {
     ImageLoader.getInstance().displayImage(newUrl, targetView, displayOptions);
   }
 }
예제 #28
0
 /** 带回调的缓存图片 */
 public static void loadImage(String url, ImageLoadingListener imageLoadingListener) {
   if (TextUtils.isEmpty(url)) {
     return;
   }
   // 本地图片
   if (!url.toLowerCase().startsWith(URL_PATH_SYMBOL)) {
     String newUrl = LOCAL_URL_PATH_SYMBOL + url;
     ImageLoader.getInstance().loadImage(newUrl, imageLoadingListener);
   } else { // 网络图片
     ImageLoader.getInstance().loadImage(url, imageLoadingListener);
   }
 }
 private void initImageLoader() {
   mImageLoader = ImageLoader.getInstance();
   mImageLoader.init(ImageLoaderConfiguration.createDefault(context));
   mOptions =
       new DisplayImageOptions.Builder() //
           .showImageOnLoading(R.drawable.loading) //
           .showImageForEmptyUri(R.drawable.empty_img) //
           .showImageOnFail(R.drawable.empty_img) //
           .cacheInMemory(true) //
           .cacheOnDisc(true) //
           .build();
 }
예제 #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_example);

    final ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(ImageLoaderConfiguration.createDefault(this));

    final LinkedList<PinchImageView> viewCache = new LinkedList<PinchImageView>();

    final PinchImageViewPager pager = (PinchImageViewPager) findViewById(R.id.pager);
    pager.setAdapter(
        new PagerAdapter() {
          @Override
          public int getCount() {
            return mImages.length;
          }

          @Override
          public boolean isViewFromObject(View view, Object o) {
            return view == o;
          }

          @Override
          public Object instantiateItem(ViewGroup container, int position) {
            PinchImageView piv;
            if (viewCache.size() > 0) {
              piv = viewCache.remove();
              piv.reset();
            } else {
              piv = new PinchImageView(ExampleActivity.this);
            }
            DisplayImageOptions options =
                new DisplayImageOptions.Builder().resetViewBeforeLoading(true).build();
            imageLoader.displayImage(mImages[position], piv, options);
            container.addView(piv);
            return piv;
          }

          @Override
          public void destroyItem(ViewGroup container, int position, Object object) {
            PinchImageView piv = (PinchImageView) object;
            container.removeView(piv);
            viewCache.add(piv);
          }

          @Override
          public void setPrimaryItem(ViewGroup container, int position, Object object) {
            pager.setMainPinchImageView((PinchImageView) object);
          }
        });
  }