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
@ExperimentalCoroutinesApi | |
abstract class IBaseFragment<VB : ViewBinding, VM : IBaseViewModel> : Fragment() { | |
protected abstract val viewModel: VM | |
lateinit var binding: VB | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? |
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
inline fun <reified T : Any> Activity.launchActivity( | |
requestCode: Int = -1, | |
options: Bundle? = null, | |
noinline init: Intent.() -> Unit = {}) { | |
val intent = newIntent<T>(this) | |
intent.init() | |
startActivityForResult(intent, requestCode, options) | |
overridePendingTransition(R.anim.slide_up, R.anim.no_change) |
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 kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.* | |
import retrofit2.Response | |
import java.io.IOException | |
typealias NetworkAPIInvoke<T> = suspend () -> Response<T> | |
suspend fun <T : Any> performNetworkCall( | |
messageInCaseOfError: String = "Network error", |
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
plugins { | |
id 'com.android.application' | |
id 'kotlin-android' | |
id 'kotlin-android-extensions' | |
} | |
android { | |
compileSdkVersion 29 | |
buildToolsVersion "29.0.3" |
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
[ | |
{ | |
"day": "25", | |
"month": "06", | |
"year": "2019", | |
"imageUrl": "https://s3.ap-south-1.amazonaws.com/mindorks-server-uploads/use-mockito-as-pro-banner.png", | |
"blogUrl": "https://blog.mindorks.com/using-mockito-in-android-unit-testing-as-a-pro", | |
"name": "Hi" | |
}, | |
{ |
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 fun drawCurve(canvas: Canvas, mPointa: PointF, mPointb: PointF): Path { | |
val myPath = Path() | |
myPath.moveTo((canvas.width / 2).toFloat(), ((((canvas.height) - canvas.width / 5) / 2)).toFloat()) | |
myPath.quadTo(midPoint(mPointa.x, mPointb.x), midPoint(mPointa.y, mPointb.y) - 150, mPointb.x, mPointb.y) | |
return myPath | |
} |
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 AlarmManagerTaskBroadCastReceiver extends BroadcastReceiver { | |
public static final String CUSTOM_INTENT = "com.test.intent.action.ALARM"; | |
public static final Context ctx = ApplicationInit.getAppContext(); | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
/* enqueue the job */ |
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
[ | |
{ | |
"name": "Latest" | |
},{ | |
"name": "Education" | |
}, { | |
"name": "Bollywood" | |
}, { | |
"name": "International" | |
} |
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 java.util.Scanner; | |
public class Pattern { | |
public static void printPattern(int n) { | |
for (int i = 1; i <= n; i++) { | |
for (int j = i; j >= 1; j--) { | |
System.out.print(j + " "); | |
} | |
System.out.println(); |
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
// CALLING SERVICE FROM MAINACTIYITY: | |
Intent service = new Intent(SettingsActivity.this, ScreenService.class); | |
//Changes - 1 | |
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O){ | |
//Changes -2 | |
MainActivity.this.startForegroundService(mContext, service); | |
} else { | |
startService(service); |