Reformat code

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2023-02-16 11:32:47 +01:00
parent d1221aa435
commit 825354881e
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
33 changed files with 123 additions and 76 deletions

View File

@ -107,10 +107,13 @@ open class BaseActivity : AppCompatActivity() {
issuedFor = cert.subjectDN.name
}
@SuppressLint("StringFormatMatches") val dialogText = String.format(
resources
.getString(R.string.nc_certificate_dialog_text),
issuedBy, issuedFor, validFrom, validUntil
@SuppressLint("StringFormatMatches")
val dialogText = String.format(
resources.getString(R.string.nc_certificate_dialog_text),
issuedBy,
issuedFor,
validFrom,
validUntil
)
val dialogBuilder = MaterialAlertDialogBuilder(this)

View File

@ -195,7 +195,8 @@ class CallNotificationActivity : CallBaseActivity() {
userBeingCalled,
intArrayOf(
ApiUtils.APIv4,
ApiUtils.APIv3, 1
ApiUtils.APIv3,
1
)
)
ncApi!!.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, userBeingCalled!!.baseUrl, roomToken))

View File

@ -210,7 +210,6 @@ class MainActivity : BaseActivity(), ActionBarProvider {
private fun handleActionFromContact(intent: Intent) {
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
val cursor = contentResolver.query(intent.data!!, null, null, null, null)
var userId = ""
@ -250,13 +249,18 @@ class MainActivity : BaseActivity(), ActionBarProvider {
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, 1))
val credentials = ApiUtils.getCredentials(currentUser?.username, currentUser?.token)
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
apiVersion, currentUser?.baseUrl, roomType,
null, userId, null
apiVersion,
currentUser?.baseUrl,
roomType,
null,
userId,
null
)
ncApi.createRoom(
credentials,
retrofitBucket.url, retrofitBucket.queryMap
retrofitBucket.url,
retrofitBucket.queryMap
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -293,8 +297,11 @@ class MainActivity : BaseActivity(), ActionBarProvider {
Parcels.wrap(roomOverall.ocs!!.data)
)
remapChatController(
router!!, currentUser!!.id!!,
roomOverall.ocs!!.data!!.token!!, bundle, true
router!!,
currentUser!!.id!!,
roomOverall.ocs!!.data!!.token!!,
bundle,
true
)
}

View File

@ -122,7 +122,8 @@ class ConversationItem(
if (adapter.hasFilter()) {
viewThemeUtils.platform.highlightText(
holder.binding.dialogName,
model.displayName!!, adapter.getFilter(String::class.java).toString()
model.displayName!!,
adapter.getFilter(String::class.java).toString()
)
} else {
holder.binding.dialogName.text = model.displayName

View File

@ -184,8 +184,11 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : MessageHolde
} ?: run {
binding.messageQuote.quotedMessageImage.visibility = View.GONE
}
binding.messageQuote.quotedMessageAuthor.text = if (parentChatMessage.actorDisplayName.isNullOrEmpty())
context!!.getText(R.string.nc_nick_guest) else parentChatMessage.actorDisplayName
binding.messageQuote.quotedMessageAuthor.text = if (parentChatMessage.actorDisplayName.isNullOrEmpty()) {
context!!.getText(R.string.nc_nick_guest)
} else {
parentChatMessage.actorDisplayName
}
binding.messageQuote.quotedMessage.text = parentChatMessage.text
if (parentChatMessage.actorId?.equals(message.activeUser!!.userId) == true) {

View File

@ -102,7 +102,8 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
AppCompatResources.getDrawable(context, drawableInt)?.let {
binding.checkMark.setImageDrawable(it)
binding.checkMark.setColorFilter(
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant, PorterDuff.Mode.SRC_ATOP
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
PorterDuff.Mode.SRC_ATOP
)
}
}

View File

@ -115,7 +115,8 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
AppCompatResources.getDrawable(context!!, drawableInt)?.let {
binding.checkMark.setImageDrawable(it)
binding.checkMark.setColorFilter(
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant, PorterDuff.Mode.SRC_ATOP
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
PorterDuff.Mode.SRC_ATOP
)
}
}

