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 GridRecyclerView : RecyclerView { | |
private lateinit var manager: GridLayoutManager | |
private var columnWidth = -1 | |
constructor(context: Context) : super(context) { | |
init(context, null) | |
} | |
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { | |
init(context, attrs) |
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 RecyclerViewAdapter : RecyclerView.Adapter<BindingViewHolder>() { | |
private val items = mutableListOf<RecyclerItem>() | |
private var eventHandler: RecyclerViewHandler? = null | |
override fun getItemCount(): Int { | |
return items.size | |
} | |
override fun getItemViewType(position: Int): Int { |
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.mobiledevpro.interactor.usecase.base | |
import com.mobiledevpro.interactor.usecase.base.executor.ExecutionThread | |
import com.mobiledevpro.interactor.usecase.base.executor.PostExecutionThread | |
import io.reactivex.Scheduler | |
import io.reactivex.disposables.CompositeDisposable | |
import io.reactivex.disposables.Disposable | |
abstract class BaseRxUseCase( | |
executionThread: ExecutionThread, |
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
/* | |
How to add this template to Android Studio: | |
1. Settings -> Edditor -> File and Code Templated; | |
2. Open "Files" tab; | |
3. Click icon "Plus" and paste the code below; | |
4. "Enable Live Templates" should be turned off. | |
*/ | |
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end |
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 VehicleDetailsFragmentKt : BaseFragment() { | |
@Override | |
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |
observeLiveData() | |
return inflater.inflate(getLayoutResId(), container, false); | |
} |
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
version: 2.1 | |
# Updated on May 10, 2022 | |
config_docker: &config_docker | |
docker: | |
- image: cimg/android:2021.10.2 | |
resource_class: large | |
working_directory: ~/code | |
config_env: &config_env |
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
/** | |
* Interceptor to handle connection errors and return a readable message to user | |
* <p> | |
* Created by Dmitriy Chernysh on 12/3/19. | |
* <p> | |
* https://instagr.am/mobiledevpro | |
* #MobileDevPro | |
* | |
* | |
* NOTE: add this to: |
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
@Override | |
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
switch (requestCode) { | |
case Constants.REQUEST_CODE_ADD_VIDEO_FROM_GALLERY: | |
boolean isGranted = false; | |
for (int result : grantResults) { | |
if (result == PackageManager.PERMISSION_GRANTED) { | |
isGranted = true; | |
} else { | |
isGranted = false; |
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
/** | |
* This class helps to encrypt passwords before saving and decrypt then | |
* <p> | |
* Created by Dmitriy V. Chernysh | |
* <p> | |
* https://instagr.am/mobiledevpro | |
* <p> | |
* #MobileDevPro | |
*/ | |
public class EncryptDataHelper { |
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
//set screen brightness to max | |
Window window = getActivity().getWindow(); | |
if (window != null) { | |
WindowManager.LayoutParams lp = window.getAttributes(); | |
lp.screenBrightness = 1; //from dark (0) to full bright (1) | |
window.setAttributes(lp); | |
} |