.
This commit is contained in:
21
app/src/main/java/com/ssb/simplitend/apputils/AppUtil.java
Normal file
21
app/src/main/java/com/ssb/simplitend/apputils/AppUtil.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.ssb.simplitend.apputils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
public abstract class AppUtil {
|
||||
|
||||
// closes keyboard
|
||||
public static void closeKeyboard(Activity activity){
|
||||
if (activity != null){
|
||||
View view = activity.getCurrentFocus();
|
||||
if (view != null) {
|
||||
InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ssb.simplitend.userprofile;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.ProfileProgressFragmentBinding;
|
||||
|
||||
public class ProfileProgressFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected ProfileProgressFragmentBinding binding;
|
||||
|
||||
public ProfileProgressFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ProfileProgressFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ssb.simplitend.welcome.activities;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.ssb.simplitend.databinding.ActivityWelcomeBinding;
|
||||
|
||||
public class WelcomeActivity extends AppCompatActivity {
|
||||
|
||||
// View binding
|
||||
protected ActivityWelcomeBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityWelcomeBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.ssb.simplitend.welcome.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ChooseRoleFragmentBinding;
|
||||
|
||||
public class ChooseRoleFragment extends Fragment {
|
||||
|
||||
protected ChooseRoleFragmentBinding binding;
|
||||
|
||||
private static final String SELECTED_ROLE_KEY = "selected_role";
|
||||
private static final int SENIOR = 1;
|
||||
private static final int CAREGIVER = 2;
|
||||
|
||||
private int selected_role = SENIOR;
|
||||
|
||||
public ChooseRoleFragment(){
|
||||
// required empty fragment
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ChooseRoleFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initViews(savedInstanceState);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
// registers all click listeners
|
||||
private void clickEvents() {
|
||||
|
||||
binding.seniorRole.setOnClickListener(v -> {
|
||||
makeRoleSelection(SENIOR);
|
||||
Navigation.findNavController(v).navigate(R.id.action_chooseRoleFragment_to_signInSignUpFragment);
|
||||
});
|
||||
|
||||
binding.caregiverRole.setOnClickListener(v -> makeRoleSelection(CAREGIVER));
|
||||
|
||||
}
|
||||
|
||||
// initialize views
|
||||
private void initViews(Bundle savedInstanceState) {
|
||||
// checking if any previous instance existed
|
||||
if (savedInstanceState != null){
|
||||
// previously instance existed
|
||||
// thus, retrieving selected_role chosen
|
||||
|
||||
selected_role = savedInstanceState.getInt(SELECTED_ROLE_KEY, SENIOR);
|
||||
}
|
||||
|
||||
// making the role selection
|
||||
makeRoleSelection(selected_role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(SELECTED_ROLE_KEY, selected_role);
|
||||
}
|
||||
|
||||
/*
|
||||
makes the check for each role visible or invisible according to the selected role
|
||||
*/
|
||||
private void makeRoleSelection(int selectedRole){
|
||||
selected_role = selectedRole;
|
||||
|
||||
if (selectedRole == SENIOR){
|
||||
binding.seniorCheck.setVisibility(View.VISIBLE);
|
||||
binding.caregiverCheck.setVisibility(View.GONE);
|
||||
}else{
|
||||
binding.caregiverCheck.setVisibility(View.VISIBLE);
|
||||
binding.seniorCheck.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ssb.simplitend.welcome.fragments;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.ssb.simplitend.welcome.fragments.onboardfragments.OnBoardOne;
|
||||
import com.ssb.simplitend.welcome.fragments.onboardfragments.OnBoardThree;
|
||||
import com.ssb.simplitend.welcome.fragments.onboardfragments.OnBoardTwo;
|
||||
|
||||
public class OnBoardPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
public OnBoardPagerAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
|
||||
super(fragmentManager, lifecycle);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
switch (position){
|
||||
case 2:
|
||||
return new OnBoardThree();
|
||||
case 1:
|
||||
return new OnBoardTwo();
|
||||
default:
|
||||
return new OnBoardOne();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ssb.simplitend.welcome.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.SignInFragmentBinding;
|
||||
|
||||
public class SignInFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected SignInFragmentBinding binding;
|
||||
|
||||
public SignInFragment(){
|
||||
// required empty constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = SignInFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.forgotPin.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_signInFragment_to_forgotPinFragment));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ssb.simplitend.welcome.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.SignInUpFragmentBinding;
|
||||
|
||||
public class SignInSignUpFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected SignInUpFragmentBinding binding;
|
||||
|
||||
protected OnBoardPagerAdapter onBoardPagerAdapter;
|
||||
|
||||
public SignInSignUpFragment(){
|
||||
// required empty constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = SignInUpFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
// log in
|
||||
binding.login.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_signInSignUpFragment_to_signInFragment)
|
||||
);
|
||||
|
||||
// register
|
||||
binding.register.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_signInSignUpFragment_to_howToSetUpFragment)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
onBoardPagerAdapter = new OnBoardPagerAdapter(getChildFragmentManager(), getLifecycle());
|
||||
binding.viewPager.setAdapter(onBoardPagerAdapter);
|
||||
binding.circleIndicator.setViewPager(binding.viewPager);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ssb.simplitend.welcome.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.WelcomeFragmentBinding;
|
||||
|
||||
public class WelcomeFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected WelcomeFragmentBinding binding;
|
||||
|
||||
public WelcomeFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = WelcomeFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initViews(savedInstanceState);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
// Initialize views
|
||||
private void initViews(Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
// Register click events
|
||||
private void clickEvents(){
|
||||
binding.nextBtn.setOnClickListener(v ->
|
||||
Navigation.findNavController(v)
|
||||
.navigate(R.id.action_welcomeFragment_to_chooseRoleFragment)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.AddContactFragmentBinding;
|
||||
|
||||
public class AddContactFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected AddContactFragmentBinding binding;
|
||||
|
||||
public AddContactFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = AddContactFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.static1.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_addContactFragment_to_contactInfoFragment)
|
||||
);
|
||||
|
||||
binding.static2.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_addContactFragment_to_contactListFragment)
|
||||
);
|
||||
|
||||
binding.nextBtn.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_addContactFragment_to_profileProgressFragment)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.ContactInfoFragmentBinding;
|
||||
|
||||
public class ContactInfoFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected ContactInfoFragmentBinding binding;
|
||||
|
||||
public ContactInfoFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ContactInfoFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.ListAdapter;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ssb.simplitend.databinding.ContactViewHolderBinding;
|
||||
import com.ssb.simplitend.welcome.fragments.contacts.mvvm.Contact;
|
||||
|
||||
public class ContactListAdapter extends ListAdapter<Contact, ContactListAdapter.ContactViewHolder> {
|
||||
|
||||
private OnContactClickListener contactClickListener;
|
||||
|
||||
private static final DiffUtil.ItemCallback<Contact> DIFF_UTIL = new DiffUtil.ItemCallback<Contact>() {
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull Contact oldItem, @NonNull Contact newItem) {
|
||||
return oldItem.name.equals(newItem.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull Contact oldItem, @NonNull Contact newItem) {
|
||||
return oldItem.equals(newItem);
|
||||
}
|
||||
};
|
||||
|
||||
public ContactListAdapter(){
|
||||
super(DIFF_UTIL);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ContactViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ContactViewHolderBinding binding = ContactViewHolderBinding.inflate(LayoutInflater.from(parent.getContext()));
|
||||
return new ContactViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ContactViewHolder holder, int position) {
|
||||
holder.setData(getItem(position));
|
||||
|
||||
holder.binding.getRoot().setOnClickListener(v -> {
|
||||
if (contactClickListener != null){
|
||||
contactClickListener.onClick(getItem(position));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setContactClickListener(OnContactClickListener contactClickListener) {
|
||||
this.contactClickListener = contactClickListener;
|
||||
}
|
||||
|
||||
public static class ContactViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
private final ContactViewHolderBinding binding;
|
||||
|
||||
public ContactViewHolder(ContactViewHolderBinding binding){
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void setData(Contact contact){
|
||||
binding.name.setText(contact.name);
|
||||
|
||||
// static
|
||||
binding.initial.setText(contact.name.substring(0, 1).toUpperCase());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface OnContactClickListener{
|
||||
|
||||
void onClick(Contact contact);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts;
|
||||
|
||||
import static com.ssb.simplitend.welcome.fragments.contacts.CreateContactFragment.CONTACT_KEY;
|
||||
import static com.ssb.simplitend.welcome.fragments.contacts.CreateContactFragment.TO_EDIT_KEY;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ContactListFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.fragments.contacts.mvvm.Contact;
|
||||
import com.ssb.simplitend.welcome.fragments.contacts.mvvm.ContactViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ContactListFragment extends Fragment {
|
||||
|
||||
private static final String TAG = "aditya";
|
||||
|
||||
// view binding
|
||||
protected ContactListFragmentBinding binding;
|
||||
|
||||
protected ContactListAdapter contactListAdapter;
|
||||
|
||||
protected ContactViewModel contactViewModel;
|
||||
|
||||
protected ActivityResultLauncher<String> permissionLauncher;
|
||||
|
||||
public ContactListFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ContactListFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initializeViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.createContact.setOnClickListener(v ->
|
||||
{
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putBoolean(TO_EDIT_KEY, false);
|
||||
Navigation.findNavController(v).navigate(R.id.action_contactListFragment_to_createContactFragment, arguments);
|
||||
}
|
||||
);
|
||||
|
||||
contactListAdapter.setContactClickListener(contact ->
|
||||
{
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(TO_EDIT_KEY, true);
|
||||
bundle.putSerializable(CONTACT_KEY, contact);
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_contactListFragment_to_createContactFragment, bundle);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private void initializeViews() {
|
||||
// initiating recycler view for contact list
|
||||
contactListAdapter = new ContactListAdapter();
|
||||
binding.contactRv.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
binding.contactRv.setAdapter(contactListAdapter);
|
||||
|
||||
permissionLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(),
|
||||
granted -> {
|
||||
if (granted) {
|
||||
// user granted the READ_CONTACT permission
|
||||
loadContacts();
|
||||
} else {
|
||||
// user denied the permission
|
||||
// TODO: 28-06-2023
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
loadContacts();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
loads user's local contacts
|
||||
*/
|
||||
private void loadContacts() {
|
||||
if (requireActivity().checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
|
||||
permissionLauncher.launch(Manifest.permission.READ_CONTACTS);
|
||||
return;
|
||||
}
|
||||
|
||||
contactViewModel = new ViewModelProvider(this).get(ContactViewModel.class);
|
||||
Log.d(TAG, "initializeViews: viewmodel " + contactViewModel);
|
||||
|
||||
contactListAdapter.submitList(contactViewModel.getContactList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.CreateEditContactFragmentBinding;
|
||||
import com.ssb.simplitend.databinding.DecisionBottomsheetBinding;
|
||||
import com.ssb.simplitend.databinding.DoneBottomsheetBinding;
|
||||
import com.ssb.simplitend.welcome.fragments.contacts.mvvm.Contact;
|
||||
|
||||
public class CreateContactFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected CreateEditContactFragmentBinding binding;
|
||||
|
||||
// arguments keys
|
||||
public static final String TO_EDIT_KEY = "to_edit";
|
||||
public static final String CONTACT_KEY = "contact_key";
|
||||
|
||||
// flag if current instance is to edit or create contact
|
||||
boolean to_edit;
|
||||
|
||||
public CreateContactFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = CreateEditContactFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initializeViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.nextBtn.setOnClickListener(v -> {
|
||||
|
||||
if (to_edit){
|
||||
// editing existing contact
|
||||
showSaveEditDecision();
|
||||
}else {
|
||||
// saving new contact
|
||||
gotoAddContactFragment();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void showSaveEditDecision() {
|
||||
|
||||
DecisionBottomsheetBinding binding = DecisionBottomsheetBinding.inflate(getLayoutInflater());
|
||||
|
||||
BottomSheetDialog bsd = new BottomSheetDialog(requireContext(), R.style.BottomSheetDialog);
|
||||
bsd.setContentView(binding.getRoot());
|
||||
|
||||
binding.text.setText(getString(R.string.make_changes));
|
||||
|
||||
binding.positiveBtn.setText(getString(R.string.yes));
|
||||
binding.negativeBtn.setText(getString(R.string.no));
|
||||
|
||||
binding.negativeBtn.setOnClickListener(v -> bsd.dismiss());
|
||||
|
||||
binding.positiveBtn.setOnClickListener(v -> {
|
||||
bsd.dismiss();
|
||||
showDoneBottomSheet();
|
||||
});
|
||||
|
||||
bsd.show();
|
||||
|
||||
}
|
||||
|
||||
private void showDoneBottomSheet() {
|
||||
DoneBottomsheetBinding binding = DoneBottomsheetBinding.inflate(getLayoutInflater());
|
||||
|
||||
BottomSheetDialog bsd = new BottomSheetDialog(requireContext(), R.style.BottomSheetDialog);
|
||||
bsd.setContentView(binding.getRoot());
|
||||
bsd.setCancelable(false);
|
||||
|
||||
binding.text.setText(getString(R.string.changes_successful));
|
||||
|
||||
binding.anim.addAnimatorListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(@NonNull Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(@NonNull Animator animation) {
|
||||
bsd.dismiss();
|
||||
gotoAddContactFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(@NonNull Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(@NonNull Animator animation) {
|
||||
}
|
||||
});
|
||||
|
||||
bsd.show();
|
||||
|
||||
}
|
||||
|
||||
private void gotoAddContactFragment(){
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_createContactFragment_to_addContactFragment);
|
||||
}
|
||||
|
||||
private void showSOSDecision() {
|
||||
|
||||
DecisionBottomsheetBinding binding = DecisionBottomsheetBinding.inflate(getLayoutInflater());
|
||||
|
||||
BottomSheetDialog bsd = new BottomSheetDialog(requireContext(), R.style.BottomSheetDialog);
|
||||
bsd.setContentView(binding.getRoot());
|
||||
|
||||
binding.text.setText(getString(R.string.make_sos));
|
||||
|
||||
binding.positiveBtn.setText(getString(R.string.yes));
|
||||
binding.negativeBtn.setText(getString(R.string.no));
|
||||
|
||||
binding.negativeBtn.setOnClickListener(v -> {
|
||||
bsd.dismiss();
|
||||
this.binding.sosCheck.setChecked(false);
|
||||
});
|
||||
|
||||
binding.positiveBtn.setOnClickListener(v -> {
|
||||
bsd.dismiss();
|
||||
this.binding.sosCheck.setChecked(true);
|
||||
});
|
||||
|
||||
bsd.show();
|
||||
|
||||
}
|
||||
|
||||
private void initializeViews() {
|
||||
Bundle bundle = getArguments();
|
||||
|
||||
if (bundle != null){
|
||||
to_edit = bundle.getBoolean(TO_EDIT_KEY, false);
|
||||
|
||||
if (to_edit){
|
||||
|
||||
setLayoutDetails(getString(R.string.edit_contact), getString(R.string.change_photo), getString(R.string.save));
|
||||
|
||||
Contact contact = (Contact) bundle.getSerializable(CONTACT_KEY);
|
||||
setDetails(contact);
|
||||
|
||||
}else{
|
||||
setLayoutDetails(getString(R.string.create_contact), getString(R.string.add_photo), getString(R.string.create_contact));
|
||||
}
|
||||
}
|
||||
|
||||
binding.sosCheck.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked){
|
||||
showSOSDecision();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setDetails(Contact contact) {
|
||||
binding.name.setText(contact.name);
|
||||
binding.phoneNumber.setText(contact.phoneNumber);
|
||||
binding.email.setText(contact.email);
|
||||
binding.relationship.setText(contact.relationship);
|
||||
}
|
||||
|
||||
public void setLayoutDetails(String title, String photo_title, String btn_txt){
|
||||
binding.title.setText(title);
|
||||
binding.photoTv.setText(photo_title);
|
||||
binding.nextBtn.setText(btn_txt);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts.mvvm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Contact implements Serializable {
|
||||
|
||||
public String name, imageUri, phoneNumber, relationship, email;
|
||||
|
||||
public Contact(){}
|
||||
|
||||
public Contact(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Contact(String name, String phoneNumber){
|
||||
this.name = name;
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Contact contact = (Contact) o;
|
||||
return name.equals(contact.name) && Objects.equals(imageUri, contact.imageUri) && phoneNumber.equals(contact.phoneNumber) && Objects.equals(relationship, contact.relationship) && Objects.equals(email, contact.email);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, imageUri, phoneNumber, relationship, email);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Contact{" +
|
||||
"name='" + name + '\'' +
|
||||
", imageUri='" + imageUri + '\'' +
|
||||
", phoneNumber='" + phoneNumber + '\'' +
|
||||
", relationship='" + relationship + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts.mvvm;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ContactViewModel extends AndroidViewModel {
|
||||
|
||||
private final ArrayList<Contact> contactList;
|
||||
private final UserContactRepository contactRepository;
|
||||
|
||||
public ContactViewModel(Application application){
|
||||
super(application);
|
||||
this.contactRepository = new UserContactRepository();
|
||||
this.contactList = this.contactRepository.getContactList(application.getApplicationContext());
|
||||
}
|
||||
|
||||
public ArrayList<Contact> getContactList() {
|
||||
return contactList;
|
||||
}
|
||||
|
||||
public UserContactRepository getContactRepository() {
|
||||
return contactRepository;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ssb.simplitend.welcome.fragments.contacts.mvvm;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
|
||||
import com.ssb.simplitend.welcome.fragments.contacts.mvvm.Contact;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class UserContactRepository {
|
||||
|
||||
private static final String[] PROJECTION = new String[]{
|
||||
ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
|
||||
ContactsContract.Contacts.DISPLAY_NAME,
|
||||
ContactsContract.CommonDataKinds.Phone.NUMBER
|
||||
};
|
||||
|
||||
public UserContactRepository(){}
|
||||
|
||||
public ArrayList<Contact> getContactList(Context context) {
|
||||
final ArrayList<Contact> contactList = new ArrayList<>();
|
||||
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
|
||||
Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");
|
||||
|
||||
if (cursor != null) {
|
||||
|
||||
// To avoid duplicate phone numbers
|
||||
HashSet<String> mobileNoSet = new HashSet<String>();
|
||||
|
||||
try {
|
||||
final int nameIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
|
||||
final int numberIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||
|
||||
Log.d("aditya", "getContactList: " + cursor.getColumnCount());
|
||||
|
||||
String name, number, photoUri;
|
||||
while (cursor.moveToNext()) {
|
||||
name = cursor.getString(nameIndex);
|
||||
number = cursor.getString(numberIndex);
|
||||
|
||||
|
||||
// avoiding duplicate phone number
|
||||
number = number.replace(" ", "");
|
||||
if (!mobileNoSet.contains(number)) {
|
||||
contactList.add(new Contact(name, number));
|
||||
mobileNoSet.add(number);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
return contactList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.ssb.simplitend.welcome.fragments.forgotpin;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.databinding.ChangePinFragmentBinding;
|
||||
|
||||
public class ChangePinFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected ChangePinFragmentBinding binding;
|
||||
|
||||
public ChangePinFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ChangePinFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.ssb.simplitend.welcome.fragments.forgotpin;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.databinding.CheckMailFragmentBinding;
|
||||
|
||||
public class CheckMailFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected CheckMailFragmentBinding binding;
|
||||
|
||||
public CheckMailFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = CheckMailFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
initOTPBoxes();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
setting text change listener for every edit text for otp
|
||||
*/
|
||||
private void initOTPBoxes() {
|
||||
|
||||
binding.otp1.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!s.toString().trim().isEmpty()) {
|
||||
binding.otp2.requestFocus();
|
||||
}
|
||||
|
||||
// check if all otp boxes are filled
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.otp2.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!s.toString().trim().isEmpty()) {
|
||||
binding.otp3.requestFocus();
|
||||
} else {
|
||||
binding.otp1.requestFocus();
|
||||
}
|
||||
|
||||
// check if all otp boxes are filled
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.otp3.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!s.toString().trim().isEmpty()) {
|
||||
binding.otp4.requestFocus();
|
||||
} else {
|
||||
binding.otp2.requestFocus();
|
||||
}
|
||||
|
||||
// check if all otp boxes are filled
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
binding.otp4.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!s.toString().trim().isEmpty()) {
|
||||
// last otp inserted
|
||||
AppUtil.closeKeyboard(getActivity());
|
||||
} else {
|
||||
binding.otp3.requestFocus();
|
||||
}
|
||||
|
||||
// check if all otp boxes are filled
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.submit.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_checkMailFragment_to_changePinFragment));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ssb.simplitend.welcome.fragments.forgotpin;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ForgotPinFragmentBinding;
|
||||
|
||||
public class ForgotPinFragment extends Fragment {
|
||||
|
||||
protected ForgotPinFragmentBinding binding;
|
||||
|
||||
public ForgotPinFragment(){
|
||||
// required empty constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ForgotPinFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.submit.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_forgotPinFragment_to_checkMailFragment));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ssb.simplitend.welcome.fragments.onboardfragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.OnboardOneFragmentBinding;
|
||||
|
||||
public class OnBoardOne extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected OnboardOneFragmentBinding binding;
|
||||
|
||||
public OnBoardOne(){
|
||||
// required empty constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = OnboardOneFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ssb.simplitend.welcome.fragments.onboardfragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.OnboardOneFragmentBinding;
|
||||
import com.ssb.simplitend.databinding.OnboardThreeFragmentBinding;
|
||||
|
||||
public class OnBoardThree extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected OnboardThreeFragmentBinding binding;
|
||||
|
||||
public OnBoardThree(){
|
||||
// required empty constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = OnboardThreeFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ssb.simplitend.welcome.fragments.onboardfragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.OnboardOneFragmentBinding;
|
||||
import com.ssb.simplitend.databinding.OnboardTwoFragmentBinding;
|
||||
|
||||
public class OnBoardTwo extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected OnboardTwoFragmentBinding binding;
|
||||
|
||||
public OnBoardTwo(){
|
||||
// required empty constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = OnboardTwoFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ssb.simplitend.welcome.fragments.register;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.CreatePinFragmentBinding;
|
||||
|
||||
public class CreatePinFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected CreatePinFragmentBinding binding;
|
||||
|
||||
public CreatePinFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = CreatePinFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.setPin.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_createPinFragment_to_thankYouFragment)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ssb.simplitend.welcome.fragments.register;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.HowToSetUpFragmentBinding;
|
||||
|
||||
public class HowToSetUpFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected HowToSetUpFragmentBinding binding;
|
||||
|
||||
public HowToSetUpFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = HowToSetUpFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
binding.nextBtn.setOnClickListener(v -> Navigation.findNavController(v).navigate(R.id.action_howToSetUpFragment_to_registerFragment));
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ssb.simplitend.welcome.fragments.register;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.LocationFragmentBinding;
|
||||
|
||||
public class LocationFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected LocationFragmentBinding binding;
|
||||
|
||||
public LocationFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = LocationFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.submit.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_locationFragment_to_createPinFragment)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.ssb.simplitend.welcome.fragments.register;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.RegisterFragmentBinding;
|
||||
|
||||
public class RegisterFragment extends Fragment {
|
||||
|
||||
protected RegisterFragmentBinding binding;
|
||||
|
||||
public RegisterFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = RegisterFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.nextBtn.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_registerFragment_to_locationFragment));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ssb.simplitend.welcome.fragments.register;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.LocationFragmentBinding;
|
||||
import com.ssb.simplitend.databinding.ThankYouFragmentBinding;
|
||||
|
||||
public class ThankYouFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected ThankYouFragmentBinding binding;
|
||||
|
||||
public ThankYouFragment(){
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ThankYouFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
initializeViews(savedInstanceState);
|
||||
|
||||
clickEvents();
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void initializeViews(Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> Navigation.findNavController(v).popBackStack());
|
||||
|
||||
binding.proceed.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_thankYouFragment_to_contactListFragment)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user