Cleanup & Pruning legacy code
This commit is contained in:
@@ -46,7 +46,10 @@ fun LabelBillsScreen(
|
||||
title = { Text(stringResource(R.string.title_label_bills)) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null)
|
||||
Icon(
|
||||
Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = stringResource(R.string.simple_back)
|
||||
)
|
||||
}
|
||||
},
|
||||
backgroundColor = MaterialTheme.colors.primary,
|
||||
|
||||
@@ -61,11 +61,7 @@ fun ColorPicker(
|
||||
var chroma by remember { mutableFloatStateOf(initialLch[1]) }
|
||||
var hue by remember { mutableFloatStateOf(initialLch[2]) }
|
||||
|
||||
val currentColorInt = remember(lightness, chroma, hue) {
|
||||
val color = mLCHtoRBG(lightness,chroma,hue)
|
||||
onColorChanged(color)
|
||||
color
|
||||
}
|
||||
val currentColorInt = remember(lightness, chroma, hue) { mLCHtoRBG(lightness, chroma, hue) }
|
||||
|
||||
val currentColor = Color(currentColorInt)
|
||||
|
||||
@@ -74,8 +70,9 @@ fun ColorPicker(
|
||||
var isHexValid by remember { mutableStateOf(true) }
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
|
||||
// Sync HEX with LCH
|
||||
// Report the colour, and keep the HEX field in step with the LCH sliders.
|
||||
LaunchedEffect(currentColorInt) {
|
||||
onColorChanged(currentColorInt)
|
||||
val newHex = "%06X".format(0xFFFFFF and currentColorInt)
|
||||
if (hexText.uppercase() != newHex) {
|
||||
hexText = newHex
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.helcel.cowspent.android.label
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
@@ -275,6 +276,14 @@ fun LabelItem(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Split into a window and its content, the same way MemberEditDialogContent is.
|
||||
*
|
||||
* A Compose text field inside a Material AlertDialog never reaches idle under Robolectric: the
|
||||
* composition spins in measure/layout until Espresso gives up 60s later, having exhausted the
|
||||
* test heap and taken every later test class in that worker with it. A plain Dialog holding a
|
||||
* Surface behaves, so the dialog body lives there instead - which is also what makes it testable.
|
||||
*/
|
||||
@Composable
|
||||
fun EditLabelDialog(
|
||||
title: String,
|
||||
@@ -283,15 +292,33 @@ fun EditLabelDialog(
|
||||
initialColor: String,
|
||||
onDismiss: () -> Unit,
|
||||
onSave: (String, String, String) -> Unit
|
||||
) {
|
||||
Dialog(onDismissRequest = onDismiss) {
|
||||
EditLabelDialogContent(title, initialName, initialIcon, initialColor, onDismiss, onSave)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EditLabelDialogContent(
|
||||
title: String,
|
||||
initialName: String,
|
||||
initialIcon: String,
|
||||
initialColor: String,
|
||||
onDismiss: () -> Unit,
|
||||
onSave: (String, String, String) -> Unit
|
||||
) {
|
||||
var name by remember { mutableStateOf(initialName) }
|
||||
var icon by remember { mutableStateOf(initialIcon) }
|
||||
var color by remember { mutableStateOf(initialColor) }
|
||||
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(title) },
|
||||
text = {
|
||||
Surface(
|
||||
shape = MaterialTheme.shapes.medium,
|
||||
color = MaterialTheme.colors.surface,
|
||||
contentColor = contentColorFor(MaterialTheme.colors.surface)
|
||||
) {
|
||||
Column(modifier = Modifier.padding(24.dp)) {
|
||||
Text(title, style = MaterialTheme.typography.h6)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
|
||||
OutlinedTextField(
|
||||
value = name,
|
||||
@@ -315,21 +342,25 @@ fun EditLabelDialog(
|
||||
onColorChanged = { color = String.format("#%06X", 0xFFFFFF and it) }
|
||||
)
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
TextButton(onClick = onDismiss) {
|
||||
Text(stringResource(R.string.simple_cancel))
|
||||
}
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Button(
|
||||
onClick = { onSave(name, icon, color) },
|
||||
enabled = name.isNotBlank()
|
||||
) {
|
||||
Text(stringResource(R.string.action_save))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = onDismiss) {
|
||||
Text(stringResource(R.string.simple_cancel))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun parseColor(colorString: String): Color {
|
||||
|
||||
@@ -17,8 +17,6 @@ object MainConstants {
|
||||
const val BROADCAST_AVATAR_UPDATED = "net.helcel.cowspent.broadcast.avatar_updated"
|
||||
const val BROADCAST_AVATAR_UPDATED_MEMBER = "net.helcel.cowspent.broadcast.avatar_updated_for_member"
|
||||
|
||||
const val MAIN_CHANNEL_ID = 1234567890
|
||||
|
||||
const val PARAM_DIALOG_CONTENT = "net.helcel.cowspent.PARAM_DIALOG_CONTENT"
|
||||
const val PARAM_PROJECT_TO_SELECT = "net.helcel.cowspent.PARAM_PROJECT_TO_SELECT"
|
||||
|
||||
|
||||
@@ -10,10 +10,8 @@ import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.PreferenceManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import net.helcel.cowspent.R
|
||||
@@ -57,9 +55,6 @@ class NewProjectActivity : AppCompatActivity() {
|
||||
.setAction(Intent.ACTION_GET_CONTENT)
|
||||
importFileLauncher.launch(Intent.createChooser(intent, "Select a file"))
|
||||
},
|
||||
onChooseFromNextcloud = {
|
||||
chooseFromNextcloud()
|
||||
},
|
||||
onOkPressed = { onPressOk() },
|
||||
onBack = { finish() },
|
||||
onFieldsChanged = { updateAuthStatus() }
|
||||
@@ -130,19 +125,6 @@ class NewProjectActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun chooseFromNextcloud() {
|
||||
lifecycleScope.launch {
|
||||
val accountProjects = withContext(Dispatchers.IO) { db.accountProjects }
|
||||
if (accountProjects.isEmpty()) {
|
||||
showToast(getString(R.string.choose_account_project_dialog_impossible), Toast.LENGTH_LONG)
|
||||
return@launch
|
||||
}
|
||||
|
||||
viewModel.nextcloudProjects = accountProjects
|
||||
viewModel.showNextcloudProjectDialog = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateAuthStatus() {
|
||||
val url = getFormattedUrl()
|
||||
val fakeProj = DBProject(
|
||||
@@ -154,19 +136,7 @@ class NewProjectActivity : AppCompatActivity() {
|
||||
viewModel.isAuthenticatedAccount = db.cowspentServerSyncHelper.canCreateAuthenticatedProject(fakeProj)
|
||||
}
|
||||
|
||||
private fun onPressOk() {
|
||||
val type = viewModel.projectType
|
||||
val todoCreate = viewModel.whatTodoIsCreate
|
||||
val url = getFormattedUrl()
|
||||
|
||||
val fakeProj = DBProject(
|
||||
0, "", "", "", url,
|
||||
"", 0L, type, 0L,
|
||||
null, false, DBProject.ACCESS_LEVEL_UNKNOWN,
|
||||
""
|
||||
)
|
||||
createProject()
|
||||
}
|
||||
private fun onPressOk() = createProject()
|
||||
|
||||
private fun getFormattedUrl(): String {
|
||||
var url = viewModel.projectUrl.trim()
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.helcel.cowspent.android.project.create
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.selection.selectable
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
@@ -31,7 +30,6 @@ fun NewProjectScreen(
|
||||
viewModel: NewProjectViewModel,
|
||||
onScanQrCode: () -> Unit,
|
||||
onImportFile: () -> Unit,
|
||||
onChooseFromNextcloud: () -> Unit,
|
||||
onOkPressed: () -> Unit,
|
||||
onBack: () -> Unit,
|
||||
onFieldsChanged: () -> Unit
|
||||
@@ -224,40 +222,6 @@ fun NewProjectScreen(
|
||||
)
|
||||
}
|
||||
|
||||
if (viewModel.showNextcloudProjectDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { viewModel.showNextcloudProjectDialog = false },
|
||||
title = { Text(stringResource(R.string.choose_account_project_dialog_title)) },
|
||||
text = {
|
||||
Column {
|
||||
viewModel.nextcloudProjects.forEach { project ->
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.selectable(
|
||||
selected = false,
|
||||
onClick = {
|
||||
viewModel.projectId = project.remoteId
|
||||
viewModel.projectUrl = project.ncUrl
|
||||
viewModel.showNextcloudProjectDialog = false
|
||||
}
|
||||
)
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Text(text = project.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = {},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { viewModel.showNextcloudProjectDialog = false }) {
|
||||
Text(stringResource(R.string.simple_cancel))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (viewModel.isCreatingRemoteProject) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { },
|
||||
@@ -337,7 +301,6 @@ fun NewProjectScreenPreview() {
|
||||
},
|
||||
onScanQrCode = {},
|
||||
onImportFile = {},
|
||||
onChooseFromNextcloud = {},
|
||||
onOkPressed = {},
|
||||
onBack = {},
|
||||
onFieldsChanged = {}
|
||||
|
||||
@@ -5,7 +5,6 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.ViewModel
|
||||
import net.helcel.cowspent.model.DBAccountProject
|
||||
import net.helcel.cowspent.model.ProjectType
|
||||
|
||||
class NewProjectViewModel : ViewModel() {
|
||||
@@ -33,8 +32,6 @@ class NewProjectViewModel : ViewModel() {
|
||||
var isAuthenticatedAccount by mutableStateOf(false)
|
||||
|
||||
var showAuthWarningDialog by mutableStateOf(false)
|
||||
var showNextcloudProjectDialog by mutableStateOf(false)
|
||||
var nextcloudProjects by mutableStateOf<List<DBAccountProject>>(emptyList())
|
||||
|
||||
var isCreatingRemoteProject by mutableStateOf(false)
|
||||
var errorDialogMessage by mutableStateOf<String?>(null)
|
||||
|
||||
@@ -12,7 +12,6 @@ enum class ProjectType(val id: String) {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getTypeById(id: String?): ProjectType? {
|
||||
return reverseMap[id]
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package net.helcel.cowspent.persistence
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ServiceConnection
|
||||
import android.content.SharedPreferences
|
||||
import android.net.ConnectivityManager
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.core.content.edit
|
||||
@@ -50,24 +47,6 @@ class CowspentServerSyncHelper private constructor(private val dbHelper: Cowspen
|
||||
private val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(dbHelper.context)
|
||||
private var networkConnected = false
|
||||
|
||||
private val certService = object : ServiceConnection {
|
||||
override fun onServiceConnected(componentName: ComponentName, iBinder: IBinder) {
|
||||
if (isSyncPossible) {
|
||||
val lastId = PreferenceManager.getDefaultSharedPreferences(dbHelper.context).getLong("selected_project", 0)
|
||||
if (lastId != 0L) {
|
||||
val proj = dbHelper.getProject(lastId)
|
||||
if (proj != null) {
|
||||
appContext.sendBroadcast(Intent(MainConstants.BROADCAST_SYNC_PROJECT))
|
||||
appContext.sendBroadcast(Intent(MainConstants.BROADCAST_NETWORK_AVAILABLE))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onServiceDisconnected(p0: ComponentName?) {
|
||||
}
|
||||
}
|
||||
|
||||
private var syncActive = false
|
||||
private var syncAccountProjectsActive = false
|
||||
|
||||
@@ -79,11 +58,6 @@ class CowspentServerSyncHelper private constructor(private val dbHelper: Cowspen
|
||||
updateNetworkStatus()
|
||||
}
|
||||
|
||||
@Throws(Throwable::class)
|
||||
protected fun finalize() {
|
||||
appContext.unbindService(certService)
|
||||
}
|
||||
|
||||
val isSyncPossible: Boolean
|
||||
get() {
|
||||
updateNetworkStatus()
|
||||
|
||||
@@ -12,15 +12,10 @@ import net.helcel.cowspent.model.DBProject
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.xml.sax.SAXException
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import javax.xml.parsers.ParserConfigurationException
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,6 +36,10 @@ open class ServerResponse(
|
||||
val lastModified: Long
|
||||
get() = response.lastModified
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@Throws(JSONException::class)
|
||||
fun getResponseObjectData(): JSONObject {
|
||||
val rawData = JSONObject(content)
|
||||
@@ -125,10 +124,6 @@ open class ServerResponse(
|
||||
private val isJsonMember: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val remoteMemberId: Long
|
||||
get() = if (isJsonMember)
|
||||
@@ -142,10 +137,6 @@ open class ServerResponse(
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val remoteCategoryId: Long
|
||||
get() {
|
||||
@@ -162,32 +153,18 @@ open class ServerResponse(
|
||||
class EditRemoteCategoryResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class DeleteRemoteCategoryResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class CreateRemotePaymentModeResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val remotePaymentModeId: Long
|
||||
get() {
|
||||
@@ -204,32 +181,18 @@ open class ServerResponse(
|
||||
class EditRemotePaymentModeResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class DeleteRemotePaymentModeResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class CreateRemoteCurrencyResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val remoteCurrencyId: Long
|
||||
get() {
|
||||
@@ -246,32 +209,17 @@ open class ServerResponse(
|
||||
class EditRemoteCurrencyResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class DeleteRemoteCurrencyResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class EditRemoteProjectResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class EditRemoteMemberResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
@@ -289,10 +237,6 @@ open class ServerResponse(
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val remoteBillId: Long
|
||||
get() {
|
||||
@@ -311,10 +255,6 @@ open class ServerResponse(
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val remoteBillId: Long
|
||||
get() {
|
||||
@@ -331,32 +271,17 @@ open class ServerResponse(
|
||||
class DeleteRemoteBillResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class DeleteRemoteProjectResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class CreateRemoteProjectResponse(
|
||||
response: VersatileProjectSyncClient.ResponseData,
|
||||
isOcsResponse: Boolean
|
||||
) : ServerResponse(response, isOcsResponse) {
|
||||
|
||||
@get:Throws(JSONException::class)
|
||||
val stringContent: String
|
||||
get() = getResponseStringData()
|
||||
}
|
||||
) : ServerResponse(response, isOcsResponse)
|
||||
|
||||
class BillsResponse(response: VersatileProjectSyncClient.ResponseData, isOcsResponse: Boolean) :
|
||||
ServerResponse(response, isOcsResponse) {
|
||||
@@ -457,17 +382,6 @@ open class ServerResponse(
|
||||
get() = content
|
||||
}
|
||||
|
||||
@Throws(JSONException::class)
|
||||
protected fun getPublicTokenFromJSON(json: JSONObject): String? {
|
||||
if (json.has("code") && json.has("sharetoken")) {
|
||||
val done = json.getInt("code")
|
||||
val publicToken = json.getString("sharetoken")
|
||||
if (done == 1) {
|
||||
return publicToken
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
@Throws(JSONException::class)
|
||||
protected fun getNameFromJSON(json: JSONObject): String {
|
||||
@@ -937,6 +851,8 @@ open class ServerResponse(
|
||||
remoteId = json.getString("id")
|
||||
}
|
||||
if (!json.isNull("ncurl")) {
|
||||
ncUrl = json.getString("ncurl")
|
||||
} else if (!json.isNull("ncUrl")) {
|
||||
ncUrl = json.getString("ncUrl")
|
||||
}
|
||||
val archivedTs: Long? = getArchivedTsFromJSON(json)
|
||||
@@ -946,26 +862,6 @@ open class ServerResponse(
|
||||
return DBAccountProject(0, remoteId, null, name, ncUrl, archivedTs)
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
protected fun getColorFromContent(content: String): String? {
|
||||
var result: String? = null
|
||||
try {
|
||||
val dbf = DocumentBuilderFactory.newInstance()
|
||||
val db = dbf.newDocumentBuilder()
|
||||
val stream: InputStream = ByteArrayInputStream(content.toByteArray())
|
||||
val doc = db.parse(stream)
|
||||
doc.documentElement.normalize()
|
||||
// Locate the Tag Name
|
||||
val nodeList = doc.getElementsByTagName("color")
|
||||
if (nodeList.length > 0) {
|
||||
result = nodeList.item(0).textContent
|
||||
Log.i(TAG, "I GOT THE COLOR from server: $result")
|
||||
}
|
||||
} catch (_: ParserConfigurationException) {
|
||||
} catch (_: SAXException) {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
protected fun getColorFromJsonContent(json: JSONObject): String? {
|
||||
return try {
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -194,8 +194,6 @@
|
||||
<string name="todo_join">Bestehendem Projekt beitreten</string>
|
||||
<string name="todo_create">Neues Projekt erstellen</string>
|
||||
<string name="import_tooltip">Aus Datei importieren</string>
|
||||
<string name="choose_account_project_dialog_title">Projekt auswählen</string>
|
||||
<string name="choose_account_project_dialog_impossible">Keine Projekte auf diesem Konto gefunden.</string>
|
||||
<string name="choose_project_management_action">Projekt</string>
|
||||
<string name="project_added_success">Projekt erfolgreich hinzugefügt.</string>
|
||||
<string name="no_projects_text">Du hast noch keine Projekte.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -195,8 +195,6 @@
|
||||
<string name="todo_join">Unirse a un proyecto existente</string>
|
||||
<string name="todo_create">Crear un proyecto nuevo</string>
|
||||
<string name="import_tooltip">Importar desde un archivo</string>
|
||||
<string name="choose_account_project_dialog_title">Elegir un proyecto</string>
|
||||
<string name="choose_account_project_dialog_impossible">No se encontraron proyectos en esta cuenta.</string>
|
||||
<string name="choose_project_management_action">Proyecto</string>
|
||||
<string name="project_added_success">Proyecto añadido correctamente.</string>
|
||||
<string name="no_projects_text">Aún no tienes proyectos.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -198,8 +198,6 @@
|
||||
<string name="todo_join">Rejoindre un projet existant</string>
|
||||
<string name="todo_create">Créer un nouveau projet</string>
|
||||
<string name="import_tooltip">Importer depuis un fichier</string>
|
||||
<string name="choose_account_project_dialog_title">Choisir un projet</string>
|
||||
<string name="choose_account_project_dialog_impossible">Aucun projet trouvé sur ce compte.</string>
|
||||
<string name="choose_project_management_action">Projet</string>
|
||||
<string name="project_added_success">Le projet a été ajouté avec succès.</string>
|
||||
<string name="no_projects_text">Vous n\'avez pas encore de projet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -202,8 +202,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
@@ -218,8 +218,6 @@
|
||||
<string name="todo_join">Join existing project</string>
|
||||
<string name="todo_create">Create new project</string>
|
||||
<string name="import_tooltip">Import from file</string>
|
||||
<string name="choose_account_project_dialog_title">Choose project</string>
|
||||
<string name="choose_account_project_dialog_impossible">No projects found on this account.</string>
|
||||
<string name="choose_project_management_action">Project</string>
|
||||
<string name="project_added_success">Project added successfully.</string>
|
||||
<string name="no_projects_text">You have no projects yet.</string>
|
||||
|
||||
Reference in New Issue
Block a user