Skip to content

Instantly share code, notes, and snippets.

View raveesh-me's full-sized avatar
🦁
Honesty, Humility, Patience, Pride.

Raveesh Agarwal raveesh-me

🦁
Honesty, Humility, Patience, Pride.
View GitHub Profile
List<Recipe> categoryListGenerator(iCategory) {
List<Recipe> _categoryRecipe = recipes.where((recipe) {
return recipe.category == iCategory;
}).toList();
return _categoryRecipe;
}
List<Recipe> recipes = [
new Recipe(
"Pesto Pastry",
new AlertDialog.Builder(MainActivity.this)
.setTitle("Call Permission")
.setMessage("Hi there! We can't call anyone without the call permission, could you please grant it?")
.setPositiveButton("Yep", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.setNegativeButton("No thanks", new DialogInterface.OnClickListener() {
@raveesh-me
raveesh-me / RequestPermissions
Created October 27, 2017 23:04
A kotlin/anko template for a RequestPermission workflow
package `in`.cookytech.testapp
import android.Manifest
import android.Manifest.permission
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import org.jetbrains.anko.*
import org.jetbrains.anko.sdk25.coroutines.onClick
@raveesh-me
raveesh-me / [ListView ~vh~ adapter] DayAdapter.kt
Last active October 21, 2017 12:41
An performance optimized ListView adapter without viewHolder implementation.
package com.example.raveesh.stormy.adapters
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import com.example.raveesh.stormy.R
import com.example.raveesh.stormy.weather.Day
import kotlinx.android.synthetic.main.daily_list_item.view.*
import org.jetbrains.anko.imageResource