2017-06-03 15:54:19 +02:00
|
|
|
/* Copyright 2017 Thomas Schneider
|
|
|
|
*
|
2019-05-18 11:10:30 +02:00
|
|
|
* This file is a part of Fedilab
|
2017-06-03 15:54:19 +02:00
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
2019-05-18 11:10:30 +02:00
|
|
|
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
2017-06-03 15:54:19 +02:00
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
2019-05-18 11:10:30 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
2017-06-03 15:54:19 +02:00
|
|
|
* see <http://www.gnu.org/licenses>. */
|
2019-05-18 11:10:30 +02:00
|
|
|
package app.fedilab.android.activities;
|
2017-06-03 15:54:19 +02:00
|
|
|
|
|
|
|
|
2017-06-30 17:09:07 +02:00
|
|
|
import android.content.SharedPreferences;
|
2019-11-13 12:54:01 +01:00
|
|
|
import android.graphics.drawable.ColorDrawable;
|
2017-06-03 15:54:19 +02:00
|
|
|
import android.os.Bundle;
|
2018-11-03 17:02:44 +01:00
|
|
|
import android.view.LayoutInflater;
|
2017-06-03 15:54:19 +02:00
|
|
|
import android.view.MenuItem;
|
2018-11-03 17:02:44 +01:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.ImageView;
|
2019-08-18 17:41:10 +02:00
|
|
|
import android.widget.LinearLayout;
|
2018-11-03 17:02:44 +01:00
|
|
|
import android.widget.TextView;
|
2017-11-12 08:33:24 +01:00
|
|
|
|
2019-11-15 16:32:25 +01:00
|
|
|
import androidx.appcompat.app.ActionBar;
|
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
|
2019-05-18 11:10:30 +02:00
|
|
|
import app.fedilab.android.R;
|
2019-11-15 16:32:25 +01:00
|
|
|
import app.fedilab.android.helper.Helper;
|
2017-06-03 15:54:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by Thomas on 03/06/2017.
|
|
|
|
* Privacy activity
|
|
|
|
*/
|
|
|
|
|
2017-12-12 18:17:01 +01:00
|
|
|
public class PrivacyActivity extends BaseActivity {
|
2017-06-03 15:54:19 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
2019-05-18 11:10:30 +02:00
|
|
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
2017-07-04 21:15:11 +02:00
|
|
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
2019-09-06 17:55:14 +02:00
|
|
|
switch (theme) {
|
2018-05-11 11:28:05 +02:00
|
|
|
case Helper.THEME_LIGHT:
|
2019-11-09 15:47:38 +01:00
|
|
|
setTheme(R.style.AppTheme_Fedilab);
|
2018-05-11 11:28:05 +02:00
|
|
|
break;
|
|
|
|
case Helper.THEME_DARK:
|
|
|
|
setTheme(R.style.AppThemeDark);
|
|
|
|
break;
|
|
|
|
case Helper.THEME_BLACK:
|
|
|
|
setTheme(R.style.AppThemeBlack);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
setTheme(R.style.AppThemeDark);
|
2017-06-30 17:09:07 +02:00
|
|
|
}
|
2018-05-11 11:28:05 +02:00
|
|
|
|
2019-09-06 17:55:14 +02:00
|
|
|
if (getSupportActionBar() != null)
|
2017-06-03 15:54:19 +02:00
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
2018-11-03 17:02:44 +01:00
|
|
|
ActionBar actionBar = getSupportActionBar();
|
2019-09-06 17:55:14 +02:00
|
|
|
if (actionBar != null) {
|
2019-05-18 11:10:30 +02:00
|
|
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
2018-11-03 17:02:44 +01:00
|
|
|
assert inflater != null;
|
2019-09-06 17:55:14 +02:00
|
|
|
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
|
2019-11-15 19:36:39 +01:00
|
|
|
view.setBackground(new ColorDrawable(ContextCompat.getColor(PrivacyActivity.this, R.color.cyanea_primary)));
|
2018-11-03 17:02:44 +01:00
|
|
|
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
|
|
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
|
|
|
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
|
|
|
|
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
|
|
|
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
toolbar_title.setText(R.string.action_privacy);
|
2018-11-03 12:06:44 +01:00
|
|
|
}
|
2017-06-03 15:54:19 +02:00
|
|
|
setContentView(R.layout.activity_privacy);
|
2017-06-05 12:26:09 +02:00
|
|
|
setTitle(getString(R.string.action_privacy));
|
2017-06-03 15:54:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case android.R.id.home:
|
|
|
|
finish();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|