class SimpleSingleton {
private static SimpleSingleton sInstance;
private SimpleSingleton() {}
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 LocationManagerImpl @Inject constructor( | |
private val permissionManager: PermissionManager, | |
private val context: Context | |
) : LocationManager { | |
override fun getUserLocationUpdates(): Observable<UserLocation> = | |
if (checkIfGooglePlayAvailable()) getLocationFromGooglePlay() else getLocationFromAndroidSdk() | |
override fun getDefaultLocation(): UserLocation = UserLocation(DEFAULT_LATITUDE, DEFAULT_LONGITUDE) |
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
/** | |
* Util class for unit tests. | |
* Creates subject and mocks instances, resets mocks before each test. Applies Rx rule. | |
*/ | |
abstract class SubjectDelegateUnitTest<T : Any> : BaseUnitTest() { | |
@PublishedApi internal var mocks = mutableListOf<Any>() | |
lateinit var subject: T | |
override fun setUp() { |
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 FileUtils { | |
companion object { | |
private const val FILENAME = "temp_bitmap" | |
@JvmStatic | |
fun getFileUriFromBitmap(context: Context, bitmap: Bitmap): Uri { | |
val file = getFileFromBitmap(context, bitmap) | |
return Uri.parse(file.toURI().toString()) | |
} | |
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:background="@drawable/background"> | |
<FrameLayout | |
android:id="@+id/frl" | |
android:layout_width="match_parent" |
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
/** | |
* Format time in milliseconds to the string of the type "6 дней 23:59:59". | |
* | |
* @param millis number of milliseconds. | |
* @return formatted string. | |
*/ | |
fun convertMillisecondsToDHMS(millis: Long): String { | |
val s = TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1) | |
val m = TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1) |
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"?> | |
<resources xmlns:tools="http://schemas.android.com/tools"> | |
<color name="red_50">#FFEBEE</color> | |
<color name="red_100">#FFCDD2</color> | |
<color name="red_200">#EF9A9A</color> | |
<color name="red_300">#E57373</color> | |
<color name="red_400">#EF5350</color> | |
<color name="red_500">#F44336</color> | |
<color name="red_600">#E53935</color> |
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
Java. Kotlin. | |
OOP. | |
Design patterns. | |
Solid. Clean architecture. | |
Rest, crud, http, soap. | |
Android version names. | |
Android system architecture. | |
Android components. Activity, service, broadcast receiver, content provider. | |
Material design. |
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 Main { | |
/** | |
* Returns new list of N random elements from provided list. | |
* | |
* @param list list of elements to choose from | |
* @param n number of elements to choose | |
* @param <E> type of elements in a list | |
* @return new list of N random elements from provided list | |
*/ |
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 MainActivity extends AppCompatActivity implements | |
LoaderManager.LoaderCallbacks<String> { | |
private static final int LOADER_ID = 22; | |
private static final String SEARCH_QUERY_URL_EXTRA = "query"; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
NewerOlder