mend
This commit is contained in:
parent
9676190ea6
commit
ee32f8471c
|
@ -10,7 +10,7 @@ android {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "hikapro.com.backpack"
|
applicationId "com.hikapro.backpack"
|
||||||
minSdkVersion 17
|
minSdkVersion 17
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1
|
versionCode 1
|
||||||
|
@ -28,12 +28,12 @@ dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
|
||||||
|
|
||||||
compile 'com.google.code.gson:gson:2.6.2'
|
compile 'com.google.code.gson:gson:2.6.2'
|
||||||
compile 'com.squareup.retrofit2:retrofit:2.0.1'
|
compile 'com.squareup.retrofit2:retrofit:2.0.1'
|
||||||
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
|
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.2.0'
|
compile 'com.squareup.okhttp3:okhttp:3.2.0'
|
||||||
compile 'com.squareup.okhttp:logging-interceptor:2.7.0'
|
compile 'com.squareup.okhttp:logging-interceptor:2.7.0'
|
||||||
|
|
||||||
compile 'com.android.support:support-v4:23.3.0'
|
compile 'com.android.support:support-v4:23.3.0'
|
||||||
compile 'com.android.support:appcompat-v7:23.3.0'
|
compile 'com.android.support:appcompat-v7:23.3.0'
|
||||||
compile 'com.android.support:design:23.3.0'
|
compile 'com.android.support:design:23.3.0'
|
||||||
|
|
|
@ -1,7 +1,108 @@
|
||||||
package hikapro.com.backpack.model;
|
package hikapro.com.backpack.model;
|
||||||
|
|
||||||
|
import android.os.Message;
|
||||||
|
|
||||||
|
import hikapro.com.backpack.model.entities.Category;
|
||||||
|
import hikapro.com.backpack.model.entities.Item;
|
||||||
|
import hikapro.com.backpack.presenter.Presenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by tariel on 12/05/16.
|
* Created by tariel on 12/05/16.
|
||||||
*/
|
*/
|
||||||
public class BagModel {
|
public class BagModel implements Model.Bag {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertItem(Item item) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteItem(Item item) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filter(String query) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeaderId(int position) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemId(int position) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPendingRemoval(Item item) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pendingRemove(Item item) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pendingRemoveCancel(Item item) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemsCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item findItem(int id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getItemByPosition(int position) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Category getCategoryByPosition(int position) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPresenter(Presenter.ItemList presenter) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Presenter.ItemList getPresenter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(boolean isConfigurationChanging) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeQuery() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyDataSetChanged() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Message event) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,9 @@ public interface Model {
|
||||||
Bitmap getPicture();
|
Bitmap getPicture();
|
||||||
void setPresenter(Presenter.ItemDetail presenter);
|
void setPresenter(Presenter.ItemDetail presenter);
|
||||||
Presenter.ItemDetail getPresenter();
|
Presenter.ItemDetail getPresenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Bag extends Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package hikapro.com.backpack.presenter;
|
package hikapro.com.backpack.presenter;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
@ -7,6 +8,7 @@ import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
@ -97,11 +99,19 @@ public class ItemListPresenter implements Presenter.ItemList {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clickItem(int itemId) {
|
public void clickItem(int itemId) {
|
||||||
|
/*
|
||||||
Item item = model.findItem(itemId);
|
Item item = model.findItem(itemId);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
getView().showItemDetail(item);
|
getView().showItemDetail(item);
|
||||||
else
|
else
|
||||||
showMessage(String.format("Item with Id %d is not found.", itemId));
|
showMessage(String.format("Item with Id %d is not found.", itemId));
|
||||||
|
*/
|
||||||
|
Fragment fragment = (Fragment)getView();
|
||||||
|
LinearLayout ll = (LinearLayout)fragment.getView().findViewById(R.id.item_list_footer);
|
||||||
|
ll.setVisibility(android.view.View.VISIBLE);
|
||||||
|
/*
|
||||||
|
ll.setAlpha(0.0f);
|
||||||
|
ll.animate().translationY(ll.getHeight()).alpha(1.0f);*/
|
||||||
}
|
}
|
||||||
// process <--
|
// process <--
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,9 @@ public interface Presenter {
|
||||||
void onSaveInstanceState(Bundle outState);
|
void onSaveInstanceState(Bundle outState);
|
||||||
Item getCurrentItem();
|
Item getCurrentItem();
|
||||||
void displayPicture(Bitmap bitmap);
|
void displayPicture(Bitmap bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Bag extends ItemList {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,10 @@ public interface View {
|
||||||
void setPresenter(Presenter.ItemDetail presenter);
|
void setPresenter(Presenter.ItemDetail presenter);
|
||||||
Item getItem();
|
Item getItem();
|
||||||
}
|
}
|
||||||
|
interface Bag extends Base {
|
||||||
|
void setPresenter(Presenter.Bag presenter);
|
||||||
|
|
||||||
|
}
|
||||||
interface ActivityCallback {
|
interface ActivityCallback {
|
||||||
void startSetListFragment();
|
void startSetListFragment();
|
||||||
void startItemListFragment(Set set);
|
void startItemListFragment(Set set);
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
package hikapro.com.backpack.view.fragments;
|
package hikapro.com.backpack.view.fragments;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import hikapro.com.backpack.model.entities.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by tariel on 12/05/16.
|
* Created by tariel on 12/05/16.
|
||||||
*/
|
*/
|
||||||
public class BagFragment {
|
public class BagFragment extends ItemListFragment {
|
||||||
|
|
||||||
|
public BagFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BagFragment construct() {
|
||||||
|
return new BagFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BagFragment newFromSet(Set set) {
|
||||||
|
BagFragment ret = BagFragment.construct();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putSerializable(BUNDLE_SET_KEY, set);
|
||||||
|
ret.setArguments(args);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import hikapro.com.backpack.presenter.Presenter;
|
||||||
public class ItemListFragment extends Fragment implements hikapro.com.backpack.view.View.ItemList,
|
public class ItemListFragment extends Fragment implements hikapro.com.backpack.view.View.ItemList,
|
||||||
SearchView.OnQueryTextListener {
|
SearchView.OnQueryTextListener {
|
||||||
|
|
||||||
private static final String BUNDLE_SET_KEY = "BUNDLE_SET_KEY";
|
protected static final String BUNDLE_SET_KEY = "BUNDLE_SET_KEY";
|
||||||
private hikapro.com.backpack.view.View.ActivityCallback activityCallback;
|
private hikapro.com.backpack.view.View.ActivityCallback activityCallback;
|
||||||
private Presenter.ItemList presenter;
|
private Presenter.ItemList presenter;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class ItemListFragment extends Fragment implements hikapro.com.backpack.v
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ItemListFragment construct() {
|
private static ItemListFragment construct() {
|
||||||
return new ItemListFragment();
|
return new ItemListFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,26 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical" android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:animateLayoutChanges="true"
|
||||||
|
android:id="@+id/item_list_footer"
|
||||||
|
android:background="#33D3D3D3"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Packed 8/106"
|
||||||
|
android:id="@+id/footer_packed_count"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="What is in my bag"
|
||||||
|
android:id="@+id/open_packed"/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,8 +1,13 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="hikapro.com.backpack.view.fragments.ItemListFragment"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="hikapro.com.backpack.view.fragments.ItemListFragment"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
|
@ -12,3 +17,29 @@
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/item_list_footer"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:visibility="gone">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="Packed 8/106"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:id="@+id/footer_packed_count"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:text="Show what's in my bag ↓"
|
||||||
|
android:id="@+id/open_packed"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
Loading…
Reference in New Issue