Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

55 changes: 46 additions & 9 deletions .idea/misc.xml

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

4 changes: 1 addition & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'androidx.navigation.safeargs'
id 'kotlin-parcelize'


}

android {
Expand Down Expand Up @@ -74,9 +75,6 @@ dependencies {
//bar chart
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

//lotti
implementation "com.airbnb.android:lottie:3.7.1"


//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.serdar.budges">
<uses-permission android:name="android.permission.INTERNET">

</uses-permission>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/playicon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@drawable/raundicon"
android:supportsRtl="true"
android:theme="@style/Theme.Budges"
android:usesCleartextTraffic="true"
tools:targetApi="31">


<activity
android:name=".ui.splash.HomeActivity"
android:exported="false" />
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/com/serdar/budges/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package com.serdar.budges

import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.serdar.budges.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
Expand Down
30 changes: 21 additions & 9 deletions app/src/main/java/com/serdar/budges/adapter/BudgesAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import androidx.navigation.findNavController
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -21,11 +22,12 @@ class BudgesAdapter :
val transactions = view.findViewById<TextView>(R.id.transaction)
val amount = view.findViewById<TextView>(R.id.amount)
val amountView = view.findViewById<ImageView>(R.id.amountView)
val card = view.findViewById<CardView>(R.id.delete)

fun bind(transaction: Transaction) {
transactions.setText(transaction.transaction.toString())
amount.setText(transaction.amount.toString())
desc.setText(transaction.description.toString())
transactions.text = transaction.transaction.toString()
amount.text = transaction.amount.toString()
desc.text = transaction.description.toString()

}
}
Expand All @@ -34,33 +36,43 @@ class BudgesAdapter :

val view =
LayoutInflater.from(parent.context).inflate(R.layout.transaction_item, parent, false)

return TransactionHolder(view)
}

