Initial import
[SaveMySugar/android-savemysugar.git] / src / main / java / it / ao2 / savemysugar / SettingsActivity.java
1 /*
2  * SaveMySugar - Exchange messages using the distance between phone calls
3  *
4  * Copyright (C) 2015  Antonio Ospite <ao2@ao2.it>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 package it.ao2.savemysugar;
21
22 import android.os.Bundle;
23 import android.support.v7.app.ActionBar;
24 import android.support.v7.app.AppCompatActivity;
25 import android.support.v7.preference.PreferenceFragmentCompat;
26 import android.support.v7.widget.Toolbar;
27
28 public class SettingsActivity extends AppCompatActivity {
29
30     @Override
31     public void onCreate(Bundle savedInstanceState) {
32         super.onCreate(savedInstanceState);
33         setContentView(R.layout.activity_settings);
34
35         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
36         setSupportActionBar(toolbar);
37
38         ActionBar ab = getSupportActionBar();
39         ab.setDisplayHomeAsUpEnabled(true);
40
41         getSupportFragmentManager().beginTransaction().replace(R.id.content_wrapper_settings, new MyPreferenceFragment()).commit();
42     }
43
44     public static class MyPreferenceFragment extends PreferenceFragmentCompat {
45
46         @Override
47         public void onCreatePreferences(final Bundle savedInstanceState, String s) {
48             addPreferencesFromResource(R.xml.preferences);
49         }
50     }
51 }