mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Added 'Up navigation' for settings activity
This commit is contained in:
parent
fe470d64a9
commit
654471c098
1 changed files with 16 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import android.os.Bundle;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.app.AppCompatDelegate;
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
|
@ -34,5 +35,20 @@ public class SettingsActivity extends PreferenceActivity {
|
||||||
settingsDelegate = AppCompatDelegate.create(this, null);
|
settingsDelegate = AppCompatDelegate.create(this, null);
|
||||||
}
|
}
|
||||||
settingsDelegate.onPostCreate(savedInstanceState);
|
settingsDelegate.onPostCreate(savedInstanceState);
|
||||||
|
|
||||||
|
//Get an up button
|
||||||
|
settingsDelegate.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Handle action-bar clicks
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue