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(){