This commit is contained in:
s452641 2021-11-25 02:47:31 +01:00
parent cc7f3fbfef
commit c7df29ffa5
7 changed files with 38 additions and 17 deletions

View File

@ -16,6 +16,11 @@
<entry key="..\:/Android Projects/TaskListA3/app/src/main/res/layout/fragment_set_pass.xml" value="0.2109375" />
<entry key="..\:/Android Projects/TaskListA3/app/src/main/res/layout/fragment_task_list.xml" value="0.2210144927536232" />
<entry key="..\:/Android Projects/TaskListA3/app/src/main/res/layout/item_task.xml" value="0.2210144927536232" />
<entry key="..\:/Android Projects/TaskListA5/app/src/main/res/layout/fragment_items.xml" value="0.20520833333333333" />
<entry key="..\:/Android Projects/TaskListA5/app/src/main/res/layout/fragment_login_page.xml" value="0.20520833333333333" />
<entry key="..\:/Android Projects/TaskListA5/app/src/main/res/layout/fragment_task_list.xml" value="0.2210144927536232" />
<entry key="..\:/Android Projects/TaskListA5/app/src/main/res/layout/item_task.xml" value="0.2210144927536232" />
<entry key="..\:/Android Projects/TaskListA5/app/src/main/res/layout/items.xml" value="0.20520833333333333" />
<entry key="..\:/AndroidStudio/TaskListA/app/src/main/res/drawable/bordershape.xml" value="0.22135416666666666" />
<entry key="..\:/AndroidStudio/TaskListA/app/src/main/res/layout/activity_login_page.xml" value="0.20520833333333333" />
<entry key="..\:/AndroidStudio/TaskListA/app/src/main/res/layout/fragment_activity_login_page.xml" value="0.2682291666666667" />

View File

@ -5,10 +5,12 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.example.tasklist.data.DataSource
import com.example.tasklist.data.Database
import com.example.tasklist.data.Task
import com.example.tasklist.databinding.FragmentAddingTasksBinding

View File

@ -3,4 +3,5 @@ package com.example.tasklist.data
data class Task(
var name: String,
var date: String
)

View File

@ -52,7 +52,7 @@ class TaskDao {
DataSource.zadanie.addAll(readedData)
}
private fun loadListFromSharedPreferneces(
fun loadListFromSharedPreferneces(
context: Context,
sharedPreferencesTag: String
): List<Task> {

View File

@ -1,13 +0,0 @@
package com.example.tasklist
import android.os.Build
import androidx.annotation.RequiresApi
class itemOnDis {
@RequiresApi(Build.VERSION_CODES.O)
fun encryptedToStr(str:String):String{
val crypting = ChCrypto
val taskCrypred = crypting.aesDecrypt(str)
return taskCrypred
}
}

View File

@ -1,20 +1,26 @@
package com.example.tasklist.ui.choose.list
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import com.example.tasklist.ChCrypto
import com.example.tasklist.MainApplication
import com.example.tasklist.R
import com.example.tasklist.data.DataSource
import com.example.tasklist.data.Database
import com.example.tasklist.data.Repository
import com.example.tasklist.data.Task
import com.example.tasklist.data.dao.TaskDao
import com.example.tasklist.databinding.FragmentTaskListBinding
import com.example.tasklist.ui.adapters.TaskAdapter
import com.example.tasklist.ui.adapters.TaskItemClickListener
@ -30,9 +36,12 @@ class TaskListFragment : Fragment(), TaskItemClickListener {
val sharedViewModel : TaskListViewModel by activityViewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
@RequiresApi(Build.VERSION_CODES.O)
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@ -45,7 +54,6 @@ class TaskListFragment : Fragment(), TaskItemClickListener {
mAdapter.submitList(Repository.getAllTasks().value)
binding.recyclerView.adapter = mAdapter
binding.fragment = this@TaskListFragment
subscribeUi(mAdapter, binding)
return binding.root
@ -56,9 +64,23 @@ class TaskListFragment : Fragment(), TaskItemClickListener {
newAdapter.notifyDataSetChanged()
}
@RequiresApi(Build.VERSION_CODES.O)
override fun chooseTask(task: Task) {
val taskToast = Toast.makeText(activity, "Zostało wybrane zadanie ${task.name}", Toast.LENGTH_LONG)
val crypting = ChCrypto
val taskCrypred = crypting.aesDecrypt(task.name)
val taskToast = Toast.makeText(activity, "Zostało wybrane zadanie $taskCrypred", Toast.LENGTH_LONG)
taskToast.show()
// val taskToast = Toast.makeText(activity, "Zostało wybrane zadanie ${task.name}", Toast.LENGTH_LONG)
}
@SuppressLint("ShowToast")
@RequiresApi(Build.VERSION_CODES.O)
fun decryptTasks(task: Task): String {
val crypting = ChCrypto
val taskDeCrypred = crypting.aesDecrypt(task.name)
val taskToast = Toast.makeText(activity,taskDeCrypred, Toast.LENGTH_LONG)
taskToast.show()
return taskDeCrypred
}
fun addTask(){

View File

@ -13,6 +13,10 @@
<variable
name="crypto"
type="com.example.tasklist.ChCrypto" />
<variable
name="tlf"
type="com.example.tasklist.ui.choose.list.TaskListFragment" />
@ -26,7 +30,7 @@
android:id="@+id/checkBox_task"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@{task.name + "\n" + task.date}'
android:text='@{tlf.decryptTasks(task) + "\n" + task.date}'
android:onClick="@{() -> clickListener.chooseTask(task)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"