# PermissionViewModel

class PermissionViewModel(application: Application) : AndroidViewModel
Content copied to clipboard

View model for managing permission fragments data.

## Constructors

PermissionViewModel
Link copied to clipboard
fun PermissionViewModel(application: Application)
Content copied to clipboard

## Types

PermissionVMInit
Link copied to clipboard
data class PermissionVMInit(serverAddress: String, theoryText: String, permissionType: String, permissionText: String)
Content copied to clipboard

## Properties

_exampleButtonEnable
Link copied to clipboard
private var _exampleButtonEnable: MutableLiveData<Boolean>
Content copied to clipboard
_progressBarTextViewVisibility
Link copied to clipboard
private var _progressBarTextViewVisibility: MutableLiveData<Int>
Content copied to clipboard
_progressBarVisibility
Link copied to clipboard
private var _progressBarVisibility: MutableLiveData<Int>
Content copied to clipboard
_successServerCommunication
Link copied to clipboard
private var _successServerCommunication: MutableLiveData<String>
Content copied to clipboard
communicationService
Link copied to clipboard
private val communicationService: CommunicationService
Content copied to clipboard
dataIsSent
Link copied to clipboard
private var dataIsSent: Boolean
Content copied to clipboard
error
Link copied to clipboard
private val error: String
Content copied to clipboard
exampleButtonEnable
Link copied to clipboard
val exampleButtonEnable: LiveData<Boolean>
Content copied to clipboard
ok
Link copied to clipboard
private val ok: String
Content copied to clipboard
permissionFunction
Link copied to clipboard
private val permissionFunction: PermissionFunction
Content copied to clipboard
permissionId
Link copied to clipboard
private var permissionId: Int
Content copied to clipboard
photo
Link copied to clipboard
private var photo: Bitmap? = null
Content copied to clipboard
progressBarTextViewVisibility
Link copied to clipboard
var progressBarTextViewVisibility: LiveData<Int>
Content copied to clipboard
progressBarVisibility
Link copied to clipboard
var progressBarVisibility: LiveData<Int>
Content copied to clipboard
sharedPreferences
Link copied to clipboard
private val sharedPreferences: SettingsSharedPreferences
Content copied to clipboard
successServerCommunication
Link copied to clipboard
val successServerCommunication: LiveData<String>
Content copied to clipboard
userCreatedInServer
Link copied to clipboard
private var userCreatedInServer: Boolean
Content copied to clipboard
volleyAddDataToServerResponse
Link copied to clipboard
private val volleyAddDataToServerResponse: PermissionViewModel.<no name provided>
Content copied to clipboard
waiting
Link copied to clipboard
private val waiting: String
Content copied to clipboard

## Inherited properties

mApplication
Link copied to clipboard
private val mApplication: Application
Content copied to clipboard
mBagOfTags
Link copied to clipboard
@Nullable
private val mBagOfTags: MutableMap<String, Any>?
Content copied to clipboard
mCleared
Link copied to clipboard
private val mCleared: Boolean
Content copied to clipboard

## Functions

addPermissionTypeToServer
Link copied to clipboard
private fun addPermissionTypeToServer(activity: Activity, context: Context)
Content copied to clipboard

Create table for user permission data in server.

createUserInServer
Link copied to clipboard
private fun createUserInServer(activity: Activity, context: Context)
Content copied to clipboard

Create user account in server.

deleteUserInServer
Link copied to clipboard
fun deleteUserInServer()
Content copied to clipboard

Delete user account and all users data in server.

deleteUserInServerProtect
Link copied to clipboard
fun deleteUserInServerProtect()
Content copied to clipboard

Delete user account and all users data in server - protect from bugs, when OS Android force terminate app.

deleteUserTableInServer
Link copied to clipboard
fun deleteUserTableInServer()
Content copied to clipboard

Delete table for user permission data in server.

getDataIsSend
Link copied to clipboard
fun getDataIsSend(): Boolean
Content copied to clipboard
getPermissionID
Link copied to clipboard
fun getPermissionID(): Int
Content copied to clipboard
getPhoto
Link copied to clipboard
fun getPhoto(): Bitmap?
Content copied to clipboard
initPermissionTexts
Link copied to clipboard
fun initPermissionTexts(context: Context): PermissionViewModel.PermissionVMInit
Content copied to clipboard

Initialize variables in permission theory fragment based on permission ID.

onCleared
Link copied to clipboard
protected open override fun onCleared()
Content copied to clipboard

When ViewModel is cleared, save UserCreated state.

progressBarOn
Link copied to clipboard
private fun progressBarOn(visible: Boolean)
Content copied to clipboard

Function set the visibility of "connecting to server" progress bar.

saveDataIsSend
Link copied to clipboard
fun saveDataIsSend(newDataIsSend: Boolean)
Content copied to clipboard
savePhoto
Link copied to clipboard
fun savePhoto(newPhoto: Bitmap)
Content copied to clipboard
sendDataToServer
Link copied to clipboard
fun sendDataToServer(activity: Activity, context: Context)
Content copied to clipboard

Start the send data flow to server for permission data.

sendPermissionDataToServer
Link copied to clipboard
fun sendPermissionDataToServer(cameraPhoto: Bitmap)
Content copied to clipboard

Send permission data to server - only for camera permission.

private fun sendPermissionDataToServer(activity: Activity, context: Context)
Content copied to clipboard

Send permission data to server based on permission ID.

setPermissionID
Link copied to clipboard
fun setPermissionID(newPermissionId: Int)
Content copied to clipboard

## Inherited functions

clear
Link copied to clipboard
@MainThread
fun clear()
Content copied to clipboard
getApplication
Link copied to clipboard
@NonNull
open fun <T : Application> getApplication(): T
Content copied to clipboard
getTag
Link copied to clipboard
open fun <T : Any> getTag(p0: String): T
Content copied to clipboard
setTagIfAbsent
Link copied to clipboard
open fun <T : Any> setTagIfAbsent(p0: String, p1: T): T
Content copied to clipboard