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 ExecTask implements Runnable { | |
private List<String> commands; | |
private ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() { | |
@Override | |
public Thread newThread(Runnable r) { | |
Thread t = new Thread(r); | |
t.setDaemon(true); | |
return t; | |
} |
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
# -*- coding=utf-8 -*- | |
#!/usr/bin/env python | |
__author__ = 'kobashin' | |
from argparse import ArgumentParser | |
def main(args): | |
print('') |
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 DialogFragmentBase extends DialogFragment { | |
public interface OnDialogActionListerner { | |
void onPositiveButtonClicked(); | |
void onNegativeButtonClicked(); | |
} | |
public static class Builder { |
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
class CustomDialogFragment : DialogFragment() { | |
interface OnDialogActionListerner { | |
fun onPositiveButtonClicked() | |
fun onNegativeButtonClicked() | |
} | |
class Builder { |
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
class Sample(){ | |
private val writer: PrintWriter by lazy { | |
val name = SimpleDateFormat("yyyyMMdd_HHmmss'.log'").format(Date(System.currentTimeMillis())) | |
PrintWriter(BufferedWriter(FileWriter(File("${Environment.getExternalStorageDirectory()}/$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
package uselibrary.sample.kobashin.com.uselibrary_sample; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.widget.Button; | |
import butterknife.Bind; | |
import butterknife.ButterKnife; | |
import butterknife.OnClick; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
android:paddingBottom="@dimen/activity_vertical_margin" |
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
TOP_LOCAL_PATH:= $(call my-dir) | |
LOCAL_PATH:= $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_MODULE_TAGS := optional | |
LOCAL_JAVACFLAGS := -processor butterknife.internal.ButterKnifeProcessor | |
LOCAL_STATIC_JAVA_LIBRARIES := \ |
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
new Runnable() { | |
@Override | |
public void run() { | |
OkHttpClient.Builder builder = new OkHttpClient.Builder(); | |
final Map<String, CachingAuthenticator> authCache = new ConcurrentHashMap<>(); | |
final DigestAuthenticator authenticator = new DigestAuthenticator(new Credentials("hoge", "fuga")); | |
OkHttpClient client = builder.authenticator(authenticator) | |
.addInterceptor(new AuthenticationCacheInterceptor(authCache)) | |
.build(); | |
Retrofit retrofit = new Retrofit.Builder() |
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
final ApiService service = retrofit.create(ApiService.class); | |
service.login() | |
.subscribeOn(Schedulers.newThread()) | |
.observeOn(Schedulers.newThread()) | |
.flatMap(response -> { | |
if (response.getErrCode != 0) { | |
return null; | |
} | |
return service.getDataFromWeb(); | |
}) |
OlderNewer