mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Config Action Bar
This commit is contained in:
@@ -11,6 +11,8 @@ import android.view.MenuItem;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
ViewPager2 viewPager2;
|
||||
@@ -23,6 +25,8 @@ 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);
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package com.capstone.foodify;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class SignInActivity extends AppCompatActivity {
|
||||
|
||||
TextView signUp_textView;
|
||||
@@ -15,6 +20,12 @@ public class SignInActivity extends AppCompatActivity {
|
||||
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);
|
||||
signUp_textView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -23,4 +34,15 @@ public class SignInActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// this event will enable the back
|
||||
// function to the button on press
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -23,5 +23,7 @@ public class SplashScreenActivity extends AppCompatActivity {
|
||||
finish();
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
Objects.requireNonNull(getSupportActionBar()).hide();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="8dp"
|
||||
android:height="12dp"
|
||||
android:viewportWidth="8"
|
||||
android:viewportHeight="12">
|
||||
<path
|
||||
android:pathData="M2.926,6L7.463,10.538L6.167,11.834L0.333,6L6.167,0.166L7.463,1.462L2.926,6Z"
|
||||
android:fillColor="#2D2D2D"/>
|
||||
</vector>
|
||||
Reference in New Issue
Block a user