Toolbar for settings
This commit is contained in:
@ -32,6 +32,7 @@ import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@ -49,6 +50,8 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
|
||||
static final int ALTER_IDENTITY_LIST = 1;
|
||||
|
||||
private Toolbar mToolbar;
|
||||
|
||||
// Preference Header vars
|
||||
private Header[] mIdentityListHeaders;
|
||||
|
||||
@ -78,6 +81,29 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
// Load the legacy preferences headers
|
||||
buildLegacyHeaders();
|
||||
}
|
||||
|
||||
mToolbar.setTitle(getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(int layoutResID) {
|
||||
ViewGroup contentView = (ViewGroup) LayoutInflater.from(this).inflate(
|
||||
R.layout.activity_settings,
|
||||
(ViewGroup) getWindow().getDecorView().getRootView(), false);
|
||||
|
||||
mToolbar = (Toolbar) contentView.findViewById(R.id.main_toolbar);
|
||||
mToolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp));
|
||||
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
ViewGroup contentWrapper = (ViewGroup) contentView.findViewById(R.id.content_wrapper);
|
||||
LayoutInflater.from(this).inflate(layoutResID, contentWrapper, true);
|
||||
|
||||
getWindow().setContentView(contentView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_arrow_back_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_arrow_back_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 287 B |
BIN
app/src/main/res/drawable-mdpi/ic_arrow_back_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_arrow_back_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 B |
BIN
app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 336 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 410 B |
21
app/src/main/res/layout/activity_settings.xml
Normal file
21
app/src/main/res/layout/activity_settings.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/main_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user