override fun onBindViewHolder(holder: TransactionHolder, position: Int) {
val transaction = transactionList[position]
holder.bind(transaction)
holder.itemView.setOnClickListener {
val action = HomeFragmentDirections.actionNavigationHomeToUpdateFragment(transaction)
holder.itemView.findNavController().navigate(action)


holder.card.setOnClickListener {
val action = HomeFragmentDirections.actionNavigationHomeToBalanceDialog(transaction)
holder.card.findNavController().navigate(action)


}


val context = holder.amount.context

if (transaction.amount >= 0) {
if (transaction.incomeExpenseType == "INCOME") {
holder.amount.text = "+$%.2f".format(transaction.amount)
holder.amount.setTextColor(ContextCompat.getColor(context, R.color.green))
holder.amountView.setImageResource(R.drawable.profits)
holder.amountView.setImageResource(R.drawable.incomeline)
holder.desc.setTextColor(ContextCompat.getColor(context, R.color.green))


} else {
holder.amount.text = "-$%.2f".format(Math.abs(transaction.amount))
holder.amount.setTextColor(ContextCompat.getColor(context, R.color.red))
holder.amountView.setImageResource(R.drawable.expansion)
holder.amountView.setImageResource(R.drawable.expensesline)
holder.desc.setTextColor(ContextCompat.getColor(context, R.color.red))

}
holder.transactions.text = transaction.transaction



}


Expand Down
36 changes: 24 additions & 12 deletions app/src/main/java/com/serdar/budges/adapter/CryptoAdapter.kt
Original file line number Diff line number Diff line change
@@ -1,54 +1,66 @@
package com.serdar.budges.adapter


import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.serdar.budges.R
import com.serdar.budges.data.crypto.Data
import java.math.RoundingMode

class CryptoAdapter:RecyclerView.Adapter<CryptoAdapter.CryptoViewHolder>() {
class CryptoAdapter : RecyclerView.Adapter<CryptoAdapter.CryptoViewHolder>() {

private var myList = emptyList<Data>()

inner class CryptoViewHolder(itemview: View):RecyclerView.ViewHolder(itemview){
inner class CryptoViewHolder(itemview: View) : RecyclerView.ViewHolder(itemview) {
val symbol = itemview.findViewById<TextView>(R.id.symbol)
val price = itemview.findViewById<TextView>(R.id.price)
val macap = itemview.findViewById<TextView>(R.id.maCap)
val name = itemview.findViewById<TextView>(R.id.currency)
val where = itemview.findViewById<ImageView>(R.id.where)
val graph = itemview.findViewById<ImageView>(R.id.graphic)

}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CryptoViewHolder {
return CryptoViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.crypto_layout,parent,false))
return CryptoViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.crypto_layout, parent, false)
)
}

override fun onBindViewHolder(holder: CryptoViewHolder, position: Int) {
holder.symbol.text=myList[position].symbol.toString()
holder.name.text=myList[position].name.toString()
holder.symbol.text = myList[position].symbol.toString()
holder.name.text = myList[position].name.toString()
val context = holder.macap.context
holder.price.text=myList[position].priceUsd.toString()
holder.price.text=myList[position].priceUsd.toBigDecimal().setScale(1, RoundingMode.UP).toString()
holder.macap.text=myList[position].changePercent24Hr.toBigDecimal().setScale(1,RoundingMode.UP).toString()
if (myList[position].changePercent24Hr> 0.toString()){
holder.price.text = myList[position].priceUsd.toString()
holder.price.text =
myList[position].priceUsd.toBigDecimal().setScale(1, RoundingMode.UP).toString()
holder.macap.text =
myList[position].changePercent24Hr.toBigDecimal().setScale(1, RoundingMode.UP).toString()
if (myList[position].changePercent24Hr > 0.toString()) {
holder.macap.setTextColor(ContextCompat.getColor(context, R.color.green))
holder.where.setImageResource(R.drawable.up)
}else{
holder.graph.setImageResource(R.drawable.ups)

} else {
holder.macap.setTextColor(ContextCompat.getColor(context, R.color.red))
holder.where.setImageResource(R.drawable.down)
holder.graph.setImageResource(R.drawable.downs)
}
}

override fun getItemCount(): Int {
return myList.size
}
fun setData(newList: List<Data>){
myList= newList

fun setData(newList: List<Data>) {
myList = newList
notifyDataSetChanged()

}
Expand Down
59 changes: 59 additions & 0 deletions app/src/main/java/com/serdar/budges/adapter/ExpenseAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.serdar.budges.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.serdar.budges.R
import com.serdar.budges.data.transaction.Transaction

class ExpenseAdapter : RecyclerView.Adapter<ExpenseAdapter.TransactionHolder>() {
private var transactionList = emptyList<Transaction>()

class TransactionHolder(view: View) : RecyclerView.ViewHolder(view) {
val desc = view.findViewById<TextView>(R.id.descExpanse)
val transactions = view.findViewById<TextView>(R.id.transactionExpanse)
val amount = view.findViewById<TextView>(R.id.amountExpanse)
val amountView = view.findViewById<ImageView>(R.id.amountViewExpanse)

fun bind(transaction: Transaction) {
transactions.text = transaction.transaction.toString()
amount.text = transaction.amount.toString()
desc.text = transaction.description.toString()

}

}


override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): ExpenseAdapter.TransactionHolder {
val view =
LayoutInflater.from(parent.context).inflate(R.layout.expanse_item, parent, false)

return ExpenseAdapter.TransactionHolder(view)
}

override fun onBindViewHolder(holder: ExpenseAdapter.TransactionHolder, position: Int) {
val transaction = transactionList[position]
holder.bind(transaction)
val context = holder.amount.context
holder.amount.text = "-$%.2f".format(transaction.amount)
holder.amount.setTextColor(ContextCompat.getColor(context, R.color.red))
holder.amountView.setImageResource(R.drawable.expensesline)
}

override fun getItemCount(): Int {
return transactionList.size
}

fun setExpanse(transactionList: List<Transaction>) {
this.transactionList = transactionList
notifyDataSetChanged()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class HomeCryptoAdapter : RecyclerView.Adapter<HomeCryptoAdapter.HomeViewHolder>
holder.price.text = dataList[position].priceUsd.toString()
holder.price.text =
dataList[position].priceUsd.toBigDecimal().setScale(1, RoundingMode.UP).toString()
holder.price.text = "$%.2f".format(dataList[position].priceUsd.toDouble())

when (dataList[position].symbol) {

Expand Down
Loading