@Override
  public View getView(int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
      convertView = context.getLayoutInflater().inflate(R.layout.custom_listview, parent, false);
    }

    noticeTitle = (TextView) convertView.findViewById(R.id.notice_title);
    mNetworkImageView = (NetworkImageView) convertView.findViewById(R.id.networkImageView);

    createdAt = (TextView) convertView.findViewById(R.id.created_at);
    department = (TextView) convertView.findViewById(R.id.department);

    mImageLoader = CustomVolleyRequestQueue.getInstance(context).getImageLoader();
    // Image URL - This can point to any image file supported by Android
    final String url = data.get(position).getImage();
    mImageLoader.get(
        url,
        ImageLoader.getImageListener(
            mNetworkImageView, R.mipmap.ic_launcher, android.R.drawable.ic_dialog_alert));
    mNetworkImageView.setImageUrl(url, mImageLoader);
    noticeTitle.setText(data.get(position).getNotice());
    noticPostDate = formateStringDate(data.get(position).getCreatedAt());
    createdAt.setText(noticPostDate);
    department.setText("Notice From - " + data.get(position).getDepartment());
    Log.d("simul", noticPostDate);

    return convertView;
  }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
      Context context = ImageShowActivity.this;

      int padding = context.getResources().getDimensionPixelSize(R.dimen.padding_medium);
      ImageLocation imageLocation = imageLocations.get(position);
      if (imageLocation.isLocal()) {
        ImageView imageView = new ImageView(context);
        imageView.setPadding(padding, padding, padding, padding);
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        imageView.setImageURI(imageLocation.getUri());
        container.addView(imageView, 0);
        return imageView;
      } else {

        NetworkImageView imageView = new NetworkImageView(context);

        imageView.setPadding(padding, padding, padding, padding);
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        imageView.setImageUrl(
            API_IMAGE_GET + imageLocation.getId(), BaseApplication.baseApplication.mImageLoader);

        container.addView(imageView, 0);
        return imageView;
      }
    }
示例#3
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    if (inflater == null)
      inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) convertView = inflater.inflate(R.layout.list_row, null);

    if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader();
    NetworkImageView thumbNail = (NetworkImageView) convertView.findViewById(R.id.thumbnail);
    TextView username = (TextView) convertView.findViewById(R.id.username);
    TextView phone = (TextView) convertView.findViewById(R.id.phone);

    // getting user data for the row
    User user = userItems.get(position);

    // thumbnail image
    thumbNail.setImageUrl(user.getThumbnailUrl(), imageLoader);

    // username
    username.setText(user.getUsername());

    // phone
    phone.setText(user.getPhone());

    return convertView;
  }
