Skip to content

Commit

Permalink
Rearranged the kotlin files in packages
Browse files Browse the repository at this point in the history
  • Loading branch information
1HazArd1 committed Mar 18, 2022
1 parent f6dd066 commit 1b5793f
Show file tree
Hide file tree
Showing 27 changed files with 395 additions and 216 deletions.
19 changes: 7 additions & 12 deletions .idea/misc.xml

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

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies {
implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
implementation 'com.google.firebase:firebase-firestore-ktx:24.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
android:supportsRtl="true"
android:theme="@style/Theme.Samarpan">
<activity
android:name=".Main2Activity"
android:name=".common.Main2Activity"
android:exported="false" />
<!-- android:theme="@style/splashScreenTheme" -->
<!-- this is the logic for the splash screen place it inside the activity tag -->
<activity
android:name=".MainActivity"
android:name=".common.MainActivity"
android:exported="true"
android:theme="@style/splashScreenTheme">
<intent-filter>
Expand Down
32 changes: 0 additions & 32 deletions app/src/main/java/com/hazard/samarpan/ClothAdapter.kt

This file was deleted.

36 changes: 0 additions & 36 deletions app/src/main/java/com/hazard/samarpan/DashboardFragment.kt

This file was deleted.

32 changes: 32 additions & 0 deletions app/src/main/java/com/hazard/samarpan/adapters/ClothAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.hazard.samarpan.adapters

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.hazard.samarpan.R

class ClothAdapter(private var clothList: ArrayList<Int>) :
RecyclerView.Adapter<ClothAdapter.ViewHolder>() {

override fun getItemCount() = clothList.size

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.clothImage.setImageDrawable(holder.itemView.context.getDrawable(clothList[position]))

}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view: View = LayoutInflater.from(parent.context)
.inflate(R.layout.clothing_item_dashboard, parent, false)
return ViewHolder(view)
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var clothImage: ImageView = itemView.findViewById(R.id.cloth_image)


}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hazard.samarpan
package com.hazard.samarpan.common

import android.content.Intent
import android.os.Bundle
Expand All @@ -14,6 +14,9 @@ import com.google.android.material.textfield.TextInputEditText
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase
import com.hazard.samarpan.ngo.NgoSignup1Fragment
import com.hazard.samarpan.R
import com.hazard.samarpan.user.UserRegisterFragment


class LoginFragment: Fragment() {
Expand Down Expand Up @@ -44,7 +47,7 @@ class LoginFragment: Fragment() {
}

userSignUp?.setOnClickListener {
val userRegistrationPage=UserRegisterFragment()
val userRegistrationPage= UserRegisterFragment()
activity?.supportFragmentManager?.beginTransaction()?.replace(R.id.fragment_container1,userRegistrationPage)
?.commit()
}
Expand Down Expand Up @@ -103,7 +106,7 @@ class LoginFragment: Fragment() {
if (currentUser != null) {
// write logic to send to the main dashboard of the application
activity?.let{
val intent =Intent(it,Main2Activity::class.java)
val intent =Intent(it, Main2Activity::class.java)
startActivity(intent)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.hazard.samarpan
package com.hazard.samarpan.common

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase
import com.hazard.samarpan.R
import com.hazard.samarpan.user.UserDashboardFragment

class Main2Activity : AppCompatActivity() {
// private var btnLogout: Button? =null
Expand All @@ -17,18 +15,18 @@ class Main2Activity : AppCompatActivity() {
addFragment()

//this is just for testing the logout functionality remove this while adding the dashboard fragment
// btnLogout=findViewById(R.id.btnLogout)
//
// btnLogout?.setOnClickListener{
// Firebase.auth.signOut()
// val intent=Intent(this,MainActivity::class.java)
// startActivity(intent)
// finish()
// }
/* btnLogout=findViewById(R.id.btnLogout)
btnLogout?.setOnClickListener{
Firebase.auth.signOut()
val intent=Intent(this,MainActivity::class.java)
startActivity(intent)
finish()
} */

}
private fun addFragment() {
val dashboard=DashboardFragment()
val dashboard= UserDashboardFragment()
supportFragmentManager.beginTransaction().add(R.id.fragment_container2,dashboard).commit()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.hazard.samarpan
package com.hazard.samarpan.common

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.hazard.samarpan.R

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -15,7 +16,7 @@ class MainActivity : AppCompatActivity() {
}

private fun addFragment() {
val userSignInLayout=LoginFragment()
val userSignInLayout= LoginFragment()
supportFragmentManager.beginTransaction().add(R.id.fragment_container1,userSignInLayout).commit()
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.hazard.samarpan
package com.hazard.samarpan.ngo

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.fragment.app.Fragment
import com.hazard.samarpan.R

class NgoSignup1Fragment : Fragment() {

Expand All @@ -21,7 +22,8 @@ class NgoSignup1Fragment : Fragment() {
nextBtn = v.findViewById(R.id.btn_ngosignup1_next)
nextBtn.setOnClickListener {
activity?.supportFragmentManager?.beginTransaction()
?.replace(R.id.fragment_container1,
?.replace(
R.id.fragment_container1,
NgoSignup2Fragment()
)?.addToBackStack(null)?.commit()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hazard.samarpan;
package com.hazard.samarpan.ngo;

import android.os.Bundle;
import android.view.LayoutInflater;
Expand All @@ -11,6 +11,8 @@
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.hazard.samarpan.R;

public class NgoSignup2Fragment extends Fragment {

@Nullable
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/com/hazard/samarpan/user/DonationInfoFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.hazard.samarpan.user

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.hazard.samarpan.R

class DonationInfoFragment: Fragment() {

private var itemView: View? = null

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
itemView=layoutInflater.inflate(R.layout.donation_info_fragment,container,false)

return itemView
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.hazard.samarpan.user

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.hazard.samarpan.adapters.ClothAdapter
import com.hazard.samarpan.R

class UserDashboardFragment : Fragment() {

private lateinit var clothRecycler: RecyclerView
private var donate: FloatingActionButton?= null

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {

val v = layoutInflater.inflate(R.layout.user_dashboard_fragment, container, false)

donate = v.findViewById(R.id.btnDonate)

var clothList: ArrayList<Int> = ArrayList()
for (i in 1..15) {
clothList.add(R.drawable.ic_uploadimage)
}
clothRecycler = v.findViewById(R.id.clothing_recycler)
clothRecycler.layoutManager =
LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
clothRecycler.adapter = ClothAdapter(clothList)


donate?.setOnClickListener {
val donationInfo= DonationInfoFragment()
activity?.supportFragmentManager?.beginTransaction()?.replace(R.id.fragment_container2,donationInfo)?.commit()
}
return v

}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.hazard.samarpan
package com.hazard.samarpan.user

import android.app.Activity
import android.content.ContentValues.TAG
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.view.LayoutInflater
import android.view.View
Expand All @@ -20,6 +18,9 @@ import com.google.firebase.auth.ktx.auth
import com.google.firebase.firestore.DocumentReference
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.ktx.Firebase
import com.hazard.samarpan.common.LoginFragment
import com.hazard.samarpan.common.Main2Activity
import com.hazard.samarpan.R
import java.util.regex.Pattern

class UserRegisterFragment : Fragment() {
Expand Down
Loading

0 comments on commit 1b5793f

Please sign in to comment.