public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {
private int mItemOffset;
public ItemOffsetDecoration(int itemOffset) {
mItemOffset = itemOffset;
}
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 android.graphics.Rect; | |
import android.support.v7.widget.GridLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
public class GridDividerDecoration extends RecyclerView.ItemDecoration { | |
private int space; | |
private int spanCount; | |
private int lastItemInFirstLane = -1; |
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 CommonTextWatcher( | |
private val beforeChanged:((CharSequence?,Int,Int,Int)->Unit)={_,_,_,_->}, | |
private val afterChanged:((Editable?)->Unit)={}, | |
private val onChanged:(CharSequence?,Int,Int,Int)->Unit | |
):TextWatcher { | |
override fun afterTextChanged(p0: Editable?) { | |
afterChanged(p0) | |
} | |
override fun beforeTextChanged(char: CharSequence?, start: Int, count: Int, after: Int) { |
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 React, { useEffect, useState } from 'react'; | |
import { StyleSheet, View, Text, Alert } from 'react-native'; | |
import NetInfo from '@react-native-community/netinfo' | |
let cellularGeneration='' | |
let signalStrength=100 | |
let connectionType='' | |
const NetworkConnectionChange=()=>{ |
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 Activity.goToActivity(newActivity: Class<*>){ | |
val intent= Intent(this, newActivity) | |
startActivity(intent) | |
} | |
fun Activity.goToActivityWithBundle(newActivity: Class<*>,bundle: Bundle){ | |
val intent=Intent(this, newActivity) | |
intent.putExtra("bundle",bundle) | |
startActivity(intent) | |
} |
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 val swipeCallBack = object : ItemTouchHelper.SimpleCallback(0,ItemTouchHelper.RIGHT or ItemTouchHelper.LEFT){ | |
override fun onMove( | |
recyclerView: RecyclerView, | |
viewHolder: RecyclerView.ViewHolder, | |
target: RecyclerView.ViewHolder | |
): Boolean { | |
return true | |
} | |
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) { |
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 val diffUtil = object : DiffUtil.ItemCallback<String>() { | |
override fun areItemsTheSame(oldItem: String, newItem: String): Boolean { | |
return oldItem == newItem | |
} | |
override fun areContentsTheSame(oldItem: String, newItem: String): Boolean { | |
return oldItem == newItem | |
} | |
} |