示例#4
0
  @SuppressLint("NewApi")
  private void resue() {
    String url = Config.SERVICEURL;
    url = url.substring(0, url.length() - 1);
    for (int i = 0; i < pictureTypes.size(); i++) {
      NetworkImageView niv = new NetworkImageView(this);

      niv.setImageUrl(
          url + pictureTypes.get(i).getTp_pic(),
          new VolleyUtils()
              .getImageLoader(
                  PictureTypeActivity.this,
                  new HttpCallback() {

                    @Override
                    public void httpCallback(Object oj) {
                      // TODO Auto-generated method stub
                      if (wd.isShowing()) {
                        wd.dismiss();
                      }
                    }
                  }));

      niv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
      niv.setScaleType(ScaleType.FIT_XY);
      ims.addView(niv);
    }
    Log.i("sys", "图片添加完成");
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    if (inflater == null)
      inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) convertView = inflater.inflate(R.layout.list_row, null);

    if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader();
    NetworkImageView thumbNail = (NetworkImageView) convertView.findViewById(R.id.thumbnail);
    thumbNail.startAnimation(imageFadeInAnimation);

    TextView headline = (TextView) convertView.findViewById(R.id.headline);
    TextView category = (TextView) convertView.findViewById(R.id.category);
    TextView pubTime = (TextView) convertView.findViewById(R.id.pub_time);
    TextView upVotes = (TextView) convertView.findViewById(R.id.upvotes);
    TextView downVotes = (TextView) convertView.findViewById(R.id.downvotes);

    // getting NewsObject data for the row
    NewsObject newsObject = newsObjectItems.get(position);

    // thumbnail image
    thumbNail.setImageUrl(newsObject.thumbnailUrl, imageLoader);

    // headline
    headline.setText(newsObject.headline);

    // category
    category.setTextColor(activity.getResources().getColor(getCategoryColor(newsObject.category)));
    category.setText(newsObject.getCategory());

    // publishDate/Time
    pubTime.setText(timeAgo(newsObject.publicationDateTime));

    // upvotes
    upVotes.setText("" + newsObject.upvotes);

    // downvotes
    downVotes.setText("" + newsObject.downvotes);

    // genre
    /*String genreStr = "";
    for (String str : m.getGenre()) {
    	genreStr += str + ", ";
    }
    genreStr = genreStr.length() > 0 ? genreStr.substring(0,
    		genreStr.length() - 2) : genreStr;
    genre.setText(genreStr);

    // release year
    year.setText(String.valueOf(m.getYear()));*/

    return convertView;
  }
  public void setValue() {

    txt_challengename.setText(getChallengeDetailsItems.getTitle());
    txt_challengeDescription.setText(getChallengeDetailsItems.getDescription());
    etxt_days.setText(getChallengeDetailsItems.getC_day());
    etxt_hours.setText(getChallengeDetailsItems.getC_hrs());
    etxt_minutes.setText(getChallengeDetailsItems.getC_min());
    txt_challengetime.setText(getChallengeDetailsItems.getDate_added());
    txt_pize.setText(getChallengeDetailsItems.getCustom_prize());
    txt_coins.setText(getChallengeDetailsItems.getC_coin());

    for (int i = 0; i < getChallengeDetailsItems.getParticipantItemsArrayList().size(); i++) {

      LayoutInflater mInflater =
          (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
      View rowView = mInflater.inflate(R.layout.row_members, null);
      ImageView imv_cross = (ImageView) rowView.findViewById(R.id.imv_cross);
      ImageView imv_circle = (ImageView) rowView.findViewById(R.id.imv_circle);
      TextView txt_name = (TextView) rowView.findViewById(R.id.txt_name);
      TextView txt_challengee_witness =
          (TextView) rowView.findViewById(R.id.txt_challengee_witness);

      txt_name.setText(getChallengeDetailsItems.getParticipantItemsArrayList().get(i).getName());
      txt_challengee_witness.setText(
          getChallengeDetailsItems.getParticipantItemsArrayList().get(i).getUser_type());

      if (getChallengeDetailsItems
          .getParticipantItemsArrayList()
          .get(i)
          .getC_status()
          .equalsIgnoreCase("0")) {
        imv_circle.setImageResource(R.drawable.yallow_circle);
      } else {
        imv_circle.setImageResource(R.drawable.green_circle);
      }

      NetworkImageView imv_icon = (NetworkImageView) rowView.findViewById(R.id.imv_icon);
      ImageLoader mImageLoader = null;
      mImageLoader = AppController.getInstance().getImageLoader();

      imv_icon.setImageUrl(
          getChallengeDetailsItems.getParticipantItemsArrayList().get(i).getProfile_img(),
          mImageLoader);
      imv_cross.setTag(getChallengeDetailsItems.getParticipantItemsArrayList().get(i).getUser_id());

      imv_cross.setOnClickListener(this);

      layout_lv_members.addView(rowView);
    }
  }
  public View getView(int position, View convertView, ViewGroup parent) {
    FrameLayout fl = (FrameLayout) convertView;
    NetworkImageView niv;
    if (fl == null) {
      LayoutInflater inflater =
          (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      fl = (FrameLayout) inflater.inflate(R.layout.grid_image, parent, false);
      niv = (NetworkImageView) fl.findViewById(R.id.niv_grid);

      niv.setDefaultImageResId(R.drawable.ic_icon);
      niv.setErrorImageResId(android.R.drawable.ic_dialog_alert);
    }
    niv = (NetworkImageView) fl.findViewById(R.id.niv_grid);

    GApplication appState = (GApplication) mActivity.getApplication();
    niv.setImageUrl(getItem(position), appState.mImageLoader);
    return fl;
  }
 /**
  * 프로필 이미지에 대해 view를 update한다.
  *
  * @param profileImageURL 화면에 반영할 프로필 이미지
  */
 public void setProfileURL(final String profileImageURL) {
   this.profileImageURL = profileImageURL;
   if (profile != null && profileImageURL != null) {
     Application app = GlobalApplication.getGlobalApplicationContext();
     if (app == null)
       throw new UnsupportedOperationException(
           "needs com.kakao.GlobalApplication in order to use ImageLoader");
     profile.setImageUrl(profileImageURL, ((GlobalApplication) app).getImageLoader());
   }
 }
示例#9
0
 public void bind(EventoDto evento) {
   this.evento = evento;
   thumbnail.setImageUrl(Constants.PATH_IMAGE + evento.getImagemUrl(), imageLoader);
   nomeEvento.setText(evento.getNomeEvento());
   localEvento.setText(evento.getNomeInstituicao());
   dataEvento.setText(
       TreatDate.formatTime(TreatDate.parseDateTime(evento.getDataInicio()))
           + " - "
           + TreatDate.formatTime(TreatDate.parseDateTime(evento.getDataInicio())));
   likeView.setLikeViewStyle(LikeView.Style.BOX_COUNT);
   likeView.setObjectIdAndType(evento.getUrlFacebookEvento(), LikeView.ObjectType.DEFAULT);
 }
    @Override
    public View execute(final FakkuManga fakkuManga) {
      Context c = mViewGroup.getContext();

      if (mConvertView == null) {
        mConvertView = View.inflate(c, R.layout.dummy_gallery_item, null);
      }

      ((TextView) mConvertView.findViewById(R.id.manga_title)).setText(fakkuManga.getTitle());

      // set all gallery item values
      if (fakkuManga.getCoverUrl() != null) {
        NetworkImageView networkImageView =
            (NetworkImageView) mConvertView.findViewById(R.id.manga_thumb);
        networkImageView.setImageUrl(fakkuManga.getCoverUrl(), VolleySingleton.getImageLoader());
      }

      setupFavoriteButton((ImageView) mConvertView.findViewById(R.id.manga_favorite), fakkuManga);

      mConvertView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              getGalleryItemClickListener().galleryItemClicked(fakkuManga);
            }
          });

      mConvertView
          .findViewById(R.id.manga_overflow)
          .setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                  showOverflowView(view, fakkuManga);
                }
              });

      return mConvertView;
    }
  /** 优点: 被父控件dispatch的时候会自动取消掉网络请求 */
  private void NetWorkImageViewVolley() {
    String imageUrl = "http://file.bmob.cn/M02/42/CB/oYYBAFaTXjyAaiKEABJh2CKNhlI556.png";
    RequestQueue requestQueue = Volley.newRequestQueue(this);
    final android.support.v4.util.LruCache<String, Bitmap> lruCache =
        new android.support.v4.util.LruCache<String, Bitmap>(20);
    ImageLoader.ImageCache imageCache =
        new ImageLoader.ImageCache() {

          @Override
          public void putBitmap(String key, Bitmap value) {
            lruCache.put(key, value);
          }

          @Override
          public Bitmap getBitmap(String key) {
            return lruCache.get(key);
          }
        };
    ImageLoader imageLoader = new ImageLoader(requestQueue, imageCache);
    NetworkImageViewVolley.setTag("url");
    NetworkImageViewVolley.setImageUrl(imageUrl, imageLoader);
  }
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // DevLog.defaultLogging("widthMeasureSpec...W:"+widthMeasureSpec+" H:"+heightMeasureSpec);

    if (mHeightRatio > 0.0) {
      // set the image views size
      int width = View.MeasureSpec.getSize(widthMeasureSpec);
      int height = (int) (width * mHeightRatio);
      setMeasuredDimension(width, height);
    } else {
      super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }
  }
  private void setViewsValues() {
    try {
      carImageView.setImageUrl(
          objCarInfo.getImage(), ApplicationQuicker.getInstance().getImageLoader());
      nameTextView.setText(objCarInfo.getName());
      ratingTextView.setText(objCarInfo.getRating());
      ccTextView.setText(objCarInfo.getEngine_cc());
      typeTextView.setText(objCarInfo.getType());
      absTextView.setText(objCarInfo.getAbs_exist());
      mileageTextView.setText(objCarInfo.getMileage());
      descriptionTextView.setText(objCarInfo.getDescription());

      colorView.setBackgroundColor(Color.parseColor(objCarInfo.getColor()));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /**
   * Bind an instance of the <code>Chat</code> class to our view. This method is called by <code>
   * FirebaseListAdapter</code> when there is a data change, and we are given an instance of a View
   * that corresponds to the layout that we passed to the constructor, as well as a single <code>
   * Chat</code> instance that represents the current data to bind.
   *
   * @param view A view instance corresponding to the layout we passed to the constructor.
   * @param chat An instance representing the current state of a chat message
   */
  @Override
  protected void populateView(View view, Chat chat) {
    // Map a Chat object to an entry in our listview
    String author = chat.getAuthor();
    TextView authorText = (TextView) view.findViewById(R.id.author);
    authorText.setText(author + ": ");
    instanceOfVolley = VolleySingleton.newInstance(context);

    final NetworkImageView imageView = (NetworkImageView) view.findViewById(R.id.networkImageView);
    final ImageLoader imageLoader = instanceOfVolley.getImageLoader();
    final TextView titleTextView = (TextView) view.findViewById(R.id.title);
    final TextView descriptionTextView = (TextView) view.findViewById(R.id.description);

    // If the message was sent by this user, color it differently
    if (author.equals(username)) {
      authorText.setTextColor(Color.RED);
    } else {
      authorText.setTextColor(Color.BLUE);
    }
    ((TextView) view.findViewById(R.id.message)).setText(chat.getMessage());

    String message = chat.getMessage();
    int start = message.indexOf("((");
    if (start != -1) {
      String query = message.substring(start + 2, message.indexOf("))"));

      // the volley listener
      listener =
          new Response.Listener<JSONObject>() {

            @Override
            public void onResponse(JSONObject response) {
              try {
                JSONArray items = response.getJSONArray("items");
                JSONObject json = items.getJSONObject(0);
                JSONObject id = json.getJSONObject("id");
                JSONObject snippet = json.getJSONObject("snippet");
                JSONObject thumbnails = snippet.getJSONObject("thumbnails");
                JSONObject high = thumbnails.getJSONObject("high");
                String url = high.getString("url");
                String description = snippet.getString("description");
                String title = snippet.getString("title");
                titleTextView.setText(title);
                descriptionTextView.setText(description);
                imageView.setImageUrl(url, imageLoader);
                videoID = id.getString("videoId");
                imageView.setVisibility(View.VISIBLE);
                titleTextView.setVisibility(View.VISIBLE);
                descriptionTextView.setVisibility(View.VISIBLE);
                imageView.setTag(videoID);
                imageView.setOnClickListener(
                    new View.OnClickListener() {

                      @Override
                      public void onClick(View view) {
                        String tag = view.getTag().toString();
                        Intent intent = new Intent(activity, PlayActivity.class);
                        intent.putExtra("id", tag);
                        activity.startActivity(intent);
                      }
                    });
              } catch (JSONException ex) {
                ex.printStackTrace();
              }
            }
          };

      // the volley error listener
      errorListener =
          new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
              error.printStackTrace();
            }
          };

      try {
        url = Config.URL + URLEncoder.encode(query, "utf-8");
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }

      JsonObjectRequest req = new JsonObjectRequest(url, null, listener, errorListener);
      instanceOfVolley.addToRequestQueue(req);

    } else {
      imageView.setVisibility(View.GONE);
      titleTextView.setVisibility(View.GONE);
      descriptionTextView.setVisibility(View.GONE);
    }
  }
