0% found this document useful (0 votes)
9 views38 pages

Vendor Login and Terms Overview

code of Android

Uploaded by

Star Bawa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views38 pages

Vendor Login and Terms Overview

code of Android

Uploaded by

Star Bawa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Vendor Main Page

package [Link].project2;

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class MainActivity extends AppCompatActivity {


Button b1,admin;
TextView tv1;
TextView tvTc;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);

tvTc=findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
startActivity(new Intent([Link],t_and_c.class));
}
});
b1=findViewById([Link]);

[Link](new [Link]() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(),[Link]));
}
});

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate([Link],menu);
return [Link](menu);
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch ([Link]())
{
case [Link]:
startActivity(new Intent([Link],[Link]));
break;

case [Link]:
startActivity(new Intent([Link],[Link]));
break;
}
return [Link](item);
}
}

Vendor Main Layout(XML)


<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:icon="@drawable/ic_baseline_admin_panel_settings_24"
android:background="@drawable/book_main">

<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="59dp"
android:background="@drawable/button_style"
android:text="Are you a Vendor ?"
android:textColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.833" />

<TextView
android:id="@+id/textViewTandC"
android:layout_width="290dp"
android:layout_height="58dp"
android:gravity="center"
android:text="By Proceeding you agree with the Terms and conditions"
android:textColor="#4703C6"
android:textSize="15dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.937"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.976" />

<TextView
android:id="@+id/textView14"
android:layout_width="301dp"
android:layout_height="104dp"
android:gravity="center"
android:text="BookWorm"
android:textColor="#fff"
android:textSize="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.67" />
</[Link]>

SELLER LOGIN
package [Link].project2;

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
//import [Link];
//import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class sellerLogin extends AppCompatActivity {

EditText edmail;
ProgressDialog pdg;
TextInputEditText edpass;
TextView Forgot;
TextView textforgot;
Button loginVendor;
@Override

protected void onCreate(Bundle savedInstanceState) {


[Link](savedInstanceState);
setContentView([Link].activity_seller_login);

edmail=findViewById([Link]);
edpass=findViewById([Link]);
textforgot=findViewById([Link]);
Forgot=findViewById([Link]);
loginVendor=findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
[Link]([Link], "Sucess", Toast.LENGTH_LONG).show();
startActivity(new Intent(getApplicationContext(),[Link]));

}
});

[Link](new [Link]() {
@Override
public void onClick(View v) {
String mail=[Link]().toString();
String pass=[Link]().toString();

if([Link]() && [Link]())


{
[Link]([Link], "Please enter login details", Toast.LENGTH_SHORT).show();
}
else {
FirebaseAuth auth = [Link]();
[Link](mail, pass).addOnCompleteListener(new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {

// [Link]([Link], "Hello", Toast.LENGTH_SHORT).show();


if ([Link]()) {
[Link]([Link], "Authenticated", Toast.LENGTH_SHORT).show();
Intent it = new Intent([Link], [Link]);

startActivity(it);
[Link]("");
[Link]("");
}
else{
[Link]([Link], "No user found ", Toast.LENGTH_SHORT).show();
}
}
}).addOnSuccessListener(new OnSuccessListener<AuthResult>() {
@Override
public void onSuccess(AuthResult authResult) {

}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
[Link]([Link], [Link](), Toast.LENGTH_SHORT).show();
}
});
}
}
});

[Link](new [Link]() {
@Override
public void onClick(View v) {
startActivity(new Intent([Link],[Link]));
}
});

}
}

SELLER LOGIN (XML)


<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".sellerLogin"
android:background="@drawable/book_main"
>

<[Link]
android:layout_width="396dp"
android:layout_height="232dp"
app:cardBackgroundColor="#F8F5F5"
app:cardCornerRadius="20dp"
app:cardElevation="20dp"

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<EditText
android:id="@+id/editTextmail"
android:layout_width="match_parent"
android:layout_height="78dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:drawableLeft="@drawable/ic_baseline_email_24"
android:ems="10"
android:hint=" Email"
android:inputType="textPersonName"
android:maxLength="20"
android:minHeight="48dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.223" />

<[Link]
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="122dp"
android:layout_marginTop="100dp"
app:boxBackgroundColor="@color/purple_500"
app:boxBackgroundMode="outline"
app:counterEnabled="true"
app:counterMaxLength="8"
app:endIconMode="password_toggle"

app:helperText="Required"
app:helperTextEnabled="true"
app:helperTextTextColor="#E10909"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.392"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.374">

