Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3b44b9b
Terminei as duas aulas: 12 e 13
alanliongar Jul 4, 2024
2955bdd
Terminei as duas aulas: 12 e 13
alanliongar Jul 5, 2024
4dcbfbd
Terminei as duas aulas: 12 e 13
alanliongar Jul 5, 2024
cc6fb81
Terminei a aula: 15
alanliongar Jul 5, 2024
aa03392
Terminei a aula: 15
alanliongar Jul 5, 2024
5b4af7c
Terminei a aula: 15
alanliongar Jul 9, 2024
0b9a037
Terminei a aula: 15
alanliongar Jul 9, 2024
80da605
Terminei a aula: 15
alanliongar Jul 9, 2024
18b8b3a
Terminei as duas aulas: 12 e 13
alanliongar Jul 4, 2024
87708af
Terminei as duas aulas: 12 e 13
alanliongar Jul 5, 2024
09cda52
Terminei as duas aulas: 12 e 13
alanliongar Jul 5, 2024
0b17484
Terminei a aula: 15
alanliongar Jul 5, 2024
09c48b5
Terminei a aula: 15
alanliongar Jul 5, 2024
b2113bb
Terminei a aula: 15
alanliongar Jul 9, 2024
1e545e9
Terminei a aula: 15
alanliongar Jul 9, 2024
77a6f7f
Terminei a aula: 15
alanliongar Jul 9, 2024
98266c4
Merge remote-tracking branch 'origin/aula-16' into aula-16
alanliongar Jul 9, 2024
084cfd9
Terminei a aula: 16 com uma observação:
alanliongar Jul 9, 2024
568733b
Terminei a aula: 17 - deletando apenas a categoria.
alanliongar Jul 10, 2024
86e76e3
Terminei a aula: 18 - deletando apenas a categoria - detalhamento: cr…
alanliongar Jul 10, 2024
8a69648
Terminei a aula: 19 - nela aprendemos a relacionar as tabelas criando…
alanliongar Jul 10, 2024
7554db8
Terminei a aula: 19 - nela aprendemos a relacionar as tabelas criando…
alanliongar Jul 10, 2024
2a166db
Terminei a aula: 20 - nela eu tive uma grande dor de cabeça, coloquei…
alanliongar Jul 10, 2024
4a70057
Terminei a aula: 20 - nela eu tive uma grande dor de cabeça, coloquei…
alanliongar Jul 10, 2024
c88e4f8
Terminei a aula: 21 - nela aprendi a fazer o filtro diretamente fazen…
alanliongar Jul 11, 2024
15f5d0e
Terminei a aula: 22 - só colocamos uma condicional para o "all" não t…
alanliongar Jul 11, 2024
d66dc00
Terminei a aula: 22 - só colocamos uma condicional para o "all" não t…
alanliongar Jul 11, 2024
dcc68b8
Terminei a aula: 23 - eu aprendi aqui, a incluir a categoria "select"…
alanliongar Jul 11, 2024
fe9fdf3
Terminei a aula: 24 - mexemos no estado de "vazio".
alanliongar Jul 11, 2024
21509fb
Terminei a aula: 24 - extra - ajuste no item do spinner, dei um peque…
alanliongar Jul 12, 2024
eeca816
Add files via upload
alanliongar Aug 16, 2024
e82c225
Create README.md
alanliongar Aug 16, 2024
fffe5ec
Aqui eu fiz algumas alterações:
alanliongar Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 66 additions & 11 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Taskbeats
Esse projeto é um aplicativo android nativo, desenvolvido com a linguagem de programação Kotlin, tem como principal funcionalidade ajudar o usuário a fazer uma gestão de tarefas.

## :camera_flash: Screenshots
<p float="left">
<img src="https://github.com/alanliongar/taskbeats_00/blob/main/Taskbeat01.png" width="200" />
<img src="https://github.com/alanliongar/taskbeats_00/blob/main/Taskbeat02.png" width="200" />
<img src="https://github.com/alanliongar/taskbeats_00/blob/main/Taskbeat03.png" width="200" />
<img src="https://github.com/alanliongar/taskbeats_00/blob/main/Taskbeat04.png" width="200" />
</p>

## Tecnologias
- Activity
- Snackbar
- Room Database
- Bottom Sheet
- ViewGroups
- LinearLayout
- ConstraintLayout
- Views
- ImageView
- Recyclerview
- TextView
- EditText
- Button

