Kotlin Learning
https://medium.com/peachstudio/get-started-with-kotlin-it-is-here-to-stay-1eaac85ae6a0
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 abstract class RxAsyncTask<T> implements LifecycleObserver { | |
private Disposable disposable; | |
private Lifecycle lifecycleOwner; | |
private Lifecycle.State event = Lifecycle.State.DESTROYED; | |
public abstract Observable<T> doInBackGround(); | |
public void onPreExecute() { | |
} |
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 abstract class BaseRecyclerViewAdapter<T extends BaseRecyclerViewAdapter.BaseHolder, X> | |
extends RecyclerView.Adapter<T> { | |
private RecyclerViewListener recyclerViewListener; | |
private List<X> data; | |
public BaseRecyclerViewAdapter(List<X> data) { | |
this.data = data; | |
} |
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
private void downloadFile(String downloadPath) { | |
RetrofitUtils.getWebServices().downloadFile(downloadPath) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.map(new Function<ResponseBody, File>() { | |
@Override | |
public File apply(ResponseBody responseBody) { | |
File file = new File(""); | |
writeResponseBodyToDisk(responseBody,file ); | |
return file; |
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 om.dc.testing; | |
import android.annotation.SuppressLint; | |
import android.databinding.DataBindingUtil; | |
import android.net.Uri; | |
import android.os.AsyncTask; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.support.annotation.RequiresApi; | |
import android.support.v7.app.AppCompatActivity; |
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 om.dc.testing; | |
import android.annotation.SuppressLint; | |
import android.databinding.DataBindingUtil; | |
import android.net.Uri; | |
import android.os.AsyncTask; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.support.annotation.RequiresApi; | |
import android.support.v7.app.AppCompatActivity; |
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 com.dc.myapplication; | |
import android.os.Bundle; | |
import android.os.Environment; | |
import android.support.v7.app.AppCompatActivity; | |
import java.io.BufferedInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; |
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
int offset = TimeZone.getDefault().getRawOffset() + TimeZone.getDefault().getDSTSavings(); | |
long now = System.currentTimeMillis() + offset; |
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
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.drawable.Drawable; | |
import android.graphics.drawable.StateListDrawable; | |
import android.util.AttributeSet; | |
import android.util.StateSet; | |
public class SelectorImageView extends android.support.v7.widget.AppCompatImageView { | |
public SelectorImageView(Context context) { |
OlderNewer