Skip to content

Instantly share code, notes, and snippets.

View ariefannur's full-sized avatar
🏠
Working from home

Arief Maffrudin A N ariefannur

🏠
Working from home
  • Android Developer
View GitHub Profile
@ariefannur
ariefannur / CustomRadioButtonFlutter.dart
Last active July 31, 2019 08:12
Custom Radio Button Flutter
// The click Radio Item Example
class SizeContainer extends StatefulWidget{
final String text;
final bool isSelect;
SizeContainer({this.text, this.isSelect});
@override
State<StatefulWidget> createState() => SizeContainerState();
}
@ariefannur
ariefannur / simple layout
Created March 21, 2018 03:56
simple layout relative and linear layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
tools:context=".MainActivity">
<RelativeLayout
@ariefannur
ariefannur / logic game
Created February 13, 2018 08:49
Rock Paper Scissor Logic
override fun onClick(v: View) {
if(curState == state.finish)
return
when(v.id){
R.id.btn_rock->{
img_mc.setImageResource(R.drawable.ic_rock)
cekAnswer(type.rock)
}
R.id.btn_paper->{
@ariefannur
ariefannur / game lifecycle
Created February 13, 2018 08:45
game lifecycle kotlin
interface GameState {
fun onStartEngine()
fun onUpdate(time:Long)
fun onFinish()
}
@ariefannur
ariefannur / game engine
Created February 13, 2018 08:43
game engine timer kotlin
class GameEngine {
// time length 20 s
val TIME_UNIT: Long = 21000
var timer:CountDownTimer? = null
fun init(state: GameState){
state.onStartEngine()
// interval 1 s
timer = object : CountDownTimer(TIME_UNIT, 1000){