mirror of
https://github.com/Nezumi-2711/PRM392.git
synced 2026-09-22 05:41:45 +00:00
Fix font and improve UI
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -116,7 +116,7 @@ public class Cart extends AppCompatActivity implements GoogleApiClient.Connectio
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ChangePassword extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.TextPaint;
|
||||
import android.text.style.TypefaceSpan;
|
||||
|
||||
public class CustomTypefaceSpan extends TypefaceSpan {
|
||||
|
||||
private final Typeface newType;
|
||||
|
||||
public CustomTypefaceSpan(String family, Typeface type) {
|
||||
super(family);
|
||||
newType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
applyCustomTypeFace(ds, newType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMeasureState(TextPaint paint) {
|
||||
applyCustomTypeFace(paint, newType);
|
||||
}
|
||||
|
||||
private static void applyCustomTypeFace(Paint paint, Typeface tf) {
|
||||
int oldStyle;
|
||||
Typeface old = paint.getTypeface();
|
||||
if (old == null) {
|
||||
oldStyle = 0;
|
||||
} else {
|
||||
oldStyle = old.getStyle();
|
||||
}
|
||||
|
||||
int fake = oldStyle & ~tf.getStyle();
|
||||
if ((fake & Typeface.BOLD) != 0) {
|
||||
paint.setFakeBoldText(true);
|
||||
}
|
||||
|
||||
if ((fake & Typeface.ITALIC) != 0) {
|
||||
paint.setTextSkewX(-0.25f);
|
||||
}
|
||||
|
||||
paint.setTypeface(tf);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
@@ -19,6 +20,11 @@ import com.waterbase.foodify.Model.Favorites;
|
||||
import com.waterbase.foodify.ViewHolder.FavoritesAdapter;
|
||||
import com.waterbase.foodify.ViewHolder.FavoritesViewHolder;
|
||||
|
||||
import io.github.inflationx.calligraphy3.CalligraphyConfig;
|
||||
import io.github.inflationx.calligraphy3.CalligraphyInterceptor;
|
||||
import io.github.inflationx.viewpump.ViewPump;
|
||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
|
||||
|
||||
public class FavoritesActivity extends AppCompatActivity implements RecyclerItemTouchHelperListener {
|
||||
|
||||
RecyclerView recyclerView;
|
||||
@@ -28,9 +34,24 @@ public class FavoritesActivity extends AppCompatActivity implements RecyclerItem
|
||||
|
||||
RelativeLayout rootLayout;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//Set font all activity
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
setContentView(R.layout.activity_favorites);
|
||||
|
||||
rootLayout = findViewById(R.id.rootLayout);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class FoodDetail extends AppCompatActivity implements RatingDialogListene
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
@@ -265,26 +265,5 @@ public class FoodDetail extends AppCompatActivity implements RatingDialogListene
|
||||
Toast.makeText(FoodDetail.this, "Cảm ơn bạn đã đánh giá!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
// ratingTbl.child(Common.currentUser.getPhone()).addValueEventListener(new ValueEventListener() {
|
||||
// @Override
|
||||
// public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
// if (dataSnapshot.child(Common.currentUser.getPhone()).exists()) {
|
||||
// //Remove old feedback
|
||||
// ratingTbl.child(Common.currentUser.getPhone()).removeValue();
|
||||
// //Update new feedback
|
||||
// ratingTbl.child(Common.currentUser.getPhone()).setValue(rating);
|
||||
// } else {
|
||||
//
|
||||
// //Update new value
|
||||
// ratingTbl.child(Common.currentUser.getPhone()).setValue(rating);
|
||||
// }
|
||||
// Toast.makeText(FoodDetail.this, "Cảm ơn bạn đã đánh giá món ăn!", Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancelled(DatabaseError databaseError) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class FoodList extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ForgotPassword extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -3,11 +3,15 @@ package com.waterbase.foodify;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AnimationUtils;
|
||||
@@ -96,7 +100,7 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
@@ -156,6 +160,23 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
|
||||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
|
||||
//Set font to navigation
|
||||
Menu m = navigationView.getMenu();
|
||||
for (int i=0;i<m.size();i++) {
|
||||
MenuItem mi = m.getItem(i);
|
||||
|
||||
//for aapplying a font to subMenu ...
|
||||
SubMenu subMenu = mi.getSubMenu();
|
||||
if (subMenu != null && subMenu.size() > 0) {
|
||||
for (int j = 0; j < subMenu.size(); j++) {
|
||||
MenuItem subMenuItem = subMenu.getItem(j);
|
||||
applyFontToMenuItem(subMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
//the method we have create in activity
|
||||
applyFontToMenuItem(mi);
|
||||
}
|
||||
|
||||
//Init database
|
||||
database = FirebaseDatabase.getInstance();
|
||||
@@ -217,6 +238,13 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
|
||||
|
||||
}
|
||||
|
||||
private void applyFontToMenuItem(MenuItem mi) {
|
||||
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/font.otf");
|
||||
SpannableString mNewTitle = new SpannableString(mi.getTitle());
|
||||
mNewTitle.setSpan(new CustomTypefaceSpan("" , font), 0 , mNewTitle.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
mi.setTitle(mNewTitle);
|
||||
}
|
||||
|
||||
private void setupSlider() {
|
||||
mSlider = findViewById(R.id.slider);
|
||||
image_list = new HashMap<>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.waterbase.foodify;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -41,6 +42,10 @@ import org.json.JSONObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.inflationx.calligraphy3.CalligraphyConfig;
|
||||
import io.github.inflationx.calligraphy3.CalligraphyInterceptor;
|
||||
import io.github.inflationx.viewpump.ViewPump;
|
||||
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -62,9 +67,24 @@ public class OrderDetail extends AppCompatActivity {
|
||||
|
||||
APIService mService;
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//Set font all activity
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
setContentView(R.layout.activity_order_detail);
|
||||
|
||||
String comment = "";
|
||||
@@ -135,14 +155,13 @@ public class OrderDetail extends AppCompatActivity {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
String order_number = String.valueOf(System.currentTimeMillis());
|
||||
String totalPrice = request.getTotal().substring(0, request.getTotal().length() - 2).replace(".", ""); //Remove character " đ"
|
||||
|
||||
CreateOrder orderApi = new CreateOrder();
|
||||
|
||||
try {
|
||||
JSONObject data = orderApi.createOrder(totalPrice);
|
||||
Log.d("Amount", totalPrice);
|
||||
JSONObject data = orderApi.createOrder(totalPrice, order_number);
|
||||
String code = data.getString("return_code");
|
||||
|
||||
if (code.equals("1")) {
|
||||
@@ -156,7 +175,6 @@ public class OrderDetail extends AppCompatActivity {
|
||||
request.setPaymentStatus("Đã thanh toán!");
|
||||
//Summit to Firebase
|
||||
//We will using System.CurrentMilli to key
|
||||
String order_number = String.valueOf(System.currentTimeMillis());
|
||||
requests.child(order_number).setValue(request);
|
||||
|
||||
sendNotificationOrder(order_number);
|
||||
@@ -209,7 +227,7 @@ public class OrderDetail extends AppCompatActivity {
|
||||
//Create raw payload to send
|
||||
Map<String, String> dataSend = new HashMap<>();
|
||||
dataSend.put("title", "Foodify");
|
||||
dataSend.put("message", "Bạn có 1 đơn hàng mới +" + order_number);
|
||||
dataSend.put("message", "Bạn có 1 đơn hàng mới #" + order_number);
|
||||
DataMessage dataMessage = new DataMessage(serverToken.getToken(), dataSend);
|
||||
|
||||
mService.sendNotification(dataMessage)
|
||||
|
||||
@@ -52,7 +52,7 @@ public class OrderStatus extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SearchActivity extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ShowComment extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SignIn extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
@@ -67,7 +67,7 @@ public class SignIn extends AppCompatActivity {
|
||||
|
||||
txtAppName = (TextView) findViewById(R.id.txtAppName);
|
||||
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/NABILA.TTF");
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Nabila.ttf");
|
||||
txtAppName.setTypeface(face);
|
||||
|
||||
//Init Firebase
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SignUp extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
@@ -74,7 +74,7 @@ public class SignUp extends AppCompatActivity {
|
||||
|
||||
txtAppName = (TextView) findViewById(R.id.txtAppName);
|
||||
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/NABILA.TTF");
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Nabila.ttf");
|
||||
txtAppName.setTypeface(face);
|
||||
|
||||
//Init Firebase
|
||||
|
||||
@@ -58,7 +58,7 @@ public class VerifyPhone extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Welcome extends AppCompatActivity {
|
||||
ViewPump.init(ViewPump.builder()
|
||||
.addInterceptor(new CalligraphyInterceptor(
|
||||
new CalligraphyConfig.Builder()
|
||||
.setDefaultFontPath("fonts/font.ttf")
|
||||
.setDefaultFontPath("fonts/font.otf")
|
||||
.setFontAttrId(io.github.inflationx.calligraphy3.R.attr.fontPath)
|
||||
.build()))
|
||||
.build());
|
||||
@@ -53,7 +53,7 @@ public class Welcome extends AppCompatActivity {
|
||||
|
||||
txtSlogan = (TextView) findViewById(R.id.txtSlogan);
|
||||
txtAppName = (TextView) findViewById(R.id.txtAppName);
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/NABILA.TTF");
|
||||
Typeface face = Typeface.createFromAsset(getAssets(), "fonts/Nabila.ttf");
|
||||
txtSlogan.setTypeface(face);
|
||||
txtAppName.setTypeface(face);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CreateOrder {
|
||||
String Description;
|
||||
String Mac;
|
||||
|
||||
private CreateOrderData(String amount) throws Exception {
|
||||
private CreateOrderData(String amount, String orderId) throws Exception {
|
||||
long appTime = new Date().getTime();
|
||||
AppId = String.valueOf(AppInfo.APP_ID);
|
||||
AppUser = "Android_Demo";
|
||||
@@ -33,7 +33,7 @@ public class CreateOrder {
|
||||
EmbedData = "{}";
|
||||
Items = "[]";
|
||||
BankCode = "zalopayapp";
|
||||
Description = "Merchant pay for order #" + Helpers.getAppTransId();
|
||||
Description = "Thanh toán đơn hàng Foodify #" + orderId;
|
||||
String inputHMac = String.format("%s|%s|%s|%s|%s|%s|%s",
|
||||
this.AppId,
|
||||
this.AppTransId,
|
||||
@@ -47,8 +47,8 @@ public class CreateOrder {
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject createOrder(String amount) throws Exception {
|
||||
CreateOrderData input = new CreateOrderData(amount);
|
||||
public JSONObject createOrder(String amount, String orderId) throws Exception {
|
||||
CreateOrderData input = new CreateOrderData(amount, orderId);
|
||||
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("app_id", input.AppId)
|
||||
|
||||
@@ -11,17 +11,15 @@
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:weightSum="5"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/food_image"
|
||||
android:src="@drawable/bg4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:layout_height="250dp"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
|
||||
@@ -30,8 +28,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -51,4 +51,8 @@
|
||||
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
|
||||
</style>
|
||||
|
||||
<style name="fontTextViewStyle" parent="android:Widget.TextView">
|
||||
<item name="android:fontFamily">@fonts/</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -58,13 +58,16 @@
|
||||
android:name=".Home"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_home"
|
||||
android:theme="@style/Theme.FoodifyServer.NoActionBar" />
|
||||
android:theme="@style/Theme.FoodifyServer.NoActionBar"
|
||||
/>
|
||||
<activity
|
||||
android:name=".SignIn"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.FoodifyServer.NoActionBar" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.FoodifyServer.NoActionBar" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.waterbase.foodifyServer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -89,6 +90,12 @@ public class BannerActivity extends AppCompatActivity {
|
||||
|
||||
loadListBanner();
|
||||
loadListFood();
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void loadListBanner() {
|
||||
@@ -393,4 +400,14 @@ public class BannerActivity extends AppCompatActivity {
|
||||
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.waterbase.foodifyServer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -74,6 +75,8 @@ public class FoodList extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_food_list);
|
||||
|
||||
setTitle("Quản lý danh sách thức ăn");
|
||||
|
||||
//Firebase
|
||||
db = FirebaseDatabase.getInstance();
|
||||
foodList = db.getReference("Foods");
|
||||
@@ -158,6 +161,12 @@ public class FoodList extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void uploadImage() {
|
||||
@@ -392,4 +401,14 @@ public class FoodList extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
|
||||
setContentView(R.layout.activity_home);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
toolbar.setTitle("Menu Management");
|
||||
toolbar.setTitle("Quản lý menu");
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
//Init database
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.waterbase.foodifyServer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.waterbase.foodifyServer.Common.Common;
|
||||
@@ -46,5 +49,21 @@ public class OrderDetail extends AppCompatActivity {
|
||||
OrderDetailAdapter adapter = new OrderDetailAdapter(Common.currentRequest.getFoods());
|
||||
adapter.notifyDataSetChanged();
|
||||
lstFoods.setAdapter(adapter);
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.waterbase.foodifyServer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -11,6 +12,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
@@ -71,6 +73,12 @@ public class OrderStatus extends AppCompatActivity {
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
loadOrders();
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void loadOrders() {
|
||||
@@ -275,4 +283,14 @@ public class OrderStatus extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.waterbase.foodifyServer;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -41,13 +44,6 @@ public class SendMessage extends AppCompatActivity {
|
||||
btnSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//Create message
|
||||
// Notification notification = new Notification(edtTitle.getText().toString(), edtMessage.getText().toString());
|
||||
//
|
||||
// Sender toTopic = new Sender();
|
||||
// toTopic.to = new StringBuilder("/topics/").append(Common.topicName).toString();
|
||||
// toTopic.notification = notification;
|
||||
|
||||
Map<String,String> dataSend = new HashMap<>();
|
||||
dataSend.put("title",edtTitle.getText().toString());
|
||||
dataSend.put("message",edtMessage.getText().toString());
|
||||
@@ -68,5 +64,21 @@ public class SendMessage extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// calling the action bar
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
// showing the back button in action bar
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -20,12 +20,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="@color/overlayBackground"
|
||||
android:background="@color/white"
|
||||
android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_home"
|
||||
|
||||
app:itemIconTint="@color/white"
|
||||
app:itemTextColor="@color/white"
|
||||
app:itemIconTint="@color/black"
|
||||
app:itemTextColor="@color/black"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
android:background="@color/purple_500"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
@@ -14,11 +14,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@string/nav_header_desc"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
app:srcCompat="@mipmap/ic_launcher_round" />
|
||||
app:srcCompat="@drawable/avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtFullName"
|
||||
@@ -27,10 +27,4 @@
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
android:text="@string/nav_header_title"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/nav_header_subtitle" />
|
||||
</LinearLayout>
|
||||
@@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.FoodifyServer" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<style name="Theme.FoodifyServer" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
|
||||
Reference in New Issue
Block a user