mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Add back button for sign in and sign up screen
This commit is contained in:
@@ -25,8 +25,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Objects.requireNonNull(getSupportActionBar()).hide();
|
||||
|
||||
bottomNavigationView = findViewById(R.id.bottom_nav);
|
||||
viewPager2 = findViewById(R.id.viewPager);
|
||||
viewPagerAdapter = new ViewPagerAdapter(this);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -15,18 +16,23 @@ import java.util.Objects;
|
||||
public class SignInActivity extends AppCompatActivity {
|
||||
|
||||
TextView signUp_textView;
|
||||
|
||||
ImageView back_image;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sign_in);
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
Objects.requireNonNull(actionBar).setDisplayShowTitleEnabled(false);
|
||||
// showing the back button in action bar
|
||||
Objects.requireNonNull(actionBar).setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
signUp_textView = (TextView) findViewById(R.id.sign_up_textView);
|
||||
|
||||
back_image = (ImageView) findViewById(R.id.back_image);
|
||||
|
||||
back_image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
signUp_textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -30,9 +31,9 @@ public class SignUpActivity extends AppCompatActivity {
|
||||
textInput_address, textInput_repeatPassword, textInput_firstName, textInput_lastName, textInput_birthDay;
|
||||
final Calendar myCalendar= Calendar.getInstance();
|
||||
EditText editText, edt_birthday;
|
||||
|
||||
TextView signIn_textView;
|
||||
Spinner wardSpinner, districtSpinner;
|
||||
ImageView back_image;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -52,9 +53,14 @@ public class SignUpActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
// enabling action bar app icon and behaving it as toggle button
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
back_image = (ImageView) findViewById(R.id.back_image);
|
||||
|
||||
back_image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,5 @@ public class SplashScreenActivity extends AppCompatActivity {
|
||||
finish();
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
Objects.requireNonNull(getSupportActionBar()).hide();
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,28 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".SignInActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="@string/sign_in_text"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="50sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo_image"
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".SignUpActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -18,7 +28,7 @@
|
||||
android:textColor="@color/black"
|
||||
android:textSize="50sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
@@ -248,8 +258,9 @@
|
||||
android:text="@string/sign_up_text"
|
||||
android:textSize="20sp"
|
||||
android:padding="10dp"
|
||||
android:layout_margin="40dp"
|
||||
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginBottom="17dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="DefaultSolid" parent="Widget.MaterialComponents.Button">
|
||||
|
||||
Reference in New Issue
Block a user