mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
ktlint: No whitespace expected between opening parenthesis and first parameter name
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
f2b86a9d86
commit
627e9d5c20
@ -1050,10 +1050,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
private val isConnectionEstablished: Boolean
|
private val isConnectionEstablished: Boolean
|
||||||
get() = currentCallStatus === CallStatus.JOINED || currentCallStatus === CallStatus.IN_CONVERSATION
|
get() = currentCallStatus === CallStatus.JOINED || currentCallStatus === CallStatus.IN_CONVERSATION
|
||||||
|
|
||||||
private fun onAudioManagerDevicesChanged(
|
private fun onAudioManagerDevicesChanged(currentDevice: AudioDevice, availableDevices: Set<AudioDevice>) {
|
||||||
currentDevice: AudioDevice,
|
|
||||||
availableDevices: Set<AudioDevice>
|
|
||||||
) {
|
|
||||||
Log.d(TAG, "onAudioManagerDevicesChanged: $availableDevices, currentDevice: $currentDevice")
|
Log.d(TAG, "onAudioManagerDevicesChanged: $availableDevices, currentDevice: $currentDevice")
|
||||||
val shouldDisableProximityLock =
|
val shouldDisableProximityLock =
|
||||||
currentDevice == AudioDevice.WIRED_HEADSET ||
|
currentDevice == AudioDevice.WIRED_HEADSET ||
|
||||||
@ -1529,10 +1526,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addIceServers(
|
private fun addIceServers(signalingSettingsOverall: SignalingSettingsOverall, apiVersion: Int) {
|
||||||
signalingSettingsOverall: SignalingSettingsOverall,
|
|
||||||
apiVersion: Int
|
|
||||||
) {
|
|
||||||
if (signalingSettingsOverall.ocs!!.settings!!.stunServers != null) {
|
if (signalingSettingsOverall.ocs!!.settings!!.stunServers != null) {
|
||||||
val stunServers = signalingSettingsOverall.ocs!!.settings!!.stunServers
|
val stunServers = signalingSettingsOverall.ocs!!.settings!!.stunServers
|
||||||
if (apiVersion == ApiUtils.APIv3) {
|
if (apiVersion == ApiUtils.APIv3) {
|
||||||
@ -3035,11 +3029,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePictureInPictureActions(
|
private fun updatePictureInPictureActions(@DrawableRes iconId: Int, title: String?, requestCode: Int) {
|
||||||
@DrawableRes iconId: Int,
|
|
||||||
title: String?,
|
|
||||||
requestCode: Int
|
|
||||||
) {
|
|
||||||
if (isGreaterEqualOreo && isPipModePossible) {
|
if (isGreaterEqualOreo && isPipModePossible) {
|
||||||
val actions = ArrayList<RemoteAction>()
|
val actions = ArrayList<RemoteAction>()
|
||||||
val icon = Icon.createWithResource(this, iconId)
|
val icon = Icon.createWithResource(this, iconId)
|
||||||
|
@ -203,9 +203,7 @@ class ConversationItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldLoadAvatar(
|
private fun shouldLoadAvatar(holder: ConversationItemViewHolder): Boolean {
|
||||||
holder: ConversationItemViewHolder
|
|
||||||
): Boolean {
|
|
||||||
return when (model.objectType) {
|
return when (model.objectType) {
|
||||||
Conversation.ObjectType.SHARE_PASSWORD -> {
|
Conversation.ObjectType.SHARE_PASSWORD -> {
|
||||||
holder.binding.dialogAvatar.setImageDrawable(
|
holder.binding.dialogAvatar.setImageDrawable(
|
||||||
@ -237,10 +235,7 @@ class ConversationItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setLastMessage(
|
private fun setLastMessage(holder: ConversationItemViewHolder, appContext: Context) {
|
||||||
holder: ConversationItemViewHolder,
|
|
||||||
appContext: Context
|
|
||||||
) {
|
|
||||||
if (model.lastMessage != null) {
|
if (model.lastMessage != null) {
|
||||||
holder.binding.dialogDate.visibility = View.VISIBLE
|
holder.binding.dialogDate.visibility = View.VISIBLE
|
||||||
holder.binding.dialogDate.text = DateUtils.getRelativeTimeSpanString(
|
holder.binding.dialogDate.text = DateUtils.getRelativeTimeSpanString(
|
||||||
|
@ -38,12 +38,7 @@ import io.reactivex.schedulers.Schedulers
|
|||||||
|
|
||||||
class LinkPreview {
|
class LinkPreview {
|
||||||
|
|
||||||
fun showLink(
|
fun showLink(message: ChatMessage, ncApi: NcApi, binding: ReferenceInsideMessageBinding, context: Context) {
|
||||||
message: ChatMessage,
|
|
||||||
ncApi: NcApi,
|
|
||||||
binding: ReferenceInsideMessageBinding,
|
|
||||||
context: Context
|
|
||||||
) {
|
|
||||||
binding.referenceName.text = ""
|
binding.referenceName.text = ""
|
||||||
binding.referenceDescription.text = ""
|
binding.referenceDescription.text = ""
|
||||||
binding.referenceLink.text = ""
|
binding.referenceLink.text = ""
|
||||||
|
@ -79,10 +79,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListItemViewHolder {
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ListItemViewHolder {
|
|
||||||
val listItemView: View = parent.inflate(dialog.windowContext, R.layout.menu_item_sheet)
|
val listItemView: View = parent.inflate(dialog.windowContext, R.layout.menu_item_sheet)
|
||||||
val viewHolder = ListItemViewHolder(
|
val viewHolder = ListItemViewHolder(
|
||||||
itemView = listItemView,
|
itemView = listItemView,
|
||||||
@ -94,10 +91,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
|
|||||||
|
|
||||||
override fun getItemCount() = items.size
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
override fun onBindViewHolder(
|
override fun onBindViewHolder(holder: ListItemViewHolder, position: Int) {
|
||||||
holder: ListItemViewHolder,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
holder.itemView.isEnabled = !disabledIndices.contains(position)
|
holder.itemView.isEnabled = !disabledIndices.contains(position)
|
||||||
val currentItem = items[position]
|
val currentItem = items[position]
|
||||||
|
|
||||||
@ -120,10 +114,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceItems(
|
override fun replaceItems(items: List<IT>, listener: ListItemListener<IT>) {
|
||||||
items: List<IT>,
|
|
||||||
listener: ListItemListener<IT>
|
|
||||||
) {
|
|
||||||
this.items = items
|
this.items = items
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
this.selection = listener
|
this.selection = listener
|
||||||
|
@ -46,10 +46,7 @@ class ReactionAnimator(
|
|||||||
) {
|
) {
|
||||||
private val reactionsList: MutableList<CallReaction> = ArrayList()
|
private val reactionsList: MutableList<CallReaction> = ArrayList()
|
||||||
|
|
||||||
fun addReaction(
|
fun addReaction(emoji: String, displayName: String) {
|
||||||
emoji: String,
|
|
||||||
displayName: String
|
|
||||||
) {
|
|
||||||
val callReaction = CallReaction(emoji, displayName)
|
val callReaction = CallReaction(emoji, displayName)
|
||||||
reactionsList.add(callReaction)
|
reactionsList.add(callReaction)
|
||||||
|
|
||||||
@ -58,9 +55,7 @@ class ReactionAnimator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun animateReaction(
|
private fun animateReaction(callReaction: CallReaction) {
|
||||||
callReaction: CallReaction
|
|
||||||
) {
|
|
||||||
val reactionWrapper = getReactionWrapperView(callReaction)
|
val reactionWrapper = getReactionWrapperView(callReaction)
|
||||||
|
|
||||||
val params = RelativeLayout.LayoutParams(
|
val params = RelativeLayout.LayoutParams(
|
||||||
|
@ -2979,9 +2979,7 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun leaveRoom(
|
fun leaveRoom(funToCallWhenLeaveSuccessful: (() -> Unit)?) {
|
||||||
funToCallWhenLeaveSuccessful: (() -> Unit)?
|
|
||||||
) {
|
|
||||||
logConversationInfos("leaveRoom")
|
logConversationInfos("leaveRoom")
|
||||||
|
|
||||||
var apiVersion = 1
|
var apiVersion = 1
|
||||||
@ -3147,11 +3145,7 @@ class ChatActivity :
|
|||||||
signalingMessageSender = webSocketInstance?.signalingMessageSender
|
signalingMessageSender = webSocketInstance?.signalingMessageSender
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pullChatMessages(
|
fun pullChatMessages(lookIntoFuture: Boolean, setReadMarker: Boolean = true, xChatLastCommonRead: Int? = null) {
|
||||||
lookIntoFuture: Boolean,
|
|
||||||
setReadMarker: Boolean = true,
|
|
||||||
xChatLastCommonRead: Int? = null
|
|
||||||
) {
|
|
||||||
if (!validSessionId()) {
|
if (!validSessionId()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -3471,10 +3465,7 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addMessagesToAdapter(
|
private fun addMessagesToAdapter(shouldAddNewMessagesNotice: Boolean, chatMessageList: List<ChatMessage>) {
|
||||||
shouldAddNewMessagesNotice: Boolean,
|
|
||||||
chatMessageList: List<ChatMessage>
|
|
||||||
) {
|
|
||||||
val isThereANewNotice =
|
val isThereANewNotice =
|
||||||
shouldAddNewMessagesNotice || adapter?.getMessagePositionByIdInReverse("-1") != -1
|
shouldAddNewMessagesNotice || adapter?.getMessagePositionByIdInReverse("-1") != -1
|
||||||
for (chatMessage in chatMessageList) {
|
for (chatMessage in chatMessageList) {
|
||||||
|
@ -29,10 +29,7 @@ import com.nextcloud.talk.utils.ApiUtils
|
|||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
|
|
||||||
class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
|
class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
|
||||||
override fun getRoom(
|
override fun getRoom(user: User, roomToken: String): Observable<ConversationModel> {
|
||||||
user: User,
|
|
||||||
roomToken: String
|
|
||||||
): Observable<ConversationModel> {
|
|
||||||
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv3, 1))
|
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv3, 1))
|
||||||
|
|
||||||
@ -42,11 +39,7 @@ class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
|
|||||||
).map { ConversationModel.mapToConversationModel(it.ocs?.data!!) }
|
).map { ConversationModel.mapToConversationModel(it.ocs?.data!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun joinRoom(
|
override fun joinRoom(user: User, roomToken: String, roomPassword: String): Observable<ConversationModel> {
|
||||||
user: User,
|
|
||||||
roomToken: String,
|
|
||||||
roomPassword: String
|
|
||||||
): Observable<ConversationModel> {
|
|
||||||
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, 1))
|
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, 1))
|
||||||
|
|
||||||
|
@ -27,13 +27,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface ConversationRepository {
|
interface ConversationRepository {
|
||||||
|
|
||||||
fun renameConversation(
|
fun renameConversation(roomToken: String, roomNameNew: String): Observable<GenericOverall>
|
||||||
roomToken: String,
|
|
||||||
roomNameNew: String
|
|
||||||
): Observable<GenericOverall>
|
|
||||||
|
|
||||||
fun createConversation(
|
fun createConversation(roomName: String, conversationType: Conversation.ConversationType?): Observable<RoomOverall>
|
||||||
roomName: String,
|
|
||||||
conversationType: Conversation.ConversationType?
|
|
||||||
): Observable<RoomOverall>
|
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,7 @@ class ConversationRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
||||||
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
||||||
|
|
||||||
override fun renameConversation(
|
override fun renameConversation(roomToken: String, roomNameNew: String): Observable<GenericOverall> {
|
||||||
roomToken: String,
|
|
||||||
roomNameNew: String
|
|
||||||
): Observable<GenericOverall> {
|
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
|
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
|
||||||
|
|
||||||
return ncApi.renameRoom(
|
return ncApi.renameRoom(
|
||||||
|
@ -54,10 +54,7 @@ class ConversationViewModel @Inject constructor(private val repository: Conversa
|
|||||||
disposable?.dispose()
|
disposable?.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createConversation(
|
fun createConversation(roomName: String, conversationType: Conversation.ConversationType?) {
|
||||||
roomName: String,
|
|
||||||
conversationType: Conversation.ConversationType?
|
|
||||||
) {
|
|
||||||
_viewState.value = CreatingState
|
_viewState.value = CreatingState
|
||||||
|
|
||||||
repository.createConversation(
|
repository.createConversation(
|
||||||
|
@ -352,9 +352,7 @@ class ConversationsListActivity :
|
|||||||
viewThemeUtils.material.themeToolbar(binding.conversationListToolbar)
|
viewThemeUtils.material.themeToolbar(binding.conversationListToolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadUserAvatar(
|
private fun loadUserAvatar(target: Target) {
|
||||||
target: Target
|
|
||||||
) {
|
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
val url = ApiUtils.getUrlForAvatar(
|
val url = ApiUtils.getUrlForAvatar(
|
||||||
currentUser!!.baseUrl,
|
currentUser!!.baseUrl,
|
||||||
|
@ -93,12 +93,7 @@ class ShareOperationWorker(context: Context, workerParams: WorkerParameters) : W
|
|||||||
companion object {
|
companion object {
|
||||||
private val TAG = ShareOperationWorker::class.simpleName
|
private val TAG = ShareOperationWorker::class.simpleName
|
||||||
|
|
||||||
fun shareFile(
|
fun shareFile(roomToken: String?, currentUser: User, remotePath: String, metaData: String?) {
|
||||||
roomToken: String?,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String,
|
|
||||||
metaData: String?
|
|
||||||
) {
|
|
||||||
val paths: MutableList<String> = ArrayList()
|
val paths: MutableList<String> = ArrayList()
|
||||||
paths.add(remotePath)
|
paths.add(remotePath)
|
||||||
|
|
||||||
|
@ -186,9 +186,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
|
|||||||
return remotePath
|
return remotePath
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransferProgress(
|
override fun onTransferProgress(percentage: Int) {
|
||||||
percentage: Int
|
|
||||||
) {
|
|
||||||
notification = mBuilder!!
|
notification = mBuilder!!
|
||||||
.setProgress(HUNDRED_PERCENT, percentage, false)
|
.setProgress(HUNDRED_PERCENT, percentage, false)
|
||||||
.setContentText(getNotificationContentText(percentage))
|
.setContentText(getNotificationContentText(percentage))
|
||||||
@ -322,12 +320,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun upload(
|
fun upload(fileUri: String, roomToken: String, conversationName: String, metaData: String?) {
|
||||||
fileUri: String,
|
|
||||||
roomToken: String,
|
|
||||||
conversationName: String,
|
|
||||||
metaData: String?
|
|
||||||
) {
|
|
||||||
val data: Data = Data.Builder()
|
val data: Data = Data.Builder()
|
||||||
.putString(DEVICE_SOURCE_FILE, fileUri)
|
.putString(DEVICE_SOURCE_FILE, fileUri)
|
||||||
.putString(ROOM_TOKEN, roomToken)
|
.putString(ROOM_TOKEN, roomToken)
|
||||||
|
@ -524,11 +524,7 @@ class LocationPickerActivity :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||||
requestCode: Int,
|
|
||||||
permissions: Array<out String>,
|
|
||||||
grantResults: IntArray
|
|
||||||
) {
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
|
|
||||||
fun areAllGranted(grantResults: IntArray): Boolean {
|
fun areAllGranted(grantResults: IntArray): Boolean {
|
||||||
|
@ -46,9 +46,7 @@ class ConversationModel(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun mapToConversationModel(
|
fun mapToConversationModel(conversation: Conversation): ConversationModel {
|
||||||
conversation: Conversation
|
|
||||||
): ConversationModel {
|
|
||||||
return ConversationModel(
|
return ConversationModel(
|
||||||
roomId = conversation.roomId,
|
roomId = conversation.roomId,
|
||||||
token = conversation.token,
|
token = conversation.token,
|
||||||
|
@ -35,10 +35,7 @@ class ChatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.ComplexMethod")
|
@Suppress("Detekt.ComplexMethod")
|
||||||
private fun parse(
|
private fun parse(messageParameters: HashMap<String?, HashMap<String?, String?>>, message: String?): String? {
|
||||||
messageParameters: HashMap<String?, HashMap<String?, String?>>,
|
|
||||||
message: String?
|
|
||||||
): String? {
|
|
||||||
var resultMessage = message
|
var resultMessage = message
|
||||||
for (key in messageParameters.keys) {
|
for (key in messageParameters.keys) {
|
||||||
val individualHashMap = messageParameters[key]
|
val individualHashMap = messageParameters[key]
|
||||||
|
@ -42,9 +42,7 @@ class OpenConversationsRepositoryImpl(private val ncApi: NcApi, currentUserProvi
|
|||||||
).map { mapToOpenConversationsModel(it.ocs?.data!!) }
|
).map { mapToOpenConversationsModel(it.ocs?.data!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToOpenConversationsModel(
|
private fun mapToOpenConversationsModel(conversations: List<Conversation>): OpenConversationsModel {
|
||||||
conversations: List<Conversation>
|
|
||||||
): OpenConversationsModel {
|
|
||||||
return OpenConversationsModel(
|
return OpenConversationsModel(
|
||||||
conversations.map { conversation ->
|
conversations.map { conversation ->
|
||||||
OpenConversation(
|
OpenConversation(
|
||||||
|
@ -49,11 +49,7 @@ class PollLoadingFragment : Fragment() {
|
|||||||
fragmentHeight = arguments?.getInt(KEY_FRAGMENT_HEIGHT)!!
|
fragmentHeight = arguments?.getInt(KEY_FRAGMENT_HEIGHT)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
||||||
binding.root.layoutParams.height = fragmentHeight
|
binding.root.layoutParams.height = fragmentHeight
|
||||||
viewThemeUtils.platform.colorCircularProgressBar(binding.pollLoadingProgressbar, ColorRole.PRIMARY)
|
viewThemeUtils.platform.colorCircularProgressBar(binding.pollLoadingProgressbar, ColorRole.PRIMARY)
|
||||||
@ -65,9 +61,7 @@ class PollLoadingFragment : Fragment() {
|
|||||||
private const val KEY_FRAGMENT_HEIGHT = "keyFragmentHeight"
|
private const val KEY_FRAGMENT_HEIGHT = "keyFragmentHeight"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(
|
fun newInstance(fragmentHeight: Int): PollLoadingFragment {
|
||||||
fragmentHeight: Int
|
|
||||||
): PollLoadingFragment {
|
|
||||||
val args = bundleOf(
|
val args = bundleOf(
|
||||||
KEY_FRAGMENT_HEIGHT to fragmentHeight
|
KEY_FRAGMENT_HEIGHT to fragmentHeight
|
||||||
)
|
)
|
||||||
|
@ -65,11 +65,7 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener {
|
|||||||
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
binding = DialogPollResultsBinding.inflate(inflater, container, false)
|
binding = DialogPollResultsBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
@ -69,11 +69,7 @@ class PollVoteFragment : Fragment() {
|
|||||||
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
binding = DialogPollVoteBinding.inflate(inflater, container, false)
|
binding = DialogPollVoteBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
@ -688,10 +688,7 @@ class ProfileActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initUserInfoEditText(
|
private fun initUserInfoEditText(holder: ViewHolder, item: UserInfoDetailsItem) {
|
||||||
holder: ViewHolder,
|
|
||||||
item: UserInfoDetailsItem
|
|
||||||
) {
|
|
||||||
holder.binding.userInfoEditTextEdit.setText(item.text)
|
holder.binding.userInfoEditTextEdit.setText(item.text)
|
||||||
holder.binding.userInfoInputLayout.hint = item.hint
|
holder.binding.userInfoInputLayout.hint = item.hint
|
||||||
holder.binding.userInfoEditTextEdit.addTextChangedListener(object : TextWatcher {
|
holder.binding.userInfoEditTextEdit.addTextChangedListener(object : TextWatcher {
|
||||||
@ -714,10 +711,7 @@ class ProfileActivity : BaseActivity() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initScopeElements(
|
private fun initScopeElements(item: UserInfoDetailsItem, holder: ViewHolder) {
|
||||||
item: UserInfoDetailsItem,
|
|
||||||
holder: ViewHolder
|
|
||||||
) {
|
|
||||||
if (item.scope == null) {
|
if (item.scope == null) {
|
||||||
holder.binding.scope.visibility = View.GONE
|
holder.binding.scope.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,11 +24,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface RequestAssistanceRepository {
|
interface RequestAssistanceRepository {
|
||||||
|
|
||||||
fun requestAssistance(
|
fun requestAssistance(roomToken: String): Observable<RequestAssistanceModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<RequestAssistanceModel>
|
|
||||||
|
|
||||||
fun withdrawRequestAssistance(
|
fun withdrawRequestAssistance(roomToken: String): Observable<WithdrawRequestAssistanceModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<WithdrawRequestAssistanceModel>
|
|
||||||
}
|
}
|
||||||
|
@ -57,18 +57,14 @@ class RequestAssistanceRepositoryImpl(private val ncApi: NcApi, currentUserProvi
|
|||||||
).map { mapToWithdrawRequestAssistanceModel(it.ocs?.meta!!) }
|
).map { mapToWithdrawRequestAssistanceModel(it.ocs?.meta!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToRequestAssistanceModel(
|
private fun mapToRequestAssistanceModel(response: GenericMeta): RequestAssistanceModel {
|
||||||
response: GenericMeta
|
|
||||||
): RequestAssistanceModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return RequestAssistanceModel(
|
return RequestAssistanceModel(
|
||||||
success
|
success
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToWithdrawRequestAssistanceModel(
|
private fun mapToWithdrawRequestAssistanceModel(response: GenericMeta): WithdrawRequestAssistanceModel {
|
||||||
response: GenericMeta
|
|
||||||
): WithdrawRequestAssistanceModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return WithdrawRequestAssistanceModel(
|
return WithdrawRequestAssistanceModel(
|
||||||
success
|
success
|
||||||
|
@ -160,10 +160,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadList(
|
private fun loadList(state: RemoteFileBrowserItemsViewModel.LoadedState, mimeTypeSelectionFilter: String?) {
|
||||||
state: RemoteFileBrowserItemsViewModel.LoadedState,
|
|
||||||
mimeTypeSelectionFilter: String?
|
|
||||||
) {
|
|
||||||
val remoteFileBrowserItems = state.items
|
val remoteFileBrowserItems = state.items
|
||||||
Log.d(TAG, "Items received: $remoteFileBrowserItems")
|
Log.d(TAG, "Items received: $remoteFileBrowserItems")
|
||||||
|
|
||||||
|
@ -26,11 +26,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface CallRecordingRepository {
|
interface CallRecordingRepository {
|
||||||
|
|
||||||
fun startRecording(
|
fun startRecording(roomToken: String): Observable<StartCallRecordingModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<StartCallRecordingModel>
|
|
||||||
|
|
||||||
fun stopRecording(
|
fun stopRecording(roomToken: String): Observable<StopCallRecordingModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<StopCallRecordingModel>
|
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,7 @@ class CallRecordingRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
|
|
||||||
var apiVersion = 1
|
var apiVersion = 1
|
||||||
|
|
||||||
override fun startRecording(
|
override fun startRecording(roomToken: String): Observable<StartCallRecordingModel> {
|
||||||
roomToken: String
|
|
||||||
): Observable<StartCallRecordingModel> {
|
|
||||||
return ncApi.startRecording(
|
return ncApi.startRecording(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForRecording(
|
ApiUtils.getUrlForRecording(
|
||||||
@ -51,9 +49,7 @@ class CallRecordingRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
).map { mapToStartCallRecordingModel(it.ocs?.meta!!) }
|
).map { mapToStartCallRecordingModel(it.ocs?.meta!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stopRecording(
|
override fun stopRecording(roomToken: String): Observable<StopCallRecordingModel> {
|
||||||
roomToken: String
|
|
||||||
): Observable<StopCallRecordingModel> {
|
|
||||||
return ncApi.stopRecording(
|
return ncApi.stopRecording(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForRecording(
|
ApiUtils.getUrlForRecording(
|
||||||
@ -64,18 +60,14 @@ class CallRecordingRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
).map { mapToStopCallRecordingModel(it.ocs?.meta!!) }
|
).map { mapToStopCallRecordingModel(it.ocs?.meta!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToStartCallRecordingModel(
|
private fun mapToStartCallRecordingModel(response: GenericMeta): StartCallRecordingModel {
|
||||||
response: GenericMeta
|
|
||||||
): StartCallRecordingModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return StartCallRecordingModel(
|
return StartCallRecordingModel(
|
||||||
success
|
success
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToStopCallRecordingModel(
|
private fun mapToStopCallRecordingModel(response: GenericMeta): StopCallRecordingModel {
|
||||||
response: GenericMeta
|
|
||||||
): StopCallRecordingModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return StopCallRecordingModel(
|
return StopCallRecordingModel(
|
||||||
success
|
success
|
||||||
|
@ -27,15 +27,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface ReactionsRepository {
|
interface ReactionsRepository {
|
||||||
|
|
||||||
fun addReaction(
|
fun addReaction(roomToken: String, message: ChatMessage, emoji: String): Observable<ReactionAddedModel>
|
||||||
roomToken: String,
|
|
||||||
message: ChatMessage,
|
|
||||||
emoji: String
|
|
||||||
): Observable<ReactionAddedModel>
|
|
||||||
|
|
||||||
fun deleteReaction(
|
fun deleteReaction(roomToken: String, message: ChatMessage, emoji: String): Observable<ReactionDeletedModel>
|
||||||
roomToken: String,
|
|
||||||
message: ChatMessage,
|
|
||||||
emoji: String
|
|
||||||
): Observable<ReactionDeletedModel>
|
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,7 @@ class ReactionsRepositoryImpl(private val ncApi: NcApi, currentUserProvider: Cur
|
|||||||
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
||||||
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
||||||
|
|
||||||
override fun addReaction(
|
override fun addReaction(roomToken: String, message: ChatMessage, emoji: String): Observable<ReactionAddedModel> {
|
||||||
roomToken: String,
|
|
||||||
message: ChatMessage,
|
|
||||||
emoji: String
|
|
||||||
): Observable<ReactionAddedModel> {
|
|
||||||
return ncApi.sendReaction(
|
return ncApi.sendReaction(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForMessageReaction(
|
ApiUtils.getUrlForMessageReaction(
|
||||||
|
@ -28,16 +28,9 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface SharedItemsRepository {
|
interface SharedItemsRepository {
|
||||||
|
|
||||||
fun media(
|
fun media(parameters: Parameters, type: SharedItemType): Observable<SharedItems>?
|
||||||
parameters: Parameters,
|
|
||||||
type: SharedItemType
|
|
||||||
): Observable<SharedItems>?
|
|
||||||
|
|
||||||
fun media(
|
fun media(parameters: Parameters, type: SharedItemType, lastKnownMessageId: Int?): Observable<SharedItems>?
|
||||||
parameters: Parameters,
|
|
||||||
type: SharedItemType,
|
|
||||||
lastKnownMessageId: Int?
|
|
||||||
): Observable<SharedItems>?
|
|
||||||
|
|
||||||
fun availableTypes(parameters: Parameters): Observable<Set<SharedItemType>>
|
fun availableTypes(parameters: Parameters): Observable<Set<SharedItemType>>
|
||||||
|
|
||||||
|
@ -48,10 +48,7 @@ import javax.inject.Inject
|
|||||||
class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi, private val dateUtils: DateUtils) :
|
class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi, private val dateUtils: DateUtils) :
|
||||||
SharedItemsRepository {
|
SharedItemsRepository {
|
||||||
|
|
||||||
override fun media(
|
override fun media(parameters: SharedItemsRepository.Parameters, type: SharedItemType): Observable<SharedItems>? {
|
||||||
parameters: SharedItemsRepository.Parameters,
|
|
||||||
type: SharedItemType
|
|
||||||
): Observable<SharedItems>? {
|
|
||||||
return media(parameters, type, null)
|
return media(parameters, type, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,5 @@ interface TranslateRepository {
|
|||||||
fromLanguage: String?
|
fromLanguage: String?
|
||||||
): Observable<String>
|
): Observable<String>
|
||||||
|
|
||||||
fun getLanguages(
|
fun getLanguages(authorization: String, url: String): Observable<List<Language>>
|
||||||
authorization: String,
|
|
||||||
url: String
|
|
||||||
): Observable<List<Language>>
|
|
||||||
}
|
}
|
||||||
|
@ -299,14 +299,11 @@ class DateTimePickerFragment(
|
|||||||
private const val HOUR_SIX_PM = 18
|
private const val HOUR_SIX_PM = 18
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(
|
fun newInstance(token: String, id: String, chatViewModel: ChatViewModel) =
|
||||||
token: String,
|
DateTimePickerFragment(
|
||||||
id: String,
|
token,
|
||||||
chatViewModel: ChatViewModel
|
id,
|
||||||
) = DateTimePickerFragment(
|
chatViewModel
|
||||||
token,
|
)
|
||||||
id,
|
|
||||||
chatViewModel
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,7 @@ class FilterConversationFragment(
|
|||||||
return MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create()
|
return MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View? {
|
|
||||||
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
||||||
setUpColors()
|
setUpColors()
|
||||||
setUpListeners()
|
setUpListeners()
|
||||||
|
@ -83,9 +83,7 @@ class SaveToStorageDialogFragment : DialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("LongLogTag")
|
@SuppressLint("LongLogTag")
|
||||||
private fun saveImageToStorage(
|
private fun saveImageToStorage(fileName: String) {
|
||||||
fileName: String
|
|
||||||
) {
|
|
||||||
val sourceFilePath = requireContext().cacheDir.path
|
val sourceFilePath = requireContext().cacheDir.path
|
||||||
val workerTag = SAVE_TO_STORAGE_WORKER_PREFIX + fileName
|
val workerTag = SAVE_TO_STORAGE_WORKER_PREFIX + fileName
|
||||||
|
|
||||||
|
@ -350,9 +350,7 @@ class SetStatusDialogFragment :
|
|||||||
return returnValue
|
return returnValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearAtToUnixTimeTypeEndOf(
|
private fun clearAtToUnixTimeTypeEndOf(clearAt: ClearAt): Long {
|
||||||
clearAt: ClearAt
|
|
||||||
): Long {
|
|
||||||
var returnValue = -1L
|
var returnValue = -1L
|
||||||
if (clearAt.time == "day") {
|
if (clearAt.time == "day") {
|
||||||
val date = Calendar.getInstance().apply {
|
val date = Calendar.getInstance().apply {
|
||||||
|
@ -295,11 +295,7 @@ class TalkSpecificViewThemeUtils @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun themeAndHighlightText(
|
fun themeAndHighlightText(textView: TextView, originalText: String?, c: String?) {
|
||||||
textView: TextView,
|
|
||||||
originalText: String?,
|
|
||||||
c: String?
|
|
||||||
) {
|
|
||||||
withScheme(textView) { scheme ->
|
withScheme(textView) { scheme ->
|
||||||
var constraint = c
|
var constraint = c
|
||||||
constraint = FlexibleUtils.toLowerCase(constraint)
|
constraint = FlexibleUtils.toLowerCase(constraint)
|
||||||
@ -374,11 +370,7 @@ class TalkSpecificViewThemeUtils @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTextColor(
|
fun getTextColor(isOutgoingMessage: Boolean, isSelfReaction: Boolean, binding: ReactionsInsideMessageBinding): Int {
|
||||||
isOutgoingMessage: Boolean,
|
|
||||||
isSelfReaction: Boolean,
|
|
||||||
binding: ReactionsInsideMessageBinding
|
|
||||||
): Int {
|
|
||||||
return withScheme(binding.root) { scheme ->
|
return withScheme(binding.root) { scheme ->
|
||||||
return@withScheme if (!isOutgoingMessage || isSelfReaction) {
|
return@withScheme if (!isOutgoingMessage || isSelfReaction) {
|
||||||
ContextCompat.getColor(binding.root.context, R.color.high_emphasis_text)
|
ContextCompat.getColor(binding.root.context, R.color.high_emphasis_text)
|
||||||
|
@ -83,11 +83,7 @@ class ChunkedFileUploader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
fun upload(
|
fun upload(localFile: File, mimeType: MediaType?, targetPath: String): Boolean {
|
||||||
localFile: File,
|
|
||||||
mimeType: MediaType?,
|
|
||||||
targetPath: String
|
|
||||||
): Boolean {
|
|
||||||
try {
|
try {
|
||||||
val uploadFolderUri: String = remoteChunkUrl + "/" + FileUtils.md5Sum(localFile)
|
val uploadFolderUri: String = remoteChunkUrl + "/" + FileUtils.md5Sum(localFile)
|
||||||
val davResource = DavResource(
|
val davResource = DavResource(
|
||||||
@ -137,10 +133,7 @@ class ChunkedFileUploader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.ComplexMethod")
|
@Suppress("Detekt.ComplexMethod")
|
||||||
private fun getUploadedChunks(
|
private fun getUploadedChunks(davResource: DavResource, uploadFolderUri: String): MutableList<Chunk> {
|
||||||
davResource: DavResource,
|
|
||||||
uploadFolderUri: String
|
|
||||||
): MutableList<Chunk> {
|
|
||||||
val davResponse = DavResponse()
|
val davResponse = DavResponse()
|
||||||
val memberElements: MutableList<at.bitfire.dav4jvm.Response> = ArrayList()
|
val memberElements: MutableList<at.bitfire.dav4jvm.Response> = ArrayList()
|
||||||
val rootElement = arrayOfNulls<at.bitfire.dav4jvm.Response>(1)
|
val rootElement = arrayOfNulls<at.bitfire.dav4jvm.Response>(1)
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
package com.nextcloud.talk.upload.chunked
|
package com.nextcloud.talk.upload.chunked
|
||||||
|
|
||||||
interface OnDataTransferProgressListener {
|
interface OnDataTransferProgressListener {
|
||||||
fun onTransferProgress(
|
fun onTransferProgress(percentage: Int)
|
||||||
percentage: Int
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,7 @@ class FileUploader(
|
|||||||
val roomToken: String,
|
val roomToken: String,
|
||||||
val ncApi: NcApi
|
val ncApi: NcApi
|
||||||
) {
|
) {
|
||||||
fun upload(
|
fun upload(sourceFileUri: Uri, fileName: String, remotePath: String, metaData: String?): Observable<Boolean> {
|
||||||
sourceFileUri: Uri,
|
|
||||||
fileName: String,
|
|
||||||
remotePath: String,
|
|
||||||
metaData: String?
|
|
||||||
): Observable<Boolean> {
|
|
||||||
return ncApi.uploadFile(
|
return ncApi.uploadFile(
|
||||||
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
||||||
ApiUtils.getUrlForFileUpload(currentUser.baseUrl, currentUser.userId, remotePath),
|
ApiUtils.getUrlForFileUpload(currentUser.baseUrl, currentUser.userId, remotePath),
|
||||||
|
@ -35,21 +35,13 @@ object BitmapShrinker {
|
|||||||
private const val DEGREES_270 = 270f
|
private const val DEGREES_270 = 270f
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun shrinkBitmap(
|
fun shrinkBitmap(path: String, reqWidth: Int, reqHeight: Int): Bitmap {
|
||||||
path: String,
|
|
||||||
reqWidth: Int,
|
|
||||||
reqHeight: Int
|
|
||||||
): Bitmap {
|
|
||||||
val bitmap = decodeBitmap(path, reqWidth, reqHeight)
|
val bitmap = decodeBitmap(path, reqWidth, reqHeight)
|
||||||
return rotateBitmap(path, bitmap)
|
return rotateBitmap(path, bitmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
||||||
private fun decodeBitmap(
|
private fun decodeBitmap(path: String, requestedWidth: Int, requestedHeight: Int): Bitmap {
|
||||||
path: String,
|
|
||||||
requestedWidth: Int,
|
|
||||||
requestedHeight: Int
|
|
||||||
): Bitmap {
|
|
||||||
return BitmapFactory.Options().run {
|
return BitmapFactory.Options().run {
|
||||||
inJustDecodeBounds = true
|
inJustDecodeBounds = true
|
||||||
BitmapFactory.decodeFile(path, this)
|
BitmapFactory.decodeFile(path, this)
|
||||||
@ -60,11 +52,7 @@ object BitmapShrinker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
||||||
private fun getInSampleSize(
|
private fun getInSampleSize(options: BitmapFactory.Options, requestedWidth: Int, requestedHeight: Int): Int {
|
||||||
options: BitmapFactory.Options,
|
|
||||||
requestedWidth: Int,
|
|
||||||
requestedHeight: Int
|
|
||||||
): Int {
|
|
||||||
val (height: Int, width: Int) = options.run { outHeight to outWidth }
|
val (height: Int, width: Int) = options.run { outHeight to outWidth }
|
||||||
var inSampleSize = 1
|
var inSampleSize = 1
|
||||||
if (height > requestedHeight || width > requestedWidth) {
|
if (height > requestedHeight || width > requestedWidth) {
|
||||||
|
@ -73,10 +73,7 @@ import java.util.concurrent.ExecutionException
|
|||||||
*/
|
*/
|
||||||
class FileViewerUtils(private val context: Context, private val user: User) {
|
class FileViewerUtils(private val context: Context, private val user: User) {
|
||||||
|
|
||||||
fun openFile(
|
fun openFile(message: ChatMessage, progressUi: ProgressUi) {
|
||||||
message: ChatMessage,
|
|
||||||
progressUi: ProgressUi
|
|
||||||
) {
|
|
||||||
val fileName = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_NAME]!!
|
val fileName = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_NAME]!!
|
||||||
val mimetype = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_MIMETYPE]!!
|
val mimetype = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_MIMETYPE]!!
|
||||||
val link = message.selectedIndividualHashMap!!["link"]!!
|
val link = message.selectedIndividualHashMap!!["link"]!!
|
||||||
|
@ -102,10 +102,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createCallsNotificationChannel(
|
private fun createCallsNotificationChannel(context: Context, appPreferences: AppPreferences) {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
) {
|
|
||||||
val audioAttributes =
|
val audioAttributes =
|
||||||
AudioAttributes.Builder()
|
AudioAttributes.Builder()
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
@ -126,10 +123,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createMessagesNotificationChannel(
|
private fun createMessagesNotificationChannel(context: Context, appPreferences: AppPreferences) {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
) {
|
|
||||||
val audioAttributes =
|
val audioAttributes =
|
||||||
AudioAttributes.Builder()
|
AudioAttributes.Builder()
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
@ -150,9 +144,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createUploadsNotificationChannel(
|
private fun createUploadsNotificationChannel(context: Context) {
|
||||||
context: Context
|
|
||||||
) {
|
|
||||||
createNotificationChannel(
|
createNotificationChannel(
|
||||||
context,
|
context,
|
||||||
Channel(
|
Channel(
|
||||||
@ -166,10 +158,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun registerNotificationChannels(
|
fun registerNotificationChannels(context: Context, appPreferences: AppPreferences) {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
) {
|
|
||||||
createCallsNotificationChannel(context, appPreferences)
|
createCallsNotificationChannel(context, appPreferences)
|
||||||
createMessagesNotificationChannel(context, appPreferences)
|
createMessagesNotificationChannel(context, appPreferences)
|
||||||
createUploadsNotificationChannel(context)
|
createUploadsNotificationChannel(context)
|
||||||
@ -197,10 +186,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.O)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
private fun getNotificationChannel(
|
private fun getNotificationChannel(context: Context, channelId: String): NotificationChannel? {
|
||||||
context: Context,
|
|
||||||
channelId: String
|
|
||||||
): NotificationChannel? {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
return notificationManager.getNotificationChannel(channelId)
|
return notificationManager.getNotificationChannel(channelId)
|
||||||
@ -275,10 +261,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isNotificationVisible(
|
fun isNotificationVisible(context: Context?, notificationId: Int): Boolean {
|
||||||
context: Context?,
|
|
||||||
notificationId: Int
|
|
||||||
): Boolean {
|
|
||||||
var isVisible = false
|
var isVisible = false
|
||||||
|
|
||||||
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
@ -319,10 +302,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCallRingtoneUri(
|
fun getCallRingtoneUri(context: Context, appPreferences: AppPreferences): Uri? {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
): Uri? {
|
|
||||||
return getRingtoneUri(
|
return getRingtoneUri(
|
||||||
context,
|
context,
|
||||||
appPreferences.callRingtoneUri,
|
appPreferences.callRingtoneUri,
|
||||||
@ -331,10 +311,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMessageRingtoneUri(
|
fun getMessageRingtoneUri(context: Context, appPreferences: AppPreferences): Uri? {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
): Uri? {
|
|
||||||
return getRingtoneUri(
|
return getRingtoneUri(
|
||||||
context,
|
context,
|
||||||
appPreferences.messageRingtoneUri,
|
appPreferences.messageRingtoneUri,
|
||||||
|
@ -31,11 +31,7 @@ import io.reactivex.schedulers.Schedulers
|
|||||||
object RemoteFileUtils {
|
object RemoteFileUtils {
|
||||||
private val TAG = RemoteFileUtils::class.java.simpleName
|
private val TAG = RemoteFileUtils::class.java.simpleName
|
||||||
|
|
||||||
fun getNewPathIfFileExists(
|
fun getNewPathIfFileExists(ncApi: NcApi, currentUser: User, remotePath: String): String {
|
||||||
ncApi: NcApi,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String
|
|
||||||
): String {
|
|
||||||
var finalPath = remotePath
|
var finalPath = remotePath
|
||||||
val fileExists = doesFileExist(
|
val fileExists = doesFileExist(
|
||||||
ncApi,
|
ncApi,
|
||||||
@ -53,11 +49,7 @@ object RemoteFileUtils {
|
|||||||
return finalPath
|
return finalPath
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doesFileExist(
|
private fun doesFileExist(ncApi: NcApi, currentUser: User, remotePath: String): Observable<Boolean> {
|
||||||
ncApi: NcApi,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String
|
|
||||||
): Observable<Boolean> {
|
|
||||||
return ncApi.checkIfFileExists(
|
return ncApi.checkIfFileExists(
|
||||||
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
||||||
ApiUtils.getUrlForFileUpload(
|
ApiUtils.getUrlForFileUpload(
|
||||||
@ -72,11 +64,7 @@ object RemoteFileUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFileNameWithoutCollision(
|
private fun getFileNameWithoutCollision(ncApi: NcApi, currentUser: User, remotePath: String): String {
|
||||||
ncApi: NcApi,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String
|
|
||||||
): String {
|
|
||||||
val extPos = remotePath.lastIndexOf('.')
|
val extPos = remotePath.lastIndexOf('.')
|
||||||
var suffix: String
|
var suffix: String
|
||||||
var extension = ""
|
var extension = ""
|
||||||
|
@ -25,11 +25,7 @@ import com.nextcloud.talk.data.user.model.User
|
|||||||
import com.nextcloud.talk.models.json.conversations.Conversation
|
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||||
|
|
||||||
object ShareUtils {
|
object ShareUtils {
|
||||||
fun getStringForIntent(
|
fun getStringForIntent(context: Context, user: User, conversation: Conversation?): String {
|
||||||
context: Context,
|
|
||||||
user: User,
|
|
||||||
conversation: Conversation?
|
|
||||||
): String {
|
|
||||||
return String.format(
|
return String.format(
|
||||||
context.resources.getString(R.string.nc_share_text),
|
context.resources.getString(R.string.nc_share_text),
|
||||||
user.baseUrl,
|
user.baseUrl,
|
||||||
|
@ -65,13 +65,7 @@ open class BetterImageSpan @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* Returns the width of the image span and increases the height if font metrics are available.
|
* Returns the width of the image span and increases the height if font metrics are available.
|
||||||
*/
|
*/
|
||||||
override fun getSize(
|
override fun getSize(paint: Paint, text: CharSequence, start: Int, end: Int, fontMetrics: FontMetricsInt?): Int {
|
||||||
paint: Paint,
|
|
||||||
text: CharSequence,
|
|
||||||
start: Int,
|
|
||||||
end: Int,
|
|
||||||
fontMetrics: FontMetricsInt?
|
|
||||||
): Int {
|
|
||||||
updateBounds()
|
updateBounds()
|
||||||
if (fontMetrics == null) {
|
if (fontMetrics == null) {
|
||||||
return mWidth
|
return mWidth
|
||||||
|
Loading…
Reference in New Issue
Block a user