store info page
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -37,7 +37,7 @@
|
|||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package ch.pizzalink.android.activity;
|
package ch.pizzalink.android.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomNavigationView;
|
import android.support.design.widget.BottomNavigationView;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
@@ -13,9 +12,7 @@ import android.support.v7.widget.RecyclerView;
|
|||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;
|
import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx;
|
||||||
|
|
||||||
@@ -28,7 +25,7 @@ import butterknife.ButterKnife;
|
|||||||
import ch.pizzalink.android.R;
|
import ch.pizzalink.android.R;
|
||||||
import ch.pizzalink.android.adapter.recycler.NavigationMenuRecyclerAdapter;
|
import ch.pizzalink.android.adapter.recycler.NavigationMenuRecyclerAdapter;
|
||||||
import ch.pizzalink.android.fragment.CartFragment;
|
import ch.pizzalink.android.fragment.CartFragment;
|
||||||
import ch.pizzalink.android.fragment.InfoFragment;
|
import ch.pizzalink.android.fragment.StoreInfoFragment;
|
||||||
import ch.pizzalink.android.fragment.HistoryFragment;
|
import ch.pizzalink.android.fragment.HistoryFragment;
|
||||||
import ch.pizzalink.android.fragment.MenuFragment;
|
import ch.pizzalink.android.fragment.MenuFragment;
|
||||||
import ch.pizzalink.android.fragment.ProductFragment;
|
import ch.pizzalink.android.fragment.ProductFragment;
|
||||||
@@ -150,10 +147,10 @@ public class MainActivity extends BaseActivity {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.action_info:
|
case R.id.action_info:
|
||||||
if (currentFragmentName.equals(InfoFragment.FRAGMENT_NAME))
|
if (currentFragmentName.equals(StoreInfoFragment.FRAGMENT_NAME))
|
||||||
return true;
|
return true;
|
||||||
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, InfoFragment.newInstance()).commit();
|
fragmentManager.beginTransaction().replace(R.id.fragmentContainer, StoreInfoFragment.newInstance()).commit();
|
||||||
currentFragmentName = InfoFragment.FRAGMENT_NAME;
|
currentFragmentName = StoreInfoFragment.FRAGMENT_NAME;
|
||||||
currentCategoryId = -1;
|
currentCategoryId = -1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,5 @@ public class ApiEndPoints {
|
|||||||
public static final String API_DELETE_ADDRESS = PREFIX + "deleteAddress" + SUFFIX + "&token=";
|
public static final String API_DELETE_ADDRESS = PREFIX + "deleteAddress" + SUFFIX + "&token=";
|
||||||
public static final String API_UPDATE_PROFILE = PREFIX + "updateCustomerInfo" + SUFFIX + "&token=";
|
public static final String API_UPDATE_PROFILE = PREFIX + "updateCustomerInfo" + SUFFIX + "&token=";
|
||||||
public static final String API_REMOVE_RPODUCT_FORM_CART = PREFIX + "removeProductFromBasket" + SUFFIX + "&token=";
|
public static final String API_REMOVE_RPODUCT_FORM_CART = PREFIX + "removeProductFromBasket" + SUFFIX + "&token=";
|
||||||
|
public static final String API_GET_STORE_INFO = PREFIX + "getStoreInfo" + SUFFIX;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import ch.pizzalink.android.model.PaymentMethodsResponseModel;
|
|||||||
import ch.pizzalink.android.model.RemoveProductFromCartResponseModel;
|
import ch.pizzalink.android.model.RemoveProductFromCartResponseModel;
|
||||||
import ch.pizzalink.android.model.ShippingMethodModel;
|
import ch.pizzalink.android.model.ShippingMethodModel;
|
||||||
import ch.pizzalink.android.model.ShippingMethodsResponseModel;
|
import ch.pizzalink.android.model.ShippingMethodsResponseModel;
|
||||||
|
import ch.pizzalink.android.model.StoreInfoModel;
|
||||||
import ch.pizzalink.android.model.ZoneModel;
|
import ch.pizzalink.android.model.ZoneModel;
|
||||||
import ch.pizzalink.android.model.cart.CartInfoModel;
|
import ch.pizzalink.android.model.cart.CartInfoModel;
|
||||||
import ch.pizzalink.android.model.CategoryModel;
|
import ch.pizzalink.android.model.CategoryModel;
|
||||||
@@ -135,4 +136,8 @@ public interface ApiInterface {
|
|||||||
Call<ResponseObject<RemoveProductFromCartResponseModel>> removeProductFromCart(@Url String url,
|
Call<ResponseObject<RemoveProductFromCartResponseModel>> removeProductFromCart(@Url String url,
|
||||||
@FieldMap HashMap<String, Object> body);
|
@FieldMap HashMap<String, Object> body);
|
||||||
|
|
||||||
|
@GET(ApiEndPoints.API_GET_STORE_INFO)
|
||||||
|
Call<ResponseObject<StoreInfoModel>> getStoreInfo();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
package ch.pizzalink.android.fragment;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import butterknife.BindString;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
import ch.pizzalink.android.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by cimenmus on 18/09/2017.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class InfoFragment extends BaseFragment {
|
|
||||||
|
|
||||||
@BindString(R.string.bottom_nav_menu_item_info) String fragmentTitle;
|
|
||||||
|
|
||||||
public static final java.lang.String FRAGMENT_NAME = "infoFragment";
|
|
||||||
|
|
||||||
public InfoFragment() {}
|
|
||||||
|
|
||||||
public static InfoFragment newInstance() {
|
|
||||||
return new InfoFragment();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
View view = inflater.inflate(R.layout.fragment_info, container, false);
|
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
initViews();
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initViews(){
|
|
||||||
setPizzalinkToolbarFields(false, fragmentTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package ch.pizzalink.android.fragment;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import butterknife.BindString;
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import ch.pizzalink.android.R;
|
||||||
|
import ch.pizzalink.android.api.ApiErrorUtils;
|
||||||
|
import ch.pizzalink.android.api.ApiService;
|
||||||
|
import ch.pizzalink.android.api.ResponseObject;
|
||||||
|
import ch.pizzalink.android.helper.DialogHelper;
|
||||||
|
import ch.pizzalink.android.model.StoreInfoModel;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cimenmus on 18/09/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class StoreInfoFragment extends BaseFragment {
|
||||||
|
|
||||||
|
@BindView(R.id.storeInfoWebView) WebView storeInfoWebView;
|
||||||
|
|
||||||
|
@BindString(R.string.bottom_nav_menu_item_info) String fragmentTitle;
|
||||||
|
|
||||||
|
public static final java.lang.String FRAGMENT_NAME = "infoFragment";
|
||||||
|
|
||||||
|
public StoreInfoFragment() {}
|
||||||
|
|
||||||
|
public static StoreInfoFragment newInstance() {
|
||||||
|
return new StoreInfoFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_store_info, container, false);
|
||||||
|
ButterKnife.bind(this, view);
|
||||||
|
initViews();
|
||||||
|
getStoreInfo();
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews(){
|
||||||
|
setPizzalinkToolbarFields(false, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getStoreInfo(){
|
||||||
|
DialogHelper.showLoadingDialog();
|
||||||
|
Call<ResponseObject<StoreInfoModel>> call = ApiService.apiInterface.getStoreInfo();
|
||||||
|
call.enqueue(new Callback<ResponseObject<StoreInfoModel>>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ResponseObject<StoreInfoModel>> call, Response<ResponseObject<StoreInfoModel>> response) {
|
||||||
|
DialogHelper.hideLoadingDialog();
|
||||||
|
if(response.isSuccessful() &&
|
||||||
|
response.body().getData() != null &&
|
||||||
|
response.isSuccessful()){
|
||||||
|
initWebView(response.body().getData());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ApiErrorUtils.parseError(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ResponseObject<StoreInfoModel>> call, Throwable t) {
|
||||||
|
DialogHelper.hideLoadingDialog();
|
||||||
|
DialogHelper.showFailedDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initWebView(StoreInfoModel storeInfoModel) {
|
||||||
|
storeInfoModel.checkNull();
|
||||||
|
setPizzalinkToolbarFields(false, storeInfoModel.getTitle());
|
||||||
|
storeInfoWebView.getSettings().setJavaScriptEnabled(true);
|
||||||
|
storeInfoWebView.loadDataWithBaseURL("", storeInfoModel.getContent(), "text/html", "UTF-8", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package ch.pizzalink.android.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cimenmus on 26.10.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class StoreInfoModel {
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
public void checkNull(){
|
||||||
|
|
||||||
|
if(title == null){
|
||||||
|
title = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(content == null){
|
||||||
|
content = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/actvity_default_background_color_1">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Info Fragment"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:textColor="@color/black"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
14
app/src/main/res/layout/fragment_store_info.xml
Normal file
14
app/src/main/res/layout/fragment_store_info.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/storeInfoWebView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
Reference in New Issue
Block a user