Java Code Examples for android.widget.ImageView

The following examples show how to use android.widget.ImageView. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: SelectionDialogs   Source File: ColorListAdapter.java    License: Apache License 2.0 8 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View rootView = convertView;

    if (rootView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rootView = inflater.inflate(R.layout.selectiondialogs_dialog_item, parent, false);

        ViewHolder viewHolder = new ViewHolder();
        viewHolder.iconIV = (ImageView) rootView.findViewById(R.id.selectiondialogs_icon_iv);
        viewHolder.nameTV = (TextView) rootView.findViewById(R.id.selectiondialogs_name_tv);
        rootView.setTag(viewHolder);
    }

    SelectableColor item = getItem(position);
    ViewHolder holder = (ViewHolder) rootView.getTag();
    holder.iconIV.setColorFilter(item.getColorValue());
    holder.nameTV.setText(item.getName());

    return rootView;
}
 
Example 2
Source Project: DistroHopper   Source File: GridAdapter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public View getView (int position, View view, ViewGroup parent)
{
	LensSearchResult result = this.getItem (position);

	if (view == null)
		view = LayoutInflater.from (this.getContext ()).inflate (R.layout.widget_dash_lens_result, parent, false);

	TextView tvLabel = (TextView) view.findViewById (R.id.tvLabel);
	ImageView imgIcon = (ImageView) view.findViewById (R.id.imgIcon);

	tvLabel.setText (result.getName ());
	tvLabel.setTextColor (view.getResources ().getColor (HomeActivity.theme.dash_applauncher_text_colour));
	tvLabel.setShadowLayer (5, 2, 2, view.getResources ().getColor (HomeActivity.theme.dash_applauncher_text_shadow_colour));
	imgIcon.setImageDrawable (result.getIcon ());

	final int width = this.iconWidth;
	final int height = width;
	view.setLayoutParams(new LinearLayout.LayoutParams(width, height));

	view.setTag (result);

	return view;
}
 
Example 3
public InterpretationHolder(View itemView, View itemBodyView,
                            TextView userTextView, TextView createdTextView, ImageView menuButton,
                            TextView interpretationTextView, View interpretationTextContainer, ImageView textMoreIcon,
                            IInterpretationViewHolder contentViewHolder,
                            View commentsShowButton, TextView commentsCountTextView,
                            MenuButtonHandler menuButtonHandler,
                            OnInterpretationInternalClickListener listener) {
    super(itemView);
    this.itemBodyView = itemBodyView;

    this.userTextView = userTextView;
    this.createdTextView = createdTextView;
    this.menuButton = menuButton;

    this.interpretationTextContainer = interpretationTextContainer;
    this.interpretationTextView = interpretationTextView;
    this.interpretationTextMoreIcon = textMoreIcon;

    this.contentViewHolder = contentViewHolder;
    this.listener = listener;

    this.commentsShowButton = commentsShowButton;
    this.commentsCountTextView = commentsCountTextView;

    this.menuButtonHandler = menuButtonHandler;
}
 
Example 4
Source Project: bither-bitmap-sample   Source File: ImageWorker.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCancelled(Bitmap bitmap) {
    if (imageViewReference != null) {//
        ImageView imageView = imageViewReference.get();
        if (imageView != null
                && imageView.getTag() != null
                && (imageView.getTag() instanceof FileDowloadProgressListener)) {
            FileDowloadProgressListener imageProgressListener = (FileDowloadProgressListener) imageView
                    .getTag();
            imageProgressListener.onCancel();
        }
    }
    super.onCancelled(bitmap);
    synchronized (mPauseWorkLock) {
        mPauseWorkLock.notifyAll();
    }
}
 
Example 5
Source Project: Musicoco   Source File: LeftNavigationController.java    License: Apache License 2.0 6 votes vote down vote up
private void initNavImage() {

        navigationView.post(new Runnable() {
            @Override
            public void run() {
                ImageView iv = (ImageView) navigationView.findViewById(R.id.main_left_nav_image);
                if (iv != null) {
                    iv.post(new Runnable() {
                        @Override
                        public void run() {
                            homeBackgroundController.updateImage();
                        }
                    });
                }

            }
        });
    }
 
