Added swipe func to the item details frag

This commit is contained in:
Tariel Hlontsi 2016-07-20 11:02:01 +03:00
parent a89d5ee1bc
commit 692dd90ca8
52 changed files with 560 additions and 428 deletions

View File

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<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">
<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">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -11,6 +11,7 @@ import android.view.MenuItem;
import com.hikapro.backpack.model.AddModel;
import com.hikapro.backpack.model.DetailModel;
import com.hikapro.backpack.model.ItemModel;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.PackedModel;
import com.hikapro.backpack.model.SetModel;
import com.hikapro.backpack.model.ShareModel;
@ -244,10 +245,10 @@ public class MainActivity extends Activity implements View.ActivityCallback {
}
@Override
public void startItemDetailFragment(Item item, int setId) {
public void startItemDetailFragment(int setId, Model.Item baseModel, int position) {
ItemDetailFragment view = ItemDetailFragment.newInstance(item, setId);
ItemDetailPresenter presenter = new ItemDetailPresenter();
ItemDetailFragment view = ItemDetailFragment.newInstance(setId);
ItemDetailPresenter presenter = new ItemDetailPresenter(baseModel, position);
DetailModel model = new DetailModel();
view.setPresenter(presenter);
@ -260,6 +261,7 @@ public class MainActivity extends Activity implements View.ActivityCallback {
stateMaintainer.put(presenter);
stateMaintainer.put(model);
}
@Override

View File

@ -34,11 +34,17 @@ public class DetailModel implements Model.Detail {
public int getCount() {
return 1;
}
@Override
public Item findItem(int id) {
public Item getCurrentItem() {
return item;
}
@Override
public void setCurrentItem(Item item) {
this.item = item;
}
@Override
public Bitmap getPicture() {
return pic;
@ -129,7 +135,6 @@ public class DetailModel implements Model.Detail {
@Override
public void setPresenter(Presenter.ItemDetail presenter) {
this.presenter = presenter;
this.item = presenter.getCurrentItem();
this.currentSet = presenter.getSetId();
}

View File

@ -60,7 +60,8 @@ public interface Model {
interface Detail extends Base {
int getCount();
com.hikapro.backpack.model.entities.Item findItem(int id);
com.hikapro.backpack.model.entities.Item getCurrentItem();
void setCurrentItem(com.hikapro.backpack.model.entities.Item item);
Bitmap getPicture();
void setPresenter(Presenter.ItemDetail presenter);
Presenter.ItemDetail getPresenter();

View File

@ -11,6 +11,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.text.TextUtils;
import java.io.IOException;
import java.util.ArrayList;
@ -1628,6 +1629,7 @@ public class DAO {
String filename = null;
if (item != null) {
if (!TextUtils.isEmpty(item.getPhotoLocal()))
bitmap = BitmapFactory.decodeFile(item.getPhotoLocal());
// cannot retrieve, download and save then
if (bitmap == null) { // return it

View File

@ -5,11 +5,13 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
@ -20,7 +22,8 @@ import com.hikapro.backpack.App;
*/
public class ImageDownloadHelper {
public static final String ITEMS_TAG = "items";
public static final String IMAGE_DOWNLOAD_TAG = "Image download";
public static final String IMAGE_DIRECTORY_NAME = "items";
private Context context;
public ImageDownloadHelper() {
@ -32,10 +35,15 @@ public class ImageDownloadHelper {
try {
URL url = new URL(netPath);
URLConnection conn = url.openConnection();
conn.setReadTimeout(4000);
bitmap = BitmapFactory.decodeStream(conn.getInputStream());
} catch (SocketTimeoutException ex) {
bitmap = null;
Log.e(IMAGE_DOWNLOAD_TAG, " Timeout elapsed.");
} catch (Exception ex) {
Log.e(ITEMS_TAG, " File cannot be downloaded");
Log.e(IMAGE_DOWNLOAD_TAG, " File cannot be downloaded due to exception.");
}
return bitmap;
}
@ -62,8 +70,9 @@ public class ImageDownloadHelper {
try {
file = File.createTempFile(fileName, null, context.getCacheDir());
} catch (IOException e) {
Log.e(ITEMS_TAG, " Cannot obtain temp file");
Log.e(IMAGE_DOWNLOAD_TAG, " Cannot obtain temp file");
}
return file;
}
@ -77,17 +86,25 @@ public class ImageDownloadHelper {
public String saveImageInternal(String filename, Bitmap bitmap) {
File file = null;
FileOutputStream outputStream;
FileOutputStream outputStream = null;
if (bitmap != null && !filename.isEmpty()) {
file = createTempFile(filename);
if (file != null) {
try {
outputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
} catch (Exception e) {
Log.e(IMAGE_DOWNLOAD_TAG, "File cannot be saved (Internal): " + e);
} finally {
if (outputStream != null) {
try {
outputStream.flush();
outputStream.close();
} catch (Exception e) {
Log.e(ITEMS_TAG, " File cannot be saved");
} catch (IOException e) {
// do nothing here
}
}
}
}
}
@ -96,18 +113,32 @@ public class ImageDownloadHelper {
public String saveImageExternal(String filename, Bitmap bitmap) {
File file = null;
FileOutputStream outputStream;
FileOutputStream outputStream = null;
if (isExternalStorageWritable()) {
if (bitmap != null && !filename.isEmpty()) {
File directory = getDir();
file = new File(directory.getAbsoluteFile(), filename);
try {
File directory = getDir();
if (directory != null) {
file = new File(directory.getAbsoluteFile(), filename);
outputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
} else {
Log.e(IMAGE_DOWNLOAD_TAG, "Saving failed (External): directory unavailable.");
}
} catch (Exception e) {
Log.e(IMAGE_DOWNLOAD_TAG, "File cannot be saved (External): " + e);
} finally {
if (outputStream != null) {
try {
outputStream.flush();
outputStream.close();
} catch (Exception e) {
Log.e(ITEMS_TAG, " File cannot be saved");
} catch (IOException e) {
// do nothing here
}
}
}
}
}
@ -116,30 +147,47 @@ public class ImageDownloadHelper {
/* Checks if external storage is available for read and write */
public boolean isExternalStorageWritable() {
boolean ret;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
return true;
}
return false;
ret = true;
} else
ret = false;
return ret;
}
/* Checks if external storage is available to at least read */
public boolean isExternalStorageReadable() {
boolean ret;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state) ||
Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
return true;
}
return false;
ret = true;
} else
ret = false;
return ret;
}
private File getDir() {
// Get the directory for the app's private pictures directory.
File file = new File(context.getExternalFilesDir(
Environment.DIRECTORY_PICTURES), ITEMS_TAG);
if (!file.mkdirs()) {
Log.e(ITEMS_TAG, " Directory not created");
}
return file;
File ret = null;
// Get available SD cards
File[] dirs = ContextCompat.getExternalFilesDirs(context, Environment.DIRECTORY_PICTURES);
if (dirs != null) {
switch (dirs.length) {
case 1:
ret = new File(dirs[0], IMAGE_DIRECTORY_NAME); // can be emulated SD card
break;
case 2:
ret = new File(dirs[1], IMAGE_DIRECTORY_NAME);// real SD card
break;
}
}
if (!ret.mkdirs()) {
Log.e(IMAGE_DOWNLOAD_TAG, "Directory was not created or already exists.");
}
return ret;
}
}

View File

@ -28,7 +28,10 @@ import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.entities.Category;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.adapters.AddListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.FlowLayout;
import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.view.View;
import java.lang.ref.WeakReference;
@ -43,7 +46,7 @@ public class AddPresenter implements Presenter.Add {
private AddListAdapter adapter;
private RecyclerView recycler;
private ViewGroup categoryContainer;
private FlowLayout categoryContainer;
private ViewGroup categoryContainerMain;
private boolean isContainerAlreadyInitialised;
private Item newItem;
@ -94,8 +97,10 @@ public class AddPresenter implements Presenter.Add {
recycler.setLayoutManager(llm);
recycler.setAdapter(adapter);
recycler.setItemAnimator(new DefaultItemAnimator());
recycler.addItemDecoration(new DividerDecoration(getActivityContext()));
categoryContainer = (ViewGroup) view.findViewById(R.id.add_item_category_flow);
//recycler.addItemDecoration(new DividerDecoration(getActivityContext()));
recycler.addItemDecoration(new DividerDecoration2(getActivityContext(), R.drawable.divider, Util.dp2px(getAppContext(), 16)));
categoryContainer = (FlowLayout) view.findViewById(R.id.add_item_category_flow);
//categoryContainer.setPaddings(Util.dp2px(getAppContext(), 15), Util.dp2px(getAppContext(), 15)); // TODO check here
categoryContainerMain = (ViewGroup) view.findViewById(R.id.add_item_category_container);
categoryContainerMain.setVisibility(android.view.View.GONE);
recycler.setVisibility(android.view.View.GONE);
@ -222,7 +227,9 @@ public class AddPresenter implements Presenter.Add {
button = (Button) LayoutInflater.from(getActivityContext()).inflate(
R.layout.category_button, null);
button.setId(category.getId());
button.setText(category.getName());
String txt = category.getName();
button.setText(txt);
button.setOnClickListener(new CategoryButtonClickListener());
categoryContainer.addView(button);

View File

@ -4,18 +4,17 @@ import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.ref.WeakReference;
@ -23,7 +22,10 @@ import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.presenter.adapters.ItemDetailAdapter;
import com.hikapro.backpack.presenter.adapters.helper.OnSwipeTouchListener;
import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.view.View;
/**
@ -33,19 +35,23 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
private WeakReference<View.ItemDetail> view;
private Model.Detail model;
private Model.Item exModel;
private ItemDetailAdapter adapter;
private Item item;
private int setId;
private ImageView itemPhoto;
private TextView itemDescription;
private TextView itemLink;
private int position;
private ViewGroup progress;
private OnSwipeTouchListener swipeTouchListener;
public ItemDetailPresenter() {
public ItemDetailPresenter(Model.Item itemModel, int startPosition) {
this.adapter = new ItemDetailAdapter(this);
this.exModel = itemModel;
this.position = startPosition;
}
// life cycle -->
@Override
public void onDestroy(boolean isChangingConfiguration) {
view = null;
@ -54,6 +60,7 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
model = null;
}
}
@Override
public android.view.View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -62,14 +69,32 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
itemPhoto = (ImageView) view.findViewById(R.id.item_photo);
itemDescription = (TextView) view.findViewById(R.id.item_description);
itemLink = (TextView) view.findViewById(R.id.item_link);
progress = (ViewGroup) view.findViewById(R.id.detail_progress_container);
progress.setVisibility(android.view.View.VISIBLE);
swipeTouchListener = new OnSwipeTouchListener(getActivityContext()) {
@Override
public void onSwipeLeft() {
swipeLeft();
}
@Override
public void onSwipeRight() {
swipeRight();
}
};
progress.setOnTouchListener(swipeTouchListener);
itemDescription.setOnTouchListener(swipeTouchListener);
LinearLayoutManager llm = new LinearLayoutManager(getActivityContext());
RecyclerView detailRecycler = (RecyclerView) view.findViewById(R.id.item_detail_recycler);
detailRecycler.setLayoutManager(llm);
detailRecycler.setAdapter(adapter);
detailRecycler.setItemAnimator(new DefaultItemAnimator());
detailRecycler.addItemDecoration(new DividerDecoration(getActivityContext()));
//detailRecycler.addItemDecoration(new DividerDecoration(getActivityContext()));
detailRecycler.addItemDecoration(new DividerDecoration2(getActivityContext(), R.drawable.divider, Util.dp2px(getAppContext(), 16)));
detailRecycler.setHasFixedSize(true);
model.setCurrentItem(exModel.getItemByPosition(position));
model.executeQuery();
Activity activity = (Activity) getActivityContext();
@ -87,19 +112,24 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
}
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
}
// life cycle <--
// process -->
@Override
public void notifyDataSetChanged() {
adapter.notifyDataSetChanged();
item = model.findItem(0);
item = model.getCurrentItem();
if (!TextUtils.isEmpty(item.getDescription())) {
itemDescription.setText(item.getDescription());
itemDescription.setVisibility(android.view.View.VISIBLE);
} else {
itemDescription.setVisibility(android.view.View.GONE);
}
if (item.getBuyUrls() != null && !item.getBuyUrls().isEmpty()) {
itemLink.setVisibility(android.view.View.VISIBLE);
itemLink.setOnClickListener(new android.view.View.OnClickListener() {
@ -122,16 +152,12 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
}
}
// process <--
// other impl -->
@Override
public void setView(View.ItemDetail view) {
this.view = new WeakReference<>(view);
this.item = getView().getItem();
this.setId = view.getSetId();
}
@Override
public void setModel(Model.Detail model) {
this.model = model;
@ -166,9 +192,17 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
@Override
public void notifyPictureChanged() {
progress.setVisibility(android.view.View.GONE);
if (model.getPicture() != null) {
itemPhoto.setImageBitmap(model.getPicture());
itemPhoto.setVisibility(android.view.View.VISIBLE);
itemPhoto.setOnTouchListener(swipeTouchListener);
} else {
itemPhoto.setImageBitmap(null);
itemPhoto.setVisibility(android.view.View.GONE);
}
}
// other impl <--
private View.ItemDetail getView() throws NullPointerException {
if ( view != null )
@ -180,4 +214,34 @@ public class ItemDetailPresenter implements Presenter.ItemDetail {
public int getSetId() {
return setId;
}
private boolean isValidPosition(int position) {
boolean ret;
ret = position > -1 && position < exModel.getItemsCount();
return ret;
}
private void swipeLeft() {
if (isValidPosition(position + 1)) {
// start progress
progress.setVisibility(android.view.View.VISIBLE);
itemPhoto.setVisibility(android.view.View.GONE);
// load data
model.setCurrentItem(exModel.getItemByPosition(++position));
model.executeQuery();
itemPhoto.setImageBitmap(null);
}
}
private void swipeRight() {
if (isValidPosition(position - 1)) {
// start progress
progress.setVisibility(android.view.View.VISIBLE);
itemPhoto.setVisibility(android.view.View.GONE);
// load data
model.setCurrentItem(exModel.getItemByPosition(--position));
model.executeQuery();
itemPhoto.setImageBitmap(null);
}
}
}

View File

@ -21,8 +21,10 @@ import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.adapters.helper.Util;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration;
import com.hikapro.backpack.presenter.adapters.ItemListAdapter;
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
import com.hikapro.backpack.presenter.adapters.helper.items.ItemSwipeCallback;
import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration;
import com.hikapro.backpack.view.View;
@ -75,7 +77,9 @@ public class ItemListPresenter implements Presenter.ItemList {
final StickyHeaderDecoration decoration = new StickyHeaderDecoration(adapter);
recycler.addItemDecoration(decoration);
recycler.addItemDecoration(new DividerDecoration(getActivityContext()));
//recycler.addItemDecoration(new DividerDecoration(getActivityContext()));
recycler.addItemDecoration(new DividerDecoration2(getActivityContext(), R.drawable.divider, Util.dp2px(getAppContext(), 16)));
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
@ -141,7 +145,7 @@ public class ItemListPresenter implements Presenter.ItemList {
@Override
public void setVisibility() {
if (model.getPackedQty() == model.getActiveItemsCount()) {
if (model.getPackedQty() > 0 && model.getPackedQty() == model.getActiveItemsCount()) {
footer.setVisibility(android.view.View.VISIBLE);
} else if ( model.getPackedQty() > 0) {
footer.setVisibility(android.view.View.VISIBLE);
@ -157,13 +161,8 @@ public class ItemListPresenter implements Presenter.ItemList {
}
@Override
public void showDetails(int itemId) {
Item item = model.findItem(itemId);
if (item != null)
getView().showItemDetail(item, set.getId());
else
showMessage(String.format("Item with Id %d is not found.", itemId));
public void showDetails(int position) {
getView().showItemDetail(getCurrentSet().getId(), model, position);
}
// process <--

View File

@ -56,7 +56,7 @@ public interface Presenter {
Set getCurrentSet();
void showMessage(String message);
void onSaveInstanceState(Bundle outState);
void showDetails(int itemId);
void showDetails(int position);
void filter(String query);
void unpack(int setId);
void restore(int setId);

View File

@ -1,15 +1,12 @@
package com.hikapro.backpack.presenter.adapters;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.entities.Item;
@ -19,7 +16,6 @@ import com.hikapro.backpack.presenter.adapters.helper.items.swipe2.SwipableEleme
import com.hikapro.backpack.presenter.adapters.helper.items.swipe2.SwipeMenu;
import com.hikapro.backpack.presenter.adapters.helper.items.swipe2.SwipeMenuItem;
import com.hikapro.backpack.presenter.adapters.helper.items.swipe2.SwipeMenuLayout;
import com.hikapro.backpack.view.recycler.DetailViewHolder;
import com.hikapro.backpack.view.recycler.ItemViewHolder;
/**
@ -41,7 +37,7 @@ public class ItemDetailAdapter extends RecyclerView.Adapter<ItemViewHolder> {
@Override
public void onBindViewHolder(final ItemViewHolder holder, final int position) {
final Item item = presenter.getModel().findItem(position);
final Item item = presenter.getModel().getCurrentItem();
holder.cb_item.setChecked(item.isPacked());
holder.tv_text.setText(item.getName() + " " + item.getId() + " pos " + position);
holder.im_info.setVisibility(View.GONE);

View File

@ -3,16 +3,11 @@ package com.hikapro.backpack.presenter.adapters;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.os.Handler;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.util.HashMap;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.entities.Category;
@ -85,7 +80,7 @@ public class ItemListAdapter extends RecyclerView.Adapter<ItemViewHolder> implem
holder.im_info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
presenter.showDetails(item.getId());
presenter.showDetails(position);
}
});
@ -224,7 +219,7 @@ public class ItemListAdapter extends RecyclerView.Adapter<ItemViewHolder> implem
public HeaderViewHolder onCreateHeaderViewHolder(ViewGroup parent) {
HeaderViewHolder viewHolder;
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.view_header, parent, false);
.inflate(R.layout.header_element, parent, false);
viewHolder = new HeaderViewHolder(v);
return viewHolder;
}

View File

@ -50,7 +50,7 @@ public class PackedListAdapter extends ItemListAdapter {
holder.im_info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
presenter.showDetails(item.getId());
presenter.showDetails(position);
}
});

View File

@ -1,4 +1,4 @@
package com.hikapro.backpack;
package com.hikapro.backpack.presenter.adapters.helper;
import android.content.Context;
import android.content.res.TypedArray;
@ -6,6 +6,8 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.hikapro.backpack.R;
/**
* Created by tariel on 22/05/16.
*/
@ -20,7 +22,7 @@ public class FlowLayout extends ViewGroup {
setPaddings(0,0);
}
protected void setPaddings(int V, int H){
public void setPaddings(int V, int H){
PADDING_X = H;
PADDING_Y = V;
}

View File

@ -0,0 +1,53 @@
package com.hikapro.backpack.presenter.adapters.helper;
import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
/**
* Created by tariel on 16/07/16.
*/
public class OnSwipeTouchListener implements View.OnTouchListener {
private final GestureDetector gestureDetector;
public OnSwipeTouchListener(Context context) {
gestureDetector = new GestureDetector(context, new GestureListener());
}
public void onSwipeLeft() {
}
public void onSwipeRight() {
}
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
private final class GestureListener extends GestureDetector.SimpleOnGestureListener {
private static final int SWIPE_DISTANCE_THRESHOLD = 100;
private static final int SWIPE_VELOCITY_THRESHOLD = 100;
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
float distanceX = e2.getX() - e1.getX();
float distanceY = e2.getY() - e1.getY();
if (Math.abs(distanceX) > Math.abs(distanceY) && Math.abs(distanceX) > SWIPE_DISTANCE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (distanceX > 0)
onSwipeRight();
else
onSwipeLeft();
return true;
}
return false;
}
}
}

View File

@ -9,6 +9,8 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.hikapro.backpack.presenter.adapters.helper.Util;
public class DividerDecoration extends RecyclerView.ItemDecoration {

View File

@ -0,0 +1,60 @@
package com.hikapro.backpack.presenter.adapters.helper.items;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* Created by tariel on 19/07/16.
*/
public class DividerDecoration2 extends RecyclerView.ItemDecoration {
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
private int paddingX;
private Drawable mDivider;
/**
* Default divider will be used
*/
public DividerDecoration2(Context context) {
final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
mDivider = styledAttributes.getDrawable(0);
styledAttributes.recycle();
}
/**
* Custom divider will be used
*/
public DividerDecoration2(Context context, int resId) {
mDivider = ContextCompat.getDrawable(context, resId);
}
public DividerDecoration2(Context context, int resId, int paddingX) {
mDivider = ContextCompat.getDrawable(context, resId);
this.paddingX = paddingX;
}
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
int left = parent.getPaddingLeft();
int right = parent.getWidth() - parent.getPaddingRight();
int childCount = parent.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int top = child.getBottom() + params.bottomMargin;
int bottom = top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left + paddingX, top, right - paddingX, bottom);
mDivider.draw(c);
}
}
}

View File

@ -67,9 +67,12 @@ public class SwipableRecycler extends RecyclerView {
if (lastTouchedElement != null && lastTouchedElement.isOpen() && lastTouchedElement != buf) {
handled = true;
}
// on click
/*
if (lastTouchedElement != null && lastTouchedElement.isOpen() && inRangeOfView(lastTouchedElement.getMenuView(), e)) {
lastTouchedElement.getMenuView().notifyOnClick(e.getRawX(), e.getRawY());
}
*/
if (lastTouchedElement != null)
lastTouchedElement.onSwipe(e);
return handled;
@ -88,6 +91,13 @@ public class SwipableRecycler extends RecyclerView {
}
return true;
}
// TODO del
case MotionEvent.ACTION_UP:
// on click
if (lastTouchedElement != null && lastTouchedElement.isOpen() && inRangeOfView(lastTouchedElement.getMenuView(), e)) {
lastTouchedElement.getMenuView().notifyOnClick(e.getRawX(), e.getRawY());
}
return super.onInterceptTouchEvent(e);
}
return super.onInterceptTouchEvent(e);
}

View File

@ -2,6 +2,7 @@ package com.hikapro.backpack.view;
import android.content.Context;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.Presenter;
@ -25,14 +26,13 @@ public interface View {
}
interface ItemList extends Base {
void showItemDetail(Item item, int setId);
void showItemDetail(int setId, Model.Item baseModel, int position);
void showPackedItems(Set set);
void setPresenter(Presenter.ItemList presenter);
Set getSet();
}
interface ItemDetail extends Base {
void setPresenter(Presenter.ItemDetail presenter);
Item getItem();
int getSetId();
}
@ -50,7 +50,7 @@ public interface View {
void startSetListFragment();
void startItemListFragment(Set set);
void startPackedListFragment(Set set);
void startItemDetailFragment(Item item, int setId);
void startItemDetailFragment(int setId, Model.Item baseModel, int position);
void startShareFragment(int setId);
void startAddFragment(Set set);

View File

@ -22,7 +22,6 @@ import com.hikapro.backpack.presenter.Presenter;
*/
public class ItemDetailFragment extends Fragment implements com.hikapro.backpack.view.View.ItemDetail {
private static final String BUNDLE_ITEM_KEY = "BUNDLE_ITEM_KEY";
private static final String BUNDLE_SET_KEY = "BUNDLE_SET_KEY";
private Presenter.ItemDetail presenter;
@ -37,10 +36,9 @@ public class ItemDetailFragment extends Fragment implements com.hikapro.backpack
return new ItemDetailFragment();
}
public static ItemDetailFragment newInstance(Item item, int setId) {
public static ItemDetailFragment newInstance(int setId) {
ItemDetailFragment ret = ItemDetailFragment.construct();
Bundle args = new Bundle();
args.putSerializable(BUNDLE_ITEM_KEY, item);
args.putInt(BUNDLE_SET_KEY, setId);
ret.setArguments(args);
return ret;
@ -142,13 +140,6 @@ public class ItemDetailFragment extends Fragment implements com.hikapro.backpack
return this.getActivity();
}
@Override
public Item getItem() {
Bundle args = getArguments();
Item item = (Item) args.getSerializable(BUNDLE_ITEM_KEY);
return item;
}
@Override
public int getSetId() {
Bundle args = getArguments();

View File

@ -17,6 +17,7 @@ import android.widget.SearchView;
import android.widget.Toast;
import com.hikapro.backpack.R;
import com.hikapro.backpack.model.Model;
import com.hikapro.backpack.model.entities.Item;
import com.hikapro.backpack.model.entities.Set;
import com.hikapro.backpack.presenter.Presenter;
@ -178,10 +179,11 @@ public class ItemListFragment extends Fragment implements com.hikapro.backpack.v
// life cycle <--
@Override
public void showItemDetail(Item item, int setId) {
activityCallback.startItemDetailFragment(item, setId);
}//TODO del?
public void showItemDetail(int setId, Model.Item baseModel, int position) {
activityCallback.startItemDetailFragment(setId, baseModel, position);
}
@Override
public void showPackedItems(Set set) {

View File

@ -1,29 +0,0 @@
package com.hikapro.backpack.view.recycler;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.hikapro.backpack.R;
/**
* Created by tariel on 23/04/16.
*/
public class DetailViewHolder extends RecyclerView.ViewHolder {
public TextView title;
public TextView description;
public ImageView photo;
public DetailViewHolder(View v) {
super(v);
setupViews(v);
}
private void setupViews(View view) {
title = (TextView) view.findViewById(R.id.item_title);
description = (TextView) view.findViewById(R.id.item_description);
photo = (ImageView) view.findViewById(R.id.item_photo);
}
}

View File

@ -1,38 +0,0 @@
package com.hikapro.backpack.view.recycler;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageButton;
import com.hikapro.backpack.R;
/**
* Created by tariel on 01/05/16.
*/
public class ItemViewHolderCopy extends RecyclerView.ViewHolder {
public int id;
public CheckBox checkBox;
public Button leaveAtHomeButton;
public Button deleteButton;
public ImageButton infoButton;
public ViewGroup swipeGroup;
public ItemViewHolderCopy(View v) {
super(v);
setupViews(v);
}
private void setupViews(View view) {
infoButton = (ImageButton) view.findViewById(R.id.info_button);
checkBox = (CheckBox) view.findViewById(R.id.item_checkbox);
leaveAtHomeButton = (Button) view.findViewById(R.id.leave_at_home_button);
deleteButton = (Button) view.findViewById(R.id.delete_button);
swipeGroup = (ViewGroup) view.findViewById((R.id.swipe_container));
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#000000" />
<corners android:radius="5dp" />
<stroke android:width="2px" android:color="#FFFFFF" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="2dp" />
<solid android:color="#ff992900" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#FFFFFF"
android:endColor="#00FF00"
android:angle="270" />
<corners android:radius="3dp" />
<stroke android:width="5px" android:color="#000000" />
</shape>

View File

@ -9,14 +9,14 @@
<Button
android:id="@+id/action_add_cancel"
style="@style/ActionBarButtonWhite"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/cancel_button"
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="ADD AN ITEM"
android:textSize="@dimen/text_size_medium"
android:layout_centerInParent="true"
@ -27,7 +27,7 @@
<Button
android:id="@+id/action_add_save"
style="@style/ActionBarButtonWhite"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/save_button"
android:layout_alignParentEnd="true"/>

View File

@ -1,7 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/margin_standard"
android:paddingLeft="@dimen/margin_standard">
android:textColor="@android:color/white"
android:background="@drawable/cat_btn_bg"
android:paddingRight="25dp"
android:paddingLeft="25dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:textSize="@dimen/text_category_btn"
>
</Button>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

View File

@ -2,22 +2,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="66dp"
android:orientation="vertical"
android:animateLayoutChanges="true"
android:id="@+id/item_list_footer"
android:background="@color/colorFooterbackground"
android:layout_gravity="bottom"
>
android:background="@color/colorFooterBackground"
android:layout_gravity="bottom">
<TextView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/colorFooterTextWhite"
android:id="@+id/footer_packed_count"/>
<TextView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/colorFooterTextGreen"
android:text="@string/what_in_bag"
android:id="@+id/open_packed"/>

View File

@ -1,11 +1,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:context="com.hikapro.backpack.view.fragments.AddFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorListBackground">
<LinearLayout
android:id="@+id/fragment_add_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.hikapro.backpack.view.fragments.AddFragment">
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
@ -14,35 +20,39 @@
<android.widget.SearchView
android:id="@+id/add_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="match_parent"
android:textColor="@color/colorText"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/add_item_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<RelativeLayout
android:id="@+id/add_item_category_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_weight="1"
android:layout_marginStart="@dimen/margin_standard">
<TextView
android:id="@+id/add_item_category_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/choose_category"/>
android:layout_marginTop="@dimen/margin_standard"
android:layout_marginBottom="@dimen/margin_standard"
android:text="@string/choose_category"
android:textColor="@color/colorText"/>
<com.hikapro.backpack.FlowLayout
<com.hikapro.backpack.presenter.adapters.helper.FlowLayout
android:id="@+id/add_item_category_flow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/add_item_category_label">
</com.hikapro.backpack.FlowLayout>
</com.hikapro.backpack.presenter.adapters.helper.FlowLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>

View File

@ -35,6 +35,25 @@
android:layout_gravity="center_horizontal"
android:contentDescription="@string/cd_item_image"/>
<RelativeLayout
android:id="@+id/detail_progress_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="gone">
<ProgressBar
android:id="@+id/set_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:paddingBottom="32dp"
android:paddingTop="20dp"
style="@android:style/Widget.ProgressBar.Large"
android:layout_centerInParent="true"
android:layout_marginEnd="5dp" />
</RelativeLayout>
<TextView
android:id="@+id/item_description"
android:paddingStart="16dp"
@ -49,7 +68,7 @@
android:paddingTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorUiSecondaryFont"
android:textColor="@color/colorFooterTextGreen"
android:text="@string/more"/>
</LinearLayout>

View File

@ -31,17 +31,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="@dimen/size_item_packed"
android:textSize="@dimen/text_footer"
android:textStyle="bold"
android:textColor="@color/colorUiSecondaryFont"
android:textColor="@color/colorFooterTextWhite"
android:id="@+id/footer_packed_count"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="@dimen/size_item_packed"
android:textSize="@dimen/text_footer"
android:textStyle="bold"
android:textColor="@color/colorUiSecondaryFont"
android:textColor="@color/colorFooterTextGreen"
android:text="@string/what_in_bag"
android:id="@+id/open_packed"/>
</LinearLayout>

View File

@ -18,18 +18,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="@dimen/size_item_packed"
android:textSize="@dimen/text_footer"
android:textStyle="bold"
android:textColor="@color/colorUiSecondaryFont"
android:textColor="@color/colorFooterTextWhite"
android:id="@+id/header_packed_count"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="@dimen/size_item_packed"
android:textSize="@dimen/text_footer"
android:textStyle="bold"
android:textColor="@color/colorUiSecondaryFont"
android:textColor="@color/colorFooterTextGreen"
android:text="@string/continue_packing"
android:id="@+id/back_to_list"/>
<Button
@ -37,12 +37,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/unpack_button"
android:textSize="@dimen/size_btn_unpack_txt"
android:textSize="@dimen/text_action_bar_header"
android:textAlignment="center"
android:background="@color/colorUnpackBtnBackground"
android:background="@color/colorUnpackBackground"
android:layout_marginTop="@dimen/margin_standard"
android:layout_marginBottom="@dimen/margin_standard"
android:visibility="invisible"/>
android:visibility="gone"/>
</LinearLayout>
<LinearLayout

View File

@ -3,14 +3,15 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="@color/colorMainBackground">
<android.support.v7.widget.RecyclerView
android:id="@+id/set_recycler"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorUiMainbackground"/>
android:background="@color/colorListBackground"/>
<RelativeLayout
android:id="@+id/set_progress_container"

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hikapro.backpack.view.fragments.ShareFragment"
android:background="#D3D3D3">
android:background="@color/colorListBackground">
<ImageView
android:id="@+id/share_image_view"

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:background="@color/colorListBackground"
android:textSize="@dimen/text_category_name"
android:textStyle="bold"
android:textAllCaps="true"
android:textColor="@android:color/white"
android:id="@+id/header"
tools:context=".MainActivity"/>
<!--
<View
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="#FF00FF00">
</View>
-->
</LinearLayout>

View File

@ -12,13 +12,16 @@
android:layout_alignParentLeft="true"
android:paddingStart="@dimen/activity_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/size_item_name_big"/>
android:textColor="@color/colorText"
android:textSize="@dimen/text_item_name"/>
<TextView
android:id="@+id/add_item_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/add_item_name"
android:textSize="@dimen/text_item_category"
android:textColor="@color/colorCategory"
android:layout_alignLeft="@id/add_item_name"
android:paddingTop="6dp"
android:paddingStart="@dimen/activity_horizontal_margin"/>
@ -28,6 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/already_in_list"
android:textSize="@dimen/text_item_category"
android:textColor="@color/save_green"
android:gravity="center_vertical"
android:layout_alignParentEnd="true"

View File

@ -18,12 +18,11 @@
android:id="@+id/item_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorUiMainFont" />
android:textColor="@color/colorDescriptionText" />
<TextView
android:id="@+id/item_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorUiMainFont"/>
android:textColor="@color/colorLinkText"/>
</LinearLayout>

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/margin_standard"
android:paddingLeft="@dimen/margin_standard"
android:paddingRight="@dimen/margin_standard"
android:paddingTop="@dimen/margin_standard">
<TextView
android:id="@+id/item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textColor="@color/colorUiMainFont"/>
<ImageView
android:id="@+id/item_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/item_title"
android:layout_marginTop="@dimen/margin_standard_plus_plus"
android:layout_centerInParent="true"
android:contentDescription="@string/cd_item_image"/>
<TextView
android:id="@+id/item_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/item_photo"
android:layout_centerHorizontal="true"
android:textColor="@color/colorUiMainFont"
android:layout_marginTop="@dimen/margin_standard_plus_plus" />
</RelativeLayout>

View File

@ -25,8 +25,8 @@
android:layout_gravity="center"
android:layout_marginStart="@dimen/margin_standard"
android:layout_marginEnd="@dimen/margin_standard"
android:textSize="@dimen/size_item_name"
android:textColor="@color/colorUiMainFont" />
android:textSize="@dimen/text_item_name"
android:textColor="@color/colorText" />
<ImageButton
android:layout_width="wrap_content"

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:customNS="com.hikapro.backpack"
android:id="@+id/sticky_header_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
customNS:paddingY="15dp"
customNS:paddingX="15dp" />

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.hikapro.backpack.FlowLayout
<com.hikapro.backpack.presenter.adapters.helper.FlowLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
@ -82,8 +82,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text 1"
android:paddingLeft="15dp"
android:paddingTop="15dp"/>
android:paddingLeft="150dp"
android:paddingTop="150dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -91,4 +91,4 @@
android:paddingLeft="15dp"
android:paddingTop="15dp"/>
</com.hikapro.backpack.FlowLayout>
</com.hikapro.backpack.presenter.adapters.helper.FlowLayout>

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/save_menu_item"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:divider="?android:attr/dividerVertical"
android:showDividers="end"
android:dividerPadding="12dip"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:duplicateParentState="true"
style="?android:attr/actionButtonStyle">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dip"
android:textColor="@color/colorUiMainFont"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Done"
style="@android:style/Widget.Holo.ActionBar.TabText" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="false"
android:orientation="horizontal">
<!-- android:paddingEnd="0dip" --> >
<Button
android:id="@+id/action_cancel"
style="@style/ActionBarButtonWhite"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="CANCEL"
android:gravity="left|center_vertical"
/>
<Button
android:id="@+id/action_add"
style="@style/ActionBarButtonWhite"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="SAVE"
android:gravity="right|center_vertical"
/>
</LinearLayout>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:background="@color/colorStickyHeaderBackground"
android:textSize="@dimen/size_sticky_header"
android:textStyle="bold"
android:textColor="@android:color/white"
android:id="@+id/header"
tools:context=".MainActivity"/>

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/item_height"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/item_checkbox_padding"
android:textSize="@dimen/size_item_name"
android:id="@+id/item_checkbox"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/margin_standard"
android:textColor="@color/colorUiMainFont"
tools:context=".MainActivity"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/info_button"
android:src="@drawable/ic_info_black_24dp"
android:background="@null"
android:layout_alignParentRight="true"
android:layout_marginLeft="@dimen/margin_standard"
android:layout_marginRight="@dimen/margin_standard"
/>
</RelativeLayout>
<LinearLayout
android:id="@+id/swipe_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end|center_vertical">
<Button
android:id="@+id/leave_at_home_button"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="@string/leave_at_home_button"
android:textAllCaps="true"
android:textColor="@android:color/white"
android:layout_gravity="end|center_vertical"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:background="@android:color/darker_gray"/>
<Button
android:id="@+id/delete_button"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="@string/delete_button"
android:textAllCaps="true"
android:textColor="@android:color/white"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
android:background="@android:color/holo_red_dark"/>
</LinearLayout>
</FrameLayout>

View File

@ -2,6 +2,9 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:textAllCaps">false</item>
<item name="android:editTextColor">@color/colorText</item>
<item name="android:textColorHint">@color/colorDescriptionText</item>
</style>
<style name="ActionBarButton">

View File

@ -11,4 +11,21 @@
<color name="colorLeaveAtHomeBtnBackground">#C9C9CE</color>
<color name="colorAddToBagBtnBackground">#76EE00</color>
<color name="colorReturnToListBtnBackground">#C9C9CE</color>
<color name="colorMainBackground">#252525</color>
<color name="colorListBackground">#1F1F1F</color>
<color name="colorElementEnabled">#68B61F</color>
<color name="colorActionBarTitle">#DFDFDF</color>
<color name="colorFooterTextGreen">#7ED321</color>
<color name="colorFooterTextWhite">#DCDCDC</color>
<color name="colorUnpackBackground">#7ED321</color>
<color name="colorText">#FFFFFF</color>
<color name="colorCategory">#DFDFDF</color>
<color name="colorFooterBackground">#76000000</color>
<color name="colorSwipeGreenBackground">#436D15</color>
<color name="colorSwipeGreyBackground">#555454</color>
<color name="colorSwipeRedBackground">#AF00</color>
<color name="colorDescriptionText">#9C9C9C</color>
<color name="colorLinkText">#76EE00</color>
</resources>

View File

@ -12,5 +12,17 @@
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_medium">16sp</dimen>
<dimen name="text_action_bar_header">14sp</dimen>
<dimen name="text_item_header">12sp</dimen>
<dimen name="text_item_name">18sp</dimen>
<dimen name="text_category_name">12sp</dimen>
<dimen name="text_item_category">10sp</dimen>
<dimen name="text_footer">14sp</dimen>
<dimen name="text_category_btn">13sp</dimen>
<dimen name="text_action_bar_btn">12sp</dimen>
<dimen name="text_item_description">17sp</dimen>
</resources>

View File

@ -8,7 +8,7 @@
<string name="what_in_bag">Show what\'s in my bag &#x2193;</string>
<string name="choose_category">Choose item category:</string>
<string name="continue_packing">Continue with my packing &#x2191;</string>
<string name="already_in_list">Already in List</string>
<string name="already_in_list">&#x2713; Already in list</string>
<string name="what_is_it">WHAT IS IT?</string>
<string name="more">More about this item &#x276D;</string>

View File

@ -6,25 +6,29 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:editTextColor">@color/colorText</item>
<item name="android:textColorHint">@color/colorDescriptionText</item>
</style>
<style name="ActionBarButton">
<style name="ActionBarButton" parent="@style/ThemeOverlay.AppCompat.Dark">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:ellipsize">end</item>
<item name="android:singleLine">true</item>
<item name="android:textSize">@dimen/text_size_small</item>
<item name="android:textSize">@dimen/text_action_bar_btn</item>
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="android:gravity">center</item>
<item name="android:background">@null</item>
<!--<item name="android:background">@drawable/ripple</item>-->
<!-- <item name="android:background">?android:attr/selectableItemBackground</item> -->
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
<!--
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
-->
</style>
<style name="ActionBarButtonWhite" parent="@style/ActionBarButton">
<item name="android:textColor">@color/white</item>
</style>
<style name="ActionBarButtonOffWhite" parent="@style/ActionBarButton">