Skip to content

Instantly share code, notes, and snippets.

@Override
public void onKitchenOrdersReceived(KitchenOrdersResponse mKitchenOrdersResponse)
{
AppLog.d(TAG, "onKitchenOrdersReceived");
this.mKitchenOrdersResponse = mKitchenOrdersResponse;
mAdapter = new OrdersAdapter(mKitchenOrdersResponse);
recyclerView.setAdapter(mAdapter);
ItemTouchHelper.Callback callback = new ItemTouchHelperCallback(mAdapter);
@baggednismo
baggednismo / camera_background_drawable
Created January 28, 2020 16:23
Example camera background drawable for android
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="640"
android:viewportHeight="480"
android:width="640dp"
android:height="480dp">
<path
android:pathData="M2.50002 0.499998H639.5V477.5H2.50002V0.499998Z"
android:strokeColor="#000000"
android:strokeWidth="20" />
<group
class MainFragment : Fragment(), ItemListener{
companion object {
private const val TAG = "MainFragment"
}
private var _binding: FragmentMainBinding? = null
private val binding get() = _binding!!
private var mActivity : MainActivity? = null
var mView: View? = null
interface ItemListener {
fun onViewCard(position: Int)
fun onRemoveCard(position: Int)
}
class ParentItemsAdapter(private val data: List<ParentItemModel>,
private var itemListener: ItemListener
) : RecyclerView.Adapter<ParentItemsViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ParentItemsViewHolder {
val inflater = LayoutInflater.from(parent.context)
return ParentItemsViewHolder(
inflater,
parent,
itemListener
class ParentItemsViewHolder(inflater: LayoutInflater, parent: ViewGroup, itemListener: ItemListener) :
RecyclerView.ViewHolder(inflater.inflate(R.layout.card_parent_item, parent, false)) {
private var itemListener: ItemListener? = null
private var cardTitle: TextView? = null
private var recyclerItem: RecyclerView? = null
init {
cardTitle = itemView.findViewById(R.id.app_title)
recyclerItem = itemView.findViewById(R.id.id_card_child_items)
class ChildItemsAdapter(private val data: ArrayList<ChildItemModel>,
private var itemListener: ItemListener
) : RecyclerView.Adapter<ChildItemsViewHolder>(), ItemListener {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChildItemsViewHolder {
val inflater = LayoutInflater.from(parent.context)
return ChildItemsViewHolder(inflater, parent, this)
}
override fun onBindViewHolder(holder: ChildItemsViewHolder, position: Int) {
class ChildItemsViewHolder(inflater: LayoutInflater, parent: ViewGroup, itemListener: ItemListener) :
RecyclerView.ViewHolder(inflater.inflate(R.layout.card_child_item, parent, false)), View.OnClickListener {
private var itemListener: ItemListener? = null
private var cardTitle: TextView? = null
private var cardDesc: TextView? = null
private var remove: ConstraintLayout? = null
init {
cardTitle = itemView.findViewById(R.id.card_title)
public class OkHttpFactory {
private static final int DEFAULT_CONNECTION_TIMEOUT = 30; // seconds
private OkHttpClient mOkHttpClient;
public void OkHttpFactory() {
mOkHttpClient = new OkHttpClient();
}
/**
* To get default OkHttpClient with out any interceptor or log level. To add OkHttpClient with its properties use {@link Builder} class
class LauncherActivity : AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val handler = Handler()
setContentView(R.layout.activity_launcher)
val updates = listOf(
UpdatesSeriesModel(