Fix tracker compilation

This commit is contained in:
Vitaliy 2020-12-02 13:04:17 +02:00
parent 10e8ffdfa2
commit ba569bb809
6 changed files with 62 additions and 54 deletions

View file

@ -699,18 +699,20 @@ class TelegramSettings(private val app: TelegramApplication) {
val hiddenChats = mutableSetOf<Long>()
val hiddenChatsSet = prefs.getStringSet(HIDDEN_ON_MAP_CHATS_KEY, mutableSetOf())
for (chatId in hiddenChatsSet) {
hiddenChatsSet?.let {
for (chatId in it) {
hiddenChats.add(chatId.toLong())
}
}
hiddenOnMapChats = hiddenChats
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(
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 {
parseShareChatsInfo(JSONArray(prefs.getString(SHARE_CHATS_INFO_KEY, "")))
@ -724,7 +726,7 @@ class TelegramSettings(private val app: TelegramApplication) {
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]
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]
locHistoryTime = prefs.getLong(LOC_HISTORY_TIME_KEY, locHistoryDef)
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]
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)
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 ""
appToConnectPackage = prefs.getString(APP_TO_CONNECT_PACKAGE_KEY, defPackage)
appToConnectPackage = prefs.getString(APP_TO_CONNECT_PACKAGE_KEY, defPackage)!!
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)

View file

@ -295,7 +295,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
private fun getStatusWidgetIntent(): Intent {
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)
return startIntent
}

View file

@ -106,6 +106,7 @@ class SetTimeBottomSheet : DialogFragment() {
}
private fun selectStartDate() {
context?.let {
val dateFromDialog = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
startCalendar.set(Calendar.YEAR, year)
startCalendar.set(Calendar.MONTH, monthOfYear)
@ -113,12 +114,13 @@ class SetTimeBottomSheet : DialogFragment() {
updateDateAndTimeButtons()
}
DatePickerDialog(
context, dateFromDialog,
it, dateFromDialog,
startCalendar.get(Calendar.YEAR),
startCalendar.get(Calendar.MONTH),
startCalendar.get(Calendar.DAY_OF_MONTH)
).show()
}
}
private fun selectStartTime() {
TimePickerDialog(
@ -132,6 +134,7 @@ class SetTimeBottomSheet : DialogFragment() {
}
private fun selectEndDate() {
context?.let {
val dateFromDialog = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
endCalendar.set(Calendar.YEAR, year)
endCalendar.set(Calendar.MONTH, monthOfYear)
@ -139,12 +142,13 @@ class SetTimeBottomSheet : DialogFragment() {
updateDateAndTimeButtons()
}
DatePickerDialog(
context, dateFromDialog,
it, dateFromDialog,
endCalendar.get(Calendar.YEAR),
endCalendar.get(Calendar.MONTH),
endCalendar.get(Calendar.DAY_OF_MONTH)
).show()
}
}
private fun selectEndTime() {
TimePickerDialog(

View file

@ -53,7 +53,7 @@ class TimelineTabFragment : Fragment() {
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
): View {
mainView = inflater.inflate(R.layout.fragment_timeline_tab, container, false)
val appBarLayout = mainView.findViewById<View>(R.id.app_bar_layout)
@ -139,6 +139,7 @@ class TimelineTabFragment : Fragment() {
fun tabClosed() {}
private fun selectDate() {
context?.let {
val dateSetListener =
DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
calendar = Calendar.getInstance()
@ -150,12 +151,13 @@ class TimelineTabFragment : Fragment() {
updateDateButton()
}
DatePickerDialog(
context, dateSetListener,
it, dateSetListener,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH)
).show()
}
}
private fun getStartOfDay(calendar: Calendar): Long {
calendar.set(Calendar.HOUR_OF_DAY, 0)

View file

@ -32,11 +32,11 @@ class BottomSheetDialog(ctx: Context) : Dialog(ctx, R.style.AppTheme_BottomSheet
super.setContentView(wrapInContainer(layoutResID, null, null))
}
override fun setContentView(view: View?) {
override fun setContentView(view: View) {
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))
}

View file

@ -40,7 +40,7 @@ class TextViewEx : AppCompatTextView {
}
val typefaceName = resolvedAttrs.getString(R.styleable.TextViewEx_typeface)
val typeface = FontCache.getFont(context, typefaceName)
val typeface = FontCache.getFont(context, typefaceName!!)
if (typeface != null) {
val style = getTypeface()?.style ?: 0
setTypeface(typeface, style)