Fix tracker compilation
This commit is contained in:
parent
10e8ffdfa2
commit
ba569bb809
6 changed files with 62 additions and 54 deletions
|
@ -699,18 +699,20 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
|
|
||||||
val hiddenChats = mutableSetOf<Long>()
|
val hiddenChats = mutableSetOf<Long>()
|
||||||
val hiddenChatsSet = prefs.getStringSet(HIDDEN_ON_MAP_CHATS_KEY, mutableSetOf())
|
val hiddenChatsSet = prefs.getStringSet(HIDDEN_ON_MAP_CHATS_KEY, mutableSetOf())
|
||||||
for (chatId in hiddenChatsSet) {
|
hiddenChatsSet?.let {
|
||||||
|
for (chatId in it) {
|
||||||
hiddenChats.add(chatId.toLong())
|
hiddenChats.add(chatId.toLong())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hiddenOnMapChats = hiddenChats
|
hiddenOnMapChats = hiddenChats
|
||||||
|
|
||||||
metricsConstants = MetricsConstants.valueOf(
|
metricsConstants = MetricsConstants.valueOf(
|
||||||
prefs.getString(METRICS_CONSTANTS_KEY, MetricsConstants.KILOMETERS_AND_METERS.name)
|
prefs.getString(METRICS_CONSTANTS_KEY, MetricsConstants.KILOMETERS_AND_METERS.name)!!
|
||||||
)
|
)
|
||||||
speedConstants = SpeedConstants.valueOf(
|
speedConstants = SpeedConstants.valueOf(
|
||||||
prefs.getString(SPEED_CONSTANTS_KEY, SpeedConstants.KILOMETERS_PER_HOUR.name)
|
prefs.getString(SPEED_CONSTANTS_KEY, SpeedConstants.KILOMETERS_PER_HOUR.name)!!
|
||||||
)
|
)
|
||||||
utcOffset = prefs.getString(UTC_OFFSET_CONSTANTS_KEY, DataConstants.UTC_FORMAT)
|
utcOffset = prefs.getString(UTC_OFFSET_CONSTANTS_KEY, DataConstants.UTC_FORMAT)!!
|
||||||
|
|
||||||
try {
|
try {
|
||||||
parseShareChatsInfo(JSONArray(prefs.getString(SHARE_CHATS_INFO_KEY, "")))
|
parseShareChatsInfo(JSONArray(prefs.getString(SHARE_CHATS_INFO_KEY, "")))
|
||||||
|
@ -724,7 +726,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
log.error(e)
|
log.error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
parseShareDevices(prefs.getString(SHARE_DEVICES_KEY, ""))
|
parseShareDevices(prefs.getString(SHARE_DEVICES_KEY, "")!!)
|
||||||
|
|
||||||
val sendMyLocDef = SEND_MY_LOC_VALUES_SEC[SEND_MY_LOC_DEFAULT_INDEX]
|
val sendMyLocDef = SEND_MY_LOC_VALUES_SEC[SEND_MY_LOC_DEFAULT_INDEX]
|
||||||
sendMyLocInterval = prefs.getLong(SEND_MY_LOC_INTERVAL_KEY, sendMyLocDef)
|
sendMyLocInterval = prefs.getLong(SEND_MY_LOC_INTERVAL_KEY, sendMyLocDef)
|
||||||
|
@ -733,7 +735,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
val locHistoryDef = LOC_HISTORY_VALUES_SEC[LOC_HISTORY_DEFAULT_INDEX]
|
val locHistoryDef = LOC_HISTORY_VALUES_SEC[LOC_HISTORY_DEFAULT_INDEX]
|
||||||
locHistoryTime = prefs.getLong(LOC_HISTORY_TIME_KEY, locHistoryDef)
|
locHistoryTime = prefs.getLong(LOC_HISTORY_TIME_KEY, locHistoryDef)
|
||||||
val shareTypeDef = SHARE_TYPE_VALUES[SHARE_TYPE_DEFAULT_INDEX]
|
val shareTypeDef = SHARE_TYPE_VALUES[SHARE_TYPE_DEFAULT_INDEX]
|
||||||
shareTypeValue = prefs.getString(SHARE_TYPE_KEY, shareTypeDef)
|
shareTypeValue = prefs.getString(SHARE_TYPE_KEY, shareTypeDef)!!
|
||||||
|
|
||||||
val minLocationDistanceDef = MIN_LOCATION_DISTANCE[MIN_LOCATION_DISTANCE_INDEX]
|
val minLocationDistanceDef = MIN_LOCATION_DISTANCE[MIN_LOCATION_DISTANCE_INDEX]
|
||||||
minLocationDistance = prefs.getFloat(MIN_LOCATION_DISTANCE_KEY, minLocationDistanceDef)
|
minLocationDistance = prefs.getFloat(MIN_LOCATION_DISTANCE_KEY, minLocationDistanceDef)
|
||||||
|
@ -743,13 +745,13 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
minLocationSpeed = prefs.getFloat(MIN_LOCATION_SPEED_KEY, minLocationSpeedDef)
|
minLocationSpeed = prefs.getFloat(MIN_LOCATION_SPEED_KEY, minLocationSpeedDef)
|
||||||
|
|
||||||
val currentUserId = app.telegramHelper.getCurrentUserId()
|
val currentUserId = app.telegramHelper.getCurrentUserId()
|
||||||
currentSharingMode = prefs.getString(SHARING_MODE_KEY, if (currentUserId != -1) currentUserId.toString() else "")
|
currentSharingMode = prefs.getString(SHARING_MODE_KEY, if (currentUserId != -1) currentUserId.toString() else "")!!
|
||||||
|
|
||||||
val defPackage = if (AppConnect.getInstalledApps(app).size == 1) AppConnect.getInstalledApps(app).first().appPackage else ""
|
val defPackage = if (AppConnect.getInstalledApps(app).size == 1) AppConnect.getInstalledApps(app).first().appPackage else ""
|
||||||
appToConnectPackage = prefs.getString(APP_TO_CONNECT_PACKAGE_KEY, defPackage)
|
appToConnectPackage = prefs.getString(APP_TO_CONNECT_PACKAGE_KEY, defPackage)!!
|
||||||
|
|
||||||
liveNowSortType = LiveNowSortType.valueOf(
|
liveNowSortType = LiveNowSortType.valueOf(
|
||||||
prefs.getString(LIVE_NOW_SORT_TYPE_KEY, LiveNowSortType.SORT_BY_DISTANCE.name)
|
prefs.getString(LIVE_NOW_SORT_TYPE_KEY, LiveNowSortType.SORT_BY_DISTANCE.name)!!
|
||||||
)
|
)
|
||||||
|
|
||||||
batteryOptimisationAsked = prefs.getBoolean(BATTERY_OPTIMISATION_ASKED,false)
|
batteryOptimisationAsked = prefs.getBoolean(BATTERY_OPTIMISATION_ASKED,false)
|
||||||
|
|
|
@ -295,7 +295,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
|
||||||
|
|
||||||
private fun getStatusWidgetIntent(): Intent {
|
private fun getStatusWidgetIntent(): Intent {
|
||||||
val startIntent = app.packageManager.getLaunchIntentForPackage(app.packageName)
|
val startIntent = app.packageManager.getLaunchIntentForPackage(app.packageName)
|
||||||
startIntent.addCategory(Intent.CATEGORY_LAUNCHER)
|
startIntent!!.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||||
startIntent.putExtra(OPEN_MY_LOCATION_TAB_KEY,true)
|
startIntent.putExtra(OPEN_MY_LOCATION_TAB_KEY,true)
|
||||||
return startIntent
|
return startIntent
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ class SetTimeBottomSheet : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun selectStartDate() {
|
private fun selectStartDate() {
|
||||||
|
context?.let {
|
||||||
val dateFromDialog = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
|
val dateFromDialog = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
|
||||||
startCalendar.set(Calendar.YEAR, year)
|
startCalendar.set(Calendar.YEAR, year)
|
||||||
startCalendar.set(Calendar.MONTH, monthOfYear)
|
startCalendar.set(Calendar.MONTH, monthOfYear)
|
||||||
|
@ -113,12 +114,13 @@ class SetTimeBottomSheet : DialogFragment() {
|
||||||
updateDateAndTimeButtons()
|
updateDateAndTimeButtons()
|
||||||
}
|
}
|
||||||
DatePickerDialog(
|
DatePickerDialog(
|
||||||
context, dateFromDialog,
|
it, dateFromDialog,
|
||||||
startCalendar.get(Calendar.YEAR),
|
startCalendar.get(Calendar.YEAR),
|
||||||
startCalendar.get(Calendar.MONTH),
|
startCalendar.get(Calendar.MONTH),
|
||||||
startCalendar.get(Calendar.DAY_OF_MONTH)
|
startCalendar.get(Calendar.DAY_OF_MONTH)
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun selectStartTime() {
|
private fun selectStartTime() {
|
||||||
TimePickerDialog(
|
TimePickerDialog(
|
||||||
|
@ -132,6 +134,7 @@ class SetTimeBottomSheet : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun selectEndDate() {
|
private fun selectEndDate() {
|
||||||
|
context?.let {
|
||||||
val dateFromDialog = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
|
val dateFromDialog = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
|
||||||
endCalendar.set(Calendar.YEAR, year)
|
endCalendar.set(Calendar.YEAR, year)
|
||||||
endCalendar.set(Calendar.MONTH, monthOfYear)
|
endCalendar.set(Calendar.MONTH, monthOfYear)
|
||||||
|
@ -139,12 +142,13 @@ class SetTimeBottomSheet : DialogFragment() {
|
||||||
updateDateAndTimeButtons()
|
updateDateAndTimeButtons()
|
||||||
}
|
}
|
||||||
DatePickerDialog(
|
DatePickerDialog(
|
||||||
context, dateFromDialog,
|
it, dateFromDialog,
|
||||||
endCalendar.get(Calendar.YEAR),
|
endCalendar.get(Calendar.YEAR),
|
||||||
endCalendar.get(Calendar.MONTH),
|
endCalendar.get(Calendar.MONTH),
|
||||||
endCalendar.get(Calendar.DAY_OF_MONTH)
|
endCalendar.get(Calendar.DAY_OF_MONTH)
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun selectEndTime() {
|
private fun selectEndTime() {
|
||||||
TimePickerDialog(
|
TimePickerDialog(
|
||||||
|
|
|
@ -53,7 +53,7 @@ class TimelineTabFragment : Fragment() {
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View {
|
||||||
mainView = inflater.inflate(R.layout.fragment_timeline_tab, container, false)
|
mainView = inflater.inflate(R.layout.fragment_timeline_tab, container, false)
|
||||||
val appBarLayout = mainView.findViewById<View>(R.id.app_bar_layout)
|
val appBarLayout = mainView.findViewById<View>(R.id.app_bar_layout)
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ class TimelineTabFragment : Fragment() {
|
||||||
fun tabClosed() {}
|
fun tabClosed() {}
|
||||||
|
|
||||||
private fun selectDate() {
|
private fun selectDate() {
|
||||||
|
context?.let {
|
||||||
val dateSetListener =
|
val dateSetListener =
|
||||||
DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
|
DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
|
||||||
calendar = Calendar.getInstance()
|
calendar = Calendar.getInstance()
|
||||||
|
@ -150,12 +151,13 @@ class TimelineTabFragment : Fragment() {
|
||||||
updateDateButton()
|
updateDateButton()
|
||||||
}
|
}
|
||||||
DatePickerDialog(
|
DatePickerDialog(
|
||||||
context, dateSetListener,
|
it, dateSetListener,
|
||||||
calendar.get(Calendar.YEAR),
|
calendar.get(Calendar.YEAR),
|
||||||
calendar.get(Calendar.MONTH),
|
calendar.get(Calendar.MONTH),
|
||||||
calendar.get(Calendar.DAY_OF_MONTH)
|
calendar.get(Calendar.DAY_OF_MONTH)
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getStartOfDay(calendar: Calendar): Long {
|
private fun getStartOfDay(calendar: Calendar): Long {
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0)
|
calendar.set(Calendar.HOUR_OF_DAY, 0)
|
||||||
|
|
|
@ -32,11 +32,11 @@ class BottomSheetDialog(ctx: Context) : Dialog(ctx, R.style.AppTheme_BottomSheet
|
||||||
super.setContentView(wrapInContainer(layoutResID, null, null))
|
super.setContentView(wrapInContainer(layoutResID, null, null))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setContentView(view: View?) {
|
override fun setContentView(view: View) {
|
||||||
super.setContentView(wrapInContainer(0, view, null))
|
super.setContentView(wrapInContainer(0, view, null))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setContentView(view: View?, params: ViewGroup.LayoutParams?) {
|
override fun setContentView(view: View, params: ViewGroup.LayoutParams?) {
|
||||||
super.setContentView(wrapInContainer(0, view, params))
|
super.setContentView(wrapInContainer(0, view, params))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class TextViewEx : AppCompatTextView {
|
||||||
}
|
}
|
||||||
|
|
||||||
val typefaceName = resolvedAttrs.getString(R.styleable.TextViewEx_typeface)
|
val typefaceName = resolvedAttrs.getString(R.styleable.TextViewEx_typeface)
|
||||||
val typeface = FontCache.getFont(context, typefaceName)
|
val typeface = FontCache.getFont(context, typefaceName!!)
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
val style = getTypeface()?.style ?: 0
|
val style = getTypeface()?.style ?: 0
|
||||||
setTypeface(typeface, style)
|
setTypeface(typeface, style)
|
||||||
|
|
Loading…
Reference in a new issue