示例#15
0
  private void initViewPager() {
    homeViewPager = (ViewPager) headerView.findViewById(R.id.home_viewpager);
    ViewGroup dotContainer = (ViewGroup) headerView.findViewById(R.id.dot_container);

    // 创建广告页
    List<View> adsImageList = new ArrayList<View>();
    NetworkImageView ads1 = new NetworkImageView(getActivity());
    ads1.setScaleType(ImageView.ScaleType.FIT_XY);
    ads1.setBackgroundColor(Color.TRANSPARENT);
    adsImageList.add(ads1);
    NetworkImageView ads2 = new NetworkImageView(getActivity());
    ads2.setScaleType(ImageView.ScaleType.FIT_XY);
    ads2.setBackgroundColor(Color.TRANSPARENT);
    adsImageList.add(ads2);
    NetworkImageView ads3 = new NetworkImageView(getActivity());
    ads3.setScaleType(ImageView.ScaleType.FIT_XY);
    ads3.setBackgroundColor(Color.TRANSPARENT);
    adsImageList.add(ads3);
    // 从服务器加载广告图片并显示
    String adUrl = "http://182.61.8.185/images/3/3.jpg";
    Traffic.showNetworkImage(requestQueue, adUrl, ads1);
    Traffic.showNetworkImage(requestQueue, adUrl, ads2);
    Traffic.showNetworkImage(requestQueue, adUrl, ads3);

    // 对dotImageViews进行填充
    dotImageViews = new ImageView[adsImageList.size()];
    // 导航圆点
    for (int i = 0; i < adsImageList.size(); i++) {
      dotImageView = new ImageView(getActivity());
      dotImageView.setLayoutParams(new LinearLayout.LayoutParams(20, 20));
      dotImageView.setPadding(5, 5, 5, 5);
      dotImageViews[i] = dotImageView;
      if (i == 0) {
        dotImageViews[i].setImageResource(R.drawable.dot_selected);
      } else {
        dotImageViews[i].setImageResource(R.drawable.dot);
      }
      dotContainer.addView(dotImageViews[i]);
    }

    homeViewPager.setAdapter(new AdsAdapter(adsImageList));
    homeViewPager.addOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          @Override
          public void onPageSelected(int position) {
            what.getAndSet(position);
            for (int i = 0; i < dotImageViews.length; i++) {
              dotImageViews[position].setImageResource(R.drawable.dot_selected);
              if (position != i) {
                dotImageViews[i].setImageResource(R.drawable.dot);
              }
            }
          }

          @Override
          public void onPageScrollStateChanged(int state) {}
        });
    homeViewPager.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
              case MotionEvent.ACTION_MOVE:
                isContinue = false;
              case MotionEvent.ACTION_UP:
                isContinue = true;
                break;
              default:
                isContinue = true;
                break;
            }
            return false;
          }
        });
    new Thread(
            new Runnable() {
              @Override
              public void run() {
                while (true) {
                  if (isContinue) {
                    viewHandler.sendEmptyMessage(what.get());
                    whatOpition();
                  }
                }
              }
            })
        .start();

    homeViewPager.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // 启动广告活动
          }
        });
  }
