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
imageView.setImageDrawable(ContextCompat.getDrawable(applicationContext, R.drawable.name)) |
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
//documents -> list of recycleview | |
val layoutManager = GridLayoutManager(activity, 2) | |
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { | |
override fun getSpanSize(position: Int): Int { | |
return if (documents.size > 1) 1 else 2 | |
} | |
} |
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
private void formatMonthlyIncomeAmount() { | |
if (etAmount.getText() != null && etAmount.getText().length() > 3) { | |
String amountString = etAmount.getText().toString(); | |
String formattedString = (amountString.replace(".", "").replace(",", "")); | |
BigInteger value = new BigInteger(formattedString); | |
NumberFormat formatWithoutFraction = NumberFormat.getInstance(new Locale("tr", "TR")); |
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
android:inputType="textNoSuggestions|textVisiblePassword" | |
android:digits="abcçdefgğhıijklmnoöpqrsştuüvyzABCÇDEFGĞHIİJKLMNOÖPQRSŞTUÜVYZ" |
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
//to hide keyboard, call the method | |
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); |
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
String text = "12"; | |
Double message; | |
try { | |
message = Double.valueOf(text); | |
} catch (NumberFormatException e) { | |
// did not contain a valid double | |
message = 0.0; | |
} |
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
Collections.sort(stringList, new Comparator<String>() { | |
@Override | |
public int compare(String lhs, String rhs) { | |
final Collator collator = Collator.getInstance(new Locale("tr_TR")); | |
return collator.compare(lhs.toUpperCase(), rhs.toUpperCase()); // toUpperCase to avoid a dotless i problem (was at the end) | |
} | |
}); | |
} |