Example 6
Source Project: AirFree-Client   Source File: ShotActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void init() {
        iLanguage();
        app = (ApplicationUtil) ShotActivity.this.getApplication();
        Intent intent = this.getIntent();
        tvShow = (TextView) findViewById(R.id.tv_show);
        tvShow.setText(strShow);
        btnBack = (Button) findViewById(R.id.btn_back);
        btnBack.setOnClickListener(this);
        tvScreenShot = (TextView) findViewById(R.id.tv_screen_capture);
        tvScreenShot.setText(strScreenCapture);
        tvRemoteDesktop = (TextView) findViewById(R.id.tv_real_time_desktop);
        tvRemoteDesktop.setText(strRealTimeDesktop);
        btnScreenShot = (LinearLayout) findViewById(R.id.btn_shot);
        btnScreenShot.setOnClickListener(this);
        btnRemoteDesktop = (LinearLayout) findViewById(R.id.btn_remote_desktop);
        btnRemoteDesktop.setOnClickListener(this);
        ivShow = (ImageView) findViewById(R.id.iv_show);
        ivShow.setOnClickListener(this);
        int what = intent.getIntExtra("what", 0);
        if (what == 1) {
            btnScreenShot.performClick();
        }
//        mThreadClient = new Thread(sRunnable);
//        mThreadClient.start();
    }
 
Example 7
private void initialize(Context context) {
    // We only want our ImageView in here. Nothing else is permitted
    removeAllViews();

    image = new ImageView(context);

    LayoutParams imageLayout = new LayoutParams(
            LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);

    image.setLayoutParams(imageLayout);

    // We want to prevent up-scaling the image, but still have it fit within
    // the layout bounds as best as possible.
    image.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    addView(image);
}
 
Example 8
Source Project: MyHearts   Source File: NewsDetailActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {
    id = getIntent().getStringExtra("id");
    title = getIntent().getStringExtra(Contants.TITLE);
    this.activitynewsdetail = (LinearLayout) findViewById(R.id.activity_news_detail);
    this.mWebview = (WebView) findViewById(R.id.web_view);
    this.mTvpublishtime = (TextView) findViewById(R.id.tv_publish_time);
    this.mTvauthor = (TextView) findViewById(R.id.tv_author);
    this.mTvname = (TextView) findViewById(R.id.tv_name);
    this.mTvtitle = (TextView) findViewById(R.id.tv_title);
    mIcBack = (ImageView) findViewById(R.id.img_back);
    mIcBack.setOnClickListener(v->finish());

    if (!TextUtils.isEmpty(title)) {
        mTvtitle.setText(title);
    }
}
 
Example 9
Source Project: YalpStore   Source File: BaseActivity.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void redrawAccounts(){
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.getHeaderView(0).findViewById(R.id.accounts).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showAccountsMenu(v, getUsers());
        }
    });
    if (YalpStoreApplication.user.isLoggedIn()) {
        NavHeaderUpdateTask task = new NavHeaderUpdateTask();
        task.setAvatarView((ImageView) navigationView.getHeaderView(0).findViewById(R.id.avatar));
        task.setUserNameView((TextView) navigationView.getHeaderView(0).findViewById(R.id.username));
        task.setDeviceView((TextView) navigationView.getHeaderView(0).findViewById(R.id.device));
        task.setContext(getApplicationContext());
        task.execute();
    }
}
 
Example 10
Source Project: science-journal   Source File: ExperimentDetailsFragment.java    License: Apache License 2.0 6 votes vote down vote up
public DetailsViewHolder(View itemView, int viewType) {
  super(itemView);
  this.viewType = viewType;
  if (viewType == VIEW_TYPE_RUN_CARD) {
    cardView = itemView.findViewById(R.id.card_view);
    runTitle = (TextView) itemView.findViewById(R.id.run_title_text);
    statsList = (StatsList) itemView.findViewById(R.id.stats_view);
    sensorName = (TextView) itemView.findViewById(R.id.run_review_sensor_name);
    sensorPrev = (ImageButton) itemView.findViewById(R.id.run_review_switch_sensor_btn_prev);
    sensorNext = (ImageButton) itemView.findViewById(R.id.run_review_switch_sensor_btn_next);
    chartView = (ChartView) itemView.findViewById(R.id.chart_view);
    sensorImage = (ImageView) itemView.findViewById(R.id.sensor_icon);
    progressView = (ProgressBar) itemView.findViewById(R.id.chart_progress);
    captionIcon = (ImageView) itemView.findViewById(R.id.edit_icon);
    captionView = itemView.findViewById(R.id.caption_section);
    timeHeader = (RelativeTimeTextView) itemView.findViewById(R.id.relative_time_text);
    menuButton = (ImageButton) itemView.findViewById(R.id.note_menu_button);
    captionTextView = (TextView) itemView.findViewById(R.id.caption);
    noteHolder = (ViewGroup) itemView.findViewById(R.id.notes_holder);

    // Only used in RunReview
    itemView.findViewById(R.id.time_text).setVisibility(View.GONE);
  }
}
 
Example 11
Source Project: Pigeon   Source File: GuidePageActivity.java    License: MIT License 6 votes vote down vote up
private void initViewPager() {
    vp = (ViewPager) findViewById(R.id.guide_vp);
    //实例化图片资源
    imageIdArray = new int[]{R.drawable.bg_guide_family, R.drawable.bg_guide_notes, R.drawable.bg_guide_weather, R.drawable.bg_guide_rebot};
    viewList = new ArrayList<>();
    //获取一个Layout参数,设置为全屏
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);

    //循环创建View并加入到集合中
    int len = imageIdArray.length;
    for (int i = 0; i < len; i++) {
        //new ImageView并设置全屏和图片资源
        ImageView imageView = new ImageView(this);
        imageView.setLayoutParams(params);
        imageView.setBackgroundResource(imageIdArray[i]);

        //将ImageView加入到集合中
        viewList.add(imageView);
    }

    //View集合初始化好后,设置Adapter
    vp.setAdapter(new GuidePageAdapter(viewList));
    //设置滑动监听
    vp.setOnPageChangeListener(this);
}
 
Example 12
Source Project: SteamGifts   Source File: CommentViewHolder.java    License: MIT License 6 votes vote down vote up
public CommentViewHolder(View v, Context context, ICommentableFragment fragment) {
    super(v);
    this.fragment = fragment;
    this.context = context;

    commentAuthor = (TextView) v.findViewById(R.id.user);
    commentTime = (TextView) v.findViewById(R.id.time);
    commentRole = (TextView) v.findViewById(R.id.role);

    commentContent = (TextView) v.findViewById(R.id.content);
    commentContent.setMovementMethod(LinkMovementMethod.getInstance());

    commentMarker = v.findViewById(R.id.comment_marker);
    commentIndent = v.findViewById(R.id.comment_indent);
    commentImage = (ImageView) v.findViewById(R.id.author_avatar);

    tradeScoreDivider = v.findViewById(R.id.trade_divider);
    tradeScorePositive = (TextView) v.findViewById(R.id.trade_score_positive);
    tradeScoreNegative = (TextView) v.findViewById(R.id.trade_score_negative);

    v.setOnCreateContextMenuListener(this);
}
 
Example 13
Source Project: SEAL-Demo   Source File: RunHistoryItemRecyclerViewAdapter.java    License: MIT License 6 votes vote down vote up
public RunItemHolder(View view) {
    super(view);
    mView = view;
    mRunMap = (ImageView) view.findViewById(R.id.runMap);
    mDate = (TextView) view.findViewById(R.id.itemDate);
    mTime = (TextView) view.findViewById(R.id.itemTime);
    mTitle = (TextView) view.findViewById(R.id.itemTitle);
    mAvgPace = (TextView) view.findViewById(R.id.itemAvgPace);
    mDistance = (TextView) view.findViewById(R.id.itemDistance);
    mProcessing = (TextView) view.findViewById(R.id.itemProcessing);
    mRunClassification = (TextView) view.findViewById(R.id.itemClassification);
    mDeleteRun = (TextView) view.findViewById(R.id.deleteRun);

    cardActive = view.getResources().getColor(R.color.cardBackgroundColor);
    cardInactive = view.getResources().getColor(R.color.cardInactiveColor);
}
 
Example 14
Source Project: FastWaiMai   Source File: SearchAddressAdapter.java    License: MIT License 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, PoiInfo item) {

    final ImageView ivPointImage = helper.getView(R.id.iv_point);
    final TextView tvName = helper.getView(R.id.tv_name);
    final TextView tvAddress = helper.getView(R.id.tv_address);
    final TextView tvDistance = helper.getView(R.id.tv_distance);
    LatLng latLng = item.getLocation();

    double distance = DistanceUtil.getDistance(currentLatLng, latLng);
    if(helper.getPosition() == 0){
        ivPointImage.setImageResource(R.drawable.point_orange);
        tvName.setTextColor(Latte.getApplication().getResources().getColor(R.color.orange));
    }else{
        ivPointImage.setImageResource(R.drawable.point_gray);
        tvName.setTextColor(Latte.getApplication().getResources().getColor(R.color.black));
    }
    tvName.setText(item.getName());
    tvAddress.setText(item.getAddress());
    tvDistance.setText(formatDistance(distance));
}
 
