Commit e7a41e06 authored by Robert Hitt's avatar Robert Hitt
Browse files

Added refresh button to main list view

- Also added buttons for settings and about pages,
though they don't yet lead to anything
parent fb9babe4
......@@ -57,12 +57,9 @@ public class DetailActivity extends AppCompatActivity implements FacilityView{
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_detail, menu);
mFavoriteMenuItem = menu.findItem(R.id.miFavorite);
mFavoriteMenuItem = menu.findItem(R.id.action_favorite);
if(mFacility.isFavorited())
mFavoriteMenuItem.setIcon(R.drawable.ic_fav_button_on_24dp);
else
mFavoriteMenuItem.setIcon(R.drawable.ic_fav_button_white_24dp);
changeFavoriteIcon(mFacility.isFavorited());
return true;
}
......@@ -73,10 +70,12 @@ public class DetailActivity extends AppCompatActivity implements FacilityView{
case R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.miFavorite:
case R.id.action_favorite:
mPresenter.toggleFavorite();
return true;
case R.id.miOptions:
case R.id.action_settings:
return true;
case R.id.action_about:
return true;
default:
return super.onOptionsItemSelected(item);
......
......@@ -5,6 +5,7 @@ import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.astuetz.PagerSlidingTabStrip;
......@@ -57,4 +58,19 @@ public class MainActivity extends AppCompatActivity {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_refresh:
mPresenter.loadFacilities();
return true;
case R.id.action_settings:
return true;
case R.id.action_about:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
......@@ -3,14 +3,18 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/miFavorite"
android:id="@+id/action_favorite"
android:icon="@drawable/ic_fav_button_white_24dp"
app:showAsAction="ifRoom"
android:title="Favorite"/>
<item
android:id="@+id/miOptions"
android:icon="@drawable/ic_options_24dp"
app:showAsAction="ifRoom"
android:title="Options"/>
android:id="@+id/action_settings"
app:showAsAction="never"
android:title="Settings"/>
<item
android:id="@+id/action_about"
app:showAsAction="never"
android:title="About"/>
</menu>
......@@ -3,14 +3,18 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/miRefresh"
android:id="@+id/action_refresh"
android:icon="@drawable/ic_refresh_white_24dp"
app:showAsAction="ifRoom"
android:title="Refresh"/>
<item
android:id="@+id/miOptions"
android:icon="@drawable/ic_options_24dp"
app:showAsAction="ifRoom"
android:title="Options"/>
android:id="@+id/action_settings"
app:showAsAction="never"
android:title="Settings"/>
<item
android:id="@+id/action_about"
app:showAsAction="never"
android:title="About"/>
</menu>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment