newpipe/error: fix warnings after kotlin conversion
This commit is contained in:
parent
78de1a0bed
commit
726cdebcd3
|
@ -40,6 +40,5 @@ class AcraReportSender : ReportSender {
|
||||||
R.string.app_ui_crash
|
R.string.app_ui_crash
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,19 +79,19 @@ class ErrorActivity : AppCompatActivity() {
|
||||||
// important add guru meditation
|
// important add guru meditation
|
||||||
addGuruMeditation()
|
addGuruMeditation()
|
||||||
currentTimeStamp = CURRENT_TIMESTAMP_FORMATTER.format(LocalDateTime.now())
|
currentTimeStamp = CURRENT_TIMESTAMP_FORMATTER.format(LocalDateTime.now())
|
||||||
activityErrorBinding!!.errorReportEmailButton.setOnClickListener { v: View? ->
|
activityErrorBinding!!.errorReportEmailButton.setOnClickListener { _: View? ->
|
||||||
openPrivacyPolicyDialog(
|
openPrivacyPolicyDialog(
|
||||||
this,
|
this,
|
||||||
"EMAIL"
|
"EMAIL"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
activityErrorBinding!!.errorReportCopyButton.setOnClickListener { v: View? ->
|
activityErrorBinding!!.errorReportCopyButton.setOnClickListener { _: View? ->
|
||||||
ShareUtils.copyToClipboard(
|
ShareUtils.copyToClipboard(
|
||||||
this,
|
this,
|
||||||
buildMarkdown()
|
buildMarkdown()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
activityErrorBinding!!.errorReportGitHubButton.setOnClickListener { v: View? ->
|
activityErrorBinding!!.errorReportGitHubButton.setOnClickListener { _: View? ->
|
||||||
openPrivacyPolicyDialog(
|
openPrivacyPolicyDialog(
|
||||||
this,
|
this,
|
||||||
"GITHUB"
|
"GITHUB"
|
||||||
|
@ -140,13 +140,13 @@ class ErrorActivity : AppCompatActivity() {
|
||||||
.setTitle(R.string.privacy_policy_title)
|
.setTitle(R.string.privacy_policy_title)
|
||||||
.setMessage(R.string.start_accept_privacy_policy)
|
.setMessage(R.string.start_accept_privacy_policy)
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.setNeutralButton(R.string.read_privacy_policy) { dialog: DialogInterface?, which: Int ->
|
.setNeutralButton(R.string.read_privacy_policy) { _: DialogInterface?, _: Int ->
|
||||||
ShareUtils.openUrlInApp(
|
ShareUtils.openUrlInApp(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.privacy_policy_url)
|
context.getString(R.string.privacy_policy_url)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.setPositiveButton(R.string.accept) { dialog: DialogInterface?, which: Int ->
|
.setPositiveButton(R.string.accept) { _: DialogInterface?, _: Int ->
|
||||||
if (action == "EMAIL") { // send on email
|
if (action == "EMAIL") { // send on email
|
||||||
val i = Intent(Intent.ACTION_SENDTO)
|
val i = Intent(Intent.ACTION_SENDTO)
|
||||||
.setData(Uri.parse("mailto:")) // only email apps should handle this
|
.setData(Uri.parse("mailto:")) // only email apps should handle this
|
||||||
|
@ -218,7 +218,7 @@ class ErrorActivity : AppCompatActivity() {
|
||||||
.value("version", BuildConfig.VERSION_NAME)
|
.value("version", BuildConfig.VERSION_NAME)
|
||||||
.value("os", osString)
|
.value("os", osString)
|
||||||
.value("time", currentTimeStamp)
|
.value("time", currentTimeStamp)
|
||||||
.array("exceptions", Arrays.asList(*errorInfo!!.stackTraces))
|
.array("exceptions", listOf(*errorInfo!!.stackTraces))
|
||||||
.value(
|
.value(
|
||||||
"user_comment",
|
"user_comment",
|
||||||
activityErrorBinding!!.errorCommentBox.text
|
activityErrorBinding!!.errorCommentBox.text
|
||||||
|
@ -237,7 +237,7 @@ class ErrorActivity : AppCompatActivity() {
|
||||||
return try {
|
return try {
|
||||||
val htmlErrorReport = StringBuilder()
|
val htmlErrorReport = StringBuilder()
|
||||||
val userComment = activityErrorBinding!!.errorCommentBox.text.toString()
|
val userComment = activityErrorBinding!!.errorCommentBox.text.toString()
|
||||||
if (!userComment.isEmpty()) {
|
if (userComment.isNotEmpty()) {
|
||||||
htmlErrorReport.append(userComment).append("\n")
|
htmlErrorReport.append(userComment).append("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,27 +288,23 @@ class ErrorActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getUserActionString(userAction: UserAction?): String? {
|
private fun getUserActionString(userAction: UserAction?): String {
|
||||||
return if (userAction == null) {
|
return userAction?.message ?: "Your description is in another castle."
|
||||||
"Your description is in another castle."
|
|
||||||
} else {
|
|
||||||
userAction.message
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val contentCountryString: String
|
private val contentCountryString: String
|
||||||
private get() = Localization.getPreferredContentCountry(this).countryCode
|
get() = Localization.getPreferredContentCountry(this).countryCode
|
||||||
private val contentLanguageString: String
|
private val contentLanguageString: String
|
||||||
private get() = Localization.getPreferredLocalization(this).localizationCode
|
get() = Localization.getPreferredLocalization(this).localizationCode
|
||||||
private val appLanguage: String
|
private val appLanguage: String
|
||||||
private get() = Localization.getAppLocale(applicationContext).toString()
|
get() = Localization.getAppLocale(applicationContext).toString()
|
||||||
private val osString: String
|
private val osString: String
|
||||||
private get() {
|
get() {
|
||||||
val osBase =
|
val osBase =
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) Build.VERSION.BASE_OS else "Android"
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) Build.VERSION.BASE_OS else "Android"
|
||||||
return (
|
return (
|
||||||
System.getProperty("os.name") +
|
(System.getProperty("os.name") ?: "unknown operating system (os.name not set)") +
|
||||||
" " + (if (osBase.isEmpty()) "Android" else osBase) +
|
" " + (osBase.ifEmpty { "Android" }) +
|
||||||
" " + Build.VERSION.RELEASE +
|
" " + Build.VERSION.RELEASE +
|
||||||
" - " + Build.VERSION.SDK_INT
|
" - " + Build.VERSION.SDK_INT
|
||||||
)
|
)
|
||||||
|
@ -333,7 +329,7 @@ class ErrorActivity : AppCompatActivity() {
|
||||||
const val ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org"
|
const val ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org"
|
||||||
const val ERROR_EMAIL_SUBJECT = "Exception in "
|
const val ERROR_EMAIL_SUBJECT = "Exception in "
|
||||||
const val ERROR_GITHUB_ISSUE_URL = "https://github.com/TeamNewPipe/NewPipe/issues"
|
const val ERROR_GITHUB_ISSUE_URL = "https://github.com/TeamNewPipe/NewPipe/issues"
|
||||||
val CURRENT_TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
|
val CURRENT_TIMESTAMP_FORMATTER: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the checked activity.
|
* Get the checked activity.
|
||||||
|
|
|
@ -150,7 +150,7 @@ class ErrorPanelHelper(
|
||||||
errorActionButton.setOnClickListener(listener)
|
errorActionButton.setOnClickListener(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showAndSetOpenInBrowserButtonAction(
|
private fun showAndSetOpenInBrowserButtonAction(
|
||||||
errorInfo: ErrorInfo
|
errorInfo: ErrorInfo
|
||||||
) {
|
) {
|
||||||
errorOpenInBrowserButton.isVisible = true
|
errorOpenInBrowserButton.isVisible = true
|
||||||
|
|
|
@ -96,6 +96,7 @@ class ReCaptchaActivity : AppCompatActivity() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Deprecated in Java")
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
saveCookiesAndFinish()
|
saveCookiesAndFinish()
|
||||||
}
|
}
|
||||||
|
@ -114,7 +115,7 @@ class ReCaptchaActivity : AppCompatActivity() {
|
||||||
if (MainActivity.DEBUG) {
|
if (MainActivity.DEBUG) {
|
||||||
Log.d(TAG, "saveCookiesAndFinish: foundCookies=$foundCookies")
|
Log.d(TAG, "saveCookiesAndFinish: foundCookies=$foundCookies")
|
||||||
}
|
}
|
||||||
if (!foundCookies.isEmpty()) {
|
if (foundCookies.isNotEmpty()) {
|
||||||
// save cookies to preferences
|
// save cookies to preferences
|
||||||
val prefs = PreferenceManager.getDefaultSharedPreferences(
|
val prefs = PreferenceManager.getDefaultSharedPreferences(
|
||||||
applicationContext
|
applicationContext
|
||||||
|
|
Loading…
Reference in New Issue