示例#16
0
 /**
  * 为 NetworkImageView 加载图片.
  *
  * @param niv
  * @param url
  */
 public static void loadImage4NetImageView(@NonNull NetworkImageView niv, @NonNull String url) {
   ImageLoader loader = ApplicationUtils.getGlobalImageLoader();
   niv.setDefaultImageResId(defaultResId);
   niv.setErrorImageResId(errorImageResId);
   niv.setImageUrl(url, loader);
 }
  private void refreshViews(Cursor cursor) {
    if (!cursor.moveToFirst()) return;

    // check whether or not to show the edit button
    String state = cursor.getString(cursor.getColumnIndex("uploadState"));
    mIsLocal = MediaUtils.isLocalFile(state);
    if (mIsLocal && getActivity() != null) {
      getActivity().invalidateOptionsMenu();
    }

    // title
    mTitleView.setText(cursor.getString(cursor.getColumnIndex("title")));

    // caption
    String caption = cursor.getString(cursor.getColumnIndex("caption"));
    if (caption == null || caption.length() == 0) {
      mCaptionView.setVisibility(View.GONE);
    } else {
      mCaptionView.setText(caption);
      mCaptionView.setVisibility(View.VISIBLE);
    }

    // description
    String desc = cursor.getString(cursor.getColumnIndex("description"));
    if (desc == null || desc.length() == 0) {
      mDescriptionView.setVisibility(View.GONE);
    } else {
      mDescriptionView.setText(desc);
      mDescriptionView.setVisibility(View.VISIBLE);
    }

    // added / upload date
    String date = MediaUtils.getDate(cursor.getLong(cursor.getColumnIndex("date_created_gmt")));
    if (mIsLocal) {
      mDateView.setText("Added on: " + date);
    } else {
      mDateView.setText("Uploaded on: " + date);
    }

    // file name
    String fileName = cursor.getString(cursor.getColumnIndex("fileName"));
    mFileNameView.setText("File name: " + fileName);

    // get the file extension from the fileURL
    String fileURL = cursor.getString(cursor.getColumnIndex("fileURL"));
    if (fileURL != null) {
      String fileType = fileURL.replaceAll(".*\\.(\\w+)$", "$1").toUpperCase();
      mFileTypeView.setText("File type: " + fileType);
      mFileTypeView.setVisibility(View.VISIBLE);
    } else {
      mFileTypeView.setVisibility(View.GONE);
    }

    String imageUri = cursor.getString(cursor.getColumnIndex("fileURL"));
    if (imageUri == null) imageUri = cursor.getString(cursor.getColumnIndex("filePath"));

    inflateImageView();

    // image and dimensions
    if (MediaUtils.isValidImage(imageUri)) {
      int width = cursor.getInt(cursor.getColumnIndex("width"));
      int height = cursor.getInt(cursor.getColumnIndex("height"));

      float screenWidth;

      View parentView = (View) mImageView.getParent();

      // differentiating between tablet and phone
      if (this.isInLayout()) {
        screenWidth = parentView.getMeasuredWidth();
      } else {
        screenWidth = getActivity().getResources().getDisplayMetrics().widthPixels;
      }
      float screenHeight = getActivity().getResources().getDisplayMetrics().heightPixels;

      if (width > 0 && height > 0) {
        String dimensions = width + "x" + height;
        mDimensionsView.setText("Dimensions: " + dimensions);
        mDimensionsView.setVisibility(View.VISIBLE);
      } else {
        mDimensionsView.setVisibility(View.GONE);
      }

      if (width > screenWidth) {
        height = (int) (height / (width / screenWidth));
        width = (int) screenWidth;
      } else if (height > screenHeight) {
        width = (int) (width / (height / screenHeight));
        height = (int) screenHeight;
      }

      if (mIsLocal) {
        final String filePath = cursor.getString(cursor.getColumnIndex("filePath"));
        loadLocalImage(mImageView, filePath, width, height);
      } else {
        // Allow non-private wp.com and Jetpack blogs to use photon to get a higher res thumbnail
        if (WordPress.getCurrentBlog() != null && WordPress.getCurrentBlog().isPhotonCapable()) {
          String thumbnailURL = StringUtils.getPhotonUrl(imageUri, (int) screenWidth);
          ((NetworkImageView) mImageView).setImageUrl(thumbnailURL, mImageLoader);
        } else {
          ((NetworkImageView) mImageView).setImageUrl(imageUri + "?w=" + screenWidth, mImageLoader);
        }
      }
      mImageView.setVisibility(View.VISIBLE);

      mImageView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, height));

    } else {
      mImageView.setVisibility(View.GONE);
      mDimensionsView.setVisibility(View.GONE);
    }
  }
示例#18
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_bankuai, container, false);
    list_forumsid = new ArrayList<Integer>();
    list_title = new ArrayList<String>();
    dialog = new ProgressDialog(getActivity());
    dialog.setCancelable(false);
    dialog.setMessage("正在加载...");
    dialog.show();
    iv1 = (NetworkImageView) view.findViewById(R.id.iv_1);
    //        iv1.setDefaultImageResId(R.drawable.icon_iemylife2);
    iv2 = (NetworkImageView) view.findViewById(R.id.iv_2);
    //        iv2.setDefaultImageResId(R.drawable.icon_aijiaren);
    iv3 = (NetworkImageView) view.findViewById(R.id.iv_3);
    //        iv3.setDefaultImageResId(R.drawable.icon_meeting);
    iv4 = (NetworkImageView) view.findViewById(R.id.iv_4);
    //        iv4.setDefaultImageResId(R.drawable.icon_forum);
    iv5 = (NetworkImageView) view.findViewById(R.id.iv_5);
    //        iv5.setDefaultImageResId(R.drawable.icon_chanpinfankui);
    iv6 = (NetworkImageView) view.findViewById(R.id.iv_6);
    //        iv6.setDefaultImageResId(R.drawable.icon_shouhoufuwu);
    iv7 = (NetworkImageView) view.findViewById(R.id.iv_7);
    //        iv7.setDefaultImageResId(R.drawable.icon_wenda);
    iv8 = (NetworkImageView) view.findViewById(R.id.iv_8);
    iv8.setDefaultImageResId(R.drawable.icon_qidai);

    tv1 = (TextView) view.findViewById(R.id.tv_1);
    tv2 = (TextView) view.findViewById(R.id.tv_2);
    tv3 = (TextView) view.findViewById(R.id.tv_3);
    tv4 = (TextView) view.findViewById(R.id.tv_4);
    tv5 = (TextView) view.findViewById(R.id.tv_5);
    tv6 = (TextView) view.findViewById(R.id.tv_6);
    tv7 = (TextView) view.findViewById(R.id.tv_7);
    if (NetWorkInfo.isNetworkAvailable(getActivity())) {
      GetForumsClient.request(
          getActivity(),
          new GetForumsHandler() {
            @Override
            public void onLoginSuccess(ForumsItem[] response) {
              super.onLoginSuccess(response);
              dialog.dismiss();
              RequestQueue queue = Volley.newRequestQueue(getActivity());
              ImageLoader loader =
                  new ImageLoader(
                      queue,
                      new ImageLoader.ImageCache() {

                        @Override
                        public Bitmap getBitmap(String url) {
                          return null;
                        }

                        @Override
                        public void putBitmap(String url, Bitmap bitmap) {}
                      });
              iv1.setImageUrl(response[0].getIcon(), loader);
              iv2.setImageUrl(response[1].getIcon(), loader);
              iv3.setImageUrl(response[2].getIcon(), loader);
              iv4.setImageUrl(response[3].getIcon(), loader);
              iv5.setImageUrl(response[4].getIcon(), loader);
              iv6.setImageUrl(response[5].getIcon(), loader);
              iv7.setImageUrl(response[6].getIcon(), loader);

              tv1.setText(response[0].getTitle().trim());
              tv2.setText(response[1].getTitle().trim());
              tv3.setText(response[2].getTitle().trim());
              tv4.setText(response[3].getTitle().trim());
              tv5.setText(response[4].getTitle().trim());
              tv6.setText(response[5].getTitle().trim());
              tv7.setText(response[6].getTitle().trim());

              for (int i = 0; i < response.length; i++) {
                list_forumsid.add(response[i].getForumID());
                list_title.add(response[i].getTitle().trim());
              }
            }

            @Override
            public void onInnovationFailure(String msg) {
              super.onInnovationFailure(msg);
              dialog.dismiss();
              FailMessage.showfail(getActivity(), msg);
            }

            @Override
            public void onInnovationError(String value) {
              super.onInnovationError(value);
              dialog.dismiss();
              FailMessage.showfail(getActivity(), value);
            }

            @Override
            public void onInnovationExceptionFinish() {
              super.onInnovationExceptionFinish();
              dialog.dismiss();
              Toast.makeText(getActivity(), "网络超时", Toast.LENGTH_SHORT).show();
            }
          },
          TestOrNot.isTest);
    } else {
      dialog.dismiss();
      Toast.makeText(getActivity(), "请检查您的网络环境", Toast.LENGTH_SHORT).show();
    }
    layout_yilife = (LinearLayout) view.findViewById(R.id.layout_bankuai_yilife);
    layout_aijiaren = (LinearLayout) view.findViewById(R.id.layout_bankuai_aijiaren);
    layout_meeting = (LinearLayout) view.findViewById(R.id.layout_bankuai_banzhuhuiyishi);
    layout_forum = (LinearLayout) view.findViewById(R.id.layout_bankuai_luntanshiwu);
    layout_fankui = (LinearLayout) view.findViewById(R.id.layout_bankuai_chanpingfankui);
    layout_shouhou = (LinearLayout) view.findViewById(R.id.layout_bankuai_shouhoufuwu);
    layout_wenda = (LinearLayout) view.findViewById(R.id.layout_bankuai_wenda);
    layout_other = (LinearLayout) view.findViewById(R.id.layout_bankuai_other);
    layout_yilife.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(0));
              intent.putExtra("forums", list_forumsid.get(0));
              startActivity(intent);
            }
          }
        });
    layout_aijiaren.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(1));
              intent.putExtra("forums", list_forumsid.get(1));
              startActivity(intent);
            }
          }
        });
    layout_meeting.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(2));
              intent.putExtra("forums", list_forumsid.get(2));
              startActivity(intent);
            }
          }
        });
    layout_forum.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(3));
              intent.putExtra("forums", list_forumsid.get(3));
              startActivity(intent);
            }
          }
        });
    layout_fankui.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(4));
              intent.putExtra("forums", list_forumsid.get(4));
              startActivity(intent);
            }
          }
        });
    layout_shouhou.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(5));
              intent.putExtra("forums", list_forumsid.get(5));
              startActivity(intent);
            }
          }
        });
    layout_wenda.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (list_forumsid.size() != 0) {
              Intent intent = new Intent(getActivity(), NoteList.class);
              intent.putExtra("bankuai", list_title.get(6));
              intent.putExtra("forums", list_forumsid.get(6));
              startActivity(intent);
            }
          }
        });
    //        layout_other.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                Intent intent = new Intent(getActivity(),NoteList.class);
    //                intent.putExtra("bankuai",list_title.get(7));
    //                intent.putExtra("forums",list_forumsid.get(7));
    //                startActivity(intent);
    //            }
    //        });
    return view;
  }
