mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
commit
c4c41e21f6
@ -10,7 +10,6 @@ import com.github.libretube.fragments.SearchFragment
|
|||||||
import com.github.libretube.preferences.PreferenceHelper
|
import com.github.libretube.preferences.PreferenceHelper
|
||||||
|
|
||||||
class SearchHistoryAdapter(
|
class SearchHistoryAdapter(
|
||||||
private val context: Context,
|
|
||||||
private var historyList: List<String>,
|
private var historyList: List<String>,
|
||||||
private val editText: EditText,
|
private val editText: EditText,
|
||||||
private val searchFragment: SearchFragment
|
private val searchFragment: SearchFragment
|
||||||
@ -28,19 +27,19 @@ class SearchHistoryAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: SearchHistoryViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: SearchHistoryViewHolder, position: Int) {
|
||||||
val history = historyList[position]
|
val historyQuery = historyList[position]
|
||||||
holder.binding.apply {
|
holder.binding.apply {
|
||||||
historyText.text = history
|
historyText.text = historyQuery
|
||||||
|
|
||||||
deleteHistory.setOnClickListener {
|
deleteHistory.setOnClickListener {
|
||||||
historyList = historyList - history
|
historyList = historyList - historyQuery
|
||||||
PreferenceHelper.saveHistory(historyList)
|
PreferenceHelper.removeFromSearchHistory(historyQuery)
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
editText.setText(history)
|
editText.setText(historyQuery)
|
||||||
searchFragment.fetchSearch(history)
|
searchFragment.fetchSearch(historyQuery)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ class UpdateDialog(
|
|||||||
private fun getDownloadUrl(updateInfo: UpdateInfo): String? {
|
private fun getDownloadUrl(updateInfo: UpdateInfo): String? {
|
||||||
val supportedArchitectures = Build.SUPPORTED_ABIS
|
val supportedArchitectures = Build.SUPPORTED_ABIS
|
||||||
supportedArchitectures.forEach { arch ->
|
supportedArchitectures.forEach { arch ->
|
||||||
updateInfo.assets.forEach { asset ->
|
updateInfo.assets?.forEach { asset ->
|
||||||
if (asset.name.contains(arch)) return asset.browser_download_url
|
if (asset.name?.contains(arch) == true) return asset.browser_download_url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
@ -210,7 +210,7 @@ class PlayerFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
hideKeyboard()
|
context?.hideKeyboard(view)
|
||||||
|
|
||||||
setUserPrefs()
|
setUserPrefs()
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class SearchFragment : Fragment() {
|
|||||||
binding.autoCompleteTextView.setOnEditorActionListener(
|
binding.autoCompleteTextView.setOnEditorActionListener(
|
||||||
OnEditorActionListener { _, actionId, _ ->
|
OnEditorActionListener { _, actionId, _ ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
hideKeyboard()
|
view?.let { context?.hideKeyboard(it) }
|
||||||
binding.searchRecycler.visibility = VISIBLE
|
binding.searchRecycler.visibility = VISIBLE
|
||||||
binding.historyRecycler.visibility = GONE
|
binding.historyRecycler.visibility = GONE
|
||||||
fetchSearch(binding.autoCompleteTextView.text.toString())
|
fetchSearch(binding.autoCompleteTextView.text.toString())
|
||||||
@ -190,7 +190,7 @@ class SearchFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
lifecycleScope.launchWhenCreated {
|
lifecycleScope.launchWhenCreated {
|
||||||
isFetchingSearch = true
|
isFetchingSearch = true
|
||||||
hideKeyboard()
|
view?.let { context?.hideKeyboard(it) }
|
||||||
val response = try {
|
val response = try {
|
||||||
RetrofitInstance.api.getSearchResults(query, apiSearchFilter)
|
RetrofitInstance.api.getSearchResults(query, apiSearchFilter)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
@ -253,16 +253,15 @@ class SearchFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
hideKeyboard()
|
view?.let { context?.hideKeyboard(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showHistory() {
|
private fun showHistory() {
|
||||||
binding.searchRecycler.visibility = GONE
|
binding.searchRecycler.visibility = GONE
|
||||||
val historyList = PreferenceHelper.getHistory()
|
val historyList = PreferenceHelper.getSearchHistory()
|
||||||
if (historyList.isNotEmpty()) {
|
if (historyList.isNotEmpty()) {
|
||||||
binding.historyRecycler.adapter =
|
binding.historyRecycler.adapter =
|
||||||
SearchHistoryAdapter(
|
SearchHistoryAdapter(
|
||||||
requireContext(),
|
|
||||||
historyList,
|
historyList,
|
||||||
binding.autoCompleteTextView,
|
binding.autoCompleteTextView,
|
||||||
this
|
this
|
||||||
@ -274,20 +273,8 @@ class SearchFragment : Fragment() {
|
|||||||
private fun addToHistory(query: String) {
|
private fun addToHistory(query: String) {
|
||||||
val searchHistoryEnabled =
|
val searchHistoryEnabled =
|
||||||
PreferenceHelper.getBoolean(PreferenceKeys.SEARCH_HISTORY_TOGGLE, true)
|
PreferenceHelper.getBoolean(PreferenceKeys.SEARCH_HISTORY_TOGGLE, true)
|
||||||
if (searchHistoryEnabled) {
|
if (searchHistoryEnabled && query != "") {
|
||||||
var historyList = PreferenceHelper.getHistory()
|
PreferenceHelper.saveToSearchHistory(query)
|
||||||
|
|
||||||
if ((historyList.isNotEmpty() && historyList.contains(query)) || query == "") {
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
historyList = historyList + query
|
|
||||||
}
|
|
||||||
|
|
||||||
if (historyList.size > 10) {
|
|
||||||
historyList = historyList.takeLast(10)
|
|
||||||
}
|
|
||||||
|
|
||||||
PreferenceHelper.saveHistory(historyList)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class ChapterSegment(
|
data class ChapterSegment(
|
||||||
var title: String?,
|
var title: String? = null,
|
||||||
var image: String?,
|
var image: String? = null,
|
||||||
var start: Long?
|
var start: Long? = null
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", -1)
|
|
||||||
}
|
|
||||||
|
@ -4,17 +4,15 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Comment(
|
data class Comment(
|
||||||
val author: String?,
|
val author: String? = null,
|
||||||
val commentId: String?,
|
val commentId: String? = null,
|
||||||
val commentText: String?,
|
val commentText: String? = null,
|
||||||
val commentedTime: String?,
|
val commentedTime: String? = null,
|
||||||
val commentorUrl: String?,
|
val commentorUrl: String? = null,
|
||||||
val repliesPage: String?,
|
val repliesPage: String? = null,
|
||||||
val hearted: Boolean?,
|
val hearted: Boolean? = null,
|
||||||
val likeCount: Int?,
|
val likeCount: Int? = null,
|
||||||
val pinned: Boolean?,
|
val pinned: Boolean? = null,
|
||||||
val thumbnail: String?,
|
val thumbnail: String? = null,
|
||||||
val verified: Boolean?
|
val verified: Boolean? = null
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", "", "", "", "", null, 0, null, "", null)
|
|
||||||
}
|
|
||||||
|
@ -7,6 +7,4 @@ data class CommentsPage(
|
|||||||
val comments: MutableList<Comment> = arrayListOf(),
|
val comments: MutableList<Comment> = arrayListOf(),
|
||||||
val disabled: Boolean? = null,
|
val disabled: Boolean? = null,
|
||||||
val nextpage: String? = ""
|
val nextpage: String? = ""
|
||||||
) {
|
)
|
||||||
constructor() : this(arrayListOf(), null, "")
|
|
||||||
}
|
|
||||||
|
@ -4,20 +4,18 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class PipedStream(
|
data class PipedStream(
|
||||||
var url: String?,
|
var url: String? = null,
|
||||||
var format: String?,
|
var format: String? = null,
|
||||||
var quality: String?,
|
var quality: String? = null,
|
||||||
var mimeType: String?,
|
var mimeType: String? = null,
|
||||||
var codec: String?,
|
var codec: String? = null,
|
||||||
var videoOnly: Boolean?,
|
var videoOnly: Boolean? = null,
|
||||||
var bitrate: Int?,
|
var bitrate: Int? = null,
|
||||||
var initStart: Int?,
|
var initStart: Int? = null,
|
||||||
var initEnd: Int?,
|
var initEnd: Int? = null,
|
||||||
var indexStart: Int?,
|
var indexStart: Int? = null,
|
||||||
var indexEnd: Int?,
|
var indexEnd: Int? = null,
|
||||||
var width: Int?,
|
var width: Int? = null,
|
||||||
var height: Int?,
|
var height: Int? = null,
|
||||||
var fps: Int?
|
var fps: Int? = null
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", "", "", "", null, -1, -1, -1, -1, -1, -1, -1, -1)
|
|
||||||
}
|
|
||||||
|
@ -4,25 +4,23 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class SearchItem(
|
data class SearchItem(
|
||||||
var url: String?,
|
var url: String? = null,
|
||||||
var thumbnail: String?,
|
var thumbnail: String? = null,
|
||||||
var uploaderName: String?,
|
var uploaderName: String? = null,
|
||||||
var uploaded: Long?,
|
var uploaded: Long? = null,
|
||||||
var shortDescription: String?,
|
var shortDescription: String? = null,
|
||||||
// Video only attributes
|
// Video only attributes
|
||||||
var title: String?,
|
var title: String? = null,
|
||||||
var uploaderUrl: String?,
|
var uploaderUrl: String? = null,
|
||||||
var uploaderAvatar: String?,
|
var uploaderAvatar: String? = null,
|
||||||
var uploadedDate: String?,
|
var uploadedDate: String? = null,
|
||||||
var duration: Long?,
|
var duration: Long? = null,
|
||||||
var views: Long?,
|
var views: Long? = null,
|
||||||
var uploaderVerified: Boolean?,
|
var uploaderVerified: Boolean? = null,
|
||||||
// Channel and Playlist attributes
|
// Channel and Playlist attributes
|
||||||
var name: String? = null,
|
var name: String? = null,
|
||||||
var description: String? = null,
|
var description: String? = null,
|
||||||
var subscribers: Long? = -1,
|
var subscribers: Long? = -1,
|
||||||
var videos: Long? = -1,
|
var videos: Long? = -1,
|
||||||
var verified: Boolean? = null
|
var verified: Boolean? = null
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", "", 0, "", "", "", "", "", 0, 0, null)
|
|
||||||
}
|
|
||||||
|
@ -4,9 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Segment(
|
data class Segment(
|
||||||
val actionType: String?,
|
val actionType: String? = null,
|
||||||
val category: String?,
|
val category: String? = null,
|
||||||
val segment: List<Float>?
|
val segment: List<Float>? = arrayListOf()
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", arrayListOf())
|
|
||||||
}
|
|
@ -5,6 +5,4 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Segments(
|
data class Segments(
|
||||||
val segments: MutableList<Segment> = arrayListOf()
|
val segments: MutableList<Segment> = arrayListOf()
|
||||||
) {
|
)
|
||||||
constructor() : this(arrayListOf())
|
|
||||||
}
|
|
||||||
|
@ -4,18 +4,16 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class StreamItem(
|
data class StreamItem(
|
||||||
var url: String?,
|
var url: String? = null,
|
||||||
var title: String?,
|
var title: String? = null,
|
||||||
var thumbnail: String?,
|
var thumbnail: String? = null,
|
||||||
var uploaderName: String?,
|
var uploaderName: String? = null,
|
||||||
var uploaderUrl: String?,
|
var uploaderUrl: String? = null,
|
||||||
var uploaderAvatar: String?,
|
var uploaderAvatar: String? = null,
|
||||||
var uploadedDate: String?,
|
var uploadedDate: String? = null,
|
||||||
var duration: Long?,
|
var duration: Long? = null,
|
||||||
var views: Long?,
|
var views: Long? = null,
|
||||||
var uploaderVerified: Boolean?,
|
var uploaderVerified: Boolean? = null,
|
||||||
var uploaded: Long?,
|
var uploaded: Long? = null,
|
||||||
var shortDescription: String?
|
var shortDescription: String? = null
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", "", "", "", "", "", 0, 0, null, 0, "")
|
|
||||||
}
|
|
@ -4,11 +4,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Subtitle(
|
data class Subtitle(
|
||||||
val url: String?,
|
val url: String? = null,
|
||||||
val mimeType: String?,
|
val mimeType: String? = null,
|
||||||
val name: String?,
|
val name: String? = null,
|
||||||
val code: String?,
|
val code: String? = null,
|
||||||
val autoGenerated: Boolean?
|
val autoGenerated: Boolean? = null
|
||||||
) {
|
)
|
||||||
constructor() : this("", "", "", "", null)
|
|
||||||
}
|
|
@ -1,12 +1,12 @@
|
|||||||
package com.github.libretube.obj
|
package com.github.libretube.obj
|
||||||
|
|
||||||
data class WatchHistoryItem(
|
data class WatchHistoryItem(
|
||||||
val videoId: String?,
|
val videoId: String? = null,
|
||||||
val title: String?,
|
val title: String? = null,
|
||||||
val uploadDate: String?,
|
val uploadDate: String? = null,
|
||||||
val uploader: String?,
|
val uploader: String? = null,
|
||||||
val uploaderUrl: String?,
|
val uploaderUrl: String? = null,
|
||||||
val uploaderAvatar: String?,
|
val uploaderAvatar: String? = null,
|
||||||
val thumbnailUrl: String?,
|
val thumbnailUrl: String? = null,
|
||||||
val duration: Int?
|
val duration: Int? = null
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.libretube.obj
|
package com.github.libretube.obj
|
||||||
|
|
||||||
data class WatchPosition(
|
data class WatchPosition(
|
||||||
val videoId: String,
|
val videoId: String = "",
|
||||||
val position: Long
|
val position: Long = 0L
|
||||||
)
|
)
|
||||||
|
@ -114,17 +114,41 @@ object PreferenceHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getHistory(): List<String> {
|
fun getSearchHistory(): List<String> {
|
||||||
return try {
|
return try {
|
||||||
val set: Set<String> = settings.getStringSet("search_history", HashSet())!!
|
val set: Set<String> = settings.getStringSet("search_history", LinkedHashSet())!!
|
||||||
set.toList()
|
set.toList()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveHistory(historyList: List<String>) {
|
fun saveToSearchHistory(query: String) {
|
||||||
val set: Set<String> = HashSet(historyList)
|
var historyList = getSearchHistory().toMutableList()
|
||||||
|
|
||||||
|
if ((historyList.contains(query))) {
|
||||||
|
// remove from history list if already contained
|
||||||
|
historyList -= query
|
||||||
|
}
|
||||||
|
|
||||||
|
// append new query to history
|
||||||
|
historyList.add(0, query)
|
||||||
|
|
||||||
|
if (historyList.size > 10) {
|
||||||
|
historyList.removeAt(historyList.size - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSearchHistory(historyList)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeFromSearchHistory(query: String) {
|
||||||
|
val historyList = getSearchHistory().toMutableList()
|
||||||
|
historyList -= query
|
||||||
|
updateSearchHistory(historyList)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateSearchHistory(historyList: List<String>) {
|
||||||
|
val set: Set<String> = LinkedHashSet(historyList)
|
||||||
editor.putStringSet("search_history", set).apply()
|
editor.putStringSet("search_history", set).apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,17 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Asset(
|
data class Asset(
|
||||||
val browser_download_url: String,
|
val browser_download_url: String? = null,
|
||||||
val content_type: String,
|
val content_type: String? = null,
|
||||||
val created_at: String,
|
val created_at: String? = null,
|
||||||
val download_count: Int,
|
val download_count: Int? = null,
|
||||||
val id: Int,
|
val id: Int? = null,
|
||||||
val label: Any,
|
val label: Any? = null,
|
||||||
val name: String,
|
val name: String? = null,
|
||||||
val node_id: String,
|
val node_id: String? = null,
|
||||||
val size: Int,
|
val size: Int? = null,
|
||||||
val state: String,
|
val state: String? = null,
|
||||||
val updated_at: String,
|
val updated_at: String? = null,
|
||||||
val uploader: Uploader,
|
val uploader: Uploader? = null,
|
||||||
val url: String
|
val url: String? = null
|
||||||
)
|
)
|
||||||
|
@ -4,22 +4,22 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Author(
|
data class Author(
|
||||||
val avatar_url: String,
|
val avatar_url: String? = null,
|
||||||
val events_url: String,
|
val events_url: String? = null,
|
||||||
val followers_url: String,
|
val followers_url: String? = null,
|
||||||
val following_url: String,
|
val following_url: String? = null,
|
||||||
val gists_url: String,
|
val gists_url: String? = null,
|
||||||
val gravatar_id: String,
|
val gravatar_id: String? = null,
|
||||||
val html_url: String,
|
val html_url: String? = null,
|
||||||
val id: Int,
|
val id: Int? = null,
|
||||||
val login: String,
|
val login: String? = null,
|
||||||
val node_id: String,
|
val node_id: String? = null,
|
||||||
val organizations_url: String,
|
val organizations_url: String? = null,
|
||||||
val received_events_url: String,
|
val received_events_url: String? = null,
|
||||||
val repos_url: String,
|
val repos_url: String? = null,
|
||||||
val site_admin: Boolean,
|
val site_admin: Boolean? = null,
|
||||||
val starred_url: String,
|
val starred_url: String? = null,
|
||||||
val subscriptions_url: String,
|
val subscriptions_url: String? = null,
|
||||||
val type: String,
|
val type: String? = null,
|
||||||
val url: String
|
val url: String? = null
|
||||||
)
|
)
|
||||||
|
@ -4,12 +4,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Reactions(
|
data class Reactions(
|
||||||
val confused: Int,
|
val confused: Int? = null,
|
||||||
val eyes: Int,
|
val eyes: Int? = null,
|
||||||
val heart: Int,
|
val heart: Int? = null,
|
||||||
val hooray: Int,
|
val hooray: Int? = null,
|
||||||
val laugh: Int,
|
val laugh: Int? = null,
|
||||||
val rocket: Int,
|
val rocket: Int? = null,
|
||||||
val total_count: Int,
|
val total_count: Int? = null,
|
||||||
val url: String
|
val url: String? = null
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.libretube.update
|
package com.github.libretube.update
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.github.libretube.GITHUB_API_URL
|
import com.github.libretube.GITHUB_API_URL
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
@ -10,6 +11,7 @@ object UpdateChecker {
|
|||||||
// run http request as thread to make it async
|
// run http request as thread to make it async
|
||||||
val thread = Thread {
|
val thread = Thread {
|
||||||
// otherwise crashes without internet
|
// otherwise crashes without internet
|
||||||
|
versionInfo = getUpdateInfo()
|
||||||
try {
|
try {
|
||||||
versionInfo = getUpdateInfo()
|
versionInfo = getUpdateInfo()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -4,24 +4,24 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class UpdateInfo(
|
data class UpdateInfo(
|
||||||
val assets: List<Asset>,
|
val assets: List<Asset>? = null,
|
||||||
val assets_url: String,
|
val assets_url: String? = null,
|
||||||
val author: Author,
|
val author: Author? = null,
|
||||||
val body: String,
|
val body: String? = null,
|
||||||
val created_at: String,
|
val created_at: String? = null,
|
||||||
val draft: Boolean,
|
val draft: Boolean? = null,
|
||||||
val html_url: String,
|
val html_url: String? = null,
|
||||||
val id: Int,
|
val id: Int? = null,
|
||||||
val mentions_count: Int,
|
val mentions_count: Int? = null,
|
||||||
val name: String,
|
val name: String? = null,
|
||||||
val node_id: String,
|
val node_id: String? = null,
|
||||||
val prerelease: Boolean,
|
val prerelease: Boolean? = null,
|
||||||
val published_at: String,
|
val published_at: String? = null,
|
||||||
val reactions: Reactions,
|
val reactions: Reactions? = null,
|
||||||
val tag_name: String,
|
val tag_name: String? = null,
|
||||||
val tarball_url: String,
|
val tarball_url: String? = null,
|
||||||
val target_commitish: String,
|
val target_commitish: String? = null,
|
||||||
val upload_url: String,
|
val upload_url: String? = null,
|
||||||
val url: String,
|
val url: String? = null,
|
||||||
val zipball_url: String
|
val zipball_url: String? = null
|
||||||
)
|
)
|
||||||
|
@ -4,22 +4,22 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class Uploader(
|
data class Uploader(
|
||||||
val avatar_url: String,
|
val avatar_url: String? = null,
|
||||||
val events_url: String,
|
val events_url: String? = null,
|
||||||
val followers_url: String,
|
val followers_url: String? = null,
|
||||||
val following_url: String,
|
val following_url: String? = null,
|
||||||
val gists_url: String,
|
val gists_url: String? = null,
|
||||||
val gravatar_id: String,
|
val gravatar_id: String? = null,
|
||||||
val html_url: String,
|
val html_url: String? = null,
|
||||||
val id: Int,
|
val id: Int? = null,
|
||||||
val login: String,
|
val login: String? = null,
|
||||||
val node_id: String,
|
val node_id: String? = null,
|
||||||
val organizations_url: String,
|
val organizations_url: String? = null,
|
||||||
val received_events_url: String,
|
val received_events_url: String? = null,
|
||||||
val repos_url: String,
|
val repos_url: String? = null,
|
||||||
val site_admin: Boolean,
|
val site_admin: Boolean? = null,
|
||||||
val starred_url: String,
|
val starred_url: String? = null,
|
||||||
val subscriptions_url: String,
|
val subscriptions_url: String? = null,
|
||||||
val type: String,
|
val type: String? = null,
|
||||||
val url: String
|
val url: String? = null
|
||||||
)
|
)
|
||||||
|
@ -4,11 +4,6 @@ import android.app.Activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
|
|
||||||
fun Fragment.hideKeyboard() {
|
|
||||||
view?.let { activity?.hideKeyboard(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Context.hideKeyboard(view: View) {
|
fun Context.hideKeyboard(view: View) {
|
||||||
val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
|
Loading…
x
Reference in New Issue
Block a user