Commit 33d1b17e authored by Robert Hitt's avatar Robert Hitt

SettingsActivity can now be reached from multiple activities

parent 3e0b582b
......@@ -25,6 +25,7 @@
<activity android:name=".views.activities.DetailActivity"
android:parentActivityName=".views.activities.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.activities.MainActivity"/>
......@@ -32,16 +33,13 @@
<activity android:name=".views.activities.AboutActivity"
android:parentActivityName=".views.activities.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.activities.MainActivity"/>
</activity>
<activity android:name=".views.activities.SettingsActivity"
android:parentActivityName=".views.activities.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.activities.MainActivity"/>
<activity android:name=".views.activities.SettingsActivity">
</activity>
<receiver android:name=".util.NotificationReceiver"
......
package srct.whatsopen.views.activities;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
......@@ -89,13 +90,11 @@ public class DetailActivity extends AppCompatActivity implements FacilityView,
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_favorite:
mPresenter.toggleFavorite(mFacility);
return true;
case R.id.action_settings:
expandSettingsActivity();
return true;
default:
return super.onOptionsItemSelected(item);
......@@ -176,4 +175,10 @@ public class DetailActivity extends AppCompatActivity implements FacilityView,
public void onSetNotification() {
setNotificationStatus();
}
// Opens the About page for the app
private void expandSettingsActivity() {
Intent i = new Intent(this, SettingsActivity.class);
startActivity(i);
}
}
package srct.whatsopen.views.activities;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.NavUtils;
......@@ -37,8 +38,8 @@ public class SettingsActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.home:
NavUtils.navigateUpFromSameTask(this);
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
......
......@@ -13,9 +13,4 @@
app:showAsAction="never"
android:title="Settings"/>
<item
android:id="@+id/action_about"
app:showAsAction="never"
android:title="About"/>
</menu>
......@@ -2,9 +2,4 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
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