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
fun setTimeToStartOfDay(calendar: Calendar): Calendar { | |
calendar.set(Calendar.HOUR_OF_DAY, 0) | |
calendar.set(Calendar.MINUTE, 0) | |
calendar.set(Calendar.SECOND, 0) | |
calendar.set(Calendar.MILLISECOND, 0) | |
return calendar | |
} | |
fun setTimeToEndOfDay(calendar: Calendar): Calendar { | |
calendar.set(Calendar.HOUR_OF_DAY, 23) |
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
fun getDaysBetweenRoundUp(t1: Long, t2: Long): Int { | |
val msDiff = t2 - t1 | |
val daysFraction = msDiff.toFloat() / android.text.format.DateUtils.DAY_IN_MILLIS | |
return ceil(daysFraction.toDouble()).toInt() | |
} | |
fun getDaysBetweenRoundUp(c1: Calendar, c2: Calendar): Int { | |
return getDaysBetweenRoundUp(c1.timeInMillis, c2.timeInMillis) | |
} |
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
object ReadableDateUtils { | |
private const val flagsDateOnly = DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_ABBREV_MONTH | |
private const val flagsDateOnlyWithDayOfWeek = | |
DateUtils.FORMAT_SHOW_DATE or | |
DateUtils.FORMAT_ABBREV_MONTH or | |
DateUtils.FORMAT_ABBREV_WEEKDAY or | |
DateUtils.FORMAT_SHOW_WEEKDAY |
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
/** | |
* View Pager Adapter - An implementation of PagerAdapter for views | |
* Simplified implementation which enables access to created view at a specific position | |
* for controlling the view status and force pre creation of a view when necessary | |
* | |
* Created by tomergoldst on 15/11/2018. | |
*/ | |
public abstract class ViewPagerAdapter<T> extends PagerAdapter { |
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
interface KeyStoreDataSource { | |
fun getString(key: String, defaultValue: String?): String? | |
fun putString(key: String, value: String?) | |
fun getInt(key: String, defaultValue: Int): Int | |
fun putInt(key: String, value: Int) | |
fun getLong(key: String, defaultValue: Long): Long | |
fun putLong(key: String, value: Long) | |
fun getFloat(key: String, defaultValue: Float): Float | |
fun putFloat(key: String, value: Float) |
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 Singelton private constructor(context: Context) { | |
companion object { | |
@Volatile | |
private var INSTANCE: Singelton? = null | |
fun getInstance(context: Context): Singelton = | |
INSTANCE ?: synchronized(this) { | |
INSTANCE ?: Singelton(context).also { INSTANCE = it } |
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 interface KeyStoreDataSource { | |
String getString(String key, String defaultValue); | |
void putString(String key, String value); | |
int getInt(String key, int defaultValue); | |
void putInt(String key, int value); | |
long getLong(String key, long defaultValue); | |
void putLong(String key, long value); | |
float getFloat(String key, float defaultValue); | |
void putFloat(String key, float value); |