Skip to content

Instantly share code, notes, and snippets.

View AbGhost-cyber's full-sized avatar
🎯
Focusing

Ab dremo AbGhost-cyber

🎯
Focusing
View GitHub Profile
private <T> T execute(final Request request, final Class<T> classOfT) throws IOException {
OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();
return GOSN.fromJson(response.body().string(), classOfT);
}
@AbGhost-cyber
AbGhost-cyber / sololearn-kotlin-assignment.kt
Created March 19, 2021 12:47
this assignment is called parking fee
fun main() {
var hours = 4.0
val fixedHours = 24.0
val flatFee = 15.0
val total: Double
val chargeAfterFiveHours = 0.5
val chargeBeforeFiveHours = 1
when {
hours > fixedHours -> {
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/actionsLayout"
android:layout_width="match_parent"
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import android.os.Build
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
/**
private fun checkWritePermissionAndProcessPdf() {
ActivityCompat.requestPermissions(
requireActivity(),
arrayOf(android.Manifest.permission.WRITE_EXTERNAL_STORAGE), REQUEST_CODE
)
if (checkSelfPermission(
requireContext(),
android.Manifest.permission.WRITE_EXTERNAL_STORAGE
)
== PackageManager.PERMISSION_GRANTED
viewPdf.visibility = View.VISIBLE
viewPdf.setOnClickListener {
//your action here
}
val countDown = 4000L
val countDownTimer = object : CountDownTimer(countDown, 1000) {
override fun onFinish() {
private val itemTouchHelperCallback = object : SimpleCallback(
0, LEFT or RIGHT
) {
override fun onMove(
recyclerView: RecyclerView,
viewHolder: ViewHolder,
target: ViewHolder
): Boolean {
return false
}
class CurvedBottomNavigationView : BottomNavigationView {
private var mPath: Path? = null
private var mPaint: Paint? = null
/** the CURVE_CIRCLE_RADIUS represent the radius of the fab button */
private val CURVE_CIRCLE_RADIUS = 256 / 2
// the coordinates of the first curve
private val mFirstCurveStartPoint: Point = Point()
private val mFirstCurveEndPoint: Point = Point()