Skip to content

Instantly share code, notes, and snippets.

@IkhwanSI13
IkhwanSI13 / LiquidPullToRefresh
Created March 18, 2021 06:39
Liquid-Pull-To-Refresh
import 'package:flutter/material.dart';
import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final GlobalKey<LiquidPullToRefreshState> _refreshIndicatorKey =
GlobalKey<LiquidPullToRefreshState>();
@IkhwanSI13
IkhwanSI13 / MahasiswaModel.dart
Created March 6, 2021 15:28
Code setelah upgrade schema, Sqflite
class MahasiswaModel {
MahasiswaModel(
{this.nim, this.name, this.department, this.sks, this.address});
String nim;
String name;
String department;
int sks;
String address;
}
@IkhwanSI13
IkhwanSI13 / DeviceLocationActivity.kt
Last active February 5, 2021 09:57
Menampilkan lokasi pengguna dengan mapbox
package id.yukngoding.explore_mapbox.type.deviceLoc
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.android.core.location.LocationEngine
import com.mapbox.android.core.location.LocationEngineProvider
import com.mapbox.android.core.location.LocationEngineRequest
package ${escapeKotlinIdentifiers(packageName)}
import android.content.Context
class ${mvpClass}Presenter(var view: ${mvpClass}Contract.View)
: ${mvpClass}Contract.Presenter {
override fun dropView() {
}
package ${escapeKotlinIdentifiers(packageName)}
interface ${mvpClass}Contract {
interface View{
}
interface Presenter {
fun dropView()
}
}
@IkhwanSI13
IkhwanSI13 / ViewClass.kt.ftl
Created May 10, 2020 09:46
Activity template with MVP pattern
package ${escapeKotlinIdentifiers(packageName)}
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class ${mvpClass}Activity : AppCompatActivity(), ${mvpClass}Contract.View {
lateinit var presenter: ${mvpClass}Presenter
@IkhwanSI13
IkhwanSI13 / recipe.xml.ftl
Created May 10, 2020 09:19
recipe.xml.ftl for activity with MVP patter
<?xml version="1.0"?>
<#import "root://activities/common/kotlin_macros.ftl" as kt>
<recipe>
<#include "../common/recipe_manifest.xml.ftl" />
<@kt.addAllKotlinDependencies />
<#include "../common/recipe_simple.xml.ftl" />
<open file="${escapeXmlAttribute(resOut)}/layout/${layoutName}.xml" />
<instantiate from="root/src/app_package/ViewClass.kt.ftl"
@IkhwanSI13
IkhwanSI13 / globals.xml.ftl
Created May 10, 2020 09:11
file for activity template for MVP pattern
<?xml version="1.0"?>
<globals>
<global id="hasNoActionBar" type="boolean" value="false" />
<global id="simpleLayoutName" value="${layoutName}" />
<global id="activityClass" value="${mvpClass}Activity" />
<global id="excludeMenu" type="boolean" value="true" />
<global id="generateActivityTitle" type="boolean" value="false" />
<#include "../common/common_globals.xml.ftl" />
</globals>
@IkhwanSI13
IkhwanSI13 / template.xml
Created May 10, 2020 08:11
template.xml for MVP Activity
<?xml version="1.0"?>
<template
format="5"
revision="1"
name="MVP Activity"
description="Creates a new activity with MVP Pattern">
<category value="Activity" />
<formfactor value="Mobile" />
@IkhwanSI13
IkhwanSI13 / RecyclerView
Created April 23, 2020 12:28
Live template for RecyclerView
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.extensions.LayoutContainer
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.${LAYOUT_NAME}.*