Skip to content

Commit

Permalink
Merge pull request #35 from blanyal/bug_fix
Browse files Browse the repository at this point in the history
Added a text message to users instructing them to click on the FAB to cr...
  • Loading branch information
blanyal committed May 6, 2015
2 parents 756ddff + 72beabc commit d77ff00
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
32 changes: 32 additions & 0 deletions app/src/main/java/com/blanyal/remindme/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class MainActivity extends AppCompatActivity {
private RecyclerView mList;
private SimpleAdapter mAdapter;
private Toolbar mToolbar;
private TextView mNoReminderView;
private FloatingActionButton mAddReminderButton;
private int mTempPost;
private LinkedHashMap<Integer, Integer> IDmap = new LinkedHashMap<>();
Expand All @@ -73,6 +74,15 @@ protected void onCreate(Bundle savedInstanceState) {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mAddReminderButton = (FloatingActionButton) findViewById(R.id.add_reminder);
mList = (RecyclerView) findViewById(R.id.reminder_list);
mNoReminderView = (TextView) findViewById(R.id.no_reminder_text);

// To check is there are saved reminders
// If there are no reminders display a message asking the user to create reminders
List<Reminder> mTest = rb.getAllReminders();

if (mTest.isEmpty()) {
mNoReminderView.setVisibility(View.VISIBLE);
}

// Create recycler view
mList.setLayoutManager(getLayoutManager());
Expand Down Expand Up @@ -148,6 +158,17 @@ public boolean onActionItemClicked(android.support.v7.view.ActionMode actionMode
Toast.makeText(getApplicationContext(),
"Deleted",
Toast.LENGTH_SHORT).show();

// To check is there are saved reminders
// If there are no reminders display a message asking the user to create reminders
List<Reminder> mTest = rb.getAllReminders();

if (mTest.isEmpty()) {
mNoReminderView.setVisibility(View.VISIBLE);
} else {
mNoReminderView.setVisibility(View.GONE);
}

return true;

// On clicking save reminders
Expand Down Expand Up @@ -186,6 +207,17 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
@Override
public void onResume(){
super.onResume();

// To check is there are saved reminders
// If there are no reminders display a message asking the user to create reminders
List<Reminder> mTest = rb.getAllReminders();

if (mTest.isEmpty()) {
mNoReminderView.setVisibility(View.VISIBLE);
} else {
mNoReminderView.setVisibility(View.GONE);
}

mAdapter.setItemCount(getDefaultItemCount());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected void onCreate(Bundle savedInstanceState) {

// Setup Toolbar
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle(R.string.title_activity_add_reminder);
getSupportActionBar().setTitle(R.string.title_activity_edit_reminder);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<TextView
android:id="@+id/no_reminder_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="16dp"
android:gravity="center"
android:visibility="gone"
android:text="@string/no_reminders"/>

<View
android:layout_width="match_parent"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

<string name="action_discard_reminder">Discard Reminder</string>
<string name="action_save_reminder">Save Reminder</string>

<string name="no_reminders">Click on the plus button below to begin creating your reminders!</string>

<string name="licenses"><BIG><b>NOTICES FOR LIBRARIES:</b></BIG> \n\n <b> 1) MaterialDateTimePicker
</b> \n\n<TT>Copyright (c) 2015 Wouter Dullaert\n\n
Expand Down

0 comments on commit d77ff00

Please sign in to comment.