@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ndialog); instance = ndialog.this; // 获取传递过来的参数 Bundle b = new Bundle(); b = getIntent().getBundleExtra("data"); promt = b.getString("promt"); icon = b.getInt("icon"); time = b.getInt("time"); // 绑定组件 IvIcon = (ImageView) findViewById(R.id.icon); TvPromt = (TextView) findViewById(R.id.promt); // 设置提示框内容,delay为提示框延迟函数 TvPromt.setText(promt); switch (icon) { case 0: IvIcon.setImageResource(R.drawable.wrong1); break; case 1: IvIcon.setImageResource(R.drawable.loading); Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.animation); IvIcon.startAnimation(hyperspaceJumpAnimation); isYaolianwang = true; setFinishOnTouchOutside(false); // 点击外部不返回 break; default: IvIcon.setImageResource(R.mipmap.about1); } delay(); }
/** * Load an image specified by the data parameter into an ImageView (override {@link * ImageWorker#processBitmap(Object)} to define the processing logic). A memory and disk cache * will be used if an {@link ImageCache} has been added using {@link * ImageWorker#addImageCache(android.support.v4.app.FragmentManager, * ImageCache.ImageCacheParams)}. If the image is found in the memory cache, it is set * immediately, otherwise an {@link AsyncTask} will be created to asynchronously load the bitmap. * * @param data The URL of the image to download. * @param imageView The ImageView to bind the downloaded image to. */ public void loadImage(Object data, ImageView imageView) { if (data == null) { return; } BitmapDrawable value = null; if (mImageCache != null) { value = mImageCache.getBitmapFromMemCache(String.valueOf(data)); } if (value != null) { // Bitmap found in memory cache imageView.setImageDrawable(value); } else if (cancelPotentialWork(data, imageView)) { // BEGIN_INCLUDE(execute_background_task) final BitmapWorkerTask task = new BitmapWorkerTask(data, imageView); final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task); imageView.setImageDrawable(asyncDrawable); // NOTE: This uses a custom version of AsyncTask that has been pulled from the // framework and slightly modified. Refer to the docs at the top of the class // for more info on what was changed. task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR); // END_INCLUDE(execute_background_task) } }
public void onRadioButtonClicked(View v) { if (v.getId() == R.id.group_closed_radio) { groupLogo.setImageResource(R.drawable.group_closed); groupLogo.setBackgroundColor(R.color.color_primary); groupTypeDescr.setText(R.string.group_closed_description); Log.e( TAG, "Cliccato: " + v.getId() + "! Setto: " + R.drawable.group_closed + ", " + R.color.color_primary + ", " + R.string.group_closed_description); } else if (v.getId() == R.id.group_open_radio) { groupLogo.setImageResource(R.drawable.group_open); groupLogo.setBackgroundColor(R.color.color_primary); groupTypeDescr.setText(R.string.group_open_description); Log.e( TAG, "Cliccato: " + v.getId() + "! Setto: " + R.drawable.group_open + ", " + R.color.color_primary + ", " + R.string.group_open_description); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 1 && resultCode == RESULT_OK && data != null) { Uri selectedImage = data.getData(); String[] filePath = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePath, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePath[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); ImageView image = (ImageView) findViewById(R.id.imageView2); image.setImageBitmap(BitmapFactory.decodeFile(picturePath)); imagepath = picturePath; } else if (requestCode == 2 && resultCode == RESULT_OK) { Bitmap photo = (Bitmap) data.getExtras().get("data"); ImageView image = (ImageView) findViewById(R.id.imageView2); image.setImageBitmap(photo); try { File imagefile = createImageFile(photo); Log.d("dir", imagefile.getAbsolutePath()); imagepath = imagefile.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); } } }
public void updateUI(boolean isSignedIn) { if (isSignedIn) { getActionBar().setTitle("My Profile"); logo.setVisibility(View.GONE); header.setVisibility(View.GONE); title.setVisibility(View.GONE); // loginTwitter.setVisibility(View.GONE); btnLoginTwitter.setVisibility(View.GONE); btnSignIn.setVisibility(View.GONE); loginNormal.setVisibility(View.GONE); authButton.setVisibility(View.GONE); btnSignOut.setVisibility(View.GONE); btnRevokeAccess.setVisibility(View.VISIBLE); btnProceed.setVisibility(View.VISIBLE); llProfileLayout.setVisibility(View.VISIBLE); } else { logo.setVisibility(View.VISIBLE); header.setVisibility(View.VISIBLE); title.setVisibility(View.VISIBLE); // loginTwitter.setVisibility(View.VISIBLE); btnLoginTwitter.setVisibility(View.VISIBLE); btnSignIn.setVisibility(View.VISIBLE); loginNormal.setVisibility(View.VISIBLE); authButton.setVisibility(View.VISIBLE); btnSignOut.setVisibility(View.GONE); btnRevokeAccess.setVisibility(View.GONE); btnProceed.setVisibility(View.GONE); llProfileLayout.setVisibility(View.GONE); } }
/** Put a nice border on the bitmap. */ private static View applyFrame( final PhotoTable table, final BitmapFactory.Options options, Bitmap decodedPhoto) { LayoutInflater inflater = (LayoutInflater) table.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View photo = inflater.inflate(R.layout.photo, null); ImageView image = (ImageView) photo; Drawable[] layers = new Drawable[2]; int photoWidth = options.outWidth; int photoHeight = options.outHeight; if (decodedPhoto == null || options.outWidth <= 0 || options.outHeight <= 0) { photo = null; } else { decodedPhoto.setHasMipMap(true); layers[0] = new BitmapDrawable(table.mResources, decodedPhoto); layers[1] = table.mResources.getDrawable(R.drawable.frame); LayerDrawable layerList = new LayerDrawable(layers); layerList.setLayerInset(0, table.mInset, table.mInset, table.mInset, table.mInset); image.setImageDrawable(layerList); photo.setTag(R.id.photo_width, Integer.valueOf(photoWidth)); photo.setTag(R.id.photo_height, Integer.valueOf(photoHeight)); photo.setOnTouchListener(new PhotoTouchListener(table.getContext(), table)); } return photo; }
/** 对拖拽图片不同的点击事件处理 */ @Override public boolean onTouchEvent(MotionEvent event) { int X = (int) event.getX(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: dragBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.lock_touch); heartView.setImageBitmap(dragBitmap); linearLayoutL.setBackgroundResource(R.drawable.left_bg_default); linearLayoutR.setBackgroundResource(R.drawable.left_bg_default); locationX = (int) event.getX(); Log.i(TAG, "是否点击到位=" + isActionDown(event)); return isActionDown(event); // 判断是否点击了滑动区�? case MotionEvent.ACTION_MOVE: // 保存x轴方向,绘制图画 locationX = X; invalidate(); // 重新绘图 return true; case MotionEvent.ACTION_UP: // 判断是否解锁成功 dragBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.icon_slide_circle_n); heartView.setImageBitmap(dragBitmap); linearLayoutL.setBackgroundColor(getResources().getColor(R.color.transparent)); linearLayoutR.setBackgroundResource(getResources().getColor(R.color.transparent)); if (!unLockLeft() && !unLockRight()) { // 没有解锁成功,动画应该回滚 flag = false; handleActionUpEvent(event); // 动画回滚 } return true; } return super.onTouchEvent(event); }
@Override public void prepareViews(View currentView) { imgMap = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgMap)); imgFilter = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgFilter)); imgFilterSort = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgFilterSort)); imgAddEntry = ((ImageView) ((SmartActivity) getActivity()).getHeaderView().findViewById(R.id.imgAddEntry)); imgMap.setVisibility(View.GONE); imgFilter.setVisibility(View.VISIBLE); imgFilterSort.setVisibility(View.VISIBLE); imgAddEntry.setVisibility(View.VISIBLE); if (IN_PARENT_ID != null) { getEntries(); } else { prepareList((List<ArrayList<HashMap<String, String>>>) entryListData, false, false, 1, 10); listAdapterWithHolder = getListAdapter(listData); lstEntries.setAdapter(listAdapterWithHolder); } }
public void loadBitmap(Message message, ImageView imageView) { Bitmap bm; try { bm = xmppConnectionService .getFileBackend() .getThumbnail(message, (int) (metrics.density * 288), true); } catch (FileNotFoundException e) { bm = null; } if (bm != null) { imageView.setImageBitmap(bm); imageView.setBackgroundColor(0x00000000); } else { if (cancelPotentialWork(message, imageView)) { imageView.setBackgroundColor(0xff333333); final BitmapWorkerTask task = new BitmapWorkerTask(imageView); final AsyncDrawable asyncDrawable = new AsyncDrawable(getResources(), null, task); imageView.setImageDrawable(asyncDrawable); try { task.execute(message); } catch (final RejectedExecutionException ignored) { } } } }
public View getView(int position, View convertView, ViewGroup parent) { View row = super.getView(position, convertView, parent); ImageView icon = (ImageView) row.findViewById(R.id.icon); ImageView listThumb = (ImageView) row.findViewById(R.id.listThumb); TextView author = (TextView) row.findViewById(R.id.bookAuthor); Drawable d = new BitmapDrawable(bookImages.get(position)); icon.setImageResource(R.drawable.blank); listThumb.setImageDrawable(d); author.setText("Author:" + authors.get(position)); fileNames = booksInDirectory.list(); for (int i = 0; i < fileNames.length; i++) { System.out.println(fileNames[i]); if (fileNames[i].equals(bookArray[position])) { icon.setImageResource(R.drawable.accept); } } return (row); }
public void a(aoa aoa1, boolean flag, String s, int j, int k, int i1) { if (s == null) { if (a()) { h.setVisibility(0); } } else { int j1 = j; if (j == 0) { j1 = i; } j = k; if (k == 0) { j = i; } if (Math.abs(i1 % 180) == 90) { e.a(j, j1); } else { e.a(j1, j); } f = flag; d = new aqn((new edq(s, aoa1.a())).a(i).a(false).c(f()).d(false), this, null, true, null); if (((dpn) hlp.a(getContext(), dpn)).a(d, f)) { d = null; } else { e(); } if (g.a(g.nU, "babel_extra_log_scrolling", false)) { j = e.getHeight(); eev.e( "Babel_Scroll", (new StringBuilder(39)).append("Image request begin, Height:").append(j).toString()); return; } } }
private void dependToShowDialog() { if (!SomeUtil.hasSystemFeatureGPS(this)) { // 系统没有 GPS 模块就不弹出开启 GPS 的对话框 return; } if (!SomeUtil.isGPSOn(this)) { mDialog = new Dialog(this, R.style.Dialog_style_dim2); View view = View.inflate(this, R.layout.dialog_my_vehicle_condition, null); TextView txt1 = (TextView) view.findViewById(R.id.txt_dialog_my_vehicle_condition_heading); TextView txt2 = (TextView) view.findViewById(R.id.txt_dialog_my_vehicle_condition_subheading); ImageView ivYes = (ImageView) view.findViewById(R.id.iv_dialog_my_vehicle_condition_yes); ImageView ivNo = (ImageView) view.findViewById(R.id.iv_dialog_my_vehicle_condition_no); txt1.setText(getResources().getString(R.string.myVehicleCondition_heading_no_gps)); txt2.setText(getResources().getString(R.string.myVehicleCondition_subheading_no_gps)); ivYes.setOnClickListener(mDialogOnClickListener); ivNo.setOnClickListener(mDialogOnClickListener); mDialog.setContentView(view); mDialog.setCanceledOnTouchOutside(true); mDialog.getWindow().setType((WindowManager.LayoutParams.TYPE_SYSTEM_ALERT)); mDialog.show(); } else { mLocationClient.start(); } }
private void newWait() { if (DeviceUtil.checkConnection(mContext)) { // 加载动画 progressLinear.setVisibility(View.VISIBLE); AnimationDrawable animationDrawable = (AnimationDrawable) progreView.getDrawable(); animationDrawable.start(); mRecyclerView.setVisibility(View.VISIBLE); networkInfo.setVisibility(View.GONE); initData(sessionData); } else { errorInfo.setImageDrawable(getResources().getDrawable(R.mipmap.error_nowifi)); mRecyclerView.setVisibility(View.GONE); networkInfo.setVisibility(View.VISIBLE); newLoading.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { newWait(); } }); } }
/** 当窗口焦点改变时调用 */ public void onWindowFocusChanged(boolean hasFocus) { ImageView imageView = (ImageView) findViewById(R.id.spinnerImageView); // 获取ImageView上的动画背景 AnimationDrawable spinner = (AnimationDrawable) imageView.getBackground(); // 开始动画 spinner.start(); }
@Override public View getView(int position, View convertView, ViewGroup parent) { final ImageView imageView; if (convertView == null) { imageView = new ImageView(context); convertView = imageView; convertView.setTag(imageView); } else { imageView = (ImageView) convertView.getTag(); } imageView.setImageResource(R.drawable.default_img); String imgUrl = imageUrls.get(position); if (CacheUtil.getInstence().iSCacheFileExists(imgUrl)) { imageView.setImageBitmap(AndroidFileUtils.getBitmap(imgUrl, 400, 400)); } else { if (imgUrl != null && !imgUrl.equals("")) { Bitmap bitmap = LocalImageCache.get() .loadImageBitmap( CacheUtil.avatarCachePath + imgUrl.substring(imgUrl.lastIndexOf("/"))); if (bitmap == null) { // new NetImageTask(imageView).execute(position); AppData.volleyUtil.loadImageByVolley( ChatServerConstant.URL.SERVER_HOST + imgUrl, imageView, R.drawable.default_img, R.drawable.default_img); } else { imageView.setImageBitmap(bitmap); } } } return convertView; }
/** * 初始化 * * @param context context */ private void init(Context context) { mHeaderContainer = (RelativeLayout) findViewById(R.id.pull_to_refresh_header_content); mArrowImageView = (ImageView) findViewById(R.id.pull_to_refresh_header_arrow); mHintTextView = (TextView) findViewById(R.id.pull_to_refresh_header_hint_textview); mHeaderTimeView = (TextView) findViewById(R.id.pull_to_refresh_header_time); mHeaderTimeViewTitle = (TextView) findViewById(R.id.pull_to_refresh_last_update_time_text); mArrowImageView.setScaleType(ScaleType.CENTER); mArrowImageView.setImageResource(R.drawable.default_ptr_rotate); float pivotValue = 0.5f; // SUPPRESS CHECKSTYLE float toDegree = 720.0f; // SUPPRESS CHECKSTYLE mRotateAnimation = new RotateAnimation( 0.0f, toDegree, Animation.RELATIVE_TO_SELF, pivotValue, Animation.RELATIVE_TO_SELF, pivotValue); mRotateAnimation.setFillAfter(true); mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION); mRotateAnimation.setRepeatCount(Animation.INFINITE); mRotateAnimation.setRepeatMode(Animation.RESTART); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); generateShuffle(); mainLayout = (LinearLayout) findViewById(R.id.activity_main_linear_layout); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); params.weight = 1f; for (int i = 0; i < 4; i++) { LinearLayout row = new LinearLayout(this); // row.setOrientation(LinearLayout.HORIZONTAL); for (int j = 0; j < 3; j++) { ImageView imageView = new ImageView(this); imageView.setTag(tag++); imageView.setOnClickListener(this); imageView.setImageResource(R.drawable.card_back); row.addView(imageView, params); } mainLayout.addView(row, params); } }
@Override public boolean onLongClick(View v) { int nBtnID = v.getId(); // If the mode is not changed, open the setting view. If the mode is same, close the // setting view. if (nBtnID == mPenBtn.getId()) { mSCanvas.setSettingViewSizeOption( SCanvasConstants.SCANVAS_SETTINGVIEW_PEN, SCanvasConstants.SCANVAS_SETTINGVIEW_SIZE_MINI); if (mSCanvas.getCanvasMode() == SCanvasConstants.SCANVAS_MODE_INPUT_PEN) { mSCanvas.toggleShowSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_PEN); } else { mSCanvas.setCanvasMode(SCanvasConstants.SCANVAS_MODE_INPUT_PEN); mSCanvas.showSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_PEN, true); updateModeState(); } return true; } else if (nBtnID == mEraserBtn.getId()) { mSCanvas.setSettingViewSizeOption( SCanvasConstants.SCANVAS_SETTINGVIEW_ERASER, SCanvasConstants.SCANVAS_SETTINGVIEW_SIZE_MINI); if (mSCanvas.getCanvasMode() == SCanvasConstants.SCANVAS_MODE_INPUT_ERASER) { mSCanvas.toggleShowSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_ERASER); } else { mSCanvas.setCanvasMode(SCanvasConstants.SCANVAS_MODE_INPUT_ERASER); mSCanvas.showSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_ERASER, true); updateModeState(); } return true; } else if (nBtnID == mTextBtn.getId()) { mSCanvas.setSettingViewSizeOption( SCanvasConstants.SCANVAS_SETTINGVIEW_TEXT, SCanvasConstants.SCANVAS_SETTINGVIEW_SIZE_MINI); if (mSCanvas.getCanvasMode() == SCanvasConstants.SCANVAS_MODE_INPUT_TEXT) { mSCanvas.toggleShowSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_TEXT); } else { mSCanvas.setCanvasMode(SCanvasConstants.SCANVAS_MODE_INPUT_TEXT); mSCanvas.showSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_TEXT, true); updateModeState(); Toast.makeText(mContext, "Tap Canvas to insert Text", Toast.LENGTH_SHORT).show(); } return true; } else if (nBtnID == mFillingBtn.getId()) { mSCanvas.setSettingViewSizeOption( SCanvasConstants.SCANVAS_SETTINGVIEW_FILLING, SCanvasConstants.SCANVAS_SETTINGVIEW_SIZE_MINI); if (mSCanvas.getCanvasMode() == SCanvasConstants.SCANVAS_MODE_INPUT_FILLING) { mSCanvas.toggleShowSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_FILLING); } else { mSCanvas.setCanvasMode(SCanvasConstants.SCANVAS_MODE_INPUT_FILLING); mSCanvas.showSettingView(SCanvasConstants.SCANVAS_SETTINGVIEW_FILLING, true); updateModeState(); Toast.makeText(mContext, "Tap Canvas to fill color", Toast.LENGTH_SHORT).show(); } return true; } return false; }
public ToggleMenuItem( Context context, String label, int imgRes, boolean isToggle, OnCheckedChangeListener listener) { super(context); View.inflate(context, R.layout.sw_menu_item_toggle, this); itemLabel = (TextView) findViewById(R.id.textLabel); itemIcon = (ImageView) findViewById(R.id.imageView); toggleButton = (ToggleButton) findViewById(R.id.toggleButton); if (imgRes != 0) { itemIcon.setImageResource(imgRes); itemIcon.setVisibility(VISIBLE); } else { itemIcon.setVisibility(GONE); } itemLabel.setText(label); toggleButton.setChecked(isToggle); toggleButton.setOnCheckedChangeListener(listener); }
private void initView() { mImgFollowMe = (ImageView) findViewById(R.id.image_notice); mImgFollowMe.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (!isCatch) { catchMeRequest(); } else { dropCatch(); } } }); // mImgFav = (ImageView) findViewById(R.id.image_fav); // mImgFav.setImgStateChangeListener(this); mRadioGroup = (FlowRadioGroup) this.findViewById(R.id.video_detail_radiogroup); mRadioGroup.setOnCheckedChangeListener(mRadioCheckedChangeListener); mRadioGroup.getRadioButton(0).setChecked(true); bar = (ProgressBar) findViewById(R.id.videoplayerPreloader); video_down_layout = (RelativeLayout) findViewById(R.id.video_down_layoutx); mVideoView = (cn.fxdata.tv.view.video.FullScreenVideoView) findViewById(R.id.video_viewx); mDownloadImage = (ImageView) findViewById(R.id.image_download); mDownloadImage.setOnClickListener(this); btnShare = (ImageView) findViewById(R.id.image_share); btnShare.setOnClickListener(this); image_fav = (ImageView) findViewById(R.id.image_fav); image_fav.setOnClickListener(this); }
private static void AddTab( Activity_Tab activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo, String label, int drawable) { tabSpec.setContent(activity.new TabFactory(activity)); View tabIndicator = LayoutInflater.from(activity) .inflate(R.layout.tab_indicator, tabHost.getTabWidget(), false); TextView txtTitle = (TextView) tabIndicator.findViewById(R.id.title); ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon); txtTitle.setText(label); txtTitle.setTextSize( Float.parseFloat(activity.getResources().getString(R.string.size_pointer))); txtTitle.setTypeface(StaticUtils.getTypeface(activity, Font.THSarabanNew)); icon.setImageResource(drawable); tabSpec.setIndicator(tabIndicator); tabHost.addTab(tabSpec); }
@Override public void onClickEvent(View view) { switch (view.getId()) { case R.id.btn_more: btnClickMore(); break; case R.id.btn_user_model: AppLockApplication.getInstance().setVisitorState(true); finish(); break; case R.id.gesturepwd_unlock_forget: unGoHome = true; Intent intent = new Intent(this, SecretCheckActivity.class); startActivity(intent); closePopView(); break; case R.id.btn_user_check: boolean flag = SharedPreferenceUtil.readUnlockUserByEnter(); SharedPreferenceUtil.editUnlockUserByEnter(!flag); if (SharedPreferenceUtil.readUnlockUserByEnter()) { iv_user_check.setImageResource(R.drawable.checkbox_select); } else { iv_user_check.setImageResource(R.drawable.checkbox_unselect); } break; default: break; } super.onClickEvent(view); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; LayoutInflater vi; vi = LayoutInflater.from(mContext); v = vi.inflate(R.layout.categories_listview_items, null); Category c = getItem(position); if (c != null) { TextView name = (TextView) v.findViewById(R.id.categories_listview_items_name); ImageView icon = (ImageView) v.findViewById(R.id.categories_listview_items_icon); if (name != null) { name.setTypeface(typeface); name.setText(c.getName()); } if (icon != null) icon.setImageResource( mContext .getResources() .getIdentifier(c.getIconFileName(), "drawable", mContext.getPackageName())); } return v; }
/* * On resume, check and see if a meal photo has been set from the * CaptureFragment. If it has, load the image in this fragment and make the * preview image visible. */ @Override public void onResume() { super.onResume(); Bitmap img = getArguments().getParcelable("image"); if (img != null) { postDoneContainer.setEnabled(true); postImage.setImageBitmap(img); postImage.setVisibility(View.VISIBLE); } boolean fromCamera = getArguments().getBoolean("from_camera", true); String videoPath = getArguments().getString("video", null); Log.d("fromCamera", String.valueOf(fromCamera)); String hashtagSelected = getArguments().getString("hashtag_selected"); if (hashtagSelected != null) { Log.d("hashtagSelected", hashtagSelected); } if (fromCamera) { hideImage(); saveScaledPhoto(img, videoPath); } }
private void setButtonDarker(ImageView button, boolean darker) { if (darker) { button.animate().alpha(0.3f).setDuration(300).start(); } else { button.animate().alpha(1).setDuration(300).start(); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { InstagramPhoto photo = getItem(position); if (convertView == null) { // is recycled view ? // create one convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_photo, parent, false); } TextView tvCaption = (TextView) convertView.findViewById(R.id.tvCaption); TextView tvUser = (TextView) convertView.findViewById(R.id.tvUser); TextView tvComment1 = (TextView) convertView.findViewById(R.id.tvComment1); TextView tvLikes = (TextView) convertView.findViewById(R.id.tvLikes); ImageView ivPhoto = (ImageView) convertView.findViewById(R.id.ivPhoto); ImageView ivThumb = (ImageView) convertView.findViewById(R.id.ivThumb); tvCaption.setText(photo.caption); tvUser.setText(photo.username); tvComment1.setText(photo.comments); tvLikes.setText(photo.likes); // tvUsername.setText() //still have a username remains unused ivPhoto.setImageResource(0); // clear image first (this might be a recycled view) ivThumb.setImageResource(0); // as above Picasso.with(getContext()).load(photo.imageUrl).into(ivPhoto); // call picasso lib to load image Picasso.with(getContext()) .load(photo.profilePicture) .into(ivThumb); // call picasso lib to load image return convertView; }
/** * Same as download but the image is always downloaded and the cache is not used. Kept private at * the moment as its interest is not clear. */ private void forceDownload(String url, ImageView imageView) { // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys. if (url == null) { imageView.setImageDrawable(null); return; } if (cancelPotentialDownload(url, imageView)) { // switch (mode) { // case NO_ASYNC_TASK: // Bitmap bitmap = downloadBitmap(url); // addBitmapToCache(url, bitmap); // imageView.setImageBitmap(bitmap); // break; // // case NO_DOWNLOADED_DRAWABLE: // imageView.setMinimumHeight(156); BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); // task.execute(url); // break; // // case CORRECT: // task = new BitmapDownloaderTask(imageView); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); // imageView.setMinimumHeight(156); task.execute(url); // break; // } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_address); Intent intent = getIntent(); mAddress = intent.getExtras().getString("address"); mAmount = intent.getExtras().getLong("amount"); BigInteger amt = mAmount == 0 ? null : BigInteger.valueOf(mAmount); mURI = BitcoinURI.convertToBitcoinURI(mAddress, amt, null, null); mLogger.info("view address uri=" + mURI); final int size = (int) (240 * getResources().getDisplayMetrics().density); Bitmap bm = createBitmap(mURI, size); if (bm != null) { ImageView iv = (ImageView) findViewById(R.id.address_qr_view); iv.setImageBitmap(bm); } TextView idtv = (TextView) findViewById(R.id.address); idtv.setText(mAddress); updateAmount(); mLogger.info("ViewAddressActivity created"); }
@Override public void onInfo(MediaRecorder mr, int what, int extra) { EMLog.v("video", "onInfo"); if (what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) { EMLog.v("video", "max duration reached"); stopRecording(); btn_switch.setVisibility(View.VISIBLE); chronometer.stop(); btnStart.setVisibility(View.VISIBLE); btnStop.setVisibility(View.INVISIBLE); chronometer.stop(); if (localPath == null) { return; } String st3 = getResources().getString(R.string.Whether_to_send); new AlertDialog.Builder(this) .setMessage(st3) .setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { arg0.dismiss(); sendVideo(null); } }) .setNegativeButton(R.string.cancel, null) .setCancelable(false) .show(); } }
@Override public View getView(int position, View view, ViewGroup parent) { DeviceCandidate device = getItem(position); if (view == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.device_candidate_item, parent, false); } ImageView deviceImageView = (ImageView) view.findViewById(R.id.device_candidate_image); TextView deviceNameLabel = (TextView) view.findViewById(R.id.device_candidate_name); TextView deviceAddressLabel = (TextView) view.findViewById(R.id.device_candidate_address); String name = formatDeviceCandidate(device); deviceNameLabel.setText(name); deviceAddressLabel.setText(device.getMacAddress()); switch (device.getDeviceType()) { case PEBBLE: deviceImageView.setImageResource(R.drawable.ic_device_pebble); break; case MIBAND: deviceImageView.setImageResource(R.drawable.ic_device_miband); break; default: deviceImageView.setImageResource(R.drawable.ic_launcher); } return view; }