This file contains hidden or 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
Android Studio | |
Preferences -> Editor -> Live Templates | |
Under AndroidLog | |
Copy "logm" Tamplate or any | |
Paste Under Kotlin | |
Choose logm under Kotlin | |
This file contains hidden or 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 convertToCircularBitmapDrawable(final Context context, Object url, ImageView imageView, int placeHolderResourceId) { | |
Bitmap placeholder = BitmapFactory.decodeResource(context.getResources(), placeHolderResourceId); | |
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), placeholder); | |
circularBitmapDrawable.setCircular(true); | |
Glide | |
.with(context) | |
.load(url) | |
.apply(new RequestOptions() | |
.circleCrop(context) | |
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) |
This file contains hidden or 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
adb help // List all comands | |
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader |
This file contains hidden or 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 int solution(int N, String S) { | |
TreeSet<String> sortSet = new TreeSet<>(); | |
String[] reservedSeats = S.split(" "); | |
for (String reservedSeat : reservedSeats) { | |
sortSet.add(reservedSeat); | |
} | |
int counterFourFamilySeats = 0; | |
for (int i = 1; i <= N; i++) { |
This file contains hidden or 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
#99000000 99 two digits are opacity value | |
100% — FF | |
99% — FC | |
98% — FA | |
97% — F7 | |
96% — F5 | |
95% — F2 | |
94% — F0 | |
93% — ED |
This file contains hidden or 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.content.Context | |
import android.content.SharedPreferences | |
import android.preference.PreferenceManager | |
class PrefUtils { | |
companion object { | |
private var singleton: PrefUtils? = null |
This file contains hidden or 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 int dpToPx(int dp) | |
{ | |
return (int) (dp * Resources.getSystem().getDisplayMetrics().density); | |
} | |
public static int pxToDp(int px) | |
{ | |
return (int) (px / Resources.getSystem().getDisplayMetrics().density); | |
} |
This file contains hidden or 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
One Way | |
double number = 81.53104456348756; | |
System.out.println("Output: " + new DecimalFormat("##.##").format(number)); | |
Output: 81.53 | |
Other Way | |
double oldNumber = 55.654322; | |
double newNumber = (int)Math.round(oldNumber * 100)/(double)100; | |
System.out.println("Output: " + newNumber); | |
Output: 55.65 |