Skip to content

Instantly share code, notes, and snippets.

View nicemak's full-sized avatar
👨‍💻
Working

Mohsin Ahmed Khan nicemak

👨‍💻
Working
  • Sr. Android Developer @ Bosch Pharma Pvt. Ltd.
  • Karachi, Pakistan
View GitHub Profile
@nicemak
nicemak / fix-duplicate-class-android-studio.md
Created June 21, 2024 04:49 — forked from danielcshn/fix-duplicate-class-android-studio.md
Fix Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules kotlin-stdlib-* Android Studio | 2022.2.1

📜 Info:

  • Android Studio Flamingo | 2022.2.1
  • Build #AI-222.4459.24.2221.9862592, built on March 31, 2023
  • Gradle JDK: jbr-17 (JetBrains Runtime version 17.0.6)
  • Windows 11 (version 10.0.22000.1817)

🐛 Bug/Error log:

@nicemak
nicemak / CircularTimerListener.kt
Last active October 25, 2022 05:56
CircularTimerView
interface CircularTimerListener {
fun updateDataOnTick(remainingTimeInMs: Long): String?
fun onTimerFinished()
}
@nicemak
nicemak / DownloadProgressLiveData.kt
Created June 27, 2022 04:40 — forked from typebrook/DownloadProgressLiveData.kt
Observe Download manager progress using LiveData and Coroutine #android #kotlin #livedata
data class DownloadItem(
val bytesDownloadedSoFar: Long = -1,
val totalSizeBytes: Long = -1,
val status: Int,
val uri: String
)
class DownloadProgressLiveData(private val activity: Activity) :
LiveData<List<DownloadItem>>(),
CoroutineScope {
@nicemak
nicemak / ExpandableTextView.kt
Created June 27, 2022 04:39 — forked from typebrook/ExpandableTextView.kt
Simple Android Expandable TextView #android #textview
package com.geothings.geobingan.ui
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
@nicemak
nicemak / Screenshot + PDF File
Created June 17, 2022 07:49
Get screenshot and save it to PDF
saveImageToPDF(layout, layout.getScreenShot(), fileName)
fun View.getScreenShot(): Bitmap {
val returnedBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(returnedBitmap)
val bgDrawable = background
if (bgDrawable != null) bgDrawable.draw(canvas)
else canvas.drawColor(Color.WHITE)
draw(canvas)
return returnedBitmap
If you want install application programmatically in Android 10, You need to give permission to install app for your application
==============================================================================
Steps 1: Give permission in Manifest
==============================================================================
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
==============================================================================
Step 2: Write provider in Android Manifest
@nicemak
nicemak / Plugins.txt
Last active November 24, 2021 10:16
Use Full Plugins Android Studio
Android Drawable Preview
Android WiFiADB
ChroMATERIAL
Json To Kotlin Class
Kotlin Fill Class
MAD Scorecard
Material Design Icon Generator
Material Theme UI
Rainbow Brackets
Regex Rename Files
@nicemak
nicemak / Urls.txt
Last active September 11, 2021 08:13
Usefull Websites For Android Development
https://lankydan.dev/ // nice tutorials
https://proandroiddev.com/ // nice tutorials
https://medium.com/androiddevelopers
https://androidweekly.net/
https://mindorks.com/
https://blog.stylingandroid.com/ === Best Reading
https://www.reddit.com/r/androiddev/ === Users
https://medium.com/androiddevelopers === Android Developers
https://www.uplabs.com/ === Designer resources
https://codelabs.developers.google.com/?cat=Android === Android Practice
@nicemak
nicemak / VideoPlayer.kt
Created February 11, 2020 07:35 — forked from scruffyfox/VideoPlayer.kt
Playing a video from Assets using ExoPlayer 2
/**
* It took me AGES to figure this out, seriously, exoplayer documentation IS SO BAD.
*/
package xxx
import android.net.Uri
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.cube.arc.R
@nicemak
nicemak / BroadCastReceiver.kt
Last active January 10, 2020 04:50
Location Monitoring Service Files
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
class BroadCastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
context.startForegroundService(Intent(context,LocationMonitoringService::class.java))