This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CommitEditText extends AppCompatEditText { | |
private CommitListener commitListener; | |
public CommitEditText(Context context) { | |
super(context); | |
} | |
public CommitEditText(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public long getFreeMemory() { | |
File externalStorageDir = Environment.getExternalStorageDirectory(); | |
StatFs statFs = new StatFs(externalStorageDir.getAbsolutePath()); | |
long blocks = statFs.getAvailableBlocks(); | |
long free = (blocks * statFs.getBlockSize()) / 1024 / 1024; | |
return free; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100% - FF | |
95% - F2 | |
90% - E6 | |
85% - D9 | |
80% - CC | |
75% - BF | |
70% - B3 | |
65% - A6 | |
60% - 99 | |
55% - 8C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//give up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repositories{ | |
flatDir{ | |
dirs 'libs' | |
} | |
mavenCentral() | |
} | |
dependencies { | |
compile '**PACKAGE NAME**:**NAME OF AAR**:**VERSION**@aar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Gradle Dependency: | |
//In your build gradle | |
dependencies { | |
compile 'com.willowtreeapps:oak-library:1.3.3' | |
} | |
//Maven Dependency: | |
//In your pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<oak.widget.TextViewWithFont | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:res="http://schemas.android.com/apk/res-auto" | |
res:oakFont="Font.ttf"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<oak.widget.TextViewWithFont | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:oak="http://oak/oak/schema" | |
oak:font="Font.ttf"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleLoader extends AsyncTaskLoader<List<SampleItem>> { | |
// We hold a reference to the Loader’s data here. | |
private List<SampleItem> mData; | |
public SampleLoader(Context ctx) { | |
// Loaders may be used across multiple Activitys (assuming they aren't | |
// bound to the LoaderManager), so NEVER hold a reference to the context | |
// directly. Doing so will cause you to leak an entire Activity's context. | |
// The superclass constructor will store a reference to the Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OkHttpClient providesOkHttpClient() { | |
OkHttpClient httpClient = new OkHttpClient(); | |
SSLContext sslContext; | |
try { | |
sslContext = SSLContext.getInstance("TLS"); | |
sslContext.init(null, null, null); | |
} catch (GeneralSecurityException e) { | |
throw new AssertionError(); // The system has no TLS. Just give up. | |
} | |
httpClient.setSslSocketFactory(sslContext.getSocketFactory()); |
NewerOlder