This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DpsPxsConversion { | |
public static float dpFromPx(final Context context, float px) { | |
return px / context.getResources().getDisplayMetrics().density; | |
} | |
public static float pxFromDp(final Context context, float dp) { | |
return dp * context.getResources().getDisplayMetrics().density; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.SuppressLint; | |
import android.annotation.TargetApi; | |
import android.app.Activity; | |
import android.content.ContentUris; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.database.Cursor; | |
import android.graphics.Bitmap; | |
import android.net.Uri; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.text.format.DateUtils; | |
import com.example.jonathan.medsblaprueba.R; | |
import com.example.jonathan.medsblaprueba.models.chat.ChatAbstract; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.graphics.Bitmap; | |
import android.media.MediaScannerConnection; | |
import android.net.Uri; | |
import android.os.Environment; | |
import android.util.Log; | |
import java.io.File; | |
import java.io.FileOutputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UtilsBitmap { | |
public static Bitmap drawableToBitmap(Drawable drawable){ | |
Bitmap bitmap; | |
if (drawable instanceof BitmapDrawable) { | |
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; | |
if(bitmapDrawable.getBitmap() != null) { | |
return bitmapDrawable.getBitmap(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void colorize(int color, ImageView... ivs) { | |
for (ImageView iv : ivs) { | |
iv.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static float getScreenWidthDps(Context context) { | |
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); | |
return displayMetrics.widthPixels / displayMetrics.density; | |
} | |
public static float getScreenWidthPxs(Context context) { | |
return context.getResources().getDisplayMetrics().widthPixels; | |
} | |