<[Link]
android:id="@+id/editTextInputLayout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:drawableLeft="@drawable/ic_baseline_lock_24"
android:hint="Enter a password"
android:inputType="textPassword" />
</[Link]>

</[Link]>

<!-- </[Link]>-->

<Button
android:id="@+id/buttonlogin"
android:layout_width="287dp"
android:layout_height="41dp"
android:background="@drawable/button_style"
android:text="Login"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.863" />

<TextView
android:id="@+id/textView2"
android:layout_width="345dp"
android:layout_height="56dp"
android:gravity="center"
android:text="LOGIN"
android:textSize="30dp"
android:textColor="#fff"
android:textStyle="bold"

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.066" />

<TextView
android:id="@+id/forgotpassword"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginBottom="4dp"
android:gravity="center"
android:textStyle="bold"
android:maxLength="10"
android:text="Sign Up"
android:textColor="#FFFFFF"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent" />

<TextView
android:id="@+id/textViewForgot"
android:layout_width="171dp"
android:layout_height="31dp"
android:gravity="right"
android:text="Forgot Password ?"
android:textColor="#E4172FF6"
android:textSize="18dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.933"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.744" />
</[Link]>

Forgot Password
package [Link].project2;

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class forgotpassword extends AppCompatActivity {

EditText mailf;
EditText num_fetch;
Button fetchPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_forgotpassword);

mailf=findViewById([Link]);
fetchPassword=findViewById([Link]);
num_fetch=findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
// [Link]([Link], "success", Toast.LENGTH_SHORT).show();
DatabaseReference ref=[Link]().getReference("Vendor1");

[Link](num_fetch.getText().toString()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {

String mail=[Link]("email").getValue().toString();
if([Link]([Link]().toString())) {

[Link]([Link], mail, Toast.LENGTH_SHORT).show();


Intent it=new Intent([Link],[Link]);
[Link]("phno",num_fetch.getText().toString());
startActivity(it);
}
else
[Link]([Link],"Not Sucessful", Toast.LENGTH_SHORT).show();

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});

});

Forgot password (Layout)


<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PasswordQuestion"
android:background="@drawable/registration_page">

<EditText
android:id="@+id/editTextQuestion1Security"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:background="@drawable/edittextsyle"
android:inputType="textPersonName"
android:minHeight="48dp"
android:hint="Where did your parents meet ?"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.177" />

<EditText
android:id="@+id/editTextQuestion3Security"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edittextsyle"
android:inputType="textPersonName"
android:minHeight="48dp"
android:hint="Which is your favorite form of exercise ?"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/buttonQuestionCheck"
android:layout_width="262dp"
android:layout_height="61dp"
android:background="@drawable/button_style"
android:text="Verify"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.436"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.786" />

<EditText
android:id="@+id/editTextQuestion2Security"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edittextsyle"
android:ems="10"
android:hint="What was your secreet food ?"
android:inputType="textPersonName"
android:minHeight="48dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.388"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.313" />

<TextView
android:id="@+id/textViewDetails"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Your Password will be visible here"
android:gravity="center"
android:textSize="20dp"
android:textColor="#fff"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.602" />

<Button
android:id="@+id/buttonChange"
android:layout_width="327dp"
android:layout_height="60dp"
android:background="@drawable/button_style"
android:text="Change password"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonQuestionCheck" />
</[Link]>
Change Password / Verify
package [Link].project2;

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

//import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class PasswordQuestion extends AppCompatActivity {


Button verify,ChangePassword;
TextView Detail;
EditText edques1,edques2,edques3;

ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_password_question);

Intent it=getIntent();
String number=[Link]("phno");
// [Link](this, "login sucessfull", Toast.LENGTH_SHORT).show();
DatabaseReference dbr=[Link]().getReference();
verify=findViewById([Link]);
edques1=findViewById([Link].editTextQuestion1Security);
edques2=findViewById([Link].editTextQuestion2Security);
edques3=findViewById([Link].editTextQuestion3Security);
Detail=findViewById([Link]);
ChangePassword=(Button) findViewById([Link]);

[Link](new [Link]() {
@Override
public void onClick(View v) {
progressDialog=new ProgressDialog([Link]());
[Link]("Fetching password");
[Link]("Fetching password please wait");
[Link](false);
[Link]();
String ques1F=[Link]().toString().trim();
String ques2F=[Link]().toString();
String ques3F=[Link]().toString();
[Link]([Link], number, Toast.LENGTH_SHORT).show();
DatabaseReference
reference=[Link]().getReference("Vendor1").child(number);
[Link](new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if([Link]()) {
String ques1V = [Link]("ques1").getValue([Link]).trim();
String ques2V=[Link]("ques2").getValue([Link]).trim();
String ques3V=[Link]("ques3").getValue([Link]).trim();
if([Link](ques1V) && [Link](ques2V) &&[Link](ques3V))
{
// [Link]([Link], "success",
Toast.LENGTH_SHORT).show();
[Link]();
String pwd=[Link]("password").getValue([Link]);
[Link](pwd);
}
}
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}
});
}
});

[Link](new [Link]() {
@Override
public void onClick(View v) {
startActivity(new Intent([Link], [Link]));
}
});

Change Password
package [Link].project2;

import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class ChangePassword extends AppCompatActivity {

EditText password1,password2;
EditText phoneNumber;
Button change;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_change_password);
password1=findViewById([Link].editTextChangePassword1);
password2=findViewById([Link].editTextChangePassword2);
change=findViewById([Link]);

phoneNumber=findViewById([Link].editTextChangePassword3);

[Link](new [Link]() {
@Override
public void onClick(View v) {
String pass1=[Link]().toString();
String pass2=[Link]().toString();
String phone=[Link]().toString();

if([Link]() || [Link]() || [Link]())


{
[Link]([Link], "Some details are missing",
Toast.LENGTH_SHORT).show();
}
if([Link](pass2) && [Link]() !=1) {
DatabaseReference reference = [Link]().getReference("Vendor1");
[Link](phone).child("password").setValue(pass1);
[Link]([Link], "Sucess", Toast.LENGTH_SHORT).show();
}
}
});

}
}

Change password (XML)


<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:background="@drawable/registration_page"
android:layout_height="match_parent"
tools:context=".ChangePassword">

<EditText
android:id="@+id/editTextChangePassword1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:background="@drawable/edittextsyle"
android:hint="Enter password"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.282" />

<EditText
android:id="@+id/editTextChangePassword2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:background="@drawable/edittextsyle"
android:hint="Enter Confirm password"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/buttonChangePass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_style"
android:text="Change password"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.852" />

<EditText
android:id="@+id/editTextChangePassword3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:background="@drawable/edittextsyle"
android:inputType="textPersonName"
android:hint="Enter your phoneNumber"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.422"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.677" />

</[Link]>

FIRST PAGE AFTER AUTHENTICATION (BOTTOM NAVIGATION VIEW )

Package [Link].project2;

import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];

public class HomePageVendor extends AppCompatActivity {

private ActivityHomePageVendorBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);

binding = [Link](getLayoutInflater());
setContentView([Link]());

BottomNavigationView navView = findViewById([Link].nav_view);


// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new [Link](
[Link].navigation_home, [Link].navigation_dashboard, [Link].navigation_notifications)
.build();
NavController navController = [Link](this,
[Link].nav_host_fragment_activity_home_page_vendor);
[Link](this, navController, appBarConfiguration);
[Link]([Link], navController);

Fragment Home

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link].project2.R;
import [Link];
import [Link];
import [Link].project2.contact_support;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class HomeFragment extends Fragment {

private FragmentHomeBinding binding;


ListView listView;
VendorAdapter adapter;
DatabaseReference mbase;
RecyclerView rcv;
FloatingActionButton fb;
private MenuItem menuItem;
private SearchView searchView;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
HomeViewModel homeViewModel =
new ViewModelProvider(this).get([Link]);

binding = [Link](inflater, container, false);


View root = [Link]();
fb=[Link]([Link]);

[Link](new [Link]() {
@Override
public void onClick(View v) {
startActivity(new Intent(getContext(), contact_support.class));
}
});

rcv=binding.RecyclerView1;

[Link](new LinearLayoutManager(getContext()));

DatabaseReference vendorRef = [Link]().getReference("Products");


FirebaseRecyclerOptions<VendorModal> options = new
[Link]<VendorModal>()
.setQuery(vendorRef, [Link])
.build();

adapter = new VendorAdapter(options,getContext());

[Link](adapter);
// [Link](getContext(), "Hello Recycler Toast", Toast.LENGTH_SHORT).show();

setHasOptionsMenu(true);
[Link]();
// [Link]();
return root;
}

@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
[Link]([Link],menu);
MenuItem item=[Link]([Link].search_menu);

SearchView searchView=(SearchView)[Link]();

[Link](new [Link]() {
@Override
public boolean onQueryTextSubmit(String query) {
processSearch(query);
return false;
}

@Override
public boolean onQueryTextChange(String newText) {
processSearch(newText);
return false;
}
});
[Link](menu, inflater);
}

