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
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. |
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 NetworkConnectionInterceptor implements Interceptor { | |
private Context mContext; | |
public NetworkConnectionInterceptor(Context context) { | |
mContext = context; | |
} | |
@Override |
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 RetrofitAPIClient { | |
private static Retrofit retrofit = null; | |
public static Retrofit getRetrofitClient(Context mContext) { | |
if (retrofit == null) { | |
OkHttpClient.Builder oktHttpClient = new OkHttpClient.Builder() | |
.addInterceptor(new NetworkConnectionInterceptor(mContext)); | |
// Adding NetworkConnectionInterceptor with okHttpClientBuilder. |
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 'package:blockpatter/base/BaseState.dart'; | |
import 'package:blockpatter/ui/forgot_pass/forgotpass_page.dart'; | |
import 'package:blockpatter/ui/home/home_page.dart'; | |
import 'package:blockpatter/ui/login/login_contract.dart'; | |
import 'package:blockpatter/ui/registration/registeration_page.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:blockpatter/values/styles.dart'; | |
class LoginPage extends StatefulWidget { | |
static const route = "/login-page"; |
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
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 | |
} |
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
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 >>>> |
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
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() |
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
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 |
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
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) |
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
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() { |
NewerOlder