android.widget.ImageView Java Examples

The following examples show how to use android.widget.ImageView. 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 File: ColorListAdapter.java    From SelectionDialogs with 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 File: ProductsActivity.java    From EasyVolley with 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 #3
Source File: InterpretationAdapter.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 File: ShotActivity.java    From AirFree-Client with 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 #5
Source File: ProfilePictureView.java    From platform-friends-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #6
Source File: NewsDetailActivity.java    From MyHearts with 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 #7
Source File: LeftNavigationController.java    From Musicoco with 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 #8
Source File: GridAdapter.java    From DistroHopper with 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 #9
Source File: ImageWorker.java    From bither-bitmap-sample with 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 #10
Source File: BaseActivity.java    From YalpStore with 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 #11
Source File: ExperimentDetailsFragment.java    From science-journal with 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 #12
Source File: GuidePageActivity.java    From Pigeon with 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 #13
Source File: CommentViewHolder.java    From SteamGifts with 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 #14
Source File: RunHistoryItemRecyclerViewAdapter.java    From SEAL-Demo with 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 #15
Source File: SearchAddressAdapter.java    From FastWaiMai with 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 #16
Source File: ProfileActivity.java    From mage-android with 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 #17
Source File: AwesomeSplash.java    From AwesomeSplash with 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 #18
Source File: StartAnimatable.java    From Melophile with 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 #19
Source File: ExpandedControllerActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@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 File: WelcomeActivity.java    From haxsync with 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
Source File: MaterialNavHeadItemActivity.java    From AdvancedMaterialDrawer with Apache License 2.0 6 votes vote down vote up
@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 File: EliminateMainActivity.java    From android-tv-launcher with 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
Source File: AnimalFragment.java    From FoldingNavigationDrawer-Android with Apache License 2.0 6 votes vote down vote up
@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 File: AboutActivity.java    From PopCorn with 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 File: CustomBanner.java    From WanAndroid with 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 File: DialogCreator.java    From jmessage-android-uikit with 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 #27
Source File: TimeLineBitmapDownloader.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
private static boolean cancelPotentialDownload(String url, ImageView imageView) {
    IPictureWorker bitmapDownloaderTask = getBitmapDownloaderTask(imageView);

    if (bitmapDownloaderTask != null) {
        String bitmapUrl = bitmapDownloaderTask.getUrl();
        if ((bitmapUrl == null) || (!bitmapUrl.equals(url))) {
            if (bitmapDownloaderTask instanceof MyAsyncTask) {
                ((MyAsyncTask) bitmapDownloaderTask).cancel(true);
            }
        } else {
            return false;
        }
    }
    return true;
}
 
Example #28
Source File: DefaultOnDoubleTapListener.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (this.photoViewAttacher == null)
        return false;

    ImageView imageView = photoViewAttacher.getImageView();

    if (null != photoViewAttacher.getOnPhotoTapListener()) {
        final RectF displayRect = photoViewAttacher.getDisplayRect();

        if (null != displayRect) {
            final float x = e.getX(), y = e.getY();

            // Check to see if the user tapped on the photo
            if (displayRect.contains(x, y)) {

                float xResult = (x - displayRect.left)
                        / displayRect.width();
                float yResult = (y - displayRect.top)
                        / displayRect.height();

                photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                return true;
            }
        }
    }
    if (null != photoViewAttacher.getOnViewTapListener()) {
        photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
    }

    return false;
}
 
Example #29
Source File: AlbumGridViewAdapter.java    From school_shop with 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");
	}
}
 
Example #30
Source File: DefaultOnDoubleTapListener.java    From Album with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (this.photoViewAttacher == null)
        return false;

    ImageView imageView = photoViewAttacher.getImageView();

    if (null != photoViewAttacher.getOnPhotoTapListener()) {
        final RectF displayRect = photoViewAttacher.getDisplayRect();

        if (null != displayRect) {
            final float x = e.getX(), y = e.getY();

            // Check to see if the user tapped on the photo
            if (displayRect.contains(x, y)) {

                float xResult = (x - displayRect.left)
                        / displayRect.width();
                float yResult = (y - displayRect.top)
                        / displayRect.height();

                photoViewAttacher.getOnPhotoTapListener().onPhotoTap(imageView, xResult, yResult);
                return true;
            } else {
                photoViewAttacher.getOnPhotoTapListener().onOutsidePhotoTap();
            }
        }
    }
    if (null != photoViewAttacher.getOnViewTapListener()) {
        photoViewAttacher.getOnViewTapListener().onViewTap(imageView, e.getX(), e.getY());
    }

    return false;
}