Example 15
Source Project: mage-android   Source File: ProfileActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void onEmailLongCLick(final View view) {
	String[] items = {"Email", "Copy to clipboard"};
	View titleView = getLayoutInflater().inflate(R.layout.alert_primary_title, null);
	TextView title = titleView.findViewById(R.id.alertTitle);
	title.setText(user.getEmail());
	ImageView icon = titleView.findViewById(R.id.icon);
	icon.setImageResource(R.drawable.ic_email_white_24dp);

	new AlertDialog.Builder(this)
	.setCustomTitle(titleView)
		.setItems(items, (dialog, item) -> {
			if (item == 0) {
				onEmailClick(view);
			} else {
				ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
				ClipData clip = ClipData.newPlainText("Email", user.getEmail());
				clipboard.setPrimaryClip(clip);
			}
		})
		.create()
		.show();
}
 
Example 16
Source Project: AwesomeSplash   Source File: AwesomeSplash.java    License: MIT License 6 votes vote down vote up
public void initUI(int flag) {
    setContentView(R.layout.activity_main_lib);

    mRlReveal = (RelativeLayout) findViewById(R.id.rlColor);
    mTxtTitle = (AppCompatTextView) findViewById(R.id.txtTitle);


    switch (flag) {
        case Flags.WITH_PATH:
            mFl = (FrameLayout) findViewById(R.id.flCentral);
            initPathAnimation();
            break;
        case Flags.WITH_LOGO:
            mImgLogo = (ImageView) findViewById(R.id.imgLogo);
            mImgLogo.setImageResource(mConfigSplash.getLogoSplash());
            break;
        default:
            break;

    }

}
 
Example 17
Source Project: Melophile   Source File: StartAnimatable.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Animator createAnimator(ViewGroup sceneRoot,
                               TransitionValues startValues,
                               TransitionValues endValues) {
  if (animatable == null || endValues == null
          || !(endValues.view instanceof ImageView)) return null;

  ImageView iv = (ImageView) endValues.view;
  iv.setImageDrawable((Drawable) animatable);

  // need to return a non-null Animator even though we just want to listen for the start
  ValueAnimator transition = ValueAnimator.ofInt(0, 1);
  transition.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationStart(Animator animation) {
      animatable.start();
    }
  });
  return transition;
}
 
Example 18
Source Project: jmessage-android-uikit   Source File: DialogCreator.java    License: MIT License 6 votes vote down vote up
public static Dialog createLoadingDialog(Context context, String msg) {
    LayoutInflater inflater = LayoutInflater.from(context);
    View v = inflater.inflate(IdHelper.getLayout(context, "jmui_loading_view"), null);
    RelativeLayout layout = (RelativeLayout) v.findViewById(IdHelper.getViewID(context, "jmui_dialog_view"));
    ImageView mLoadImg = (ImageView) v.findViewById(IdHelper.getViewID(context, "jmui_loading_img"));
    TextView mLoadText = (TextView) v.findViewById(IdHelper.getViewID(context, "jmui_loading_txt"));
    AnimationDrawable mDrawable = (AnimationDrawable) mLoadImg.getDrawable();
    mDrawable.start();
    mLoadText.setText(msg);
    final Dialog loadingDialog = new Dialog(context, IdHelper.getStyle(context, "jmui_loading_dialog_style"));
    loadingDialog.setCancelable(true);
    loadingDialog.setContentView(layout, new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT));
    return loadingDialog;
}
 
Example 19
@Override
protected void onResume() {
    super.onResume();
    if (mVideoInfo.state == PlayerState.FINISHED) finish();
    if (mMediaRouteController == null) return;

    // Lifetime of the media element is bound to that of the {@link MediaStateListener}
    // of the {@link MediaRouteController}.
    RecordCastAction.recordFullscreenControlsShown(
            mMediaRouteController.getMediaStateListener() != null);

    mMediaRouteController.prepareMediaRoute();

    ImageView iv = (ImageView) findViewById(R.id.cast_background_image);
    if (iv == null) return;
    Bitmap posterBitmap = mMediaRouteController.getPoster();
    if (posterBitmap != null) iv.setImageBitmap(posterBitmap);
    iv.setImageAlpha(POSTER_IMAGE_ALPHA);
}
 
