design part 3

This commit is contained in:
cimenmus
2017-11-04 00:20:52 +03:00
parent 2002a3c7f0
commit e5679da0ab
13 changed files with 192 additions and 47 deletions

View File

@@ -53,7 +53,10 @@ public class MainActivity extends BaseActivity {
@BindView(R.id.pizzalinkToolbar) PizzalinkToolbar pizzalinkToolbar;
@BindView(R.id.bottomNavigationView) BottomNavigationViewEx bottomNavigationView;
@BindView(R.id.shoppingCartLayout) RelativeLayout shoppingCartLayout;
@BindView(R.id.badgeLayout) RelativeLayout badgeLayout;
@BindView(R.id.badgeTextView) TextView badgeTextView;
@BindView(R.id.shoppingCartButtonLayout) RelativeLayout shoppingCartButtonLayout;
@BindView(R.id.shoppingCartImageView) ImageView shoppingCartImageView;
@BindView(R.id.shoppingCartTextView) TextView shoppingCartTextView;
@@ -69,7 +72,7 @@ public class MainActivity extends BaseActivity {
private boolean isStartWithOrderHistory;
private ArrayList<CategoryModel> categoryList = new ArrayList<>();
private NavigationMenuRecyclerAdapter navigationMenuRecyclerAdapter;
private Badge badge;
//private Badge badge;
private Animation animUp,animDown;
private SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter();
@@ -93,7 +96,7 @@ public class MainActivity extends BaseActivity {
}
private void initViews(){
initBadgeView();
//initBadgeView();
initNavigationDrawer();
initBottomNavigationView();
showStartScreen();
@@ -107,24 +110,24 @@ public class MainActivity extends BaseActivity {
animDown = AnimationUtils.loadAnimation(this, R.anim.anim_scale_down);
animUp = AnimationUtils.loadAnimation(this, R.anim.anim_scale_up);
shoppingCartLayout.setOnTouchListener(new View.OnTouchListener() {
shoppingCartButtonLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case (android.view.MotionEvent.ACTION_DOWN):
shoppingCartLayout.startAnimation(animDown);
shoppingCartButtonLayout.startAnimation(animDown);
return false;
case (android.view.MotionEvent.ACTION_UP):
shoppingCartLayout.startAnimation(animUp);
shoppingCartButtonLayout.startAnimation(animUp);
return false;
case (android.view.MotionEvent.ACTION_CANCEL):
shoppingCartLayout.startAnimation(animUp);
shoppingCartButtonLayout.startAnimation(animUp);
}
return false;
}
});
shoppingCartLayout.setOnClickListener(new View.OnClickListener() {
shoppingCartButtonLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bottomNavigationView.setCurrentItem(2);
@@ -132,12 +135,14 @@ public class MainActivity extends BaseActivity {
});
}
/*
private void initBadgeView(){
badge = new QBadgeView(this)
.setBadgeBackgroundColor(redColor)
.setBadgeTextColor(whiteColor)
.setBadgeGravity(Gravity.TOP | Gravity.END);
}
*/
private void showStartScreen(){
fragmentManager = getSupportFragmentManager();
@@ -405,9 +410,21 @@ public class MainActivity extends BaseActivity {
bottomNavigationView.setCurrentItem(1);
}
/*
private void addBadgeAt(int position, int number) {
badge.setBadgeNumber(number);
badge.bindTarget(bottomNavigationView.getBottomNavigationItemView(position));
}
*/
private void addBadgeAt(int position, int number) {
badgeTextView.setText(String.valueOf(number));
if(number <= 0){
badgeLayout.setVisibility(View.GONE);
}
else {
badgeLayout.setVisibility(View.VISIBLE);
}
}
}

View File

@@ -30,6 +30,8 @@ public class DialogHelper {
new MaterialDialog.Builder(context)
.title(title)
.content(message)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.positiveColor(ContextCompat.getColor(context, R.color.colorPrimary))
.onPositive(new MaterialDialog.SingleButtonCallback() {
@@ -39,6 +41,7 @@ public class DialogHelper {
dialog.dismiss();
}
})
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -52,8 +55,11 @@ public class DialogHelper {
new MaterialDialog.Builder(context)
.title(R.string.alert)
.content(content)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.positiveColor(ContextCompat.getColor(context, R.color.colorPrimary))
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -62,8 +68,11 @@ public class DialogHelper {
new MaterialDialog.Builder(BaseActivity.currentActivity)
.title(R.string.alert)
.content(BaseActivity.currentActivity.getString(R.string.failed))
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.positiveColor(ContextCompat.getColor(BaseActivity.currentActivity, R.color.colorPrimary))
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -72,6 +81,8 @@ public class DialogHelper {
new MaterialDialog.Builder(BaseActivity.currentActivity)
.title(R.string.alert)
.content(BaseActivity.currentActivity.getString(R.string.no_network_message))
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.positiveColor(ContextCompat.getColor(BaseActivity.currentActivity, R.color.colorPrimary))
.onPositive(new MaterialDialog.SingleButtonCallback() {
@@ -80,6 +91,7 @@ public class DialogHelper {
BaseActivity.currentActivity.finishAffinity();
}
})
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -88,9 +100,12 @@ public class DialogHelper {
return;
loadingDialog = new MaterialDialog.Builder(BaseActivity.currentActivity)
.content(BaseActivity.currentActivity.getString(R.string.loading))
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.cancelable(false)
.progress(true, 0)
.progressIndeterminateStyle(true)
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -107,10 +122,13 @@ public class DialogHelper {
new MaterialDialog.Builder(context)
.title(R.string.alert)
.content(message)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.onPositive(positiveButtonCallback)
.negativeText(R.string.cancel)
.onNegative(negativeButtonCallback)
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -119,6 +137,8 @@ public class DialogHelper {
new MaterialDialog.Builder(context)
.title(R.string.alert)
.content(R.string.alert_update_app)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.update_app)
.positiveColor(ContextCompat.getColor(context, R.color.colorPrimary))
.cancelable(false)
@@ -131,6 +151,7 @@ public class DialogHelper {
BaseActivity.currentActivity.finishAffinity();
}
})
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -139,8 +160,11 @@ public class DialogHelper {
new MaterialDialog.Builder(BaseActivity.currentActivity)
.title(R.string.app_name)
.content(message)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.onPositive(singleButtonCallback)
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -151,6 +175,8 @@ public class DialogHelper {
new MaterialDialog.Builder(context)
.title(R.string.app_name)
.content(R.string.password_reset)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.positiveColor(ContextCompat.getColor(context, R.color.colorPrimary))
.cancelable(false)
@@ -162,6 +188,7 @@ public class DialogHelper {
BaseActivity.currentActivity.finishAffinity();
}
})
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
@@ -171,9 +198,12 @@ public class DialogHelper {
new MaterialDialog.Builder(BaseActivity.currentActivity)
.title(R.string.app_name)
.content(R.string.profile_updated)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.ok)
.cancelable(false)
.onPositive(singleButtonCallback)
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}
*/
@@ -181,8 +211,11 @@ public class DialogHelper {
public static void showListDialog(ArrayList<String> itemList, MaterialDialog.ListCallback listCallback){
new MaterialDialog.Builder(BaseActivity.currentActivity)
.title(R.string.choose)
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.items(itemList)
.itemsCallback(listCallback)
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.show();
}

View File

@@ -2,12 +2,15 @@ package ch.pizzalink.android.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.BaseActivity;
/**
* Created by cimenmus on 26.10.2017.
@@ -18,7 +21,9 @@ public class PizzalinkDropdownView extends LinearLayout {
private View rootView;
private TextView hintTextView;
private TextView textview;
private RelativeLayout bottomLineLayout;
private String hint;
private String dropdownTheme;
public PizzalinkDropdownView(Context context) {
super(context);
@@ -31,6 +36,7 @@ public class PizzalinkDropdownView extends LinearLayout {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.PizzalinkDropdownView, 0, 0);
try {
hint = a.getString(R.styleable.PizzalinkDropdownView_dropdownHintView);
dropdownTheme = a.getString(R.styleable.PizzalinkDropdownView_dropdownTheme);
} finally {
a.recycle();
}
@@ -42,7 +48,14 @@ public class PizzalinkDropdownView extends LinearLayout {
rootView = (View) inflate(context, R.layout.layout_pizzalink_drowdown_view, this);
hintTextView = (TextView) rootView.findViewById(R.id.hintTextView);
textview = (TextView) rootView.findViewById(R.id.textview);
bottomLineLayout = (RelativeLayout) rootView.findViewById(R.id.bottomLineLayout);
hintTextView.setText(hint);
if(dropdownTheme != null && dropdownTheme.equals("navy")){
int navyColor = ContextCompat.getColor(BaseActivity.currentActivity, R.color.navigation_drawer_background);
hintTextView.setTextColor(navyColor);
textview.setTextColor(navyColor);
bottomLineLayout.setBackgroundColor(navyColor);
}
}
public boolean isEmpty(){

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!-- fill color -->
<solid android:color="@color/red" />
<!-- radius -->
<stroke
android:width="1dp"
android:color="@color/red" />
<!-- corners -->
<corners
android:bottomLeftRadius="2dp"
android:bottomRightRadius="2dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp" />
</shape>

View File

@@ -38,6 +38,7 @@
android:id="@+id/address1PizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:inputType="address"
app:hint="@string/addres_line_1"/>
@@ -45,24 +46,28 @@
android:id="@+id/cityPizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/city"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/postcodePizzalinkDrowpdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/postcode"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/countryPizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/country"/>
<ch.pizzalink.android.view.PizzalinkDropdownView
android:id="@+id/zonePizzalinkDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dropdownTheme="navy"
app:dropdownHintView="@string/zone"/>
<android.support.v4.widget.Space
@@ -79,7 +84,7 @@
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
style="@style/PizzalinkButton"
style="@style/PizzalinkRedButton"
android:text="@string/add"
android:layout_alignParentBottom="true" />

View File

@@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingPrefix"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@@ -49,40 +50,68 @@
app:itemBackground="@color/navy"
android:layout_alignParentBottom="true"/>
<RelativeLayout
android:id="@+id/shoppingCartLayout"
android:layout_width="72dp"
android:layout_height="72dp"
android:orientation="vertical"
android:background="@drawable/background_button_cart"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="-8dp"
android:elevation="9dp">
android:elevation="9dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/shoppingCartImageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_bottom_nav_item_cart_white"/>
<RelativeLayout
android:id="@+id/badgeLayout"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginBottom="-12dp"
android:elevation="9dp"
android:background="@drawable/background_badge"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/shoppingCartTextView"
android:id="@+id/badgeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_nav_menu_item_cart"
android:textSize="12sp"
android:textColor="@color/white"/>
android:layout_centerInParent="true"
fontPath="fonts/Quicksand-Bold.ttf"
android:textColor="@color/white"
android:text="1"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/shoppingCartButtonLayout"
android:layout_width="72dp"
android:layout_height="72dp"
android:background="@drawable/background_button_cart"
android:elevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/shoppingCartImageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_bottom_nav_item_cart_white"/>
<TextView
android:id="@+id/shoppingCartTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bottom_nav_menu_item_cart"
android:textSize="12sp"
android:textColor="@color/white"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/shoppingCartButton"

View File

@@ -30,7 +30,7 @@
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
style="@style/PizzalinkButton"
style="@style/PizzalinkRedButton"
android:text="@string/add_new_address"
android:layout_alignParentBottom="true"/>

View File

@@ -7,6 +7,8 @@
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="ch.pizzalink.android.activity.UpdatePasswordActivity">
<ch.pizzalink.android.view.PizzalinkToolbar
@@ -22,6 +24,7 @@
android:id="@+id/oldPasswordPizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:inputType="password"
app:hint="@string/hint_old_password"/>
@@ -29,6 +32,7 @@
android:id="@+id/newPasswordPizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:inputType="password"
app:hint="@string/hint_new_password"/>
@@ -37,6 +41,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="password"
app:edittextTheme="navy"
app:hint="@string/hint_confirm_new_password"/>
<android.support.v4.widget.Space
@@ -49,7 +54,7 @@
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
style="@style/PizzalinkButton"
style="@style/PizzalinkRedButton"
android:text="@string/update_app" />
</LinearLayout>

View File

@@ -30,6 +30,7 @@
android:id="@+id/firstnamePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:inputType="name"
app:hint="@string/firstname"/>
@@ -37,6 +38,7 @@
android:id="@+id/lasstnamePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:inputType="name"
app:hint="@string/lastname"/>
@@ -44,6 +46,7 @@
android:id="@+id/telephonePizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:hint="@string/telephone"
app:inputType="phone"/>
@@ -51,6 +54,7 @@
android:id="@+id/emailPizzalinkEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:edittextTheme="navy"
app:hint="@string/email"
app:inputType="email"/>
@@ -62,10 +66,8 @@
android:layout_height="48dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
style="@style/PizzalinkButton"
style="@style/PizzalinkRedButton"
android:text="@string/update_app"
android:layout_alignParentBottom="true" />
</RelativeLayout>

View File

@@ -35,6 +35,7 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/bottomLineLayout"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/row_product_ingredients_background"

View File

@@ -38,6 +38,7 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/bottomLineLayout"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/white"

View File

@@ -57,17 +57,35 @@
</RelativeLayout>
<TextView
android:id="@+id/productPriceTextView"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:background="@drawable/background_product_cart_price"
android:text="CHF 25.00"
android:padding="17dp"
android:gravity="center_horizontal"
fontPath="fonts/Quicksand-Bold.ttf"
android:layout_gravity="center_horizontal" />
android:background="@drawable/background_product_cart_price">
<TextView
android:id="@+id/productPriceTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="CHF 25.00"
android:padding="17dp"
android:gravity="center_horizontal"
fontPath="fonts/Quicksand-Bold.ttf"
android:layout_gravity="center_horizontal" />
<ImageView
android:id="@+id/downImageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_down_black"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:padding="6dp"
android:layout_margin="8dp"
android:tint="@color/white"/>
</RelativeLayout>
</LinearLayout>

View File

@@ -31,6 +31,7 @@
</declare-styleable>
<declare-styleable name="PizzalinkDropdownView">
<attr name="dropdownTheme" format="string" />
<attr name="dropdownHintView" format="string" />
</declare-styleable>