List of usage examples for android.widget ImageView setMinimumHeight
@RemotableViewMethod public void setMinimumHeight(int minHeight)
From source file:kr.co.WhenWhereWho3.ImageDownloader.java
/** * 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. *//*w w w .ja va 2 s.c o m*/ private void forceDownload(String url, ImageView imageView) { // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys. // set ( forground null ) if (url == null) { imageView.setImageDrawable(null); return; } // if (cancelPotentialDownload(url, imageView)) { // AsyncTack BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); // Drawble . // task DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); // ( ) . imageView.setImageDrawable(downloadedDrawable); // imageView.setMinimumHeight(60); // task . task.execute(url); } }
From source file:com.velia_systems.menuphoto.connection.ImageDownloader.java
/** * 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. *//*from ww w . j a v a 2 s. c om*/ private void forceDownload(String url, ImageView imageView, Bitmap bitmap, ProgressBar progress) { // 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 = downloadBitmap(url); // Log.d("ImageDownloader", "Sizes: " + bitmap.getWidth() + "x" + bitmap.getHeight()); int width = bitmap.getWidth(); int height = bitmap.getHeight(); int destHeight = 100 * height / width; Bitmap bmp1 = Bitmap.createScaledBitmap(bitmap, 100, destHeight, false); bitmap.recycle(); addBitmapToCache(url, bmp1); imageView.setImageBitmap(bmp1); progress.setVisibility(View.GONE); break; case NO_DOWNLOADED_DRAWABLE: imageView.setMinimumHeight(50); BitmapDownloaderTask task = new BitmapDownloaderTask(imageView, progress); task.execute(url); break; case CORRECT: task = new BitmapDownloaderTask(imageView, progress); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); imageView.setMinimumHeight(50); task.execute(url); break; } } }
From source file:com.android.aft.AFCoreTools.ImageDownloader.java
/** * 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. *///from ww w. j ava2s . co m private void forceDownload(String url, ImageView imageView, int reqWidth, int reqHeight, ImageDownloaderListener listener, Animation animation) { // 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)) { BitmapDownloaderTask task = new BitmapDownloaderTask(imageView, listener, reqWidth, reqHeight); Bitmap bg = null; if (imageView.getDrawable() instanceof BitmapDrawable) bg = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task, bg); imageView.setImageDrawable(downloadedDrawable); if (animation != null) { imageView.setAnimation(animation); } imageView.setMinimumHeight(156); task.execute(Mode.Parallel, url); } }
From source file:adapters.images.ImageDownloader.java
/** * 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. *//*from w ww . j a v a 2s .co m*/ 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; /* task.execute(url); break; case CORRECT: */ new BitmapDownloaderTask(imageView); task = new BitmapDownloaderTask(imageView); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); imageView.setMinimumHeight(156); task.execute(url); //break; //} } }
From source file:onion.chat.MainActivity.java
void showQR() { String name = db.getName();/*from ww w . j a va 2 s. c o m*/ String txt = "Its Ur's " + tor.getID() + " " + name; QRCode qr; try { //qr = Encoder.encode(txt, ErrorCorrectionLevel.H); qr = Encoder.encode(txt, ErrorCorrectionLevel.M); } catch (Exception ex) { throw new Error(ex); } ByteMatrix mat = qr.getMatrix(); int width = mat.getWidth(); int height = mat.getHeight(); int[] pixels = new int[width * height]; for (int y = 0; y < height; y++) { int offset = y * width; for (int x = 0; x < width; x++) { pixels[offset + x] = mat.get(x, y) != 0 ? Color.BLACK : Color.WHITE; } } Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bitmap.setPixels(pixels, 0, width, 0, 0, width, height); bitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() * 8, bitmap.getHeight() * 8, false); ImageView view = new ImageView(this); view.setImageBitmap(bitmap); int pad = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics()); view.setPadding(pad, pad, pad, pad); Rect displayRectangle = new Rect(); Window window = getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle); int s = (int) (Math.min(displayRectangle.width(), displayRectangle.height()) * 0.9); view.setMinimumWidth(s); view.setMinimumHeight(s); new AlertDialog.Builder(this) //.setMessage(txt) .setView(view).show(); }
From source file:com.nd.pad.GreenBrowser.util.ImageDownloader.java
/** * 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. *//*from www .jav a 2 s. c om*/ private void forceDownload(String url, ImageView imageView, int loadingDrawable_ID, int failDrawable_ID, boolean isSaveLocal, ImageDownLoaderAction action) { if (url == null) { imageView.setImageResource(failDrawable_ID); return; } if (cancelPotentialDownload(url, imageView)) { /*modeCORRECT*/ 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, failDrawable_ID, isSaveLocal, action); task.execute(url); break; case CORRECT: task = new BitmapDownloaderTask(imageView, failDrawable_ID, isSaveLocal, action); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task, loadingDrawable_ID); imageView.setImageDrawable(downloadedDrawable); imageView.setMinimumHeight(156); try { task.execute(url); } catch (RejectedExecutionException localRejectedExecutionException) { } break; } } }
From source file:util.ImageDownloader.java
/** * 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. *///from ww w . j a v a 2 s . c om 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; // } } }
From source file:com.nd.teacherplatform.util.ImageDownloader.java
/** * 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. *///from www . j a va 2s . co m private void forceDownload(String url, ImageView imageView, int loadingDrawable_ID, int failDrawable_ID, boolean isSaveLocal, ImageDownLoaderAction action) { if (url == null) { imageView.setImageResource(failDrawable_ID); return; } if (cancelPotentialDownload(url, imageView)) { /* modeCORRECT */ 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, failDrawable_ID, isSaveLocal, action); task.execute(url); break; case CORRECT: task = new BitmapDownloaderTask(imageView, failDrawable_ID, isSaveLocal, action); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task, loadingDrawable_ID); imageView.setImageDrawable(downloadedDrawable); imageView.setMinimumHeight(156); try { task.execute(url); } catch (RejectedExecutionException localRejectedExecutionException) { } break; } } }
From source file:com.juick.android.UserCenterActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { JuickAdvancedApplication.setupTheme(this); handler = new Handler(); super.onCreate(savedInstanceState); setContentView(R.layout.user_center); final ListView list = (ListView) findViewById(R.id.list); final View listWait = findViewById(R.id.list_wait); final TextView userRealName = (TextView) findViewById(R.id.user_realname); final ImageView userPic = (ImageView) findViewById(R.id.userpic); final TextView userName = (TextView) findViewById(R.id.username); search = findViewById(R.id.search);/*from ww w .java2 s . c o m*/ final View stats = findViewById(R.id.stats); userRealName.setText("..."); Bundle extras = getIntent().getExtras(); if (extras == null) { finish(); return; } uname = extras.getString("uname"); final int uid = extras.getInt("uid"); final MessageID mid = (MessageID) extras.getSerializable("mid"); final MessagesSource messagesSource = (MessagesSource) extras.getSerializable("messagesSource"); if (uname == null || mid == null) { finish(); return; } int height = getWindow().getWindowManager().getDefaultDisplay().getHeight(); final int userpicSize = height <= 320 ? 32 : 96; float scaledDensity = getResources().getDisplayMetrics().scaledDensity; userPic.setMinimumHeight((int) (scaledDensity * userpicSize)); userPic.setMinimumWidth((int) (scaledDensity * userpicSize)); stats.setEnabled(false); userName.setText("@" + uname); final boolean russian = Locale.getDefault().getLanguage().equals("ru"); new Thread() { @Override public void run() { final Utils.RESTResponse json = Utils.getJSON(UserCenterActivity.this, "http://" + Utils.JA_ADDRESS + "/api/userinfo?uname=" + Uri.encode(uname), null); runOnUiThread(new Runnable() { @Override public void run() { stats.setEnabled(true); if (json.getErrorText() != null) { Toast.makeText(UserCenterActivity.this, "JA server: " + json.getErrorText(), Toast.LENGTH_LONG).show(); listWait.setVisibility(View.GONE); } else { final UserInfo userInfo = new Gson().fromJson(json.getResult(), UserInfo.class); if (userInfo == null) { Toast.makeText(UserCenterActivity.this, "Unable to parse JSON", Toast.LENGTH_LONG) .show(); listWait.setVisibility(View.GONE); } else { userRealName.setText(userInfo.fullName); listWait.setVisibility(View.GONE); list.setVisibility(View.VISIBLE); list.setAdapter(new BaseAdapter() { @Override public int getCount() { return userInfo.getExtraInfo().size(); } @Override public Object getItem(int position) { return userInfo.getExtraInfo().get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getLayoutInflater().inflate(R.layout.listitem_userinfo, null); } TextView text = (TextView) convertView.findViewById(R.id.text); TextView text2 = (TextView) convertView.findViewById(R.id.text2); String info = userInfo.getExtraInfo().get(position); int ix = info.indexOf("|"); if (ix == -1) { text.setText(info); if (russian && UserInfo.translations.containsKey(info)) { info = UserInfo.translations.get(info); } text2.setText(""); } else { String theInfo = info.substring(0, ix); if (russian && UserInfo.translations.containsKey(theInfo)) { theInfo = UserInfo.translations.get(theInfo); } text.setText(theInfo); String value = info.substring(ix + 1); if (value.startsWith("Date:")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); value = value.substring(5); value = sdf.format(new Date(Long.parseLong(value))); } text2.setText(value); } return convertView; } }); } } } }); } }.start(); View subscribe_user = findViewById(R.id.subscribe_user); View unsubscribe_user = findViewById(R.id.unsubscribe_user); View subscribe_comments = findViewById(R.id.subscribe_comments); View unsubscribe_comments = findViewById(R.id.unsubscribe_comments); View filter_user = findViewById(R.id.filter_user); View blacklist_user = findViewById(R.id.blacklist_user); View show_blog = findViewById(R.id.show_blog); MicroBlog microBlog = MainActivity.getMicroBlog(mid.getMicroBlogCode()); final MessageMenu mm = microBlog.getMessageMenu(this, messagesSource, null, null); JuickMessage message = microBlog.createMessage(); mm.listSelectedItem = message; message.User = new JuickUser(); message.User.UName = uname; message.User.UID = uid; message.setMID(mid); final UserpicStorage.AvatarID avatarID = microBlog.getAvatarID(message); final UserpicStorage.Listener userpicListener = new UserpicStorage.Listener() { @Override public void onUserpicReady(UserpicStorage.AvatarID id, int size) { final UserpicStorage.Listener thiz = this; runOnUiThread(new Runnable() { @Override public void run() { UserpicStorage.instance.removeListener(avatarID, userpicSize, thiz); final Bitmap userpic = UserpicStorage.instance.getUserpic(UserCenterActivity.this, avatarID, userpicSize, thiz); userPic.setImageBitmap(userpic); // can be null } }); } }; Bitmap userpic = UserpicStorage.instance.getUserpic(this, avatarID, userpicSize, userpicListener); userPic.setImageBitmap(userpic); // can be null subscribe_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mm.actionSubscribeUser(); } }); show_blog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mm.listSelectedItem.User.UID == 0) { JuickMicroBlog.obtainProperUserIdByName(UserCenterActivity.this, mm.listSelectedItem.User.UName, "Getting Juick User Id", new Utils.Function<Void, Pair<String, String>>() { @Override public Void apply(Pair<String, String> cred) { mm.listSelectedItem.User.UID = Integer.parseInt(cred.first); mm.actionUserBlog(); return null; } }); } else { mm.actionUserBlog(); } } }); search.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { search.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add(0, SEARCH_PAST_CONVERSATIONS, 0, "My dialogs with user"); menu.add(0, SEARCH_MORE, 1, "More"); } }); search.showContextMenu(); } }); stats.setOnClickListener(new View.OnClickListener() { NewJuickPreferenceActivity.MenuItem[] items = new NewJuickPreferenceActivity.MenuItem[] { new NewJuickPreferenceActivity.MenuItem(R.string.UserAllTimeActivityReport, R.string.UserAllTimeActivityReport2, new Runnable() { @Override public void run() { NewJuickPreferenceActivity.showChart(UserCenterActivity.this, "USER_ACTIVITY_VOLUME", "uid=" + uid); } }), new NewJuickPreferenceActivity.MenuItem(R.string.UserHoursReport, R.string.UserHoursReport2, new Runnable() { @Override public void run() { NewJuickPreferenceActivity.showChart(UserCenterActivity.this, "USER_HOURS_ACTIVITY", "uid=" + uid + "&tzoffset=" + TimeZone.getDefault().getRawOffset() / 1000 / 60 / 60); } }) }; @Override public void onClick(View v) { list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { items[position].action.run(); } }); list.setAdapter(new BaseAdapter() { @Override public int getCount() { return items.length; } @Override public Object getItem(int position) { return items[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater layoutInflater = getLayoutInflater(); View listItem = layoutInflater.inflate(android.R.layout.simple_list_item_2, null); TextView text = (TextView) listItem.findViewById(android.R.id.text1); text.setText(items[position].labelId); TextView text2 = (TextView) listItem.findViewById(android.R.id.text2); text2.setText(items[position].label2Id); return listItem; } }); } }); blacklist_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mm.actionBlacklistUser(); } }); filter_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mm.actionFilterUser(uname); } }); unsubscribe_user.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mm.actionUnsubscribeUser(); } }); subscribe_comments.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { enableJAM(new Runnable() { @Override public void run() { JAMService.instance.client.subscribeToComments(uname); } }); } }); unsubscribe_comments.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { enableJAM(new Runnable() { @Override public void run() { JAMService.instance.client.unsubscribeFromComments(uname); } }); } }); }
From source file:com.example.gtuandroid.component.ImageDownloader.java
/** * 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. *//*w ww .j a v a 2 s . c om*/ private void forceDownload(String url, final ImageView imageView) { // State sanity: url is guaranteed to never be null in // DownloadedDrawable and cache keys. if (url == null) { // imageView.setImageDrawable(null); handler.post(new Runnable() { @Override public void run() { imageView.setImageDrawable(null); } }); return; } if (cancelPotentialDownload(url, imageView)) { switch (mode) { case NO_ASYNC_TASK: final Bitmap bitmap = downloadBitmap(url); addBitmapToCache(url, bitmap); // imageView.setImageBitmap(bitmap); handler.post(new Runnable() { @Override public void run() { imageView.setImageBitmap(bitmap); } }); break; case NO_DOWNLOADED_DRAWABLE: // imageView.setMinimumHeight(156); handler.post(new Runnable() { @Override public void run() { imageView.setMinimumHeight(156); } }); BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); task.execute(url); break; case CORRECT: task = new BitmapDownloaderTask(imageView); final DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); // imageView.setImageDrawable(downloadedDrawable); // imageView.setMinimumHeight(156); handler.post(new Runnable() { @Override public void run() { imageView.setImageDrawable(downloadedDrawable); imageView.setMinimumHeight(156); } }); task.execute(url); break; } } }