Example 20
Source Project: haxsync   Source File: WelcomeActivity.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_welcome);
      //	Animation hyperspaceJump = AnimationUtils.loadAnimation(this, R.anim.hyperjump);
      ImageView image = (ImageView) findViewById(R.id.logo);
      //image.startAnimation(hyperspaceJump);
      image.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View v) {
		Intent nextIntent = new Intent(WelcomeActivity.this, WizardActivity.class);
		WelcomeActivity.this.startActivity(nextIntent);
	    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
	    WelcomeActivity.this.finish();
	}
});

  }
 
Example 21
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@SuppressWarnings("deprecation")
private void initHeadViews() {
    headItemTitle = (TextView) this.findViewById(R.id.current_head_item_title);
    headItemTitle.setTextColor(headItemTitleColor);

    headItemSubTitle = (TextView) this.findViewById(R.id.current_head_item_sub_title);
    headItemSubTitle.setTextColor(headItemSubTitleColor);

    headItemFirstPhoto = (ImageView) this.findViewById(R.id.current_head_item_photo);
    headItemSecondPhoto = (ImageView) this.findViewById(R.id.second_head_item_photo);
    headItemThirdPhoto = (ImageView) this.findViewById(R.id.third_head_item_photo);
    headItemBackground = (ImageView) this.findViewById(R.id.current_back_item_background);
    headItemBackgroundSwitcher = (ImageView) this.findViewById(R.id.background_switcher);
    headItemButtonSwitcher = (ImageButton) this.findViewById(R.id.user_switcher);
    headItemBackgroundGradientLL = (LinearLayout) this.findViewById(R.id.background_gradient);
    int sdk = android.os.Build.VERSION.SDK_INT;
    if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
        headItemBackgroundGradientLL.setBackgroundDrawable(headItemBackgroundGradient);
    } else {
        headItemBackgroundGradientLL.setBackground(headItemBackgroundGradient);
    }
}
 
Example 22
Source Project: android-tv-launcher   Source File: EliminateMainActivity.java    License: MIT License 6 votes vote down vote up
public void Init() {
GetSurplusMemory();
Round_img=(ImageView)findViewById(R.id.eliminate_roundimg);
Start_kill=(Button)findViewById(R.id.start_killtask);
release_memory=(TextView)findViewById(R.id.relase_memory);
increase_speed=(TextView)findViewById(R.id.increase_speed);
Allpercent=(TextView)findViewById(R.id.all_percent);
clear_endlayout=(LinearLayout)findViewById(R.id.clear_endlayout);
Clearing_layout=(RelativeLayout)findViewById(R.id.clearing_layout);
Animation animation=AnimationUtils.loadAnimation(EliminateMainActivity.this, R.anim.eliminatedialog_anmiation);
TotalMemory=GetTotalMemory();
Round_img.setAnimation(animation);
Start_kill.setClickable(false);
Start_kill.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
	finish();	
	}
});
}
 
Example 23
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(R.layout.fragment_animal, container,
			false);
	int i = getArguments().getInt(ARG_ANIMAL_NUMBER);
	String planet = getResources().getStringArray(R.array.animal_array)[i];

	int imageId = getResources().getIdentifier(
			planet.toLowerCase(Locale.getDefault()), "drawable",
			getActivity().getPackageName());
	((ImageView) rootView.findViewById(R.id.image))
			.setImageResource(imageId);
	getActivity().setTitle(planet);
	return rootView;
}
 
Example 24
Source Project: PopCorn   Source File: AboutActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    setTitle(R.string.about);

    featureGraphicImageView = (ImageView) findViewById(R.id.image_view_feature_graphic_about);
    featureGraphicImageView.getLayoutParams().width = getResources().getDisplayMetrics().widthPixels;
    featureGraphicImageView.getLayoutParams().height = (int) ((double) getResources().getDisplayMetrics().widthPixels * (500.0 / 1024.0));

    shareImageButton = (ImageButton) findViewById(R.id.image_button_share_about);
    rateUsImageButton = (ImageButton) findViewById(R.id.image_button_rate_us_about);
    feedbackImageButton = (ImageButton) findViewById(R.id.image_button_feedback_about);

    sourceCodeOnGitHubCardView = (CardView) findViewById(R.id.card_view_source_code_on_github);

    openSourceLicensesFrameLayout = (FrameLayout) findViewById(R.id.frame_layout_open_source_licenses);
    versionNumberTextView = (TextView) findViewById(R.id.text_view_version_number);

    loadActivity();

}
 
Example 25
Source Project: WanAndroid   Source File: CustomBanner.java    License: Apache License 2.0 6 votes vote down vote up
private void displayIndicator() {
    indicatorViews.clear();
    indicatorContainer.removeAllViews();
    for (int i = 0; i < count; i++) {
        ImageView imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(indicatorWidth, indicatorHeight);
        params.leftMargin = indicatorLeftMargin;
        params.rightMargin = indicatorRightMargin;
        if (i == 0) {
            imageView.setImageResource(R.drawable.gray_radius);
        }else {
            imageView.setImageResource(R.drawable.white_radius);
        }
        indicatorViews.add(imageView);
        indicatorContainer.addView(imageView, params);
    }
}
 
Example 26
Source Project: EasyVolley   Source File: ProductsActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    productsAdapter = new ProductsAdapter(mContext, new ArrayList<Product>());
    gridView.setEmptyView(emptyElement);
    gridView.setAdapter(productsAdapter);
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Product product = productsAdapter.getItem(position);
            DetailsActivity.launch(mContext, product, (ImageView) view.findViewById(R.id.imageView));
        }
    });

    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            loadProducts();
        }
    });

    loadProducts();
}
 
Example 27
Source Project: Tok-Android   Source File: ImageLoadUtils.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * 加载缩略图
 *
 * @param context 上下文
 * @param path url/filepath/uri
 * @param imgView 目标imageView
 */
public static void loadThumbnail(Context context, String path, ImageView imgView) {
    LogUtil.i(TAG, "loadThumbnail path:" + path);
    Glide.with(context)
        .setDefaultRequestOptions(getOptions())
        .load(path)
        .thumbnail(THUMB_NAIL)
        .into(imgView);
}
 
Example 28
Source Project: letv   Source File: PersonalInfoActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void initUI() {
    this.mBackImageView = (ImageView) findViewById(R.id.back_btn);
    this.mBackImageView.setOnClickListener(this);
    this.mTitleTv = (TextView) findViewById(2131362147);
    this.mTitleTv.setText(getActivity().getResources().getString(2131100413));
    this.mUserBean = (UserBean) getIntent().getBundleExtra(ShareRequestParam.RESP_UPLOAD_PIC_PARAM_DATA).getSerializable("userbean");
    this.mPersonalInfoFragment = new PersonalInfoFragment(this.mUserBean);
}
 
Example 29
Source Project: school_shop   Source File: AlbumGridViewAdapter.java    License: MIT License 5 votes vote down vote up
public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(R.layout.item_show_file_photo, null);
			viewHolder.imageView = (ImageView) convertView.findViewById(R.id.item_filePhoto_imageview);
			viewHolder.toggleButton = (ToggleButton) convertView.findViewById(R.id.item_filePhoto_toggle_button);
			viewHolder.choosetoggle = (Button) convertView.findViewById(R.id.item_filePhoto_choosedbt);
//			RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,dipToPx(65)); 
//			lp.setMargins(50, 0, 50,0); 
//			viewHolder.imageView.setLayoutParams(lp);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		String path;
		if (dataList != null && dataList.size() > position)
			path = dataList.get(position).imagePath;
		else
			path = "camera_default";
		if (path.contains("camera_default")) {
			viewHolder.imageView.setImageResource(R.drawable.camera_no_pictures);
		} else {
			final ImageItem item = dataList.get(position);
			viewHolder.imageView.setTag(item.imagePath);
			cache.displayBmp(viewHolder.imageView, item.thumbnailPath, item.imagePath,
					callback);
		}
		viewHolder.toggleButton.setTag(position);
		viewHolder.choosetoggle.setTag(position);
		viewHolder.toggleButton.setOnClickListener(new ToggleClickListener(viewHolder.choosetoggle));
		if (selectedDataList.contains(dataList.get(position))) {
			viewHolder.toggleButton.setChecked(true);
			viewHolder.choosetoggle.setVisibility(View.VISIBLE);
		} else {
			viewHolder.toggleButton.setChecked(false);
			viewHolder.choosetoggle.setVisibility(View.GONE);
		}
		return convertView;
	}
 
Example 30
Source Project: school_shop   Source File: AlbumGridViewAdapter.java    License: MIT License 5 votes vote down vote up
@Override
public void imageLoad(ImageView imageView, Bitmap bitmap,
		Object... params) {
	if (imageView != null && bitmap != null) {
		String url = (String) params[0];
		if (url != null && url.equals((String) imageView.getTag())) {
			((ImageView) imageView).setImageBitmap(bitmap);
		} else {
			Log.e(TAG, "callback, bmp not match");
		}
	} else {
		Log.e(TAG, "callback, bmp null");
	}
}