bug fixes

This commit is contained in:
cimenmus
2018-02-02 00:05:13 +03:00
parent 64f25ee44f
commit 218e4717bc
12 changed files with 175 additions and 11 deletions

2
.idea/misc.xml generated
View File

@@ -24,7 +24,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -50,8 +50,12 @@
<activity
android:name=".activity.UpdateProfileActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.ProductPropertiesActivity" />
<activity android:name=".activity.OrderHistoryDetailsActivity"></activity>
<activity
android:name=".activity.ProductPropertiesActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.OrderHistoryDetailsActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>

View File

@@ -54,7 +54,8 @@ public class LoginActivity extends BaseActivity {
//initViews();
}
@OnClick({R.id.loginButton, R.id.forgotPasswordTextView, R.id.registerButton})
@OnClick({R.id.loginButton, R.id.forgotPasswordTextView,
R.id.registerButton, R.id.loginAsGuestTextView})
protected void onClick(View view){
switch (view.getId()){
case R.id.loginButton:
@@ -68,6 +69,9 @@ public class LoginActivity extends BaseActivity {
case R.id.registerButton:
startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
break;
case R.id.loginAsGuestTextView:
startActivity(new Intent(LoginActivity.this, MainActivity.class));
break;
}
}

View File

@@ -36,7 +36,9 @@ import ch.pizzalink.android.fragment.StoreInfoFragment;
import ch.pizzalink.android.fragment.MenuFragment;
import ch.pizzalink.android.fragment.ProductFragment;
import ch.pizzalink.android.fragment.ProfileFragment;
import ch.pizzalink.android.helper.DialogHelper;
import ch.pizzalink.android.helper.PriceHelper;
import ch.pizzalink.android.helper.SessionHelper;
import ch.pizzalink.android.helper.SharedPrefsHelper;
import ch.pizzalink.android.model.CategoryModel;
import ch.pizzalink.android.view.PizzalinkToolbar;
@@ -130,6 +132,10 @@ public class MainActivity extends BaseActivity {
shoppingCartButtonLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!SessionHelper.isCustomerLoggedIn()){
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
return;
}
bottomNavigationView.setCurrentItem(2);
}
});
@@ -186,6 +192,10 @@ public class MainActivity extends BaseActivity {
return true;
case R.id.action_empty:
if(!SessionHelper.isCustomerLoggedIn()){
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
return false;
}
if (currentFragmentName.equals(CartFragment.FRAGMENT_NAME))
return true;
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, CartFragment.newInstance()).commit();
@@ -200,6 +210,10 @@ public class MainActivity extends BaseActivity {
return true;
case R.id.action_history:
if(!SessionHelper.isCustomerLoggedIn()){
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
return false;
}
if (currentFragmentName.equals(OrderHistoryFragment.FRAGMENT_NAME))
return true;
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, OrderHistoryFragment.newInstance()).commit();
@@ -214,6 +228,10 @@ public class MainActivity extends BaseActivity {
return true;
case R.id.action_profile:
if(!SessionHelper.isCustomerLoggedIn()){
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_that_part);
return false;
}
if (currentFragmentName.equals(ProfileFragment.FRAGMENT_NAME))
return true;
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, ProfileFragment.newInstance()).commit();

View File

@@ -28,7 +28,7 @@ import retrofit2.Response;
public class OrderHistoryDetailsActivity extends BaseActivity {
@BindView(R.id.orderDatePizzalinkInfoLayout) PizzalinkInfoView orderDatePizzalinkInfoLayout;
@BindView(R.id.orderStatusPizzalinkInfoLayout) PizzalinkInfoView orderStatusPizzalinkInfoLayout;
//@BindView(R.id.orderStatusPizzalinkInfoLayout) PizzalinkInfoView orderStatusPizzalinkInfoLayout;
@BindView(R.id.orderShippingTimePizzalinkInfoLayout) PizzalinkInfoView orderShippingTimePizzalinkInfoLayout;
@BindView(R.id.orderTotalPizzalinkInfoLayout) PizzalinkInfoView orderTotalPizzalinkInfoLayout;
@BindView(R.id.orderPaymentMethodPizzalinkInfoLayout) PizzalinkInfoView orderPaymentMethodPizzalinkInfoLayout;
@@ -57,7 +57,7 @@ public class OrderHistoryDetailsActivity extends BaseActivity {
private void initViews(){
orderDatePizzalinkInfoLayout.setText(orderHistoryModel.getFormattedCreateDate());
orderStatusPizzalinkInfoLayout.setText(orderHistoryModel.getStatus());
//orderStatusPizzalinkInfoLayout.setText(orderHistoryModel.getStatus());
if(orderHistoryModel.getShippingTime().isEmpty()){
orderShippingTimePizzalinkInfoLayout.setVisibility(View.GONE);
}

View File

@@ -120,8 +120,14 @@ public class ProductPropertiesActivity extends BaseActivity {
productPriceTextView.getText().toString(), productCount + 1, productCount));
break;
case R.id.addToCartButton:
if(checkFields())
addProductToCart();
if(checkFields()){
if(SessionHelper.isCustomerLoggedIn()){
addProductToCart();
}
else {
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_shopping);
}
}
break;
}
}

View File

