List of usage examples for android.widget ImageView ImageView
public ImageView(Context context)
From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java
/** * SINGLE IMAGE ROW/* ww w .jav a 2s. com*/ * @param att * @param linear * @return */ public LinearLayout getSingleImageRow(Map<String, String> att, LinearLayout linear) { LinearLayout container_layout = new LinearLayout(context); container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo)); container_layout.setMinimumHeight(46); container_layout.setVerticalGravity(Gravity.CENTER); LinearLayout.LayoutParams value = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.5f); TextView tx = new TextView(context); tx.setText(att.get("title")); tx.setTextSize(11); tx.setTypeface(null, Typeface.BOLD); tx.setGravity(Gravity.LEFT); tx.setPadding(3, 0, 0, 2); tx.setTextColor(Color.rgb(66, 66, 66)); container_layout.addView(tx, value); LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 40, 0.5f); ImageView img = new ImageView(context); String path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value")); img.setImageResource(context.getResources().getIdentifier(path, null, null)); img.setPadding(0, 3, 0, 3); container_layout.addView(img, value_params); linear.addView(container_layout); return linear; }
From source file:com.vonglasow.michael.satstat.ui.RadioSectionFragment.java
private final void addWifiResult(ScanResult result) { // needed to pass a persistent reference to the OnClickListener final ScanResult r = result; android.view.View.OnClickListener clis = new android.view.View.OnClickListener() { @Override// w w w . j av a 2s . c om public void onClick(View v) { onWifiEntryClick(r.BSSID); } }; LinearLayout wifiLayout = new LinearLayout(wifiAps.getContext()); wifiLayout.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); wifiLayout.setOrientation(LinearLayout.HORIZONTAL); wifiLayout.setWeightSum(22); wifiLayout.setMeasureWithLargestChildEnabled(false); ImageView wifiType = new ImageView(wifiAps.getContext()); wifiType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 3)); if (WifiCapabilities.isAdhoc(result)) { wifiType.setImageResource(R.drawable.ic_content_wifi_adhoc); } else if ((WifiCapabilities.isEnterprise(result)) || (WifiCapabilities.getScanResultSecurity(result) == WifiCapabilities.EAP)) { wifiType.setImageResource(R.drawable.ic_content_wifi_eap); } else if (WifiCapabilities.getScanResultSecurity(result) == WifiCapabilities.PSK) { wifiType.setImageResource(R.drawable.ic_content_wifi_psk); } else if (WifiCapabilities.getScanResultSecurity(result) == WifiCapabilities.WEP) { wifiType.setImageResource(R.drawable.ic_content_wifi_wep); } else if (WifiCapabilities.getScanResultSecurity(result) == WifiCapabilities.OPEN) { wifiType.setImageResource(R.drawable.ic_content_wifi_open); } else { wifiType.setImageResource(R.drawable.ic_content_wifi_unknown); } wifiType.setScaleType(ScaleType.CENTER); wifiLayout.addView(wifiType); TableLayout wifiDetails = new TableLayout(wifiAps.getContext()); wifiDetails.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 19)); TableRow innerRow1 = new TableRow(wifiAps.getContext()); TextView newMac = new TextView(wifiAps.getContext()); newMac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 14)); newMac.setTextAppearance(wifiAps.getContext(), android.R.style.TextAppearance_Medium); newMac.setText(result.BSSID); innerRow1.addView(newMac); TextView newCh = new TextView(wifiAps.getContext()); newCh.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newCh.setTextAppearance(wifiAps.getContext(), android.R.style.TextAppearance_Medium); newCh.setText(getChannelFromFrequency(result.frequency)); innerRow1.addView(newCh); TextView newLevel = new TextView(wifiAps.getContext()); newLevel.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newLevel.setTextAppearance(wifiAps.getContext(), android.R.style.TextAppearance_Medium); newLevel.setText(String.valueOf(result.level)); innerRow1.addView(newLevel); innerRow1.setOnClickListener(clis); wifiDetails.addView(innerRow1, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); TableRow innerRow2 = new TableRow(wifiAps.getContext()); TextView newSSID = new TextView(wifiAps.getContext()); newSSID.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 19)); newSSID.setTextAppearance(wifiAps.getContext(), android.R.style.TextAppearance_Small); newSSID.setText(result.SSID); innerRow2.addView(newSSID); innerRow2.setOnClickListener(clis); wifiDetails.addView(innerRow2, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); wifiLayout.addView(wifiDetails); wifiLayout.setOnClickListener(clis); wifiAps.addView(wifiLayout); }
From source file:eu.geopaparazzi.library.forms.views.GSketchView.java
public void refresh(final Context context) throws Exception { log("Entering refresh...."); if (_value != null && _value.length() > 0) { String[] imageSplit = _value.split(";"); log("Handling images: " + _value); IImagesDbHelper imagesDbHelper = DefaultHelperClasses.getDefaulfImageHelper(); for (String imageId : imageSplit) { log("img: " + imageId); if (imageId.length() == 0) { continue; }/*from w w w . j a va2s . c o m*/ long imageIdLong; try { imageIdLong = Long.parseLong(imageId); } catch (Exception e) { continue; } if (addedImages.contains(imageId.trim())) { continue; } byte[] imageThumbnail = imagesDbHelper.getImageThumbnail(imageIdLong); Bitmap thumbnail = ImageUtilities.getImageFromImageData(imageThumbnail); ImageView imageView = new ImageView(context); imageView.setLayoutParams(new LinearLayout.LayoutParams(102, 102)); imageView.setPadding(5, 5, 5, 5); imageView.setImageBitmap(thumbnail); imageView.setBackgroundDrawable(getResources().getDrawable(R.drawable.border_black_1px)); // imageView.setOnClickListener(new View.OnClickListener() { // public void onClick(View v) { // /* // * open in markers to edit it // */ // MarkersUtilities.launchOnImage(context, image); // } // }); log("Creating thumb and adding it: " + imageId); imageLayout.addView(imageView); imageLayout.invalidate(); addedImages.add(imageId); } if (addedImages.size() > 0) { StringBuilder sb = new StringBuilder(); for (String imagePath : addedImages) { sb.append(";").append(imagePath); } _value = sb.substring(1); log("New img paths: " + _value); } log("Exiting refresh...."); } }
From source file:kr.wdream.ui.WallpapersActivity.java
@Override public View createView(Context context) { Log.d(LOG_TAG, "createView"); actionBar.setBackButtonImage(kr.wdream.storyshop.R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(// ww w . j a v a 2s. c o m LocaleController.getString("ChatBackground", kr.wdream.storyshop.R.string.ChatBackground)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == done_button) { boolean done; TLRPC.WallPaper wallPaper = wallpappersByIds.get(selectedBackground); if (wallPaper != null && wallPaper.id != 1000001 && wallPaper instanceof TLRPC.TL_wallPaper) { int width = AndroidUtilities.displaySize.x; int height = AndroidUtilities.displaySize.y; if (width > height) { int temp = width; width = height; height = temp; } TLRPC.PhotoSize size = FileLoader.getClosestPhotoSizeWithSize(wallPaper.sizes, Math.min(width, height)); String fileName = size.location.volume_id + "_" + size.location.local_id + ".jpg"; File f = new File(FileLoader.getInstance().getDirectory(FileLoader.MEDIA_DIR_CACHE), fileName); File toFile = new File(ApplicationLoader.getFilesDirFixed(), "wallpaper.jpg"); try { done = AndroidUtilities.copyFile(f, toFile); } catch (Exception e) { done = false; FileLog.e("tmessages", e); } } else { if (selectedBackground == -1) { File fromFile = new File(ApplicationLoader.getFilesDirFixed(), "wallpaper-temp.jpg"); File toFile = new File(ApplicationLoader.getFilesDirFixed(), "wallpaper.jpg"); done = fromFile.renameTo(toFile); } else { done = true; } } if (done) { SharedPreferences preferences = ApplicationLoader.applicationContext .getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putInt("selectedBackground", selectedBackground); editor.putInt("selectedColor", selectedColor); editor.commit(); ApplicationLoader.reloadWallpaper(); } finishFragment(); } } }); ActionBarMenu menu = actionBar.createMenu(); doneButton = menu.addItemWithWidth(done_button, kr.wdream.storyshop.R.drawable.ic_done, AndroidUtilities.dp(56)); FrameLayout frameLayout = new FrameLayout(context); fragmentView = frameLayout; backgroundImage = new ImageView(context); backgroundImage.setScaleType(ImageView.ScaleType.CENTER_CROP); frameLayout.addView(backgroundImage, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); backgroundImage.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); progressView = new FrameLayout(context); progressView.setVisibility(View.INVISIBLE); frameLayout.addView(progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 52)); progressViewBackground = new View(context); progressViewBackground.setBackgroundResource(kr.wdream.storyshop.R.drawable.system_loader); progressView.addView(progressViewBackground, LayoutHelper.createFrame(36, 36, Gravity.CENTER)); ProgressBar progressBar = new ProgressBar(context); try { progressBar.setIndeterminateDrawable( context.getResources().getDrawable(kr.wdream.storyshop.R.drawable.loading_animation)); } catch (Exception e) { //don't promt } progressBar.setIndeterminate(true); AndroidUtilities.setProgressBarAnimationDuration(progressBar, 1500); progressView.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER)); RecyclerListView listView = new RecyclerListView(context); listView.setClipToPadding(false); listView.setTag(8); listView.setPadding(AndroidUtilities.dp(40), 0, AndroidUtilities.dp(40), 0); LinearLayoutManager layoutManager = new LinearLayoutManager(context); layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); listView.setLayoutManager(layoutManager); listView.setDisallowInterceptTouchEvents(true); listView.setOverScrollMode(RecyclerListView.OVER_SCROLL_NEVER); listView.setAdapter(listAdapter = new ListAdapter(context)); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 102, Gravity.LEFT | Gravity.BOTTOM)); listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() { @Override public void onItemClick(View view, int position) { if (position == 0) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); CharSequence[] items = new CharSequence[] { LocaleController.getString("FromCamera", kr.wdream.storyshop.R.string.FromCamera), LocaleController.getString("FromGalley", kr.wdream.storyshop.R.string.FromGalley), LocaleController.getString("Cancel", kr.wdream.storyshop.R.string.Cancel) }; builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { try { if (i == 0) { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File image = AndroidUtilities.generatePicturePath(); if (image != null) { if (Build.VERSION.SDK_INT >= 24) { takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", image)); takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image)); } currentPicturePath = image.getAbsolutePath(); } startActivityForResult(takePictureIntent, 10); } else if (i == 1) { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, 11); } } catch (Exception e) { FileLog.e("tmessages", e); } } }); showDialog(builder.create()); } else { if (position - 1 < 0 || position - 1 >= wallPapers.size()) { return; } TLRPC.WallPaper wallPaper = wallPapers.get(position - 1); selectedBackground = wallPaper.id; listAdapter.notifyDataSetChanged(); processSelectedBackground(); } } }); processSelectedBackground(); return fragmentView; }
From source file:com.TaxiDriver.jy.CameraPreview.java
public void showTakenPicture(Bitmap bmp) { takenPicture = new ImageView(this); takenPicture.setImageBitmap(bmp);/*from w ww . ja va2 s.c om*/ ((FrameLayout) findViewById(R.id.preview)).removeView(mPreview); ((FrameLayout) findViewById(R.id.preview)).addView(takenPicture); }
From source file:com.kakao.auth.authorization.authcode.KakaoWebViewDialog.java
private void createCrossImage() { crossImageView = new ImageView(getContext()); crossImageView.setOnClickListener(new View.OnClickListener() { @Override/*from ww w. ja v a 2 s . c o m*/ public void onClick(View v) { sendCancelToListenerIfNeeded(); KakaoWebViewDialog.this.dismiss(); } }); int id = getContext().getResources().getIdentifier("kakao_close_button", "drawable", "com.volthole.guardiansword"); //Log.d("bk", "R.drawable.kakao_close_button: " + String.valueOf( id ) ); Drawable crossDrawable = getContext().getResources().getDrawable(id, null); crossImageView.setImageDrawable(crossDrawable); crossImageView.setVisibility(View.INVISIBLE); }
From source file:com.derrick.movies.MovieDetailsActivity.java
private void setTrailers(Videos videos) { videosList = videos.getResults();//from w ww . j a v a 2 s . com int size = videosList.size(); if (size == 1) { txt_title_trailer.setText("Trailer"); } for (int i = 0; i < size; i++) { Result result = videosList.get(i); String url = IMAGE_YOUTUBE + result.getKey() + YOUTUBE_QUALITY; ImageView imageView; ImageView imageView_play; TextView txt_name; ViewGroup.LayoutParams lp = new RelativeLayout.LayoutParams(70, 70); ViewGroup.LayoutParams lp2 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); RelativeLayout relativeLayout = new RelativeLayout(this); relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); if (size == 1) { imageView = new ImageView(getApplicationContext()); imageView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); } else { imageView = new ImageView(getApplicationContext()); imageView .setLayoutParams(new RelativeLayout.LayoutParams(500, ViewGroup.LayoutParams.MATCH_PARENT)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); } imageView_play = new ImageView(getApplicationContext()); imageView_play.setLayoutParams(lp); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) imageView_play .getLayoutParams(); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); imageView_play.setLayoutParams(layoutParams); imageView_play.setScaleType(ImageView.ScaleType.CENTER_CROP); Drawable drawable = getResources() .getDrawable(getResources().getIdentifier("play", "drawable", getPackageName())); imageView_play.setImageDrawable(drawable); txt_name = new TextView(getApplicationContext()); txt_name.setLayoutParams(lp2); RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) txt_name.getLayoutParams(); layoutParams2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); layoutParams2.setMargins(8, 8, 8, 16); txt_name.setLayoutParams(layoutParams2); txt_name.setTypeface(robotoCondensed); txt_name.setText(result.getName()); txt_name.setTextColor(getResources().getColor(R.color.colorWhite)); Glide.with(getBaseContext()).load(url).diskCacheStrategy(DiskCacheStrategy.ALL) .listener(new RequestListener<String, GlideDrawable>() { @Override public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { return false; } @Override public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { return false; } }).into(imageView); // trailerSlider.addView(imageView_play); relativeLayout.addView(imageView); relativeLayout.addView(imageView_play); relativeLayout.addView(txt_name); trailerSlider.addView(relativeLayout); } }
From source file:com.ryan.ryanreader.fragments.ImageViewFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = inflater.getContext(); final LoadingView loadingView = new LoadingView(context, R.string.download_loading, true, false); final LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(loadingView);/* w w w.j av a 2s . c o m*/ CacheManager.getInstance(context) .makeRequest(new CacheRequest(url, RedditAccountManager.getAnon(), null, Constants.Priority.IMAGE_VIEW, 0, CacheRequest.DownloadType.IF_NECESSARY, Constants.FileType.IMAGE, false, false, false, context) { private void setContentView(View v) { layout.removeAllViews(); layout.addView(v); v.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; v.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; } @Override protected void onCallbackException(Throwable t) { BugReportActivity.handleGlobalError(context.getApplicationContext(), new RRError(null, null, t)); } @Override protected void onDownloadNecessary() { loadingView.setIndeterminate(R.string.download_waiting); } @Override protected void onDownloadStarted() { loadingView.setIndeterminate(R.string.download_downloading); } @Override protected void onFailure(final RequestFailureType type, Throwable t, StatusLine status, final String readableMessage) { loadingView.setDone(R.string.download_failed); final RRError error = General.getGeneralErrorForFailure(context, type, t, status); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { // TODO handle properly layout.addView(new ErrorView(getSupportActivity(), error)); } }); } @Override protected void onProgress(long bytesRead, long totalBytes) { loadingView.setProgress(R.string.download_downloading, (float) ((double) bytesRead / (double) totalBytes)); } @Override protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp, UUID session, boolean fromCache, final String mimetype) { if (mimetype == null || !Constants.Mime.isImage(mimetype)) { revertToWeb(); return; } if (Constants.Mime.isImageGif(mimetype)) { try { gifThread = new GifDecoderThread(cacheFile.getInputStream(), new GifDecoderThread.OnGifLoadedListener() { public void onGifLoaded() { new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); setContentView(imageView); gifThread.setView(imageView); imageView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { getSupportActivity().finish(); } }); } }); } public void onOutOfMemory() { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } public void onGifInvalid() { General.quickToast(context, R.string.imageview_invalid_gif); revertToWeb(); } }); gifThread.start(); } catch (IOException e) { throw new RuntimeException(e); } } else { final Bitmap finalResult; try { final int maxTextureSize = 2048; final Bitmap imageOrig = BitmapFactory.decodeStream(cacheFile.getInputStream()); if (imageOrig == null) { General.quickToast(context, "Couldn't load the image. Trying internal browser."); revertToWeb(); return; } final int maxDim = Math.max(imageOrig.getWidth(), imageOrig.getHeight()); if (maxDim > maxTextureSize) { imageOrig.recycle(); final double scaleFactorPowerOfTwo = Math .log((double) maxDim / (double) maxTextureSize) / Math.log(2); final int scaleFactor = (int) Math .round(Math.pow(2, Math.ceil(scaleFactorPowerOfTwo))); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = scaleFactor; finalResult = BitmapFactory.decodeStream(cacheFile.getInputStream(), null, options); } else { finalResult = imageOrig; } } catch (IOException e) { throw new RuntimeException(e); } catch (OutOfMemoryError e) { General.quickToast(context, "Out of memory. Trying internal browser."); revertToWeb(); return; } new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { imageView = new GestureImageView(context); imageView.setImageBitmap(finalResult); imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); setContentView(imageView); imageView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { getSupportActivity().finish(); } }); } }); } } }); final RedditPost src_post = getArguments().getParcelable("post"); final RedditPreparedPost post = src_post == null ? null : new RedditPreparedPost(context, CacheManager.getInstance(context), 0, src_post, -1, false, new RedditSubreddit("/r/" + src_post.subreddit, src_post.subreddit, false), false, false, false, RedditAccountManager.getInstance(context).getDefaultAccount()); final FrameLayout outerFrame = new FrameLayout(context); outerFrame.addView(layout); if (post != null) { final SideToolbarOverlay toolbarOverlay = new SideToolbarOverlay(context); final BezelSwipeOverlay bezelOverlay = new BezelSwipeOverlay(context, new BezelSwipeOverlay.BezelSwipeListener() { public boolean onSwipe(BezelSwipeOverlay.SwipeEdge edge) { toolbarOverlay.setContents( post.generateToolbar(context, ImageViewFragment.this, toolbarOverlay)); toolbarOverlay.show(edge == BezelSwipeOverlay.SwipeEdge.LEFT ? SideToolbarOverlay.SideToolbarPosition.LEFT : SideToolbarOverlay.SideToolbarPosition.RIGHT); return true; } public boolean onTap() { if (toolbarOverlay.isShown()) { toolbarOverlay.hide(); return true; } return false; } }); outerFrame.addView(bezelOverlay); outerFrame.addView(toolbarOverlay); bezelOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; bezelOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; } return outerFrame; }
From source file:com.xnote.lol.xnote.views.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); // calcluating horizontal padding for tabs so they fill the screen: int tabWidth = (int) Math.floor(((double) mScreenHorizontalWidth / adapter.getCount())); for (int i = 0; i < adapter.getCount(); i++) { ImageView tabView = new ImageView(getContext()); tabView.setImageDrawable(getPositiveIconDrawable(i)); tabView.setScaleType(ImageView.ScaleType.FIT_CENTER); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); tabView.setPadding(padding, padding, padding, padding); tabView.setLayoutParams(new LinearLayout.LayoutParams(tabWidth, ViewGroup.LayoutParams.WRAP_CONTENT)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView);/*from www . j a v a 2 s .c o m*/ } }
From source file:it.cdpaf.helper.DrawableManager.java
public static ImageView fetchIvOnThread(String imagepath, int nthImage, final Context ctx) { final String urlString = Const.IMAGE_URL + imagepath; final Drawable resultDrawable; final ImageView imageView = new ImageView(ctx); String urlStringValid = ""; if (nthImage == 0) urlStringValid = urlString;//from w ww. j a v a 2 s.c o m else { String url = urlString + "_" + nthImage; String[] result = urlString.split(".j"); String prima = result[0]; String seconda = result[1]; String jpg = ".j" + seconda; urlStringValid = prima + "_" + nthImage + jpg; } final String finalURl = urlStringValid; if (drawableMap.containsKey(urlStringValid)) { Log.d("ALL DRAWABLE", "INDIVIDUATO UN RIUSO : " + urlStringValid); resultDrawable = (drawableMap.get(urlStringValid)); imageView.setImageDrawable(resultDrawable); } else { final Handler handler = new Handler() { @Override public void handleMessage(Message message) { Drawable resDrawable = ((Drawable) message.obj); imageView.setImageDrawable(resDrawable); } }; Thread thread = new Thread() { @Override public void run() { //TODO : set imageView to a "pending" image Drawable drawable = fetchDrawable(finalURl, ctx); Message messageb = handler.obtainMessage(1, drawable); handler.sendMessage(messageb); } }; Log.d("ALL DRAWABLE", "LANCIO UNA RICERCA : " + finalURl); thread.start(); } return imageView; }