This file contains hidden or 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 hidden or 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 hidden or 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> |
This file contains hidden or 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"?> | |
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <item android:state_checked="true"> | |
| <shape android:shape="rectangle"> | |
| <solid android:color="#3B5A9A" /> | |
| <corners android:bottomLeftRadius="4dp" | |
| android:topLeftRadius="4dp"/> | |
| </shape> | |
| </item> |
This file contains hidden or 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 io.reactivex.Single | |
| import io.reactivex.SingleSource | |
| import io.reactivex.SingleTransformer | |
| /** | |
| * Sealed class to handle ViewStates. | |
| * | |
| * When an error happens it will return a [ViewState.Failed] with a [ViewState.Failed.throwable] field | |
| * |
This file contains hidden or 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 CurrencyAdapter: RecyclerView.Adapter<CurrencyAdapter.ViewHolder>() { | |
| var data: List<YourModelName> = emptyList() | |
| set(value) { | |
| field = value | |
| notifyDataSetChanged() | |
| } | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | |
| return ViewHolder(parent) |
This file contains hidden or 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
| <View | |
| .... | |
| app:layout_constraintHorizontal_bias="0" | |
| android:layout_width="0dp" | |
| app:layout_constraintWidth_default="wrap" > | |
| </View> |
This file contains hidden or 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
| //more plugins here.... | |
| apply plugin: 'kotlin-kapt' | |
| android { | |
| //your stuff... | |
| buildTypes { | |
| release { | |
| //your stuff... | |
| buildConfigField "String", "BASE_URL", "\"https://your.api.url//\"" |
This file contains hidden or 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 hidden or 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 |
OlderNewer