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
/** | |
The below snippets will help you find total money spent on Zomato and Swiggy so far by any individual. | |
For Zomato: | |
Step 1: Go to Zomato.com, | |
Step 2: Go to "Profiles", click on "Order History" | |
Step 3: Scroll to the very bottom and click on "Load More", until the option disappears. | |
Step 4: Do a right click anywhere on the screen and click on "Inspect", in the inspector, | |
go to console copy and paste the below snippet and press enter. | |
*****IMPORTANT**** | |
Make sure all the steps till step 3 is followed before doing the step 4. |
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
class MyCustomView : View { | |
constructor(context: Context) : super(context) | |
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) | |
constructor(context: Context, attrs: AttributeSet?, attributeSetId: Int) : super(context, attrs, attributeSetId) | |
} |
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
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
data class Sms(val phone: String, val text: String) | |
object SmsBus { | |
private val bus by lazy { PublishSubject.create<Sms>() } | |
fun incomingSms(): Observable<Sms> = bus | |
fun postSms(sms: Sms) = bus.onNext(sms) | |
} | |
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
private void hideSoftKeyBoard() { | |
final View myCurrentFocusView = getCurrentFocus(); | |
myCurrentFocusView.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
// TODO Auto-generated method stub | |
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.hideSoftInputFromWindow(myCurrentFocusView.getWindowToken(), 0); | |
} | |
},100); |
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
class MyFragment: Fragment(){ | |
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
return UI { | |
linearLayout{ | |
editText() | |
button("OK") | |
} | |
}.view | |
} | |
} |
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
class BitmapUtils { | |
companion object | |
} | |
fun BitmapUtils.Companion.getCompressedImage(pathName: String, scalingLogic: ImageView.ScaleType): String { | |
val options = BitmapFactory.Options() | |
options.inJustDecodeBounds = true | |
BitmapFactory.decodeFile(pathName, options) | |
options.inJustDecodeBounds = false | |
val dstWidth: Double = ((options.outWidth.toDouble() / (options.outWidth.toDouble() * options.outHeight.toDouble())) * 1000) * options.outWidth.toDouble() |
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.app.Activity; | |
import android.content.Context; | |
import android.graphics.Rect; | |
import android.view.View; | |
import android.view.inputmethod.InputMethodManager; | |
public class KeyboardUtils { | |
public static void hideKeyboard(Activity activity) { | |
View view = activity.findViewById(android.R.id.content); |
NewerOlder