Skip to content

Instantly share code, notes, and snippets.

View lidemin's full-sized avatar

Damon lidemin

  • Insight Timer
  • Sydney
View GitHub Profile
cd /workspace/$1
VERSION_NAME=$(git describe)
VERSION_CODE=$(git rev-list --count master)
flutter build apk --build-name=$VERSION_NAME --build-number=$VERSION_CODE
# Flutter (https://flutter.io) Developement Environment for Linux
# ===============================================================
#
# This environment passes all Linux Flutter Doctor checks and is sufficient
# for building Android applications and running Flutter tests.
#
# To build iOS applications, a Mac development environment is necessary.
#
FROM debian:stretch
@lidemin
lidemin / CustomRecyclerViewAdapter.java
Created July 13, 2016 04:46
AS's live template for custom recyclerview adapter.
public class $objectclass$Adapter extends RecyclerView.Adapter<$objectclass$ViewHolder>{
List<$objectclass$> objList;
private Context context;
private LayoutInflater inflater;
public $objectclass$Adapter(Context context) {
this.context = context;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@lidemin
lidemin / test.java
Created July 9, 2016 16:00
Just for testing.
@Override
public synchronized Bitmap getMosaicTile(String hexColor, int tileWidth, int tileHeight) throws Exception {
Bitmap newBmp = Bitmap.createBitmap(tileWidth, tileHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(newBmp);
RectF rectF = new RectF(padding, padding, tileWidth - padding, tileHeight - padding);
paint.setColor(Color.parseColor("#" + hexColor));
canvas.drawRoundRect(rectF, radius, radius, paint);
return newBmp;
}
@lidemin
lidemin / DLRecyclerView.java
Created February 6, 2015 08:18
RecyclerView which can listen scroll to the bottom or end.
public class DLRecyclerView extends RecyclerView {
public interface OnScrollListener {
/**
* only works when layoutmanager is LinearLayoutManager
*/
public abstract void onScrollToEnd();
}
private OnScrollListener _onScrollListener;
@lidemin
lidemin / BaseFragment.java
Last active August 29, 2015 14:14
LocalBroadcastManager enhancement
abstract public class BaseFragment extends Fragment {
/** Constant String representing class name for logs.*/
protected String _tag = ((Object) this).getClass().getSimpleName();
//broadcast manager
protected DLBroadcastManager broadcastManager;
protected BroadcastReceiver broadcastReceiver;
private IntentFilter intentFilter;
@lidemin
lidemin / GCMReceiver.java
Created February 6, 2015 08:14
Android Push Notification Bootstrap
/**
* Created by damon on 30/1/15.
*/
public class GCMReceiver extends WakefulBroadcastReceiver {
public static final String TAG = "GCMReceiver";
@Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GCMService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
@lidemin
lidemin / DLAppSession.java
Last active September 8, 2015 04:13
Android Utils
package com.damon.android;
/**
* Created by damon on 7/2/15.
*/
import android.content.Context;
import java.io.Serializable;
import java.util.ArrayList;
@lidemin
lidemin / StickyLocalBroadcastManager.java
Last active May 3, 2017 23:57
StickyLocalBroadcastManager
/**
* This is just a copy of Android LocalBroadcastManager from SupportLibrary.
*
* Add sticky broadcast support. PS: not sure it is the best way to do that.
*
*/
public class StickyLocalBroadcastManager {
private static class ReceiverRecord {
final IntentFilter filter;
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software