private void processSearch(String msg) {

DatabaseReference vendorRef =
[Link]().getReference().child("Products");
FirebaseRecyclerOptions<VendorModal> options = new
[Link]<VendorModal>()
.setQuery([Link]("BookName").startAt(msg).endAt(msg+"\uf8ff"),
[Link])
.build();

adapter=new VendorAdapter(options,getContext());
[Link]();
[Link](adapter);

}
}

Fragment Home (XML)

<?xml version="1.0" encoding="utf-8"?>


<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:background="@drawable/book_main"
android:layout_height="match_parent"
tools:context=".[Link]">

<TextView
android:id="@+id/text_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<[Link]
android:id="@+id/floatingActionButton"
android:layout_width="58dp"

android:layout_height="63dp"
android:clickable="true"
android:elevation="34dp"
android:gravity="center"
android:src="@drawable/ic_baseline_contact_support_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.954"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.854" />

<[Link]
android:id="@+id/RecyclerView1"
android:layout_width="match_parent"
android:layout_height="740dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.928"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

</[Link]>

Activity_Home_page_vendor (XML) Base Construction


<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<[Link]
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="#74FAFAFA"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />

<fragment
android:id="@+id/nav_host_fragment_activity_home_page_vendor"
android:name="[Link]"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/nav_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:navGraph="@navigation/mobile_navigation">
</fragment>

</[Link]>

*BOOKS WILL APPEAR IN THE RECYCLER VIEW THEN ON CLICK ON THE OF THE ITEM BELOW
IS THE XML CODE
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/book_detail"
tools:context=".PageDetailsVendor">

<TextView
android:id="@+id/TextBookTitleDetails"
android:layout_width="match_parent"
android:layout_height="68dp"
android:gravity="center"
android:text="BooK Title"
android:textColor="#FFFFFF"
android:textSize="33dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.351" />

<[Link]
android:id="@+id/ShapeAbleImageView"
android:layout_width="253dp"
android:layout_height="157dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="2dp" />

<TextView
android:id="@+id/BookAuthorDetails"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="128dp"
android:gravity="center"
android:text="Book Author"
android:textColor="#fff"
android:textSize="17dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ShapeAbleImageView" />

<TextView
android:id="@+id/VendorPhNumberDetails"
android:layout_width="223dp"
android:layout_height="57dp"
android:layout_marginBottom="16dp"
android:drawableLeft="@drawable/ic_baseline_local_phone_24"
android:gravity="left"
android:text="Seller Number"
android:textColor="#fff"
android:textSize="25dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.867"
app:layout_constraintStart_toStartOf="parent" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_constraintBottom_toTopOf="@+id/VendorPhNumberDetails"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:orientation="vertical">

<TextView
android:id="@+id/textViewDescDetail"
android:layout_width="match_parent"
android:layout_height="294dp"
android:text="Content"
android:textColor="#fff"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.804" />

</LinearLayout>
</ScrollView>
</[Link]>
THE JAVA CODE OF THE ABOVE
package [Link].project2;

import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class PageDetailsVendor extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_page_details_vendor);

Intent FetchIntent=getIntent();
String desc=[Link]("Desc").toString();
String imgpath=[Link]("imgPath");
String auth=[Link]("auth");
String B_name=[Link]("Title");
String contact=[Link]("phone");
TextView descView=findViewById([Link]);
TextView bookName=findViewById([Link]);
TextView bookAuth=findViewById([Link]);
TextView SellerNum=findViewById([Link]);

ShapeableImageView img=findViewById([Link]);
[Link](B_name);
[Link](auth);
[Link](contact);
[Link](desc);

[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent dial=new Intent(Intent.ACTION_DIAL);
[Link]([Link]("tel: +91"+contact));
startActivity(dial);
}
});
[Link](this, "success", Toast.LENGTH_SHORT).show();
[Link]().load(imgpath).into(img);
}
}

Fragment Add Product


package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link].project2.R;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class DashboardFragment extends Fragment {

private ImageView inventory;


private FragmentDashboardBinding binding;
TextView txt;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
DashboardViewModel dashboardViewModel =
new ViewModelProvider(this).get([Link]);

binding = [Link](inflater, container, false);


View root = [Link]();

inventory=[Link];
[Link](new [Link]() {
@Override
public void onClick(View v) {
// [Link](getContext(), "Inventory", Toast.LENGTH_SHORT).show();
[Link](getContext(),"Sucess!",Toasty.LENGTH_SHORT,true).show();
startActivity(new Intent(getContext(), [Link]));
}
});

ImageView b1= (ImageView) [Link];


[Link](new [Link]() {
@Override
public void onClick(View v) {
startActivity(new Intent(getContext(),[Link]));
}
});
// Bundle bundle=getArguments();
// if(bundle!=null) {
// String val = [Link]("booknameKey");
// [Link](val);
// }
//
// else
// [Link](getContext(), "No data found", Toast.LENGTH_SHORT).show();
//
return root;
}

