Skip to content

Instantly share code, notes, and snippets.

View balsikandar's full-sized avatar
💭
Working on React native and Android as the Team Lead of Carwale

BAL SIKANDAR balsikandar

💭
Working on React native and Android as the Team Lead of Carwale
View GitHub Profile
public class MrIndiaActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
finish();
}
}, 500);
@balsikandar
balsikandar / AlphaValues
Created December 5, 2019 19:22
Hex values for Transparency in ARGB color
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
@balsikandar
balsikandar / StudentBuilder.kt
Created January 19, 2020 20:00
Student Builder pattern example
class Student(
val name: String?,
val standard: Int,
val rollNumber: Int
) {
private constructor(builder: Builder) : this(builder.name, builder.standard, builder.rollNumber)
class Builder {
var name: String? = null
try {
val intent = Intent()
val manufacturer = Build.MANUFACTURER
if ("xiaomi".equals(manufacturer, ignoreCase = true)) {
intent.component = ComponentName(
"com.miui.securitycenter",
"com.miui.permcenter.autostart.AutoStartManagementActivity"
)
} else if ("oppo".equals(manufacturer, ignoreCase = true)) {
intent.component = ComponentName(
class Currency {
val map = HashMap<String, String>();
init {
map.put("India", "Rupee")
map.put("UK", "Euro")
map.put("Japan", "Yen")
map.put("USA", "Dollar")
map.put("China", "Yuan")
}
getCurrencyNameOf("UK")
fun getCurrencyNameOf(country: String): String {
return if (country == "India") {
"Rupee"
} else if (country == "USA") {
"Dollars"
} else if (country == "UK") {
"Euro"
} else if (country == "Japan") {
if (pickupSelected && dropSelected) {
gotoNextPage();
} else if (selectedTab === "PICKUP_POINT") {
if (pickupSelected) {
goToDrop();
} else {
toast("Please select pickup location")
}
} else {
if (dropSelected) {
if (pickupSelected && dropSelected) {
return gotoNextPage();
}
if (selectedTab === "PICKUP_POINT") {
if (pickupSelected) {
goToDrop();
} else {
toast("Please select pickup location")
}
fun main() {
if (pickupSelected && dropSelected) return gotoNextPage()
if (selectedTab === "PICKUP_POINT") {
verifyPickup(pickupSelected)
}
if (selectedTab === "DROP_POINT") {
verifyDropOff(dropSelected)
}
if (pickupSelected && dropSelected) return gotoNextPage()
if (selectedTab === "PICKUP_POINT") {
if (pickupSelected) {
goToDrop();
} else {
toast("Please select pickup location")
}
}