From 54fd89ac1446d1adf8a5d21aa9c77292f69eb8cf Mon Sep 17 00:00:00 2001 From: Fahrian Afdholi <89321009+fchrgrib@users.noreply.github.com> Date: Sun, 17 Mar 2024 10:18:06 +0700 Subject: [PATCH] refactor: delete duplicate fragment --- .../page/transactions/TransactionViewModel.kt | 26 ------ .../page/transactions/TransactionsFragment.kt | 20 ---- .../main/res/layout/fragment_transactions.xml | 91 ------------------- 3 files changed, 137 deletions(-) delete mode 100644 app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionViewModel.kt delete mode 100644 app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionsFragment.kt delete mode 100644 app/src/main/res/layout/fragment_transactions.xml diff --git a/app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionViewModel.kt b/app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionViewModel.kt deleted file mode 100644 index 1ea6b60..0000000 --- a/app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionViewModel.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.transactionapp.ui.page.transactions - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class TransactionViewModel : ViewModel() { - - // Balance amount - private val _balance = MutableLiveData<Int>() - var balance: LiveData<Int> - get() = _balance - set(value) {_balance} - - // Cashflow amount - private val _cashflow = MutableLiveData<Int>() - var cashflow: LiveData<Int> - get() = _cashflow - set(value) {_cashflow} - - // Growth amount - private val _growth = MutableLiveData<Float>() - var growth: LiveData<Float> - get() = _growth - set(value) {_growth} -} \ No newline at end of file diff --git a/app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionsFragment.kt b/app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionsFragment.kt deleted file mode 100644 index de63513..0000000 --- a/app/src/main/java/com/example/transactionapp/ui/page/transactions/TransactionsFragment.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.transactionapp.ui.page.transactions - -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import com.example.transactionapp.databinding.FragmentTransactionsBinding - -class TransactionsFragment : Fragment() { - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View { - // Inflate the layout for this fragment - val binding = FragmentTransactionsBinding.inflate(inflater) - return binding.root - } -} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_transactions.xml b/app/src/main/res/layout/fragment_transactions.xml deleted file mode 100644 index 12c71ad..0000000 --- a/app/src/main/res/layout/fragment_transactions.xml +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<layout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - xmlns:app="http://schemas.android.com/apk/res-auto" - tools:context=".ui.page.transactions.TransactionsFragment"> - - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:theme="@style/Theme.TransactionApp"> - - <!-- Balance --> - <TextView - android:id="@+id/TvBalanceAmount" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintEnd_toEndOf="parent" - android:layout_marginTop="24dp" - style="@style/Display1" - android:text="@string/balance_amount" - android:textColor="?attr/colorSecondary" /> - - <TextView - android:id="@+id/TvYourBalance" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/TvBalanceAmount" - app:layout_constraintEnd_toEndOf="parent" - android:layout_marginTop="-10dp" - style="@style/Label" - android:text="@string/your_balance" - android:textColor="?attr/colorSecondaryVariant" /> - - <!-- Cashflow --> - <TextView - android:id="@+id/TvCashflow" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/TvYourBalance" - android:layout_marginStart="20dp" - android:layout_marginTop="24dp" - style="@style/Label" - android:text="@string/cashflow" - android:textAlignment="textStart" - android:textColor="?attr/colorSecondaryVariant" /> - - <TextView - android:id="@+id/TvCashflowAmount" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="@+id/TvCashflow" - app:layout_constraintTop_toBottomOf="@+id/TvCashflow" - style="@style/Display3" - android:text="@string/cashflow_amount" - android:textAlignment="textStart" - android:textColor="?attr/colorAccent" /> - - <!-- Growth --> - <TextView - android:id="@+id/TvGrowth" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@+id/TvYourBalance" - android:layout_marginTop="24dp" - android:layout_marginEnd="20dp" - style="@style/Label" - android:text="@string/growth" - android:textAlignment="textEnd" - android:textColor="?attr/colorSecondaryVariant" /> - - <TextView - android:id="@+id/TvGrowthPercentage" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:layout_constraintEnd_toEndOf="@+id/TvGrowth" - app:layout_constraintTop_toBottomOf="@+id/TvGrowth" - style="@style/Display3" - android:text="@string/growth_percentage" - android:textAlignment="textEnd" - android:textColor="?attr/colorAccent" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - - - -</layout> \ No newline at end of file -- GitLab