@Override
public void onDestroyView() {
[Link]();
binding = null;
}
}
XML ADD PRODUCT
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".[Link]">

<ImageButton
android:id="@+id/buttonInventory"
android:layout_width="415dp"
android:layout_height="374dp"
android:layout_marginBottom="364dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"

app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/add_product_trolly" />

<ImageView
android:id="@+id/buttonAddproduct"
android:layout_width="417dp"
android:layout_height="353dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonInventory"
app:layout_constraintVertical_bias="0.6"
app:srcCompat="@drawable/trolly_invetory" />

<TextView
android:id="@+id/textView4"
android:layout_width="233dp"
android:layout_height="129dp"
android:layout_marginTop="56dp"
android:text="Inventory"
android:textColor="#fff"
android:textSize="45dp"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.161"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView13"
android:layout_width="176dp"
android:layout_height="98dp"
android:gravity="center"
android:text="ADD New Product"
android:textColor="#fff"
android:textSize="23dp"

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.974" />
</[Link]>
INVENTORY(JAVA CODE)
package [Link].project2;

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
public class inventory extends AppCompatActivity {

Button inventorySeller;
EditText phno;
EditText password;
ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_inventory);
inventorySeller=findViewById([Link]);
phno=findViewById([Link]);
password=findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {

if ([Link]().toString().isEmpty() ||
[Link]().toString().isEmpty()) {
[Link]([Link], "Enter all details", Toast.LENGTH_SHORT).show();
} else {
dialog = new ProgressDialog([Link]);
[Link]("Logging In");
[Link]("Logging you in");
[Link](false);
[Link]();
if ([Link]().toString().length() == 10) {
DatabaseReference reference =
[Link]().getReference("Vendor1").child([Link]().toString());
[Link](new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if ([Link]()) {
String pwd = [Link]().toString();
String phoneNumber = [Link]();
String pwdV = [Link]("password").getValue().toString();
if ([Link]([Link]().toString()) &&
[Link](pwdV)) {
[Link]([Link], "Success", Toast.LENGTH_SHORT,
true).show();
Intent it = new Intent([Link], [Link]);
[Link]("phone_number", phoneNumber);
[Link]();
startActivity(it);
} else {
[Link]();
[Link]([Link], "Password is incorrect",
Toast.LENGTH_SHORT, true).show();
}

} else {
[Link]();
[Link]([Link], "Number Not found ",
Toast.LENGTH_SHORT).show();
}

@Override
public void onCancelled(@NonNull DatabaseError error) {
// [Link]([Link], "Failure", Toast.LENGTH_SHORT).show();
}
});
} else {
[Link]([Link], "The number is incorrect",
Toast.LENGTH_SHORT).show();
}

}
}
});
}
}
XML (CODE)
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:background="@drawable/details_class"
android:layout_height="match_parent"
tools:context=".inventory">

<[Link]
android:layout_width="376dp"
android:layout_height="378dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:cardElevation="20dp"
app:cardCornerRadius="27dp">

<[Link]
android:layout_width="376dp"
android:layout_height="378dp"
android:background="#157FEF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.542"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.459">

<Button
android:id="@+id/buttonInventoryDetails"
android:layout_width="266dp"
android:layout_height="58dp"
android:background="@drawable/button_style"
android:text="Fetch inventory"

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.409"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.909" />

<EditText
android:id="@+id/editTextPhoneNumberInventory"
android:layout_width="365dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:ems="10"
android:textColor="#fff"
android:hint="Please Enter your Phone Number (Seller)"
android:inputType="phone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.2" />

<[Link]
android:layout_width="374dp"
android:layout_height="wrap_content"
app:helperText="Enter your password"
app:endIconMode="password_toggle"
app:counterEnabled="true"
app:counterMaxLength="9"
app:passwordToggleEnabled="true"
android:elevation="20dp"
app:boxBackgroundMode="outline"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<[Link]
android:id="@+id/inventoryPasswrd"
android:layout_width="match_parent"
android:textColor="#fff"
android:layout_height="wrap_content"
android:hint="Enter your password"
/>
</[Link]>

</[Link]>

</[Link]>

</[Link]>

You might also like