View File

@ -102,7 +102,8 @@ class OutcomingPollMessageViewHolder(outcomingView: View, payload: Any) : Messag
AppCompatResources.getDrawable(context, drawableInt)?.let {
binding.checkMark.setImageDrawable(it)
binding.checkMark.setColorFilter(
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant, PorterDuff.Mode.SRC_ATOP
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
PorterDuff.Mode.SRC_ATOP
)
}
}

View File

@ -118,7 +118,8 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
ResourcesCompat.getDrawable(context!!.resources, drawableInt, null)?.let {
binding.checkMark.setImageDrawable(it)
binding.checkMark.setColorFilter(
viewThemeUtils.getScheme(binding.messageText.context).onSurfaceVariant, PorterDuff.Mode.SRC_ATOP
viewThemeUtils.getScheme(binding.messageText.context).onSurfaceVariant,
PorterDuff.Mode.SRC_ATOP
)
}
}

View File

@ -136,7 +136,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
AppCompatResources.getDrawable(context!!, drawableInt)?.let {
binding.checkMark.setImageDrawable(it)
binding.checkMark.setColorFilter(
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant, PorterDuff.Mode.SRC_ATOP
viewThemeUtils.getScheme(binding.checkMark.context).onSurfaceVariant,
PorterDuff.Mode.SRC_ATOP
)
}
}

View File

