Fix UI, Layout.

This commit is contained in:
Nezumi2711
2022-06-11 10:26:35 +07:00
parent eb7a5068c9
commit 89e46b6bd3
7 changed files with 50 additions and 35 deletions
-14
View File
@@ -3,20 +3,6 @@ plugins {
}
android {
signingConfigs {
debug {
storeFile file('C:\\Users\\phanh\\Desktop\\testKeyStore.jks')
storePassword '123456'
keyAlias 'CBNV'
keyPassword '123456'
}
release {
storeFile file('C:\\Users\\phanh\\Desktop\\testKeyStore.jks')
storePassword '123456'
keyAlias 'CBNV'
keyPassword '123456'
}
}
compileSdk 32
defaultConfig {
@@ -52,6 +52,12 @@ public class FoodList extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_food_list);
// calling the action bar
ActionBar actionBar = getSupportActionBar();
// showing the back button in action bar
actionBar.setDisplayHomeAsUpEnabled(true);
//Firebase
database = FirebaseDatabase.getInstance();
foodList = database.getReference("Foods");
@@ -126,12 +132,6 @@ public class FoodList extends AppCompatActivity {
});
setTitle(categoryName);
// calling the action bar
ActionBar actionBar = getSupportActionBar();
// showing the back button in action bar
actionBar.setDisplayHomeAsUpEnabled(true);
}
private void startSearch(CharSequence text) {
@@ -2,6 +2,8 @@ package com.waterbase.foodify;
import android.content.Intent;
import android.os.Bundle;
import android.os.Debug;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -102,16 +104,23 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
viewHolder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position, boolean isLongClick) {
//Get Category Id and send to new Activity
Intent foodList = new Intent(getBaseContext(), FoodList.class);
foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
foodList.putExtra("CategoryName", model.getName());
startActivity(foodList);
try {
//Get Category Id and send to new Activity
Intent foodList = new Intent(getBaseContext(), FoodList.class);
foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
foodList.putExtra("CategoryName", model.getName());
startActivity(foodList);
}catch (Exception e){
Log.d("ERROR", e.getStackTrace().toString());
}
}
});
}
};
recyler_menu.setAdapter(adapter);
}
@Override
@@ -4,7 +4,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.waterbase.foodify.SignIn">
tools:context="com.waterbase.foodify.SignIn"
style="@style/Theme.MaterialComponents.DayNight.NoActionBar"
>
<ImageView
android:id="@+id/imageView3"
+1 -1
View File
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Foodify" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.Foodify" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
@@ -14,6 +14,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;
@@ -282,6 +283,21 @@ public class FoodList extends AppCompatActivity {
edtPrice.setText(item.getPrice());
edtDiscount.setText(item.getDiscount());
edtDescription.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (edtDescription.hasFocus()) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_SCROLL:
v.getParent().requestDisallowInterceptTouchEvent(false);
return true;
}
}
return false;
}
});
//Event for button
btnSelect.setOnClickListener(new View.OnClickListener() {
@Override
@@ -12,14 +12,13 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_margin="10dp"
android:orientation="vertical">
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/edtName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:backgroundTint="#CCCCCC"
android:drawablePadding="13dp"
android:hint="Tên món ăn"
@@ -34,15 +33,18 @@
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/edtDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="120dp"
android:layout_marginTop="20dp"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:backgroundTint="#CCCCCC"
android:drawablePadding="13dp"
android:hint="Mô tả về món ăn này"
android:inputType="textMultiLine"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:textSize="24sp"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent=".8" />
@@ -50,7 +52,7 @@
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/edtPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:backgroundTint="#CCCCCC"
android:drawablePadding="13dp"
@@ -58,7 +60,7 @@
android:inputType="number"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:textSize="24sp"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent=".8" />
@@ -66,7 +68,7 @@
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/edtDiscount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:backgroundTint="#CCCCCC"
android:drawablePadding="13dp"
@@ -74,7 +76,7 @@
android:inputType="number"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:textSize="24sp"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent=".8" />