## License
```
The MIT License (MIT)

Copyright (c) 2024 Alan Lucindo Gomes

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
Binary file added Taskbeat01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Taskbeat02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Taskbeat03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Taskbeat04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions app/src/main/java/com/devspace/taskbeats/CategoryDao.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.devspace.taskbeats

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
Expand All @@ -11,11 +12,14 @@ interface CategoryDao {
@Query("Select * From categoryentity")
fun getAll(): List<CategoryEntity>

@Insert(onConflict = OnConflictStrategy.REPLACE)
@Insert(onConflict = OnConflictStrategy.IGNORE)
fun insetAll(categoryEntity: List<CategoryEntity>) //removemos o vararg e usamos a lista
//mesmo com a documentação dizendo pra usar vararg e nao usar lista.

@Insert(onConflict = OnConflictStrategy.REPLACE)
@Insert(onConflict = OnConflictStrategy.IGNORE)
fun inset(categoryEntity: CategoryEntity)

@Delete
fun delete(categoryEntity: CategoryEntity)

}
15 changes: 13 additions & 2 deletions app/src/main/java/com/devspace/taskbeats/CategoryListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ class CategoryListAdapter :
ListAdapter<CategoryUiData, CategoryListAdapter.CategoryViewHolder>(CategoryListAdapter) {

private var onClick: (CategoryUiData) -> Unit = {} //optei por inicializar SEMPRE, por padrão, como uma função VAZIA, pra nao dar crash caso eu nao inicialize
private lateinit var onLongClick: (CategoryUiData) -> Unit

fun setOnClickListener(onClick: (CategoryUiData) -> Unit) {
this.onClick = onClick
}

fun setOnLongClickListener(onLongClick: (CategoryUiData) -> Unit){
this.onLongClick = onLongClick
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CategoryViewHolder {
val view =
LayoutInflater.from(parent.context).inflate(R.layout.item_category, parent, false)
Expand All @@ -25,19 +30,25 @@ class CategoryListAdapter :

override fun onBindViewHolder(holder: CategoryViewHolder, position: Int) {
val category = getItem(position)
holder.bind(category, onClick)
holder.bind(category, onClick, onLongClick)
}

class CategoryViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
private val tvCategory = view.findViewById<TextView>(R.id.tv_category)

fun bind(category: CategoryUiData, onClick: (CategoryUiData) -> Unit) {
fun bind(category: CategoryUiData, onClick: (CategoryUiData) -> Unit, onLongClick: (CategoryUiData) -> Unit) {
tvCategory.text = category.name
tvCategory.isSelected = category.isSelected

view.setOnClickListener {
onClick.invoke(category)
}

view.setOnLongClickListener {
onLongClick.invoke(category)
true
}

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package com.devspace.taskbeats

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.Spinner
import android.widget.TextView
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText

class CreateOrUpdateTaskBottomSheet(
private val categoryList: List<CategoryEntity>, //trocamos de categoryuidata pra categoryentity para pegar a informação do banco, ao invés do que "mostra pro usuário".
private val task: TaskUiData? = null,
private val onCreateClicked: (TaskUiData) -> Unit,
private val onUpdateClicked: (TaskUiData) -> Unit,
private val onDeleteClicked: (TaskUiData) -> Unit
) : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.create_or_update_task_bottom_sheet, container, false)
val btnCreateOrUpdate = view.findViewById<Button>(R.id.btn_task_create_or_update)
val btnDelete = view.findViewById<Button>(R.id.btn_task_delete)
val tvTitle = view.findViewById<TextView>(R.id.tv_title)
val tieTaskName = view.findViewById<TextInputEditText>(R.id.tie_task_name)
val catSpin = view.findViewById<Spinner>(R.id.category_list)
var taskCategory: String? = null
val categoryListTemp = mutableListOf("Select")
categoryListTemp.addAll(categoryList.map { it.name })
val categoryStr: List<String> = categoryListTemp
ArrayAdapter(
requireActivity().baseContext,
R.layout.item_spinner,
categoryStr.toList()
).also { adapter ->
adapter.setDropDownViewResource(R.layout.item_spinner)
catSpin.adapter = adapter
}
catSpin.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(
parent: AdapterView<*>?,
view: View?,
position: Int,
id: Long
) {
taskCategory = categoryStr.get(position)
}

override fun onNothingSelected(parent: AdapterView<*>?) {

}
}



btnCreateOrUpdate.setOnClickListener {
val name = tieTaskName.text.toString().trim()
if (taskCategory != "Select" && name.isNotEmpty()) {
if (task == null) {
onCreateClicked.invoke(
TaskUiData(
id = 0,
name = name,
category = requireNotNull(taskCategory)
)
)
dismiss()
} else {
onUpdateClicked.invoke(
TaskUiData(
id = task.id,
name = name,
category = requireNotNull(taskCategory)
)
)
dismiss()
}


} else {
Snackbar.make(btnCreateOrUpdate, "Please select a category", Snackbar.LENGTH_LONG)
.show()
}
}
if (task == null) {
btnDelete.isVisible = false
tvTitle.setText(R.string.create_task_title)
btnCreateOrUpdate.setText(R.string.create)
} else {
tvTitle.setText(R.string.update_task_title)
btnCreateOrUpdate.setText(R.string.update)
tieTaskName.setText(task.name)
btnDelete.isVisible = true
btnDelete.setOnClickListener {
if (task != null) {
onDeleteClicked.invoke(task)
dismiss()
} else {
Log.d("CreateOrUpdateTaskBottomSheet", "Task not found")
}
}
catSpin.setSelection(categoryStr.indexOf(task.category))
}
return view
}
}
Loading