Skip to content

Instantly share code, notes, and snippets.

View hasankucuk's full-sized avatar

Hasan Küçük hasankucuk

View GitHub Profile
@hasankucuk
hasankucuk / CandidatesFragment.java
Created October 2, 2018 08:41 — forked from pavlospt/CandidatesFragment.java
Simple Caching tricks
binding.fragmentCandidateBrowseList.setItemViewCacheSize(30);
binding.fragmentCandidateBrowseList.setDrawingCacheEnabled(true);
binding.fragmentCandidateBrowseList.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
@hasankucuk
hasankucuk / RealmHelper.java
Created November 9, 2018 12:21 — forked from vinhdn/RealmHelper.java
Realm Helper Android
public class RealmHelper {
public static <T extends RealmObject> void save(T object) {
Realm realm = Realm.getDefaultInstance();
try {
realm.beginTransaction();
realm.copyToRealmOrUpdate(object);
realm.commitTransaction();
} finally {
realm.close();
}
@hasankucuk
hasankucuk / RealmHelper.java
Created November 9, 2018 12:21 — forked from vinhdn/RealmHelper.java
Realm Helper Android
public class RealmHelper {
public static <T extends RealmObject> void save(T object) {
Realm realm = Realm.getDefaultInstance();
try {
realm.beginTransaction();
realm.copyToRealmOrUpdate(object);
realm.commitTransaction();
} finally {
realm.close();
}
@hasankucuk
hasankucuk / Contact.java
Created November 21, 2018 14:21 — forked from rogerhu/Contact.java
Endless scrolling with RecyclerVIew
package codepath.com.recyclerviewfun;
import java.util.ArrayList;
import java.util.List;
public class Contact {
private String mName;
private boolean mOnline;
public Contact(String name, boolean online) {
@hasankucuk
hasankucuk / extract_realm_database_android.sh
Created December 9, 2018 12:35 — forked from jk2K/extract_realm_database_android.sh
how to export realm database, work on Android 5.0+
#!/bin/bash
ADB_PATH="/Users/lee/Library/Android/sdk/platform-tools"
PACKAGE_NAME="com.yourcompany.app"
DB_NAME="default.realm"
DESTINATION_PATH="/Users/lee/Downloads/${DB_NAME}"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Make sure a device is connected"
else
@hasankucuk
hasankucuk / README.md
Created December 9, 2018 19:58 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@hasankucuk
hasankucuk / 1-README.md
Created December 9, 2018 20:27 — forked from lopspower/1-README.md
EventBus Introduction

EventBus Introduction

API

General usage and API

Here we pick up on the 3 steps of the README and expand a bit on the code.

1: Define events

Events are POJO (plain old Java object) without any specific requirements.

@hasankucuk
hasankucuk / README.md
Created December 9, 2018 20:31 — forked from lopspower/README.md
Configuration of proguard-rules.pro

Proguard Configuration

Twitter

1) Enable Proguard in your build.gradle module :

android {
    //...
 buildTypes {
@hasankucuk
hasankucuk / README.md
Created December 9, 2018 20:31 — forked from lopspower/README.md
Android Tools Attributes

Android Tools Attributes

Twitter

Android has a dedicated XML namespace intended for tools to be able to record information in XML files, and have that information stripped when the application is packaged such that there is no runtime or download size penalty. The namespace URI is http://schemas.android.com/tools and is usually bound to the tools: prefix:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
@hasankucuk
hasankucuk / gist:1075778ff74a7e2a18128bcf84b106de
Created December 18, 2018 17:12 — forked from y-gagar1n/gist:8469484
DateTime format patterns
DateTime.ToString() Patterns
All the patterns:
0 MM/dd/yyyy 08/22/2006
1 dddd, dd MMMM yyyy Tuesday, 22 August 2006
2 dddd, dd MMMM yyyy HH:mm Tuesday, 22 August 2006 06:30
3 dddd, dd MMMM yyyy hh:mm tt Tuesday, 22 August 2006 06:30 AM
4 dddd, dd MMMM yyyy H:mm Tuesday, 22 August 2006 6:30
5 dddd, dd MMMM yyyy h:mm tt Tuesday, 22 August 2006 6:30 AM