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.support.v7.widget.RecyclerView | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import kotlinx.android.synthetic.main.item_container.view.* | |
import rx.Observable | |
import rx.subjects.PublishSubject | |
import javax.inject.Inject | |
class RecyclerViewAdapter |
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
android:clickable="true" | |
android:focusable="true" | |
android:foreground="?android:attr/selectableItemBackground" |
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.support.design.widget.Snackbar | |
import android.view.View | |
import com.github.clans.fab.FloatingActionMenu | |
fun View.visible(){ | |
this.visibility = View.VISIBLE | |
} | |
fun View.visible(visible : Boolean){ | |
if(visible){ | |
visible() |
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.ComponentName | |
import android.content.Context | |
import android.content.CursorLoader | |
import android.content.pm.PackageManager | |
import android.net.ConnectivityManager | |
import android.net.Uri | |
import android.os.Looper | |
import android.provider.MediaStore | |
import android.support.annotation.ColorRes | |
import android.support.annotation.StringRes |
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.annotation.SuppressLint | |
import okhttp3.OkHttpClient | |
import java.security.cert.CertificateException | |
import javax.net.ssl.SSLContext | |
import javax.net.ssl.TrustManager | |
import javax.net.ssl.X509TrustManager | |
object UnsafeOkHttpClient { | |
fun Builder(): OkHttpClient.Builder { | |
try { |
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.support.annotation.StringDef | |
import android.text.Editable | |
import android.text.TextWatcher | |
import android.widget.EditText | |
@StringDef(PHONE_9_MASK, PHONE_8_MASK, CPF_MASK, ZIP_CODE_PT_BR, MONTH_YEAR, CREDIT_CARD) | |
@Retention(AnnotationRetention.SOURCE) | |
annotation class MaskType | |
const val PHONE_9_MASK = "(##) #####-####" |
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 java.text.SimpleDateFormat | |
import java.util.* | |
/** | |
* Pattern: yyyy-MM-dd HH:mm:ss | |
*/ | |
fun Date.formatToServerDateTimeDefaults(): String{ | |
val sdf= SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()) | |
return sdf.format(this) | |
} |
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
val subscription = Observable.interval(0, 5, TimeUnit.SECONDS) | |
.timeInterval() | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribeOn(Schedulers.io()) | |
.subscribe { | |
//TODO | |
} |
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 MarkerOptions createMarkerIcon(LatLng position) { | |
FrameLayout frameLayout = new FrameLayout(getContext()); | |
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( | |
FrameLayout.LayoutParams.WRAP_CONTENT, | |
FrameLayout.LayoutParams.WRAP_CONTENT); | |
frameLayout.setLayoutParams(params); | |
View markerView = getActivity().getLayoutInflater().inflate(R.layout.custom_map_marker, frameLayout); | |
BitmapDescriptor bitmapMerged = BitmapDescriptorFactory.fromBitmap(BitmapUtils.createDrawableFromView(getContext(), markerView)); |
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
//Preparing the request | |
val filePart = MultipartBody.Part | |
.createFormData("file", "fileName", | |
RequestBody.create(MediaType.parse("image/jpeg"), File("/your/File/Path.jpg"))) | |
//service.sendFile(id, filePart) | |
//Request definition retrofit | |
@PUT("https://www.yourdomain.com/api/file/{id}") | |
@Multipart | |
fun sendFile(@Path("id") id: Long, @Part file: MultipartBody.Part ) : Observable<YourModel> |
OlderNewer