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
// ./gradlew copyDependenciesDebug | |
android.applicationVariants.all { variant -> | |
task "copyDependencies${variant.name.capitalize()}"() { | |
outputs.upToDateWhen { false } | |
doLast { | |
println "Executing copyDependencies${variant.name.capitalize()}" | |
variant.getCompileClasspath().each { fileDependency -> | |
def sourcePath = fileDependency.absolutePath | |
def destinationPath = project.projectDir.path + "/build/dependencies/${variant.name}/" |
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 KeyboardUtil { | |
public static void hide(View v) { | |
InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); | |
if (imm != null && imm.isActive()) { | |
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); | |
} | |
} | |
public interface SoftKeyboardCallback { |
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
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
import datetime | |
date1 = datetime.datetime.now() | |
this_week_monday = date1 - datetime.timedelta(days=date1.weekday()) | |
this_week_friday = date1 + datetime.timedelta(days=6-date1.weekday()) | |
# print this_week_monday, this_week_friday | |
this_week_monday_str = str(this_week_monday).split()[0] |
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
// (1) put this snippet to the tail of app.gradle | |
// (2) ./gradlew assembleDebug | |
public class BuildTimeListener implements TaskExecutionListener, BuildListener { | |
private org.gradle.internal.time.Clock clock | |
private times = [] | |
@Override | |
void beforeExecute(Task task) { | |
clock = new org.gradle.internal.time.Clock() |
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
/** | |
* Checks whether it is necessary to ask for permission to read storage. If necessary, it also | |
* requests permission. | |
* | |
* @return true if a permission request is made. False if it is not necessary. | |
*/ | |
@TargetApi(23) | |
private boolean maybeRequestPermission() { | |
if (requiresPermission(contentUri)) { | |
requestPermissions(new String[] {permission.READ_EXTERNAL_STORAGE}, 0); |