Skip to content

Commit

Permalink
android native app
Browse files Browse the repository at this point in the history
1) fixed issue with deleting items on firebase (and adapter going out of sync)
2) fixed layout issue with todo list not being on top of the edittext
  • Loading branch information
nazmulidris committed Jan 13, 2017
1 parent 387e606 commit 0a4ea57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Created by nazmul on 1/12/17.
*/
public class TodoListAdapter extends RecyclerView.Adapter<TodoListAdapter.ViewHolder> {
private final App _ctx;
private final App _ctx;

public TodoListAdapter(App ctx) {
this._ctx = ctx;
Expand All @@ -34,8 +34,10 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Data.TodoItem row = _ctx.getReduxState().data.todoArray.get(position);
holder.item.setText(row.item);
holder.done.setText(String.valueOf(row.done));
if (row != null) {
holder.item.setText(row.item);
holder.done.setText(String.valueOf(row.done));
}
}

@Override
Expand Down
15 changes: 8 additions & 7 deletions mobile_android_native/app/src/main/res/layout/todo_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
android:id="@+id/todo_list_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_above="@+id/todo_text_input" />

<EditText
style="@style/Divider"
android:id="@+id/todo_text_input"
Expand All @@ -26,4 +19,12 @@
android:imeOptions="actionGo"
/>

<android.support.v7.widget.RecyclerView
android:layout_above="@+id/todo_text_input"
android:id="@+id/todo_list_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />

</RelativeLayout>

0 comments on commit 0a4ea57

Please sign in to comment.