示例#19
0
  public void setPost(final Post post, final ThreadManager manager) {
    this.post = post;
    this.manager = manager;

    highlightQuotesNo = -1;

    boolean boardCatalogMode =
        manager.getLoadable().isBoardMode() || manager.getLoadable().isCatalogMode();

    TypedArray ta =
        context.obtainStyledAttributes(null, R.styleable.PostView, R.attr.post_style, 0);

    if (!isBuild) {
      buildView(context, ta);
      isBuild = true;
    }

    int dateColor = ta.getColor(R.styleable.PostView_date_color, 0);
    int savedReplyColor = ta.getColor(R.styleable.PostView_saved_reply_color, 0);
    int highlightedColor = ta.getColor(R.styleable.PostView_highlighted_color, 0);
    int detailSize = ta.getDimensionPixelSize(R.styleable.PostView_detail_size, 0);

    ta.recycle();

    if (post.hasImage) {
      imageView.setVisibility(View.VISIBLE);
      imageView.setImageUrl(post.thumbnailUrl, ChanApplication.getVolleyImageLoader());
    } else {
      imageView.setVisibility(View.GONE);
      imageView.setImageUrl(null, null);
    }

    CharSequence total = new SpannableString("");

    if (post.subjectSpan != null) {
      total = TextUtils.concat(total, post.subjectSpan);
    }

    if (isList()) {
      CharSequence relativeTime =
          DateUtils.getRelativeTimeSpanString(
              post.time * 1000L, Time.get(), DateUtils.SECOND_IN_MILLIS, 0);
      SpannableString date = new SpannableString("No." + post.no + " " + relativeTime);
      date.setSpan(new ForegroundColorSpan(dateColor), 0, date.length(), 0);
      date.setSpan(new AbsoluteSizeSpan(detailSize), 0, date.length(), 0);

      total =
          TextUtils.concat(
              total,
              post.subjectSpan == null ? "" : "\n",
              post.nameTripcodeIdCapcodeSpan,
              date,
              " ");
    }

    if (!TextUtils.isEmpty(total)) {
      titleView.setText(total);
      titleView.setVisibility(View.VISIBLE);
    } else {
      titleView.setVisibility(View.GONE);
    }

    commentView.setText(post.comment);

    if (manager.getLoadable().isThreadMode()) {
      post.setLinkableListener(this);
      commentView.setMovementMethod(new PostViewMovementMethod());
      commentView.setOnClickListener(this);
    } else {
      post.setLinkableListener(null);
      commentView.setOnClickListener(null);
      commentView.setClickable(false);
      commentView.setMovementMethod(null);
    }

    if (isGrid()
        || ((post.isOP && boardCatalogMode && post.replies > 0) || (post.repliesFrom.size() > 0))) {
      repliesCountView.setVisibility(View.VISIBLE);

      String text = "";

      int count = boardCatalogMode ? post.replies : post.repliesFrom.size();

      if (count != 1) {
        text = count + " " + context.getString(R.string.multiple_replies);
      } else if (count == 1) {
        text = count + " " + context.getString(R.string.one_reply);
      }

      if (boardCatalogMode && post.images > 0) {
        if (post.images != 1) {
          text += ", " + post.images + " " + context.getString(R.string.multiple_images);
        } else {
          text += ", " + post.images + " " + context.getString(R.string.one_image);
        }
      }

      if (manager.getLoadable().isThreadMode()) {
        repliesCountView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                manager.showPostReplies(post);
              }
            });
      }

      repliesCountView.setText(text);
    } else {
      repliesCountView.setVisibility(View.GONE);
      repliesCountView.setOnClickListener(null);
    }

    boolean showCountryFlag =
        isList() && !TextUtils.isEmpty(post.country) && !TextUtils.isEmpty(post.countryUrl);
    boolean showStickyIcon = isList() && post.sticky;
    boolean showDeletedIcon = isList() && post.deleted;
    boolean showArchivedIcon = isList() && post.archived;
    boolean showClosedIcon = isList() && post.closed && !showArchivedIcon;

    iconsView.setVisibility(
        (showCountryFlag || showStickyIcon || showClosedIcon || showDeletedIcon || showArchivedIcon)
            ? View.VISIBLE
            : View.GONE);

    stickyView.setVisibility(showStickyIcon ? View.VISIBLE : View.GONE);
    closedView.setVisibility(showClosedIcon ? View.VISIBLE : View.GONE);
    deletedView.setVisibility(showDeletedIcon ? View.VISIBLE : View.GONE);
    archivedView.setVisibility(showArchivedIcon ? View.VISIBLE : View.GONE);
    if (showCountryFlag) {
      countryView.setVisibility(View.VISIBLE);
      countryView.setImageUrl(post.countryUrl, ChanApplication.getVolleyImageLoader());
    } else {
      countryView.setVisibility(View.GONE);
      countryView.setImageUrl(null, null);
    }

    if (post.isSavedReply) {
      full.setBackgroundColor(savedReplyColor);
    } else if (manager.isPostHightlighted(post)) {
      full.setBackgroundColor(highlightedColor);
    } else {
      full.setBackgroundColor(0x00000000);
    }

    if (manager.isPostLastSeen(post)) {
      lastSeen.setVisibility(View.VISIBLE);
    } else {
      lastSeen.setVisibility(View.GONE);
    }
  }
示例#20
0
  private void buildView(final Context context, TypedArray ta) {
    int thumbnailBackground = ta.getColor(R.styleable.PostView_thumbnail_background, 0);
    int replyCountColor = ta.getColor(R.styleable.PostView_reply_count_color, 0);

    int iconPadding = ta.getDimensionPixelSize(R.styleable.PostView_icon_padding, 0);
    int iconWidth = ta.getDimensionPixelSize(R.styleable.PostView_icon_width, 0);
    int iconHeight = ta.getDimensionPixelSize(R.styleable.PostView_icon_height, 0);
    int gridHeight = ta.getDimensionPixelSize(R.styleable.PostView_grid_height, 0);
    int optionsSpacing = ta.getDimensionPixelSize(R.styleable.PostView_options_spacing, 0);
    int titleSize = ta.getDimensionPixelSize(R.styleable.PostView_title_size, 0);
    int optionsLeftPadding = ta.getDimensionPixelSize(R.styleable.PostView_options_left_padding, 0);
    int optionsTopPadding = ta.getDimensionPixelSize(R.styleable.PostView_options_top_padding, 0);
    int optionsRightPadding =
        ta.getDimensionPixelSize(R.styleable.PostView_options_right_padding, 0);
    int optionsBottomPadding =
        ta.getDimensionPixelSize(R.styleable.PostView_options_bottom_padding, 0);
    int lastSeenHeight = ta.getDimensionPixelSize(R.styleable.PostView_last_seen_height, 0);

    int postListMaxHeight =
        ta.getDimensionPixelSize(R.styleable.PostView_list_comment_max_height, 0);

    int postCommentSize = 0;
    int commentPadding = 0;
    int postPadding = 0;
    int imageSize = 0;
    int repliesCountSize = 0;
    if (isList()) {
      postCommentSize =
          (int)
              TypedValue.applyDimension(
                  TypedValue.COMPLEX_UNIT_SP,
                  ThemeHelper.getInstance().getFontSize(),
                  getResources().getDisplayMetrics());
      commentPadding = ta.getDimensionPixelSize(R.styleable.PostView_list_comment_padding, 0);
      postPadding = ta.getDimensionPixelSize(R.styleable.PostView_list_padding, 0);
      imageSize = ta.getDimensionPixelSize(R.styleable.PostView_list_image_size, 0);
      repliesCountSize = ta.getDimensionPixelSize(R.styleable.PostView_list_replies_count_size, 0);
    } else if (isGrid()) {
      postCommentSize =
          (int)
              TypedValue.applyDimension(
                  TypedValue.COMPLEX_UNIT_SP,
                  ThemeHelper.getInstance().getFontSize() - 1,
                  getResources().getDisplayMetrics());
      commentPadding = ta.getDimensionPixelSize(R.styleable.PostView_grid_comment_padding, 0);
      postPadding = ta.getDimensionPixelSize(R.styleable.PostView_grid_padding, 0);
      imageSize = ta.getDimensionPixelSize(R.styleable.PostView_grid_image_size, 0);
      repliesCountSize = ta.getDimensionPixelSize(R.styleable.PostView_grid_replies_count_size, 0);
    }

    RelativeLayout wrapper = new RelativeLayout(context);
    wrapper.setLayoutParams(matchParams);

    full = new LinearLayout(context);
    if (isList()) {
      full.setOrientation(HORIZONTAL);
      wrapper.addView(full, matchParams);
    } else if (isGrid()) {
      full.setOrientation(VERTICAL);
      wrapper.addView(full, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, gridHeight));
    }

    LinearLayout imageContainer = new LinearLayout(context);
    imageContainer.setOrientation(VERTICAL);
    imageContainer.setBackgroundColor(thumbnailBackground);

    // Create thumbnail
    imageView = new CustomNetworkImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setFadeIn(100);

    imageView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            manager.onThumbnailClicked(post);
          }
        });

    if (isList()) {
      imageContainer.addView(imageView, new LinearLayout.LayoutParams(imageSize, imageSize));
      full.addView(imageContainer, wrapMatchParams);
      full.setMinimumHeight(imageSize);
    } else if (isGrid()) {
      imageContainer.addView(
          imageView, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, imageSize));
      full.addView(imageContainer, matchWrapParams);
    }

    contentContainer = new LinearLayout(context);
    contentContainer.setOrientation(VERTICAL);

    LinearLayout titleContainer = new LinearLayout(context);
    titleContainer.setOrientation(HORIZONTAL);

    if (isList()) {
      // 25 padding to give optionsView some space
      titleContainer.setPadding(0, 0, optionsSpacing, 0);
    }

    titleView = new TextView(context);
    titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
    titleView.setPadding(postPadding, postPadding, postPadding, 0);

    titleContainer.addView(titleView, wrapParams);

    contentContainer.addView(titleContainer, matchWrapParams);

    iconsView = new LinearLayout(context);
    iconsView.setOrientation(HORIZONTAL);
    iconsView.setPadding(postPadding, iconPadding, postPadding, 0);

    stickyView = new ImageView(context);
    stickyView.setImageDrawable(IconCache.stickyIcon);
    iconsView.addView(stickyView, new LinearLayout.LayoutParams(iconWidth, iconHeight));

    closedView = new ImageView(context);
    closedView.setImageDrawable(IconCache.closedIcon);
    iconsView.addView(closedView, new LinearLayout.LayoutParams(iconWidth, iconHeight));

    deletedView = new ImageView(context);
    deletedView.setImageDrawable(IconCache.trashIcon);
    iconsView.addView(deletedView, new LinearLayout.LayoutParams(iconWidth, iconHeight));

    archivedView = new ImageView(context);
    archivedView.setImageDrawable(IconCache.archivedIcon);
    iconsView.addView(archivedView, new LinearLayout.LayoutParams(iconWidth, iconHeight));

    countryView = new NetworkImageView(context);
    countryView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    iconsView.addView(countryView, new LinearLayout.LayoutParams(iconWidth, iconHeight));

    contentContainer.addView(iconsView, matchWrapParams);

    commentView = new TextView(context);
    commentView.setTextSize(TypedValue.COMPLEX_UNIT_PX, postCommentSize);

    if (isList()) {
      commentView.setPadding(postPadding, commentPadding, postPadding, commentPadding);

      if (manager.getLoadable().isBoardMode() || manager.getLoadable().isCatalogMode()) {
        commentView.setMaxHeight(postListMaxHeight);
      }
    } else if (isGrid()) {
      commentView.setPadding(postPadding, commentPadding, postPadding, 0);
      // So that is fills up all the height using weight later on
      commentView.setMinHeight(10000);
    }

    if (isList()) {
      contentContainer.addView(commentView, matchWrapParams);
    } else if (isGrid()) {
      contentContainer.addView(
          commentView, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1f));
    }

    repliesCountView = new TextView(context);
    Utils.setPressedDrawable(repliesCountView);
    repliesCountView.setTextColor(replyCountColor);
    repliesCountView.setPadding(postPadding, postPadding, postPadding, postPadding);
    repliesCountView.setTextSize(TypedValue.COMPLEX_UNIT_PX, repliesCountSize);
    repliesCountView.setSingleLine();

    contentContainer.addView(repliesCountView, wrapParams);

    lastSeen = new View(context);
    lastSeen.setBackgroundColor(0xffff0000);
    contentContainer.addView(lastSeen, new LayoutParams(LayoutParams.MATCH_PARENT, lastSeenHeight));

    if (!manager.getLoadable().isThreadMode()) {
      Utils.setPressedDrawable(contentContainer);
    }

    full.addView(contentContainer, matchWrapParams);

    optionsView = new ImageView(context);
    optionsView.setImageResource(R.drawable.ic_overflow);
    Utils.setPressedDrawable(optionsView);
    optionsView.setPadding(
        optionsLeftPadding, optionsTopPadding, optionsRightPadding, optionsBottomPadding);
    optionsView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            PopupMenu popupMenu = new PopupMenu(context, v);
            manager.showPostOptions(post, popupMenu);
            popupMenu.show();
            if (ThemeHelper.getInstance().getTheme().isLightTheme) {
              optionsView.setImageResource(R.drawable.ic_overflow_black);
              popupMenu.setOnDismissListener(
                  new PopupMenu.OnDismissListener() {
                    @Override
                    public void onDismiss(final PopupMenu menu) {
                      optionsView.setImageResource(R.drawable.ic_overflow);
                    }
                  });
            }
          }
        });
    wrapper.addView(optionsView, wrapParams);
    RelativeLayout.LayoutParams optionsParams =
        (RelativeLayout.LayoutParams) optionsView.getLayoutParams();
    optionsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    optionsParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    optionsView.setLayoutParams(optionsParams);

    addView(wrapper, matchParams);

    wrapper.setOnClickListener(this);
  }
 private void loadNetworkImageView() {
   String url = "http://dev.classmethod.jp/wp-content/uploads/2013/04/android_eyecatch.png";
   NetworkImageView view = (NetworkImageView) findViewById(R.id.network_image_view);
   view.setImageUrl(null, null);
   view.setImageUrl(url, new ImageLoader(mQueue, new BitmapCache()));
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_pointdinteret_detail, container, false);
    final TextView adresse = (TextView) rootView.findViewById(R.id.adresseTexte);
    final ImageView house = (ImageView) rootView.findViewById(R.id.adresseMarker);
    final TextView phoneNumber = (TextView) rootView.findViewById(R.id.phoneTexte);
    final ImageView phoneIcon = (ImageView) rootView.findViewById(R.id.phoneIcon);

    View.OnClickListener clickListener =
        new View.OnClickListener() {
          @Override
          public void onClick(final View v) {
            Uri uri = Uri.parse("https://www.google.fr/maps/");
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
          }
        };

    adresse.setOnClickListener(clickListener);
    house.setOnClickListener(clickListener);

    View.OnClickListener call =
        new View.OnClickListener() {
          @Override
          public void onClick(final View v) {
            String numero = phoneNumber.getText().toString();
            Intent keypad = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + numero));
            startActivity(keypad);
          }
        };

    phoneNumber.setOnClickListener(call);
    phoneIcon.setOnClickListener(call);

    // Show the dummy content as text in a TextView.
    if (mItem != null) {
      ((TextView) rootView.findViewById(R.id.attraction_detail_title)).setText(mItem.getTitle());
      getActivity().setTitle(mItem.getTitle());
      ((TextView) rootView.findViewById(R.id.attraction_detail_description))
          .setText(
              mItem.getDescription().isEmpty()
                  ? getActivity().getResources().getString(R.string.pas_de_description)
                  : mItem.getDescription());
      NetworkImageView image =
          (NetworkImageView) rootView.findViewById(R.id.attraction_detail_image);
      image.setImageUrl(
          mItem.getImageURL(), RestHelper.getInstance(getActivity()).getImageLoader());
    }

    LatLng latLng = new LatLng(mItem.getLatitude(), mItem.getLongitude());
    MapView mv = (MapView) rootView.findViewById(R.id.mapview);
    mv.setAccessToken("sk.eyJ1Ijoic29uaWFoNDMxMiIsImEiOiJDbGVzMmZJIn0.2Nj61Rz4inJyKYD6MXUsnQ");
    mv.setTileSource(new MapboxTileLayer("soniah4312.7c398ef3"));
    mv.setMinZoomLevel(mv.getTileProvider().getMinimumZoomLevel());
    mv.setMaxZoomLevel(mv.getTileProvider().getMaximumZoomLevel());
    mv.setCenter(latLng);
    mv.setZoom(16);

    Marker marker = new Marker("titre", "decription", latLng);
    mv.addMarker(marker);
    return rootView;
  }
示例#23
0
 private void makeImageRequest(NetworkImageView imgView, String Str_Url) {
   ImageLoader imageLoader = AppController.getInstance().getImageLoader();
   if (imageLoader != null) imgView.setImageUrl(Str_Url, imageLoader);
 }