@@ -31,7 +31,7 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
@BindView(R.id.orderDateTextView) TextView orderDateTextView;
@BindView(R.id.orderTotalTextView) TextView orderTotalTextView;
@BindView(R.id.orderStatusTextView) TextView orderStatusTextView;
//@BindView(R.id.orderStatusTextView) TextView orderStatusTextView;
public OrderViewHolder(final View view, final RecyclerItemClickListener recyclerItemClickListener) {
super(view);
@@ -105,7 +105,7 @@ public class OrderHistoryRecyclerAdapter extends RecyclerView.Adapter<RecyclerVi
OrderViewHolder orderViewHolder = (OrderViewHolder) holder;
orderViewHolder.orderDateTextView.setText(orderHistoryList.get(position).getFormattedCreateDate());
orderViewHolder.orderTotalTextView.setText(PriceHelper.roundFractions(orderHistoryList.get(position).getTotalString()));
orderViewHolder.orderStatusTextView.setText(orderHistoryList.get(position).getStatus());
//orderViewHolder.orderStatusTextView.setText(orderHistoryList.get(position).getStatus());
break;
case HOLDER_SPACE :

View File

@@ -13,6 +13,7 @@ import java.util.ArrayList;
import ch.pizzalink.android.R;
import ch.pizzalink.android.activity.BaseActivity;
import ch.pizzalink.android.activity.LoginActivity;
import ch.pizzalink.android.activity.RegisterActivity;
public class DialogHelper {
@@ -132,6 +133,39 @@ public class DialogHelper {
.show();
}
public static void showNeedToLoginDialog(int messageResourceId){
MaterialDialog dialog = new MaterialDialog.Builder(BaseActivity.currentActivity)
.title(R.string.alert)
.content(BaseActivity.currentActivity.getString(messageResourceId))
.titleColorRes(R.color.red)
.contentColorRes(R.color.navy)
.positiveText(R.string.button_login)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
BaseActivity.currentActivity.startActivity(new Intent(BaseActivity.currentActivity, LoginActivity.class));
}
})
.negativeText(R.string.register_text)
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
BaseActivity.currentActivity.startActivity(new Intent(BaseActivity.currentActivity, RegisterActivity.class));
}
})
.neutralText(R.string.cancel_all_caps)
//.onNeutral()
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
.build();
dialog.getActionButton(DialogAction.POSITIVE).setTextSize(12);
dialog.getActionButton(DialogAction.NEGATIVE).setTextSize(12);
dialog.getActionButton(DialogAction.NEUTRAL).setTextSize(12);
dialog.show();
}
public static void showUpdateAppDialog(Context context) {
new MaterialDialog.Builder(context)

View File

@@ -93,6 +93,18 @@
</LinearLayout>
<TextView
android:id="@+id/loginAsGuestTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="@string/login_as_guest"
android:layout_alignParentBottom="true"
android:padding="16dp"
android:layout_centerHorizontal="true"
android:textColor="@color/white" />
</RelativeLayout>

View File

@@ -63,7 +63,8 @@
android:id="@+id/orderStatusPizzalinkInfoLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:description="@string/order_history_order_status" />
app:description="@string/order_history_order_status"
android:visibility="gone"/>
<ch.pizzalink.android.view.PizzalinkInfoView
android:id="@+id/orderShippingTimePizzalinkInfoLayout"

View File

@@ -1,4 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="4dp"
android:layout_marginTop="12dp"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp">
<TextView
android:id="@+id/orderDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5 Oct. 2017"
android:textColor="@color/red"
android:padding="8dp"
fontPath="fonts/Quicksand-Bold.ttf"
android:textSize="16sp"
android:layout_centerVertical="true"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/orderTotalTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CHF 25.00"
android:textColor="@color/navy"
android:layout_marginLeft="32dp"
android:layout_marginStart="32dp"
fontPath="fonts/Quicksand-Bold.ttf"
android:padding="8dp"
android:layout_gravity="center_vertical"/>
<ImageView
android:id="@+id/arrow"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_back"
android:tint="@color/navy"
android:padding="6dp"
android:rotation="180"/>
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<!--
<android.support.v7.widget.CardView 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"
@@ -92,6 +164,15 @@
</android.support.v7.widget.CardView>
-->
<!--
<?xml version="1.0" encoding="utf-8"?>

View File

@@ -25,6 +25,9 @@
<string name="chf">CHF</string> 
<string name="empty_description">..</string>
<string name="choose">Wählen</string>
<string name="need_to_login_for_shopping">Alışveriş yapabilmek için üye olmanız gerekmektedir.</string>
<string name="need_to_login_for_that_part">Bu bölüme girebilmek için üye olmanız gerekmektedir.</string>
<string name="cancel_all_caps">BEENDEN</string>
<!-- General-->
<!-- SplashActivity -->  
@@ -40,6 +43,7 @@
<string name="register_text">REGISTRIEREN</string>    
<string name="forgot_password_hint">Haben Sie Ihr Passwort vergessen?</string>  
<string name="reset_password"><b><u>\nPASSWORT ZURÜCKSETZEN</u></b></string>
<string name="login_as_guest">Login as Guest</string>
<!-- LoginActivity-->
<!-- ForgotPasswordActivity-->