1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-07-07 12:24:24 +00:00
NewPipe/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java

72 lines
2.3 KiB
Java
Raw Normal View History

2016-08-02 19:17:54 +00:00
package org.schabi.newpipe.settings;
2015-09-04 00:15:03 +00:00
2016-01-05 20:16:50 +00:00
import android.content.Context;
2015-09-04 00:15:03 +00:00
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
2015-09-04 00:15:03 +00:00
import android.view.MenuItem;
2016-08-02 19:17:54 +00:00
import org.schabi.newpipe.R;
2017-02-27 11:55:15 +00:00
import org.schabi.newpipe.util.ThemeHelper;
2016-12-29 19:19:39 +00:00
2015-09-04 00:15:03 +00:00
/**
* Created by Christian Schabesberger on 31.08.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* SettingsActivity.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class SettingsActivity extends AppCompatActivity {
2017-02-27 11:55:15 +00:00
public static void initSettings(Context context) {
NewPipeSettings.initSettings(context);
}
2015-09-04 00:15:03 +00:00
@Override
protected void onCreate(Bundle savedInstanceBundle) {
ThemeHelper.setTheme(this);
2015-09-04 00:15:03 +00:00
super.onCreate(savedInstanceBundle);
setContentView(R.layout.settings_layout);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
2015-09-04 00:15:03 +00:00
2016-05-25 21:51:22 +00:00
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
2017-05-23 14:53:50 +00:00
actionBar.setTitle(R.string.settings);
actionBar.setDisplayShowTitleEnabled(true);
}
2015-09-04 00:15:03 +00:00
2017-05-14 14:10:00 +00:00
if (savedInstanceBundle == null) {
getFragmentManager().beginTransaction()
.replace(R.id.fragment_holder, new SettingsFragment())
.commit();
}
2015-09-04 00:15:03 +00:00
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
2017-05-14 14:10:00 +00:00
if (id == android.R.id.home) {
2015-09-04 00:15:03 +00:00
finish();
}
return true;
}
}