@ -263,7 +263,10 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
)
drawable = Drawable.createFromResourceStream(
context!!.resources,
null, inputStream, null, null
null,
inputStream,
null,
null
)
try {
inputStream.close()

View File

@ -80,7 +80,7 @@ class Reaction {
viewThemeUtils,
isOutgoingMessage,
isSelfReaction
),
)
)
emojiWithAmountWrapper.setOnClickListener {

View File

@ -179,7 +179,8 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
val accountRemovalWork = OneTimeWorkRequest.Builder(AccountRemovalWorker::class.java).build()
val periodicCapabilitiesUpdateWork = PeriodicWorkRequest.Builder(
CapabilitiesWorker::class.java,
HALF_DAY, TimeUnit.HOURS
HALF_DAY,
TimeUnit.HOURS
).build()
val capabilitiesUpdateWork = OneTimeWorkRequest.Builder(CapabilitiesWorker::class.java).build()
val signalingSettingsWork = OneTimeWorkRequest.Builder(SignalingSettingsWorker::class.java).build()

View File

@ -459,7 +459,6 @@ class ChatController(args: Bundle) :
private fun loadAvatarForStatusBar() {
if (isOneToOneConversation() && activity != null) {
val url = ApiUtils.getUrlForAvatar(
conversationUser!!.baseUrl,
currentConversation!!.name,
@ -468,7 +467,6 @@ class ChatController(args: Bundle) :
val target = object : Target {
private fun setIcon(drawable: Drawable?) {
actionBar?.let {
val avatarSize = (it.height / TOOLBAR_AVATAR_RATIO).roundToInt()
@ -689,7 +687,6 @@ class ChatController(args: Bundle) :
super.onScrollStateChanged(recyclerView, newState)
if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
if (layoutManager!!.findFirstCompletelyVisibleItemPosition() > 0) {
binding?.scrollDownButton?.visibility = View.VISIBLE
} else {
@ -2086,11 +2083,11 @@ class ChatController(args: Bundle) :
val replyMessageId: Int? = view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.tag as Int?
sendMessage(
editable,
if (
view
?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)
?.visibility == View.VISIBLE
) replyMessageId else null,
if (view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.visibility == View.VISIBLE) {
replyMessageId
} else {
null
},
sendWithoutNotification
)
cancelReply()
@ -2321,7 +2318,6 @@ class ChatController(args: Bundle) :
}
private fun processMessagesResponse(response: Response<*>, isFromTheFuture: Boolean) {
val xChatLastCommonRead = response.headers()["X-Chat-Last-Common-Read"]?.let {
Integer.parseInt(it)
}
@ -2408,7 +2404,6 @@ class ChatController(args: Bundle) :
}
private fun processMessagesFromTheFuture(chatMessageList: List<ChatMessage>) {
val shouldAddNewMessagesNotice = (adapter?.itemCount ?: 0) > 0 && chatMessageList.isNotEmpty()
if (shouldAddNewMessagesNotice) {
@ -2592,11 +2587,13 @@ class ChatController(args: Bundle) :
binding?.messageInputView?.context?.let {
viewThemeUtils.platform.colorToolbarMenuIcon(
it, menu.findItem(R.id.conversation_voice_call)
it,
menu.findItem(R.id.conversation_voice_call)
)
viewThemeUtils.platform.colorToolbarMenuIcon(
it, menu.findItem(R.id.conversation_video_call)
it,
menu.findItem(R.id.conversation_video_call)
)
}

View File

@ -248,7 +248,8 @@ class ContactsController(args: Bundle) :
)
ncApi.createRoom(
credentials,
retrofitBucket.url, retrofitBucket.queryMap
retrofitBucket.url,
retrofitBucket.queryMap
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -267,7 +268,8 @@ class ContactsController(args: Bundle) :
ncApi.getRoom(
credentials,
ApiUtils.getUrlForRoom(
apiVersion, currentUser!!.baseUrl,
apiVersion,
currentUser!!.baseUrl,
roomOverall.ocs!!.data!!.token
)
)
@ -428,7 +430,9 @@ class ContactsController(args: Bundle) :
modifiedQueryMap.put("shareTypes[]", shareTypesList)
ncApi.getContactsWithSearchParam(
credentials,
retrofitBucket.url, shareTypesList, modifiedQueryMap
retrofitBucket.url,
shareTypesList,
modifiedQueryMap
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -799,10 +803,7 @@ class ContactsController(args: Bundle) :
contactItem.model.calculatedActorId,
null
)
ncApi.createRoom(
credentials,
retrofitBucket.url, retrofitBucket.queryMap
)
ncApi.createRoom(credentials, retrofitBucket.url, retrofitBucket.queryMap)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Observer<RoomOverall> {

View File

@ -305,8 +305,11 @@ class ConversationInfoController(args: Bundle) :
conversation!!.lobbyTimer = 0
}
conversation!!.lobbyState = if (isChecked) Conversation.LobbyState
.LOBBY_STATE_MODERATORS_ONLY else Conversation.LobbyState.LOBBY_STATE_ALL_PARTICIPANTS
conversation!!.lobbyState = if (isChecked) {
Conversation.LobbyState.LOBBY_STATE_MODERATORS_ONLY
} else {
Conversation.LobbyState.LOBBY_STATE_ALL_PARTICIPANTS
}
if (
conversation!!.lobbyTimer != null &&
@ -315,7 +318,7 @@ class ConversationInfoController(args: Bundle) :
) {
binding?.webinarInfoView?.startTimePreferences?.setSummary(
dateUtils.getLocalDateTimeStringFromTimestamp(
conversation!!.lobbyTimer!! * DateConstants.SECOND_DIVIDER,
conversation!!.lobbyTimer!! * DateConstants.SECOND_DIVIDER
)
)
} else {
@ -333,7 +336,11 @@ class ConversationInfoController(args: Bundle) :
val state = if (
(binding?.webinarInfoView?.conversationInfoLobby?.findViewById<View>(R.id.mp_checkable) as SwitchCompat)
.isChecked
) 1 else 0
) {
1
} else {
0
}
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
@ -380,7 +387,8 @@ class ConversationInfoController(args: Bundle) :
val dialogBuilder = MaterialAlertDialogBuilder(it.context)
.setIcon(
viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
context, R.drawable.ic_delete_black_24dp
context,
R.drawable.ic_delete_black_24dp
)
)
.setTitle(R.string.nc_delete_call)
@ -553,7 +561,8 @@ class ConversationInfoController(args: Bundle) :
val dialogBuilder = MaterialAlertDialogBuilder(it)
.setIcon(
viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
context, R.drawable.ic_delete_black_24dp
context,
R.drawable.ic_delete_black_24dp
)
)
.setTitle(R.string.nc_clear_history)

View File

@ -237,7 +237,6 @@ class ConversationsListController(bundle: Bundle) :
}
private fun loadUserAvatar(button: MaterialButton) {
val target = object : Target {
override fun onStart(placeholder: Drawable?) {
button.icon = placeholder
@ -448,7 +447,9 @@ class ConversationsListController(bundle: Bundle) :
private fun hasActivityActionSendIntent(): Boolean {
return if (activity != null) {
Intent.ACTION_SEND == activity!!.intent.action || Intent.ACTION_SEND_MULTIPLE == activity!!.intent.action
} else false
} else {
false
}
}
override fun showSearchOrToolbar() {
@ -579,7 +580,7 @@ class ConversationsListController(bundle: Bundle) :
.setIcon(
viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
context,
R.drawable.ic_baseline_error_outline_24dp,
R.drawable.ic_baseline_error_outline_24dp
)
)
.setTitle(R.string.error_loading_chats)
@ -1199,7 +1200,8 @@ class ConversationsListController(bundle: Bundle) :
val dialogBuilder = MaterialAlertDialogBuilder(it.context)
.setIcon(
viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
context, R.drawable.ic_delete_black_24dp
context,
R.drawable.ic_delete_black_24dp
)
)
.setTitle(R.string.nc_dialog_invalid_password)

View File

@ -318,7 +318,8 @@ class LocationPickerController(args: Bundle) :
override fun onZoom(event: ZoomEvent): Boolean {
return false
}
})
}
)
@Suppress("Detekt.TooGenericExceptionCaught")
private fun requestLocationUpdates() {
@ -383,7 +384,6 @@ class LocationPickerController(args: Bundle) :
private fun shareLocation(selectedLat: Double?, selectedLon: Double?, locationName: String?) {
if (selectedLat != null || selectedLon != null) {
val name = locationName
if (name.isNullOrEmpty()) {
initGeocoder()

View File

@ -104,7 +104,8 @@ class LockedController : BaseController(R.layout.controller_locked) {
.build()
val executor: Executor = Executors.newSingleThreadExecutor()
val biometricPrompt = BiometricPrompt(
(context as FragmentActivity?)!!, executor,
(context as FragmentActivity?)!!,
executor,
object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)

View File

@ -84,7 +84,11 @@ class ServerSelectionController :
}
setCertTextView()
},
arrayOf("RSA", "EC"), null, null, -1, null
arrayOf("RSA", "EC"),
null,
null,
-1,
null
)
}
}
@ -238,7 +242,8 @@ class ServerSelectionController :
} else if (!status.installed) {
setErrorText(
String.format(
resources!!.getString(R.string.nc_server_not_installed), productName
resources!!.getString(R.string.nc_server_not_installed),
productName
)
)
} else if (status.needsUpgrade) {

View File

@ -225,7 +225,8 @@ class WebViewLoginController(args: Bundle? = null) : BaseController(
try {
val privateKey = KeyChain.getPrivateKey(activity!!, finalAlias!!)
val certificates = KeyChain.getCertificateChain(
activity!!, finalAlias
activity!!,
finalAlias
)
if (privateKey != null && certificates != null) {
request.proceed(privateKey, certificates)
@ -249,7 +250,8 @@ class WebViewLoginController(args: Bundle? = null) : BaseController(
try {
privateKey = KeyChain.getPrivateKey(activity!!, chosenAlias)
val certificates = KeyChain.getCertificateChain(
activity!!, chosenAlias
activity!!,
chosenAlias
)
if (privateKey != null && certificates != null) {
request.proceed(privateKey, certificates)

View File

@ -366,7 +366,8 @@ class OperationsMenuController(args: Bundle) : BaseController(
ncApi.getRoom(
credentials,
ApiUtils.getUrlForRoom(
apiVersion, currentUser!!.baseUrl,
apiVersion,
currentUser!!.baseUrl,
conversation!!.token
)
)

View File

@ -37,7 +37,6 @@ fun <IT : ListItemWithImage> MaterialDialog.listItemsWithImage(
waitForPositiveButton: Boolean = true,
selection: ListItemListener<IT> = null
): MaterialDialog {
if (getListAdapter() != null) {
return updateListItemsWithImage(
items = items,

View File

@ -36,7 +36,6 @@ class GuestAccessHelper(
private val context = controller.context
fun setupGuestAccess() {
val guestAccessAllowSwitch = (
binding.guestAccessView.guestAccessAllowSwitch.findViewById<View>(R.id.mp_checkable)
as SwitchCompat
@ -71,7 +70,6 @@ class GuestAccessHelper(
}
binding.guestAccessView.guestAccessPasswordSwitch.setOnClickListener {
if (guestAccessPasswordSwitch.isChecked) {
conversationsRepository.password("", conversation.token!!).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe(PasswordResultObserver(false))

View File

@ -103,7 +103,8 @@ abstract class TalkDatabase : RoomDatabase() {
super.onOpen(db)
db.execSQL("PRAGMA defer_foreign_keys = 1")
}
})
}
)
.build()
}

View File

@ -29,8 +29,16 @@ import kotlinx.parcelize.Parcelize
@Parcelize
@Entity(tableName = "ArbitraryStorage")
data class ArbitraryStorageEntity(
@PrimaryKey @ColumnInfo(name = "accountIdentifier") var accountIdentifier: Long = 0,
@ColumnInfo(name = "key") var key: String? = null,
@ColumnInfo(name = "object") var storageObject: String? = null,
@ColumnInfo(name = "value") var value: String? = null
@PrimaryKey
@ColumnInfo(name = "accountIdentifier")
var accountIdentifier: Long = 0,
@ColumnInfo(name = "key")
var key: String? = null,
@ColumnInfo(name = "object")
var storageObject: String? = null,
@ColumnInfo(name = "value")
var value: String? = null
) : Parcelable

View File

@ -729,7 +729,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
}
override fun onComplete() {
if (isCallNotificationVisible) {
// this state can be reached when call timeout is reached.
showMissedCallNotification()
@ -751,13 +750,15 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
signatureVerification.user,
intArrayOf(
ApiUtils.APIv4,
ApiUtils.APIv3, 1
ApiUtils.APIv3,
1
)
)
ncApi.getRoom(
credentials,
ApiUtils.getUrlForRoom(
apiVersion, signatureVerification.user?.baseUrl,
apiVersion,
signatureVerification.user?.baseUrl,
pushMessage.id
)
)

View File

@ -407,7 +407,9 @@ data class ChatMessage(
override fun getName(): String {
return if (!TextUtils.isEmpty(actorDisplayName)) {
actorDisplayName!!
} else sharedApplication!!.getString(R.string.nc_guest)
} else {
sharedApplication!!.getString(R.string.nc_guest)
}
}
override fun getAvatar(): String? {

View File

@ -128,7 +128,7 @@ class PollRepositoryImpl(private val ncApi: NcApi, private val currentUserProvid
pollDetailsResponse.actorType,
pollDetailsResponse.actorId,
pollDetailsResponse.actorDisplayName,
pollDetailsResponse.optionId,
pollDetailsResponse.optionId
)
}
}

View File

@ -54,7 +54,6 @@ abstract class SharedItemsViewHolder(
abstract val progressBar: ProgressBar
open fun onBind(item: SharedFileItem) {
val placeholder = viewThemeUtils.talk.getPlaceholderImage(image.context, item.mimeType)
if (item.previewAvailable) {
image.loadImage(

View File

@ -76,7 +76,6 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi, pr
parameters: SharedItemsRepository.Parameters,
type: SharedItemType
): SharedItems {
var chatLastGiven: Int? = null
val items = mutableMapOf<String, SharedItem>()

View File

@ -115,7 +115,6 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
actionState: Int,
isCurrentlyActive: Boolean
) {
if (actionState == ACTION_STATE_SWIPE) {
setTouchListener(recyclerView, viewHolder)
}

View File

@ -30,7 +30,6 @@ object ShareUtils {
user: User,
conversation: Conversation?
): String {
return String.format(
context.resources.getString(R.string.nc_share_text),
user.baseUrl,