Skip to content

Instantly share code, notes, and snippets.

View shikto1's full-sized avatar

Ahidul Islam shikto1

View GitHub Profile
1. Use Image Libraries: If need to load image in itemview, use Glide, Picasso or Fresco library.
2. setHasStableIds: This method should be used setHasStableIds(true) to enable stable item IDs. This helps in efficiently
updating and reordering items without unnecessary rebinds.
3. setHasFixedSize: If RecyclerView size itself is fixed and wouldn’t change due to its content and,
using setHasFixedSize(true) can help improve performance by avoiding unnecessary layout calculations.
4. setItemViewCacheSize: Adjust the cache size using this method to control how many offscreen views are
retained. This can help in managing memory usage.
class MainActivity : AppCompatActivity() {
private var intentFilter: IntentFilter? = null
private var smsReceiver: SMSReceiver? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Init Sms Retriever >>>>
class MainActivity : AppCompatActivity() {
private var smsReceiver: SMSReceiver? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Init Sms Retriever >>>>
initSmsListener()
package com.shishirthedev.smsretriverapi
import android.annotation.TargetApi
import android.content.Context
import android.content.ContextWrapper
import android.content.pm.PackageManager
import android.util.Base64
import android.util.Log
import java.nio.charset.StandardCharsets
import java.security.MessageDigest
class MainActivity : AppCompatActivity() {
private var intentFilter: IntentFilter? = null
private var smsReceiver: SMSReceiver? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
package com.shishirthedev.smsretriverapi
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.google.android.gms.auth.api.phone.SmsRetriever
import com.google.android.gms.common.api.CommonStatusCodes
import com.google.android.gms.common.api.Status
import java.util.regex.Pattern
class SMSReceiver : BroadcastReceiver() {
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:17.5.0'
import 'package:deliveryboy/data/pref/Keys.dart';
import 'package:deliveryboy/data/pref/PreferenceManager.dart';
import 'package:deliveryboy/ui/components/item_view/item_on_borading.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'auth/login/login_screen.dart';
class OnboardingScreen extends StatefulWidget {
static const route = "/on-boarding-screen";
fun isInternetAvailable(context: Context): Boolean {
var isConnected: Boolean = false // Initial Value
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork: NetworkInfo? = connectivityManager.activeNetworkInfo
if (activeNetwork != null && activeNetwork.isConnected)
isConnected = true
return isConnected
}
val retrofit = new retrofit2.Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();