mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-03 17:11:33 +03:00
Fix lintFormat + remove synchronized
This commit is contained in:
parent
1b7f48c53a
commit
070e0ac792
@ -365,7 +365,7 @@ public class Util
|
|||||||
* @param value Is true or false
|
* @param value Is true or false
|
||||||
* @return The corresponding mark.
|
* @return The corresponding mark.
|
||||||
*/
|
*/
|
||||||
public static synchronized String boolToMark(boolean value)
|
public static String boolToMark(boolean value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
return "✔️";
|
return "✔️";
|
||||||
|
@ -370,8 +370,7 @@ class NavigationActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setMenuForServerSetting() {
|
private fun setMenuForServerSetting() {
|
||||||
if (isOffline())
|
if (isOffline()) {
|
||||||
{
|
|
||||||
chatMenuItem?.isVisible = false
|
chatMenuItem?.isVisible = false
|
||||||
bookmarksMenuItem?.isVisible = false
|
bookmarksMenuItem?.isVisible = false
|
||||||
sharesMenuItem?.isVisible = false
|
sharesMenuItem?.isVisible = false
|
||||||
|
@ -27,9 +27,17 @@ val MIGRATION_1_2: Migration = object : Migration(1, 2) {
|
|||||||
|
|
||||||
val MIGRATION_2_3: Migration = object : Migration(2, 3) {
|
val MIGRATION_2_3: Migration = object : Migration(2, 3) {
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
database.execSQL("ALTER TABLE ServerSetting ADD COLUMN chatSupport INTEGER NOT NULL DEFAULT(1)")
|
database.execSQL(
|
||||||
database.execSQL("ALTER TABLE ServerSetting ADD COLUMN bookmarkSupport INTEGER NOT NULL DEFAULT(1)")
|
"ALTER TABLE ServerSetting ADD COLUMN chatSupport INTEGER NOT NULL DEFAULT(1)"
|
||||||
database.execSQL("ALTER TABLE ServerSetting ADD COLUMN shareSupport INTEGER NOT NULL DEFAULT(1)")
|
)
|
||||||
database.execSQL("ALTER TABLE ServerSetting ADD COLUMN podcastSupport INTEGER NOT NULL DEFAULT(1)")
|
database.execSQL(
|
||||||
|
"ALTER TABLE ServerSetting ADD COLUMN bookmarkSupport INTEGER NOT NULL DEFAULT(1)"
|
||||||
|
)
|
||||||
|
database.execSQL(
|
||||||
|
"ALTER TABLE ServerSetting ADD COLUMN shareSupport INTEGER NOT NULL DEFAULT(1)"
|
||||||
|
)
|
||||||
|
database.execSQL(
|
||||||
|
"ALTER TABLE ServerSetting ADD COLUMN podcastSupport INTEGER NOT NULL DEFAULT(1)"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,8 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
|
|||||||
@Throws(Throwable::class)
|
@Throws(Throwable::class)
|
||||||
override fun doInBackground(): String {
|
override fun doInBackground(): String {
|
||||||
|
|
||||||
var progressString = """
|
var progressString =
|
||||||
|
"""
|
||||||
|%s - ${activity.resources.getString(R.string.button_bar_chat)}
|
|%s - ${activity.resources.getString(R.string.button_bar_chat)}
|
||||||
|%s - ${activity.resources.getString(R.string.button_bar_bookmarks)}
|
|%s - ${activity.resources.getString(R.string.button_bar_bookmarks)}
|
||||||
|%s - ${activity.resources.getString(R.string.button_bar_shares)}
|
|%s - ${activity.resources.getString(R.string.button_bar_shares)}
|
||||||
@ -345,30 +346,42 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
|
|||||||
true
|
true
|
||||||
} catch (e: Throwable) { false }
|
} catch (e: Throwable) { false }
|
||||||
|
|
||||||
updateProgress(String.format(progressString,
|
updateProgress(
|
||||||
|
String.format(
|
||||||
|
progressString,
|
||||||
Util.boolToMark(currentServerSetting!!.chatSupport),
|
Util.boolToMark(currentServerSetting!!.chatSupport),
|
||||||
"⌛", "⌛", "⌛"))
|
"⌛", "⌛", "⌛"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
currentServerSetting!!.bookmarkSupport = try {
|
currentServerSetting!!.bookmarkSupport = try {
|
||||||
subsonicApiClient.api.getBookmarks().execute()
|
subsonicApiClient.api.getBookmarks().execute()
|
||||||
true
|
true
|
||||||
} catch (e: Throwable) { false }
|
} catch (e: Throwable) { false }
|
||||||
|
|
||||||
updateProgress(String.format(progressString,
|
updateProgress(
|
||||||
|
String.format(
|
||||||
|
progressString,
|
||||||
Util.boolToMark(currentServerSetting!!.chatSupport),
|
Util.boolToMark(currentServerSetting!!.chatSupport),
|
||||||
Util.boolToMark(currentServerSetting!!.bookmarkSupport),
|
Util.boolToMark(currentServerSetting!!.bookmarkSupport),
|
||||||
"⌛", "⌛"))
|
"⌛", "⌛"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
currentServerSetting!!.shareSupport = try {
|
currentServerSetting!!.shareSupport = try {
|
||||||
subsonicApiClient.api.getShares().execute()
|
subsonicApiClient.api.getShares().execute()
|
||||||
true
|
true
|
||||||
} catch (e: Throwable) { false }
|
} catch (e: Throwable) { false }
|
||||||
|
|
||||||
updateProgress(String.format(progressString,
|
updateProgress(
|
||||||
|
String.format(
|
||||||
|
progressString,
|
||||||
Util.boolToMark(currentServerSetting!!.chatSupport),
|
Util.boolToMark(currentServerSetting!!.chatSupport),
|
||||||
Util.boolToMark(currentServerSetting!!.bookmarkSupport),
|
Util.boolToMark(currentServerSetting!!.bookmarkSupport),
|
||||||
Util.boolToMark(currentServerSetting!!.shareSupport),
|
Util.boolToMark(currentServerSetting!!.shareSupport),
|
||||||
"⌛"))
|
"⌛"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
currentServerSetting!!.podcastSupport = try {
|
currentServerSetting!!.podcastSupport = try {
|
||||||
subsonicApiClient.api.getPodcasts().execute()
|
subsonicApiClient.api.getPodcasts().execute()
|
||||||
@ -376,17 +389,20 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
|
|||||||
} catch (e: Throwable) { false }
|
} catch (e: Throwable) { false }
|
||||||
|
|
||||||
// Finalize String before displaying it to Dialog
|
// Finalize String before displaying it to Dialog
|
||||||
progressString = String.format(progressString,
|
progressString = String.format(
|
||||||
|
progressString,
|
||||||
Util.boolToMark(currentServerSetting!!.chatSupport),
|
Util.boolToMark(currentServerSetting!!.chatSupport),
|
||||||
Util.boolToMark(currentServerSetting!!.bookmarkSupport),
|
Util.boolToMark(currentServerSetting!!.bookmarkSupport),
|
||||||
Util.boolToMark(currentServerSetting!!.shareSupport),
|
Util.boolToMark(currentServerSetting!!.shareSupport),
|
||||||
Util.boolToMark(currentServerSetting!!.podcastSupport))
|
Util.boolToMark(currentServerSetting!!.podcastSupport)
|
||||||
|
)
|
||||||
updateProgress(progressString)
|
updateProgress(progressString)
|
||||||
|
|
||||||
val licenseResponse = subsonicApiClient.api.getLicense().execute()
|
val licenseResponse = subsonicApiClient.api.getLicense().execute()
|
||||||
ApiCallResponseChecker.checkResponseSuccessful(licenseResponse)
|
ApiCallResponseChecker.checkResponseSuccessful(licenseResponse)
|
||||||
if (!licenseResponse.body()!!.license.valid) {
|
if (!licenseResponse.body()!!.license.valid) {
|
||||||
progressString += "\n${activity.resources.getString(R.string.settings_testing_unlicensed)}"
|
progressString += "\n" +
|
||||||
|
activity.resources.getString(R.string.settings_testing_unlicensed)
|
||||||
}
|
}
|
||||||
return progressString
|
return progressString
|
||||||
}
|
}
|
||||||
@ -396,7 +412,8 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
|
|||||||
activity,
|
activity,
|
||||||
android.R.drawable.ic_dialog_info,
|
android.R.drawable.ic_dialog_info,
|
||||||
R.string.settings_testing_ok,
|
R.string.settings_testing_ok,
|
||||||
responseString)
|
responseString
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun error(error: Throwable) {
|
override fun error(error: Throwable) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user