Merge branch 'settings_changes' into develop
This commit is contained in:
commit
14c60ac9db
|
@ -284,21 +284,11 @@
|
|||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.LanguageActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.AboutActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.HideItemActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name" />
|
||||
<activity
|
||||
android:name="app.fedilab.android.activities.SettingsActivity"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
/* Copyright 2019 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Fedilab
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Fedilab 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 Fedilab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package app.fedilab.android.activities;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
|
||||
import app.fedilab.android.client.Entities.MainMenuItem;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.sqlite.MainMenuDAO;
|
||||
import app.fedilab.android.sqlite.Sqlite;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 28/08/2019.
|
||||
* Hide menu items activity
|
||||
*/
|
||||
|
||||
public class HideItemActivity extends BaseActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
switch (theme) {
|
||||
case Helper.THEME_LIGHT:
|
||||
setTheme(R.style.AppTheme);
|
||||
break;
|
||||
case Helper.THEME_DARK:
|
||||
setTheme(R.style.AppThemeDark);
|
||||
break;
|
||||
case Helper.THEME_BLACK:
|
||||
setTheme(R.style.AppThemeBlack);
|
||||
break;
|
||||
default:
|
||||
setTheme(R.style.AppThemeDark);
|
||||
}
|
||||
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
assert inflater != null;
|
||||
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
|
||||
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.hide_menu_items);
|
||||
if (theme == Helper.THEME_LIGHT) {
|
||||
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
|
||||
Helper.colorizeToolbar(toolbar, R.color.black, HideItemActivity.this);
|
||||
}
|
||||
}
|
||||
setContentView(R.layout.activity_hide_menu_items);
|
||||
|
||||
SQLiteDatabase db = Sqlite.getInstance(HideItemActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
MainMenuItem mainMenu = new MainMenuDAO(getApplicationContext(), db).getMainMenu();
|
||||
if (mainMenu == null) {
|
||||
mainMenu = new MainMenuItem();
|
||||
}
|
||||
CheckBox nav_news = findViewById(R.id.nav_news);
|
||||
CheckBox nav_list = findViewById(R.id.nav_list);
|
||||
CheckBox nav_scheduled = findViewById(R.id.nav_scheduled);
|
||||
CheckBox nav_archive = findViewById(R.id.nav_archive);
|
||||
CheckBox nav_archive_notifications = findViewById(R.id.nav_archive_notifications);
|
||||
CheckBox nav_peertube = findViewById(R.id.nav_peertube);
|
||||
CheckBox nav_filters = findViewById(R.id.nav_filters);
|
||||
CheckBox nav_who_to_follow = findViewById(R.id.nav_who_to_follow);
|
||||
CheckBox nav_blocked = findViewById(R.id.nav_blocked);
|
||||
CheckBox nav_muted = findViewById(R.id.nav_muted);
|
||||
CheckBox nav_blocked_domains = findViewById(R.id.nav_blocked_domains);
|
||||
CheckBox nav_how_to = findViewById(R.id.nav_how_to);
|
||||
Button validate = findViewById(R.id.validate);
|
||||
|
||||
|
||||
nav_news.setChecked(mainMenu.isNav_news());
|
||||
nav_list.setChecked(mainMenu.isNav_list());
|
||||
nav_scheduled.setChecked(mainMenu.isNav_scheduled());
|
||||
nav_archive.setChecked(mainMenu.isNav_archive());
|
||||
nav_archive_notifications.setChecked(mainMenu.isNav_archive_notifications());
|
||||
nav_peertube.setChecked(mainMenu.isNav_peertube());
|
||||
nav_filters.setChecked(mainMenu.isNav_filters());
|
||||
nav_who_to_follow.setChecked(mainMenu.isNav_how_to_follow());
|
||||
nav_blocked.setChecked(mainMenu.isNav_blocked());
|
||||
nav_muted.setChecked(mainMenu.isNav_muted());
|
||||
nav_blocked_domains.setChecked(mainMenu.isNav_blocked_domains());
|
||||
nav_how_to.setChecked(mainMenu.isNav_howto());
|
||||
|
||||
|
||||
validate.setOnClickListener(view -> {
|
||||
MainMenuItem mainMenuItem = new MainMenuItem();
|
||||
mainMenuItem.setNav_news(nav_news.isChecked());
|
||||
mainMenuItem.setNav_list(nav_list.isChecked());
|
||||
mainMenuItem.setNav_scheduled(nav_scheduled.isChecked());
|
||||
mainMenuItem.setNav_archive(nav_archive.isChecked());
|
||||
mainMenuItem.setNav_archive_notifications(nav_archive_notifications.isChecked());
|
||||
mainMenuItem.setNav_peertube(nav_peertube.isChecked());
|
||||
mainMenuItem.setNav_filters(nav_filters.isChecked());
|
||||
mainMenuItem.setNav_how_to_follow(nav_who_to_follow.isChecked());
|
||||
mainMenuItem.setNav_blocked(nav_blocked.isChecked());
|
||||
mainMenuItem.setNav_muted(nav_muted.isChecked());
|
||||
mainMenuItem.setNav_blocked_domains(nav_blocked_domains.isChecked());
|
||||
mainMenuItem.setNav_howto(nav_how_to.isChecked());
|
||||
MainMenuItem mainMenuItem1 = new MainMenuDAO(getApplicationContext(), db).getMainMenu();
|
||||
|
||||
if (mainMenuItem1 != null) {
|
||||
new MainMenuDAO(getApplicationContext(), db).updateMenu(mainMenuItem);
|
||||
} else {
|
||||
new MainMenuDAO(getApplicationContext(), db).insertMenu(mainMenuItem);
|
||||
}
|
||||
Intent mainActivity = new Intent(HideItemActivity.this, MainActivity.class);
|
||||
mainActivity.putExtra(Helper.INTENT_ACTION, Helper.REDRAW_MENU);
|
||||
startActivity(mainActivity);
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,324 +0,0 @@
|
|||
/* Copyright 2018 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Fedilab
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Fedilab 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 Fedilab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package app.fedilab.android.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import app.fedilab.android.client.Entities.Account;
|
||||
import app.fedilab.android.client.Entities.Error;
|
||||
import app.fedilab.android.client.Entities.Relationship;
|
||||
import app.fedilab.android.client.Entities.Results;
|
||||
import app.fedilab.android.drawers.AccountSearchDevAdapter;
|
||||
import app.fedilab.android.helper.ExpandableHeightListView;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.asynctasks.RetrieveRelationshipAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveRemoteDataAsyncTask;
|
||||
import app.fedilab.android.interfaces.OnRetrieveRelationshipInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveRemoteAccountInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 22/12/2018.
|
||||
* Language activity
|
||||
*/
|
||||
|
||||
public class LanguageActivity extends BaseActivity implements OnRetrieveRemoteAccountInterface, OnRetrieveRelationshipInterface {
|
||||
|
||||
private List<Account> translators = new ArrayList<>();
|
||||
|
||||
private AccountSearchDevAdapter translatorManager;
|
||||
private int count2 = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
switch (theme) {
|
||||
case Helper.THEME_LIGHT:
|
||||
setTheme(R.style.AppTheme);
|
||||
break;
|
||||
case Helper.THEME_DARK:
|
||||
setTheme(R.style.AppThemeDark);
|
||||
break;
|
||||
case Helper.THEME_BLACK:
|
||||
setTheme(R.style.AppThemeBlack);
|
||||
break;
|
||||
default:
|
||||
setTheme(R.style.AppThemeDark);
|
||||
}
|
||||
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
assert inflater != null;
|
||||
View view = inflater.inflate(R.layout.simple_bar, new LinearLayout(getApplicationContext()), false);
|
||||
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.languages);
|
||||
if (theme == Helper.THEME_LIGHT) {
|
||||
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
|
||||
Helper.colorizeToolbar(toolbar, R.color.black, LanguageActivity.this);
|
||||
}
|
||||
}
|
||||
setContentView(R.layout.activity_language);
|
||||
|
||||
|
||||
Button about_translation = findViewById(R.id.about_translation);
|
||||
|
||||
|
||||
about_translation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://crowdin.com/project/mastalab"));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
|
||||
ExpandableHeightListView lv_translator_manager = findViewById(R.id.lv_translator_manager);
|
||||
|
||||
setTitle(R.string.languages);
|
||||
lv_translator_manager.setExpanded(true);
|
||||
|
||||
translatorManager = new AccountSearchDevAdapter(translators);
|
||||
lv_translator_manager.setAdapter(translatorManager);
|
||||
|
||||
|
||||
new RetrieveRemoteDataAsyncTask(getApplicationContext(), "ButterflyOfFire", "mstdn.fr", LanguageActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
|
||||
String currentLanguage = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, Helper.localeToStringStorage(Locale.getDefault()));
|
||||
Locale currentLocale = Helper.restoreLocaleFromString(currentLanguage);
|
||||
final Spinner set_change_locale = findViewById(R.id.set_change_locale);
|
||||
ArrayAdapter<String> adapterLocale = new ArrayAdapter<>(LanguageActivity.this,
|
||||
android.R.layout.simple_spinner_dropdown_item, Helper.getLocales(getApplicationContext()));
|
||||
|
||||
set_change_locale.setAdapter(adapterLocale);
|
||||
|
||||
int positionSpinnerLanguage = Helper.languageSpinnerPosition(getApplicationContext());
|
||||
set_change_locale.setSelection(positionSpinnerLanguage);
|
||||
set_change_locale.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (count2 > 0) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
switch (position) {
|
||||
case 0:
|
||||
editor.remove(Helper.SET_DEFAULT_LOCALE_NEW);
|
||||
editor.commit();
|
||||
break;
|
||||
case 1:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "en");
|
||||
editor.commit();
|
||||
break;
|
||||
case 2:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "fr");
|
||||
editor.commit();
|
||||
break;
|
||||
case 3:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "de");
|
||||
editor.commit();
|
||||
break;
|
||||
case 4:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "it");
|
||||
editor.commit();
|
||||
break;
|
||||
case 5:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ja");
|
||||
editor.commit();
|
||||
break;
|
||||
case 6:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "zh-TW");
|
||||
editor.commit();
|
||||
break;
|
||||
case 7:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "zh-CN");
|
||||
editor.commit();
|
||||
break;
|
||||
case 8:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "eu");
|
||||
editor.commit();
|
||||
break;
|
||||
case 9:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ar");
|
||||
editor.commit();
|
||||
break;
|
||||
case 10:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "nl");
|
||||
editor.commit();
|
||||
break;
|
||||
case 11:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "gl");
|
||||
editor.commit();
|
||||
break;
|
||||
case 12:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "el");
|
||||
editor.commit();
|
||||
break;
|
||||
case 13:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "pt");
|
||||
editor.commit();
|
||||
break;
|
||||
case 14:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "es");
|
||||
editor.commit();
|
||||
break;
|
||||
case 15:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "pl");
|
||||
editor.commit();
|
||||
break;
|
||||
case 16:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "sr");
|
||||
editor.commit();
|
||||
break;
|
||||
case 17:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "uk");
|
||||
editor.commit();
|
||||
break;
|
||||
case 18:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ru");
|
||||
editor.commit();
|
||||
break;
|
||||
case 19:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "no");
|
||||
editor.commit();
|
||||
break;
|
||||
case 20:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "kab");
|
||||
editor.commit();
|
||||
break;
|
||||
}
|
||||
|
||||
PackageManager packageManager = getPackageManager();
|
||||
Intent intent = packageManager.getLaunchIntentForPackage(getPackageName());
|
||||
assert intent != null;
|
||||
ComponentName componentName = intent.getComponent();
|
||||
Intent mainIntent = Intent.makeRestartActivityTask(componentName);
|
||||
startActivity(mainIntent);
|
||||
Runtime.getRuntime().exit(0);
|
||||
}
|
||||
count2++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRetrieveRemoteAccount(Results results) {
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
if (results == null) {
|
||||
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = results.getAccounts();
|
||||
Account account;
|
||||
if (accounts != null && accounts.size() > 0) {
|
||||
account = accounts.get(0);
|
||||
account.setFollowing(true);
|
||||
switch (account.getUsername()) {
|
||||
case "ButterflyOfFire":
|
||||
translators.add(account);
|
||||
translatorManager.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(), LanguageActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (translators != null) {
|
||||
for (Account account : translators) {
|
||||
new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(), LanguageActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveRelationship(Relationship relationship, Error error) {
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, "");
|
||||
if (error != null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < translators.size(); i++) {
|
||||
if (translators.get(i).getId() != null && translators.get(i).getId().equals(relationship.getId())) {
|
||||
translators.get(i).setFollowing(relationship.isFollowing() || userId.trim().equals(relationship.getId()));
|
||||
translatorManager.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,40 +14,30 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package app.fedilab.android.activities;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.animatemenu.interfaces.Resourceble;
|
||||
import app.fedilab.android.animatemenu.interfaces.ScreenShotable;
|
||||
import app.fedilab.android.animatemenu.model.SlideMenuItem;
|
||||
import app.fedilab.android.animatemenu.util.ViewAnimator;
|
||||
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
||||
import app.fedilab.android.fragments.ContentSettingsFragment;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
|
@ -56,16 +46,8 @@ import app.fedilab.android.helper.Helper;
|
|||
* Settings activity
|
||||
*/
|
||||
|
||||
public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewAnimatorListener {
|
||||
public class SettingsActivity extends BaseActivity {
|
||||
|
||||
private int res = R.drawable.ic_timeline_menu_s;
|
||||
private LinearLayout linearLayout;
|
||||
private ViewAnimator viewAnimator;
|
||||
private DrawerLayout drawerLayout;
|
||||
private ActionBarDrawerToggle drawerToggle;
|
||||
private List<SlideMenuItem> list = new ArrayList<>();
|
||||
public static int position = 1;
|
||||
private ContentSettingsFragment.type previous;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -74,18 +56,17 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
|
|||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
switch (theme) {
|
||||
case Helper.THEME_LIGHT:
|
||||
setTheme(R.style.AppTheme_NoActionBar_Fedilab);
|
||||
setTheme(R.style.AppTheme);
|
||||
break;
|
||||
case Helper.THEME_DARK:
|
||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||
setTheme(R.style.AppThemeDark);
|
||||
break;
|
||||
case Helper.THEME_BLACK:
|
||||
setTheme(R.style.AppThemeBlack_NoActionBar);
|
||||
setTheme(R.style.AppThemeBlack);
|
||||
break;
|
||||
default:
|
||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||
setTheme(R.style.AppThemeDark);
|
||||
}
|
||||
position = 1;
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
|
@ -103,67 +84,117 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
|
|||
finish();
|
||||
}
|
||||
});
|
||||
toolbar_title.setText(R.string.action_about);
|
||||
toolbar_title.setText(R.string.settings);
|
||||
if (theme == Helper.THEME_LIGHT) {
|
||||
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
|
||||
Helper.colorizeToolbar(toolbar, R.color.black, SettingsActivity.this);
|
||||
}
|
||||
}
|
||||
setContentView(R.layout.activity_settings);
|
||||
ContentSettingsFragment contentSettingsFragment = ContentSettingsFragment.newInstance(R.drawable.ic_list_timeline);
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.content_frame, contentSettingsFragment)
|
||||
.commit();
|
||||
drawerLayout = findViewById(R.id.drawer_layout);
|
||||
drawerLayout.setScrimColor(Color.TRANSPARENT);
|
||||
linearLayout = findViewById(R.id.left_drawer);
|
||||
linearLayout.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
||||
ViewPager mPager = findViewById(R.id.settings_viewpager);
|
||||
TabLayout tabLayout = findViewById(R.id.settings_tablayout);
|
||||
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.settings_category_label_timelines)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.notifications)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.settings_category_label_interface)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.compose)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.hide_menu_items)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.administration)));
|
||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.languages)));
|
||||
PagerAdapter mPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mPagerAdapter);
|
||||
|
||||
mPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
drawerLayout.closeDrawers();
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
TabLayout.Tab tab = tabLayout.getTabAt(position);
|
||||
if (tab != null)
|
||||
tab.select();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setActionBar();
|
||||
createMenuList();
|
||||
viewAnimator = new ViewAnimator<>(this, list, contentSettingsFragment, drawerLayout, this);
|
||||
}
|
||||
|
||||
|
||||
private void setActionBar() {
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
drawerToggle = new ActionBarDrawerToggle(
|
||||
this,
|
||||
drawerLayout,
|
||||
toolbar,
|
||||
R.string.close,
|
||||
R.string.open_menu
|
||||
) {
|
||||
|
||||
/** Called when a drawer has settled in a completely closed state. */
|
||||
public void onDrawerClosed(View view) {
|
||||
super.onDrawerClosed(view);
|
||||
linearLayout.removeAllViews();
|
||||
linearLayout.invalidate();
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerSlide(View drawerView, float slideOffset) {
|
||||
super.onDrawerSlide(drawerView, slideOffset);
|
||||
if (slideOffset > 0.6 && linearLayout.getChildCount() == 0)
|
||||
viewAnimator.showMenuContent();
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
/** Called when a drawer has settled in a completely open state. */
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
SettingsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Bundle bundle = new Bundle();
|
||||
ContentSettingsFragment.type typeOfSettings;
|
||||
switch (position) {
|
||||
case 0:
|
||||
typeOfSettings = ContentSettingsFragment.type.TIMELINES;
|
||||
break;
|
||||
case 1:
|
||||
typeOfSettings = ContentSettingsFragment.type.NOTIFICATIONS;
|
||||
break;
|
||||
case 2:
|
||||
typeOfSettings = ContentSettingsFragment.type.INTERFACE;
|
||||
break;
|
||||
case 3:
|
||||
typeOfSettings = ContentSettingsFragment.type.COMPOSE;
|
||||
break;
|
||||
case 4:
|
||||
typeOfSettings = ContentSettingsFragment.type.MENU;
|
||||
break;
|
||||
case 5:
|
||||
typeOfSettings = ContentSettingsFragment.type.ADMIN;
|
||||
break;
|
||||
case 6:
|
||||
typeOfSettings = ContentSettingsFragment.type.LANGUAGE;
|
||||
break;
|
||||
default:
|
||||
typeOfSettings = ContentSettingsFragment.type.TIMELINES;
|
||||
|
||||
}
|
||||
};
|
||||
drawerLayout.addDrawerListener(drawerToggle);
|
||||
ContentSettingsFragment contentSettingsFragment = new ContentSettingsFragment();
|
||||
bundle.putSerializable("typeOfSettings", typeOfSettings);
|
||||
contentSettingsFragment.setArguments(bundle);
|
||||
return contentSettingsFragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionBarTitle(String title) {
|
||||
|
@ -175,49 +206,6 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void createMenuList() {
|
||||
|
||||
SlideMenuItem menuItemClose = new SlideMenuItem(ContentSettingsFragment.type.CLOSE, R.drawable.ic_close);
|
||||
SlideMenuItem menuItemTimeline = new SlideMenuItem(ContentSettingsFragment.type.TIMELINES, R.drawable.ic_timeline_menu_s);
|
||||
SlideMenuItem menuItemNotification = new SlideMenuItem(ContentSettingsFragment.type.NOTIFICATIONS, R.drawable.ic_notifications_menu);
|
||||
SlideMenuItem menuItemAdmin = new SlideMenuItem(ContentSettingsFragment.type.ADMIN, R.drawable.ic_security_admin_menu);
|
||||
SlideMenuItem menuItemInterface = new SlideMenuItem(ContentSettingsFragment.type.INTERFACE, R.drawable.ic_tablet_menu);
|
||||
SlideMenuItem menuItemEdit = new SlideMenuItem(ContentSettingsFragment.type.COMPOSE, R.drawable.ic_edit_black_menu);
|
||||
SlideMenuItem menuLanguage = new SlideMenuItem(ContentSettingsFragment.type.LANGUAGE, R.drawable.ic_translate_menu);
|
||||
SlideMenuItem menuMenu = new SlideMenuItem(ContentSettingsFragment.type.MENU, R.drawable.ic_menu_menu);
|
||||
list.add(menuItemClose);
|
||||
list.add(menuItemTimeline);
|
||||
list.add(menuItemNotification);
|
||||
list.add(menuItemInterface);
|
||||
list.add(menuItemEdit);
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
list.add(menuMenu);
|
||||
list.add(menuItemAdmin);
|
||||
}
|
||||
list.add(menuLanguage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
drawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
drawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -227,63 +215,4 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
|
|||
}
|
||||
|
||||
|
||||
private ScreenShotable replaceFragment(ScreenShotable screenShotable, ContentSettingsFragment.type type, int topPosition) {
|
||||
this.res = this.res == R.drawable.ic_timeline_menu_s ? R.drawable.ic_notifications_menu : R.drawable.ic_timeline_menu_s;
|
||||
if (type == ContentSettingsFragment.type.LANGUAGE) {
|
||||
Intent intent = new Intent(getApplicationContext(), LanguageActivity.class);
|
||||
startActivity(intent);
|
||||
type = previous;
|
||||
} else if (type == ContentSettingsFragment.type.MENU) {
|
||||
Intent intent = new Intent(getApplicationContext(), HideItemActivity.class);
|
||||
startActivity(intent);
|
||||
type = previous;
|
||||
}
|
||||
View view = findViewById(R.id.content_frame);
|
||||
int finalRadius = Math.max(view.getWidth(), view.getHeight());
|
||||
Animator animator;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
||||
animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius);
|
||||
animator.setInterpolator(new AccelerateInterpolator());
|
||||
animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION);
|
||||
findViewById(R.id.content_overlay).setBackground(new BitmapDrawable(getResources(), screenShotable.getBitmap()));
|
||||
animator.start();
|
||||
}
|
||||
|
||||
|
||||
ContentSettingsFragment contentSettingsFragment = ContentSettingsFragment.newInstance(this.res);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("type", type);
|
||||
contentSettingsFragment.setArguments(bundle);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentSettingsFragment).commit();
|
||||
previous = type;
|
||||
return contentSettingsFragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ScreenShotable onSwitch(Resourceble slideMenuItem, ScreenShotable screenShotable, int position) {
|
||||
|
||||
ContentSettingsFragment.type type = slideMenuItem.getType();
|
||||
if (ContentSettingsFragment.type.CLOSE.equals(type)) {
|
||||
finish();
|
||||
return null;
|
||||
}
|
||||
return replaceFragment(screenShotable, type, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableHomeButton() {
|
||||
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableHomeButton() {
|
||||
Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(true);
|
||||
drawerLayout.closeDrawers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewToContainer(View view) {
|
||||
linearLayout.addView(view);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package app.fedilab.android.animatemenu.animation;
|
||||
|
||||
import android.graphics.Camera;
|
||||
import android.graphics.Matrix;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Transformation;
|
||||
|
||||
/**
|
||||
* Created by Konstantin on 22.12.2014.
|
||||
*/
|
||||
public class FlipAnimation extends Animation {
|
||||
private final float mFromDegrees;
|
||||
private final float mToDegrees;
|
||||
private final float mCenterX;
|
||||
private final float mCenterY;
|
||||
private Camera mCamera;
|
||||
|
||||
public FlipAnimation(float fromDegrees, float toDegrees,
|
||||
float centerX, float centerY) {
|
||||
mFromDegrees = fromDegrees;
|
||||
mToDegrees = toDegrees;
|
||||
mCenterX = centerX;
|
||||
mCenterY = centerY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(int width, int height, int parentWidth, int parentHeight) {
|
||||
super.initialize(width, height, parentWidth, parentHeight);
|
||||
mCamera = new Camera();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyTransformation(float interpolatedTime, Transformation t) {
|
||||
final float fromDegrees = mFromDegrees;
|
||||
float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);
|
||||
|
||||
final float centerX = mCenterX;
|
||||
final float centerY = mCenterY;
|
||||
final Camera camera = mCamera;
|
||||
|
||||
final Matrix matrix = t.getMatrix();
|
||||
|
||||
camera.save();
|
||||
|
||||
camera.rotateY(degrees);
|
||||
|
||||
camera.getMatrix(matrix);
|
||||
camera.restore();
|
||||
|
||||
matrix.preTranslate(-centerX, -centerY);
|
||||
matrix.postTranslate(centerX, centerY);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package app.fedilab.android.animatemenu.interfaces;
|
||||
|
||||
import app.fedilab.android.fragments.ContentSettingsFragment;
|
||||
|
||||
/**
|
||||
* Created by Konstantin on 12.01.2015.
|
||||
*/
|
||||
public interface Resourceble {
|
||||
public int getImageRes();
|
||||
|
||||
public ContentSettingsFragment.type getType();
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package app.fedilab.android.animatemenu.interfaces;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
/**
|
||||
* Created by Konstantin on 12.01.2015.
|
||||
*/
|
||||
public interface ScreenShotable {
|
||||
public void takeScreenShot();
|
||||
|
||||
public Bitmap getBitmap();
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package app.fedilab.android.animatemenu.model;
|
||||
|
||||
|
||||
import app.fedilab.android.animatemenu.interfaces.Resourceble;
|
||||
import app.fedilab.android.fragments.ContentSettingsFragment;
|
||||
|
||||
/**
|
||||
* Created by Konstantin on 23.12.2014.
|
||||
*/
|
||||
public class SlideMenuItem implements Resourceble {
|
||||
|
||||
private ContentSettingsFragment.type type;
|
||||
private int imageRes;
|
||||
|
||||
public SlideMenuItem(ContentSettingsFragment.type type, int imageRes) {
|
||||
this.type = type;
|
||||
this.imageRes = imageRes;
|
||||
}
|
||||
|
||||
|
||||
public int getImageRes() {
|
||||
return imageRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContentSettingsFragment.type getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setImageRes(int imageRes) {
|
||||
this.imageRes = imageRes;
|
||||
}
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
package app.fedilab.android.animatemenu.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.ManageAccountsInListActivity;
|
||||
import app.fedilab.android.activities.SettingsActivity;
|
||||
import app.fedilab.android.animatemenu.animation.FlipAnimation;
|
||||
import app.fedilab.android.animatemenu.interfaces.Resourceble;
|
||||
import app.fedilab.android.animatemenu.interfaces.ScreenShotable;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
import static app.fedilab.android.helper.Helper.changeDrawableColor;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Konstantin on 12.01.2015.
|
||||
*/
|
||||
public class ViewAnimator<T extends Resourceble> {
|
||||
private final int ANIMATION_DURATION = 100;
|
||||
public static final int CIRCULAR_REVEAL_ANIMATION_DURATION = 500;
|
||||
|
||||
private AppCompatActivity appCompatActivity;
|
||||
|
||||
private List<T> list;
|
||||
|
||||
private List<View> viewList = new ArrayList<>();
|
||||
private ScreenShotable screenShotable;
|
||||
private DrawerLayout drawerLayout;
|
||||
private ViewAnimatorListener animatorListener;
|
||||
|
||||
|
||||
public ViewAnimator(AppCompatActivity activity,
|
||||
List<T> items,
|
||||
ScreenShotable screenShotable,
|
||||
final DrawerLayout drawerLayout,
|
||||
ViewAnimatorListener animatorListener) {
|
||||
this.appCompatActivity = activity;
|
||||
|
||||
this.list = items;
|
||||
this.screenShotable = screenShotable;
|
||||
this.drawerLayout = drawerLayout;
|
||||
this.animatorListener = animatorListener;
|
||||
}
|
||||
|
||||
|
||||
public void showMenuContent() {
|
||||
setViewsClickable(false);
|
||||
viewList.clear();
|
||||
double size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
@SuppressLint("InflateParams") View viewMenu = appCompatActivity.getLayoutInflater().inflate(R.layout.menu_list_item, null);
|
||||
|
||||
if (i == SettingsActivity.position) {
|
||||
viewMenu.setBackgroundColor(ContextCompat.getColor(appCompatActivity, R.color.mastodonC2));
|
||||
} else {
|
||||
SharedPreferences sharedpreferences = appCompatActivity.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
|
||||
if (theme == Helper.THEME_DARK) {
|
||||
viewMenu.setBackgroundResource(R.drawable.menu_item_selector);
|
||||
} else if (theme == Helper.THEME_BLACK) {
|
||||
viewMenu.setBackgroundResource(R.drawable.menu_item_selector_black);
|
||||
} else {
|
||||
viewMenu.setBackgroundResource(R.drawable.menu_item_selector_light);
|
||||
ImageView imageView = viewMenu.findViewById(R.id.menu_item_image);
|
||||
if (imageView != null) {
|
||||
changeDrawableColor(appCompatActivity, imageView, R.color.black);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final int finalI = i;
|
||||
viewMenu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int[] location = {0, 0};
|
||||
SettingsActivity.position = finalI;
|
||||
v.getLocationOnScreen(location);
|
||||
switchItem(list.get(finalI), location[1] + v.getHeight() / 2);
|
||||
}
|
||||
});
|
||||
((ImageView) viewMenu.findViewById(R.id.menu_item_image)).setImageResource(list.get(i).getImageRes());
|
||||
viewMenu.setVisibility(View.GONE);
|
||||
viewMenu.setEnabled(false);
|
||||
viewList.add(viewMenu);
|
||||
animatorListener.addViewToContainer(viewMenu);
|
||||
final double position = i;
|
||||
final double delay = 3 * ANIMATION_DURATION * (position / size);
|
||||
if (screenShotable != null) {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
if (position < viewList.size()) {
|
||||
animateView((int) position);
|
||||
}
|
||||
if (position == viewList.size() - 1) {
|
||||
screenShotable.takeScreenShot();
|
||||
setViewsClickable(true);
|
||||
}
|
||||
}
|
||||
}, (long) delay);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void hideMenuContent() {
|
||||
setViewsClickable(false);
|
||||
double size = list.size();
|
||||
for (int i = list.size(); i >= 0; i--) {
|
||||
final double position = i;
|
||||
final double delay = 3 * ANIMATION_DURATION * (position / size);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
if (position < viewList.size()) {
|
||||
animateHideView((int) position);
|
||||
}
|
||||
}
|
||||
}, (long) delay);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setViewsClickable(boolean clickable) {
|
||||
animatorListener.disableHomeButton();
|
||||
for (View view : viewList) {
|
||||
view.setEnabled(clickable);
|
||||
}
|
||||
}
|
||||
|
||||
private void animateView(int position) {
|
||||
final View view = viewList.get(position);
|
||||
view.setVisibility(View.VISIBLE);
|
||||
FlipAnimation rotation =
|
||||
new FlipAnimation(90, 0, 0.0f, view.getHeight() / 2.0f);
|
||||
rotation.setDuration(ANIMATION_DURATION);
|
||||
rotation.setFillAfter(true);
|
||||
rotation.setInterpolator(new AccelerateInterpolator());
|
||||
rotation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
view.clearAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
view.startAnimation(rotation);
|
||||
}
|
||||
|
||||
private void animateHideView(final int position) {
|
||||
final View view = viewList.get(position);
|
||||
FlipAnimation rotation =
|
||||
new FlipAnimation(0, 90, 0.0f, view.getHeight() / 2.0f);
|
||||
rotation.setDuration(ANIMATION_DURATION);
|
||||
rotation.setFillAfter(true);
|
||||
rotation.setInterpolator(new AccelerateInterpolator());
|
||||
rotation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
view.clearAnimation();
|
||||
view.setVisibility(View.INVISIBLE);
|
||||
|
||||
animatorListener.enableHomeButton();
|
||||
drawerLayout.closeDrawers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
view.startAnimation(rotation);
|
||||
}
|
||||
|
||||
private void switchItem(Resourceble slideMenuItem, int topPosition) {
|
||||
this.screenShotable = animatorListener.onSwitch(slideMenuItem, screenShotable, topPosition);
|
||||
hideMenuContent();
|
||||
}
|
||||
|
||||
public interface ViewAnimatorListener {
|
||||
|
||||
ScreenShotable onSwitch(Resourceble slideMenuItem, ScreenShotable screenShotable, int position);
|
||||
|
||||
void disableHomeButton();
|
||||
|
||||
void enableHomeButton();
|
||||
|
||||
void addViewToContainer(View view);
|
||||
|
||||
}
|
||||
}
|
|
@ -15,24 +15,22 @@ package app.fedilab.android.fragments;
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -74,23 +72,33 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.LanguageActivity;
|
||||
import app.fedilab.android.activities.MainActivity;
|
||||
import app.fedilab.android.activities.SettingsActivity;
|
||||
import app.fedilab.android.animatemenu.interfaces.ScreenShotable;
|
||||
import app.fedilab.android.asynctasks.DownloadTrackingDomainsAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveRelationshipAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveRemoteDataAsyncTask;
|
||||
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
||||
import app.fedilab.android.client.Entities.Account;
|
||||
import app.fedilab.android.client.Entities.Error;
|
||||
import app.fedilab.android.client.Entities.MainMenuItem;
|
||||
import app.fedilab.android.client.Entities.Relationship;
|
||||
import app.fedilab.android.client.Entities.Results;
|
||||
import app.fedilab.android.drawers.AccountSearchDevAdapter;
|
||||
import app.fedilab.android.filelister.FileListerDialog;
|
||||
import app.fedilab.android.filelister.OnFileSelectedListener;
|
||||
import app.fedilab.android.helper.ExpandableHeightListView;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.interfaces.OnRetrieveRelationshipInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveRemoteAccountInterface;
|
||||
import app.fedilab.android.services.LiveNotificationDelayedService;
|
||||
import app.fedilab.android.services.LiveNotificationService;
|
||||
import app.fedilab.android.services.StopLiveNotificationReceiver;
|
||||
import app.fedilab.android.sqlite.AccountDAO;
|
||||
import app.fedilab.android.sqlite.MainMenuDAO;
|
||||
import app.fedilab.android.sqlite.Sqlite;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
import mabbas007.tagsedittext.TagsEditText;
|
||||
|
@ -101,18 +109,53 @@ import static android.content.Context.MODE_PRIVATE;
|
|||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.ADMIN;
|
||||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.COMPOSE;
|
||||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.INTERFACE;
|
||||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.LANGUAGE;
|
||||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.MENU;
|
||||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.NOTIFICATIONS;
|
||||
import static app.fedilab.android.fragments.ContentSettingsFragment.type.TIMELINES;
|
||||
|
||||
public class ContentSettingsFragment extends Fragment implements ScreenShotable {
|
||||
public class ContentSettingsFragment extends Fragment implements OnRetrieveRemoteAccountInterface, OnRetrieveRelationshipInterface {
|
||||
|
||||
|
||||
private View containerView;
|
||||
protected int res;
|
||||
private Bitmap bitmap;
|
||||
private type type;
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
public void onRetrieveRemoteAccount(Results results) {
|
||||
if (results == null) {
|
||||
return;
|
||||
}
|
||||
List<Account> accounts = results.getAccounts();
|
||||
Account account;
|
||||
if (accounts != null && accounts.size() > 0) {
|
||||
account = accounts.get(0);
|
||||
account.setFollowing(true);
|
||||
switch (account.getUsername()) {
|
||||
case "ButterflyOfFire":
|
||||
translators.add(account);
|
||||
translatorManager.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
new RetrieveRelationshipAsyncTask(context, account.getId(), ContentSettingsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRetrieveRelationship(Relationship relationship, Error error) {
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, "");
|
||||
if (error != null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < translators.size(); i++) {
|
||||
if (translators.get(i).getId() != null && translators.get(i).getId().equals(relationship.getId())) {
|
||||
translators.get(i).setFollowing(relationship.isFollowing() || userId.trim().equals(relationship.getId()));
|
||||
translatorManager.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum type {
|
||||
CLOSE,
|
||||
TIMELINES,
|
||||
|
@ -123,7 +166,8 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
LANGUAGE,
|
||||
MENU
|
||||
}
|
||||
|
||||
private List<Account> translators = new ArrayList<>();
|
||||
private AccountSearchDevAdapter translatorManager;
|
||||
private static final int ACTIVITY_CHOOSE_FILE = 411;
|
||||
private TextView set_folder;
|
||||
private EditText your_api_key;
|
||||
|
@ -146,7 +190,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
context = getContext();
|
||||
assert context != null;
|
||||
this.containerView = view.findViewById(R.id.container);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -193,8 +236,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
assert getArguments() != null;
|
||||
res = getArguments().getInt(Integer.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -205,7 +246,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
Bundle bundle = this.getArguments();
|
||||
if (bundle != null) {
|
||||
type = (type) bundle.getSerializable("type");
|
||||
type = (type) bundle.getSerializable("typeOfSettings");
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,32 +279,30 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
LinearLayout settings_admin = rootView.findViewById(R.id.settings_admin);
|
||||
LinearLayout settings_interface = rootView.findViewById(R.id.settings_interface);
|
||||
LinearLayout settings_compose = rootView.findViewById(R.id.settings_compose);
|
||||
LinearLayout settings_hide_menu = rootView.findViewById(R.id.settings_hide_menu);
|
||||
LinearLayout settings_translation = rootView.findViewById(R.id.settings_translation);
|
||||
|
||||
|
||||
String title = "";
|
||||
if (type == null || type.equals(TIMELINES)) {
|
||||
settings_timeline.setVisibility(View.VISIBLE);
|
||||
title = context.getString(R.string.timelines);
|
||||
} else if (type == NOTIFICATIONS) {
|
||||
settings_notifications.setVisibility(View.VISIBLE);
|
||||
title = context.getString(R.string.notifications);
|
||||
} else if (type == ADMIN) {
|
||||
settings_admin.setVisibility(View.VISIBLE);
|
||||
title = context.getString(R.string.administration);
|
||||
} else if (type == INTERFACE) {
|
||||
settings_interface.setVisibility(View.VISIBLE);
|
||||
title = context.getString(R.string.u_interface);
|
||||
} else if (type == COMPOSE) {
|
||||
settings_compose.setVisibility(View.VISIBLE);
|
||||
title = context.getString(R.string.compose);
|
||||
} else if( type == MENU){
|
||||
settings_hide_menu.setVisibility(View.VISIBLE);
|
||||
}else if( type == LANGUAGE){
|
||||
settings_translation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
((SettingsActivity) context)
|
||||
.setActionBarTitle(title);
|
||||
|
||||
|
||||
boolean auto_store = sharedpreferences.getBoolean(Helper.SET_AUTO_STORE, true);
|
||||
|
||||
final CheckBox set_auto_store = rootView.findViewById(R.id.set_auto_store);
|
||||
final SwitchCompat set_auto_store = rootView.findViewById(R.id.set_auto_store);
|
||||
set_auto_store.setChecked(auto_store);
|
||||
set_auto_store.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -275,7 +314,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean display_content_after_fetch_more = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONTENT_AFTER_FM, true);
|
||||
final CheckBox set_display_content_after_fetch_more = rootView.findViewById(R.id.set_display_content_after_fetch_more);
|
||||
final SwitchCompat set_display_content_after_fetch_more = rootView.findViewById(R.id.set_display_content_after_fetch_more);
|
||||
set_display_content_after_fetch_more.setChecked(display_content_after_fetch_more);
|
||||
set_display_content_after_fetch_more.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -285,8 +324,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_display_content_after_fetch_more_text = rootView.findViewById(R.id.set_display_content_after_fetch_more_text);
|
||||
set_display_content_after_fetch_more_text.setOnClickListener(v -> set_display_content_after_fetch_more.performClick());
|
||||
|
||||
count1 = 0;
|
||||
count2 = 0;
|
||||
|
@ -298,7 +335,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(context));
|
||||
|
||||
boolean auto_backup = sharedpreferences.getBoolean(Helper.SET_AUTO_BACKUP_STATUSES + userId + instance, false);
|
||||
final CheckBox set_auto_backup = rootView.findViewById(R.id.set_auto_backup);
|
||||
final SwitchCompat set_auto_backup = rootView.findViewById(R.id.set_auto_backup);
|
||||
set_auto_backup.setChecked(auto_backup);
|
||||
set_auto_backup.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -311,7 +348,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean clear_cache_exit = sharedpreferences.getBoolean(Helper.SET_CLEAR_CACHE_EXIT, false);
|
||||
final CheckBox set_clear_cache_exit = rootView.findViewById(R.id.set_clear_cache_exit);
|
||||
final SwitchCompat set_clear_cache_exit = rootView.findViewById(R.id.set_clear_cache_exit);
|
||||
set_clear_cache_exit.setChecked(clear_cache_exit);
|
||||
set_clear_cache_exit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -323,7 +360,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean auto_backup_notifications = sharedpreferences.getBoolean(Helper.SET_AUTO_BACKUP_NOTIFICATIONS + userId + instance, false);
|
||||
final CheckBox set_auto_backup_notifications = rootView.findViewById(R.id.set_auto_backup_notifications);
|
||||
final SwitchCompat set_auto_backup_notifications = rootView.findViewById(R.id.set_auto_backup_notifications);
|
||||
set_auto_backup_notifications.setChecked(auto_backup_notifications);
|
||||
set_auto_backup_notifications.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -334,9 +371,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
}
|
||||
});
|
||||
|
||||
final LinearLayout set_auto_backup_text = rootView.findViewById(R.id.set_auto_backup_text);
|
||||
set_auto_backup_text.setOnClickListener(view -> set_auto_backup.performClick());
|
||||
|
||||
|
||||
TagsEditText set_featured_tags = rootView.findViewById(R.id.set_featured_tags);
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
|
||||
|
@ -456,7 +490,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||
final CheckBox set_security_provider = rootView.findViewById(R.id.set_security_provider);
|
||||
final SwitchCompat set_security_provider = rootView.findViewById(R.id.set_security_provider);
|
||||
set_security_provider.setChecked(patch_provider);
|
||||
|
||||
set_security_provider.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -467,13 +501,11 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_security_provider_text = rootView.findViewById(R.id.set_security_provider_text);
|
||||
set_security_provider_text.setOnClickListener(v -> set_security_provider.performClick());
|
||||
|
||||
|
||||
boolean display_card = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CARD, false);
|
||||
|
||||
final CheckBox set_display_card = rootView.findViewById(R.id.set_display_card);
|
||||
final SwitchCompat set_display_card = rootView.findViewById(R.id.set_display_card);
|
||||
set_display_card.setChecked(display_card);
|
||||
set_display_card.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -487,7 +519,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
boolean display_admin_menu = sharedpreferences.getBoolean(Helper.SET_DISPLAY_ADMIN_MENU + userId + instance, false);
|
||||
|
||||
final CheckBox set_display_admin_menu = rootView.findViewById(R.id.set_display_admin_menu);
|
||||
final SwitchCompat set_display_admin_menu = rootView.findViewById(R.id.set_display_admin_menu);
|
||||
set_display_admin_menu.setChecked(display_admin_menu);
|
||||
set_display_admin_menu.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -509,7 +541,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
boolean display_admin_statuses = sharedpreferences.getBoolean(Helper.SET_DISPLAY_ADMIN_STATUSES + userId + instance, false);
|
||||
|
||||
final CheckBox set_display_admin_statuses = rootView.findViewById(R.id.set_display_admin_statuses);
|
||||
final SwitchCompat set_display_admin_statuses = rootView.findViewById(R.id.set_display_admin_statuses);
|
||||
set_display_admin_statuses.setChecked(display_admin_statuses);
|
||||
set_display_admin_statuses.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -521,7 +553,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, false);
|
||||
final CheckBox set_auto_add_media_url = rootView.findViewById(R.id.set_auto_add_media_url);
|
||||
final SwitchCompat set_auto_add_media_url = rootView.findViewById(R.id.set_auto_add_media_url);
|
||||
set_auto_add_media_url.setChecked(show_media_urls);
|
||||
|
||||
set_auto_add_media_url.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -534,7 +566,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean display_video_preview = sharedpreferences.getBoolean(Helper.SET_DISPLAY_VIDEO_PREVIEWS, true);
|
||||
final CheckBox set_display_video_preview = rootView.findViewById(R.id.set_display_video_preview);
|
||||
final SwitchCompat set_display_video_preview = rootView.findViewById(R.id.set_display_video_preview);
|
||||
set_display_video_preview.setChecked(display_video_preview);
|
||||
|
||||
set_display_video_preview.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -545,11 +577,9 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_display_video_preview_text = rootView.findViewById(R.id.set_display_video_preview_text);
|
||||
set_display_video_preview_text.setOnClickListener(v -> set_display_video_preview.performClick());
|
||||
|
||||
boolean notif_validation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
|
||||
final CheckBox set_share_validation = rootView.findViewById(R.id.set_share_validation);
|
||||
final SwitchCompat set_share_validation = rootView.findViewById(R.id.set_share_validation);
|
||||
set_share_validation.setChecked(notif_validation);
|
||||
|
||||
set_share_validation.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -592,7 +622,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean notif_validation_fav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
||||
final CheckBox set_share_validation_fav = rootView.findViewById(R.id.set_share_validation_fav);
|
||||
final SwitchCompat set_share_validation_fav = rootView.findViewById(R.id.set_share_validation_fav);
|
||||
set_share_validation_fav.setChecked(notif_validation_fav);
|
||||
|
||||
set_share_validation_fav.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -606,7 +636,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false);
|
||||
final CheckBox set_expand_cw = rootView.findViewById(R.id.set_expand_cw);
|
||||
final SwitchCompat set_expand_cw = rootView.findViewById(R.id.set_expand_cw);
|
||||
set_expand_cw.setChecked(expand_cw);
|
||||
|
||||
set_expand_cw.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -619,7 +649,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean display_emoji = sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, true);
|
||||
final CheckBox set_display_emoji = rootView.findViewById(R.id.set_display_emoji);
|
||||
final SwitchCompat set_display_emoji = rootView.findViewById(R.id.set_display_emoji);
|
||||
set_display_emoji.setChecked(display_emoji);
|
||||
|
||||
set_display_emoji.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -632,7 +662,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean expand_media = sharedpreferences.getBoolean(Helper.SET_EXPAND_MEDIA, false);
|
||||
final CheckBox set_expand_media = rootView.findViewById(R.id.set_expand_image);
|
||||
final SwitchCompat set_expand_media = rootView.findViewById(R.id.set_expand_image);
|
||||
set_expand_media.setChecked(expand_media);
|
||||
|
||||
set_expand_media.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -646,7 +676,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean photo_editor = sharedpreferences.getBoolean(Helper.SET_PHOTO_EDITOR, true);
|
||||
final CheckBox set_photo_editor = rootView.findViewById(R.id.set_photo_editor);
|
||||
final SwitchCompat set_photo_editor = rootView.findViewById(R.id.set_photo_editor);
|
||||
set_photo_editor.setChecked(photo_editor);
|
||||
|
||||
set_photo_editor.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -681,7 +711,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
}
|
||||
});
|
||||
boolean remember_position_home = sharedpreferences.getBoolean(Helper.SET_REMEMBER_POSITION_HOME, true);
|
||||
final CheckBox set_remember_position = rootView.findViewById(R.id.set_remember_position);
|
||||
final SwitchCompat set_remember_position = rootView.findViewById(R.id.set_remember_position);
|
||||
set_remember_position.setChecked(remember_position_home);
|
||||
|
||||
set_remember_position.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -692,12 +722,10 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_remember_position_text = rootView.findViewById(R.id.set_remember_position_text);
|
||||
set_remember_position_text.setOnClickListener(v -> set_remember_position.performClick());
|
||||
|
||||
|
||||
boolean hide_delete_notification_on_tab = sharedpreferences.getBoolean(Helper.SET_HIDE_DELETE_BUTTON_ON_TAB, false);
|
||||
final CheckBox set_hide_delete_notification_on_tab = rootView.findViewById(R.id.set_hide_delete_notification_on_tab);
|
||||
final SwitchCompat set_hide_delete_notification_on_tab = rootView.findViewById(R.id.set_hide_delete_notification_on_tab);
|
||||
set_hide_delete_notification_on_tab.setChecked(hide_delete_notification_on_tab);
|
||||
|
||||
set_hide_delete_notification_on_tab.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -717,7 +745,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean blur_sensitive = sharedpreferences.getBoolean(Helper.SET_BLUR_SENSITIVE, true);
|
||||
final CheckBox set_blur_sensitive = rootView.findViewById(R.id.set_blur_sensitive);
|
||||
final SwitchCompat set_blur_sensitive = rootView.findViewById(R.id.set_blur_sensitive);
|
||||
set_blur_sensitive.setChecked(blur_sensitive);
|
||||
|
||||
set_blur_sensitive.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -728,15 +756,13 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_blur_sensitive_text = rootView.findViewById(R.id.set_blur_sensitive_text);
|
||||
set_blur_sensitive_text.setOnClickListener(v -> set_blur_sensitive.performClick());
|
||||
|
||||
|
||||
TextView set_invidious_host = rootView.findViewById(R.id.set_invidious_host);
|
||||
|
||||
|
||||
boolean invidious = sharedpreferences.getBoolean(Helper.SET_INVIDIOUS, false);
|
||||
final CheckBox set_invidious = rootView.findViewById(R.id.set_invidious);
|
||||
final SwitchCompat set_invidious = rootView.findViewById(R.id.set_invidious);
|
||||
set_invidious.setChecked(invidious);
|
||||
|
||||
set_invidious.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -788,7 +814,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
TextView set_nitter_host = rootView.findViewById(R.id.set_nitter_host);
|
||||
boolean nitter = sharedpreferences.getBoolean(Helper.SET_NITTER, false);
|
||||
final CheckBox set_nitter = rootView.findViewById(R.id.set_nitter);
|
||||
final SwitchCompat set_nitter = rootView.findViewById(R.id.set_nitter);
|
||||
set_nitter.setChecked(nitter);
|
||||
|
||||
set_nitter.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -838,7 +864,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean long_press_media = sharedpreferences.getBoolean(Helper.SET_LONG_PRESS_MEDIA, true);
|
||||
final CheckBox set_long_press_media = rootView.findViewById(R.id.set_long_press_media);
|
||||
final SwitchCompat set_long_press_media = rootView.findViewById(R.id.set_long_press_media);
|
||||
set_long_press_media.setChecked(long_press_media);
|
||||
|
||||
set_long_press_media.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -849,12 +875,10 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_long_press_media_text = rootView.findViewById(R.id.set_long_press_media_text);
|
||||
set_long_press_media_text.setOnClickListener(v -> set_long_press_media.performClick());
|
||||
|
||||
|
||||
boolean display_timeline_in_list = sharedpreferences.getBoolean(Helper.SET_DISPLAY_TIMELINE_IN_LIST, false);
|
||||
final CheckBox set_display_timeline_in_list = rootView.findViewById(R.id.set_display_timeline_in_list);
|
||||
final SwitchCompat set_display_timeline_in_list = rootView.findViewById(R.id.set_display_timeline_in_list);
|
||||
set_display_timeline_in_list.setChecked(display_timeline_in_list);
|
||||
|
||||
set_display_timeline_in_list.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -874,12 +898,10 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
|
||||
}
|
||||
});
|
||||
final LinearLayout set_display_timeline_in_list_text = rootView.findViewById(R.id.set_display_timeline_in_list_text);
|
||||
set_display_timeline_in_list_text.setOnClickListener(v -> set_display_timeline_in_list.performClick());
|
||||
|
||||
|
||||
boolean unfollow_validation = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
|
||||
final CheckBox set_unfollow_validation = rootView.findViewById(R.id.set_unfollow_validation);
|
||||
final SwitchCompat set_unfollow_validation = rootView.findViewById(R.id.set_unfollow_validation);
|
||||
set_unfollow_validation.setChecked(unfollow_validation);
|
||||
|
||||
set_unfollow_validation.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -893,7 +915,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean send_crash_reports = sharedpreferences.getBoolean(Helper.SET_SEND_CRASH_REPORTS, false);
|
||||
final CheckBox set_enable_crash_report = rootView.findViewById(R.id.set_enable_crash_report);
|
||||
final SwitchCompat set_enable_crash_report = rootView.findViewById(R.id.set_enable_crash_report);
|
||||
set_enable_crash_report.setChecked(send_crash_reports);
|
||||
|
||||
set_enable_crash_report.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -906,8 +928,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
getActivity().recreate();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_enable_crash_report_text = rootView.findViewById(R.id.set_enable_crash_report_text);
|
||||
set_enable_crash_report_text.setOnClickListener(v -> set_enable_crash_report.performClick());
|
||||
|
||||
int truncate_toots_size = sharedpreferences.getInt(Helper.SET_TRUNCATE_TOOTS_SIZE, 0);
|
||||
SeekBar set_truncate_size = rootView.findViewById(R.id.set_truncate_size);
|
||||
|
@ -935,7 +955,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
|
||||
final CheckBox set_new_badge = rootView.findViewById(R.id.set_display_new_badge);
|
||||
final SwitchCompat set_new_badge = rootView.findViewById(R.id.set_display_new_badge);
|
||||
set_new_badge.setChecked(new_badge);
|
||||
|
||||
set_new_badge.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -948,7 +968,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean fedilab_features_button = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FEDILAB_FEATURES_BUTTON, true);
|
||||
final CheckBox set_fedilab_features_button = rootView.findViewById(R.id.set_display_fedilab_features_button);
|
||||
final SwitchCompat set_fedilab_features_button = rootView.findViewById(R.id.set_display_fedilab_features_button);
|
||||
set_fedilab_features_button.setChecked(fedilab_features_button);
|
||||
|
||||
set_fedilab_features_button.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -959,11 +979,9 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_display_fedilab_features_button_text = rootView.findViewById(R.id.set_display_fedilab_features_button_text);
|
||||
set_display_fedilab_features_button_text.setOnClickListener(v -> set_fedilab_features_button.performClick());
|
||||
|
||||
boolean bot_icon = sharedpreferences.getBoolean(Helper.SET_DISPLAY_BOT_ICON, true);
|
||||
final CheckBox set_bot_icon = rootView.findViewById(R.id.set_display_bot_icon);
|
||||
final SwitchCompat set_bot_icon = rootView.findViewById(R.id.set_display_bot_icon);
|
||||
set_bot_icon.setChecked(bot_icon);
|
||||
|
||||
set_bot_icon.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -976,7 +994,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean display_confirm = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONFIRM, true);
|
||||
final CheckBox set_display_confirm = rootView.findViewById(R.id.set_display_confirm);
|
||||
final SwitchCompat set_display_confirm = rootView.findViewById(R.id.set_display_confirm);
|
||||
set_display_confirm.setChecked(display_confirm);
|
||||
|
||||
set_display_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -989,7 +1007,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean quick_reply = sharedpreferences.getBoolean(Helper.SET_QUICK_REPLY, true);
|
||||
final CheckBox set_quick_reply = rootView.findViewById(R.id.set_quick_reply);
|
||||
final SwitchCompat set_quick_reply = rootView.findViewById(R.id.set_quick_reply);
|
||||
set_quick_reply.setChecked(quick_reply);
|
||||
|
||||
set_quick_reply.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1000,11 +1018,9 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_quick_reply_text = rootView.findViewById(R.id.set_quick_reply_text);
|
||||
set_quick_reply_text.setOnClickListener(v -> set_quick_reply.performClick());
|
||||
|
||||
boolean fit_preview = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false);
|
||||
final CheckBox set_fit_preview = rootView.findViewById(R.id.set_fit_preview);
|
||||
final SwitchCompat set_fit_preview = rootView.findViewById(R.id.set_fit_preview);
|
||||
set_fit_preview.setChecked(fit_preview);
|
||||
|
||||
set_fit_preview.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1015,8 +1031,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_fit_preview_text = rootView.findViewById(R.id.set_fit_preview_text);
|
||||
set_fit_preview_text.setOnClickListener(v -> set_fit_preview.performClick());
|
||||
|
||||
boolean compact_mode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
|
||||
boolean console_mode = sharedpreferences.getBoolean(Helper.SET_CONSOLE_MODE, false);
|
||||
|
@ -1055,7 +1069,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
|
||||
final CheckBox set_share_details = rootView.findViewById(R.id.set_share_details);
|
||||
final SwitchCompat set_share_details = rootView.findViewById(R.id.set_share_details);
|
||||
set_share_details.setChecked(share_details);
|
||||
|
||||
set_share_details.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1069,7 +1083,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
// retrieve metadata if URL from external apps when composing
|
||||
boolean should_retrieve_metadata = sharedpreferences.getBoolean(Helper.SET_RETRIEVE_METADATA_IF_URL_FROM_EXTERAL, true);
|
||||
final CheckBox set_retrieve_metadata = rootView.findViewById(R.id.set_retrieve_metadata_share_from_extras);
|
||||
final SwitchCompat set_retrieve_metadata = rootView.findViewById(R.id.set_retrieve_metadata_share_from_extras);
|
||||
set_retrieve_metadata.setChecked(should_retrieve_metadata);
|
||||
|
||||
set_retrieve_metadata.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1084,7 +1098,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
// Custom Sharing
|
||||
final EditText edit_custom_sharing_url = rootView.findViewById(R.id.custom_sharing_url);
|
||||
boolean custom_sharing = sharedpreferences.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
||||
final CheckBox set_custom_sharing = rootView.findViewById(R.id.set_custom_sharing);
|
||||
final SwitchCompat set_custom_sharing = rootView.findViewById(R.id.set_custom_sharing);
|
||||
set_custom_sharing.setChecked(custom_sharing);
|
||||
if (custom_sharing)
|
||||
edit_custom_sharing_url.setVisibility(View.VISIBLE);
|
||||
|
@ -1102,12 +1116,10 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
edit_custom_sharing_url.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
final LinearLayout set_custom_sharing_text = rootView.findViewById(R.id.set_custom_sharing_text);
|
||||
set_custom_sharing_text.setOnClickListener(v -> set_custom_sharing.performClick());
|
||||
|
||||
// forward tags in replies
|
||||
boolean forward_tags = sharedpreferences.getBoolean(Helper.SET_FORWARD_TAGS_IN_REPLY, false);
|
||||
final CheckBox set_forward_tags = rootView.findViewById(R.id.set_forward_tags);
|
||||
final SwitchCompat set_forward_tags = rootView.findViewById(R.id.set_forward_tags);
|
||||
set_forward_tags.setChecked(forward_tags);
|
||||
set_forward_tags.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -1145,7 +1157,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false);
|
||||
final CheckBox set_disable_gif = rootView.findViewById(R.id.set_disable_gif);
|
||||
final SwitchCompat set_disable_gif = rootView.findViewById(R.id.set_disable_gif);
|
||||
set_disable_gif.setChecked(disableGif);
|
||||
set_disable_gif.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -1160,7 +1172,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
||||
final CheckBox set_disable_animated_emoji = rootView.findViewById(R.id.set_disable_animated_emoji);
|
||||
final SwitchCompat set_disable_animated_emoji = rootView.findViewById(R.id.set_disable_animated_emoji);
|
||||
set_disable_animated_emoji.setChecked(disableAnimatedEmoji);
|
||||
set_disable_animated_emoji.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -1301,7 +1313,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean capitalize = sharedpreferences.getBoolean(Helper.SET_CAPITALIZE, true);
|
||||
final CheckBox set_capitalize = rootView.findViewById(R.id.set_capitalize);
|
||||
final SwitchCompat set_capitalize = rootView.findViewById(R.id.set_capitalize);
|
||||
set_capitalize.setChecked(capitalize);
|
||||
|
||||
set_capitalize.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1312,8 +1324,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_capitalize_text = rootView.findViewById(R.id.set_capitalize_text);
|
||||
set_capitalize_text.setOnClickListener(v -> set_capitalize.performClick());
|
||||
|
||||
|
||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
|
@ -1322,7 +1332,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
}
|
||||
|
||||
boolean wysiwyg = sharedpreferences.getBoolean(Helper.SET_WYSIWYG, false);
|
||||
final CheckBox set_wysiwyg = rootView.findViewById(R.id.set_wysiwyg);
|
||||
final SwitchCompat set_wysiwyg = rootView.findViewById(R.id.set_wysiwyg);
|
||||
set_wysiwyg.setChecked(wysiwyg);
|
||||
|
||||
set_wysiwyg.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1335,9 +1345,9 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
|
||||
final CheckBox set_embedded_browser = rootView.findViewById(R.id.set_embedded_browser);
|
||||
final SwitchCompat set_embedded_browser = rootView.findViewById(R.id.set_embedded_browser);
|
||||
final LinearLayout set_javascript_container = rootView.findViewById(R.id.set_javascript_container);
|
||||
final CheckBox set_custom_tabs = rootView.findViewById(R.id.set_custom_tabs);
|
||||
final SwitchCompat set_custom_tabs = rootView.findViewById(R.id.set_custom_tabs);
|
||||
final LinearLayout custom_tabs_container = rootView.findViewById(R.id.custom_tabs_container);
|
||||
final SwitchCompat set_javascript = rootView.findViewById(R.id.set_javascript);
|
||||
boolean javascript = sharedpreferences.getBoolean(Helper.SET_JAVASCRIPT, true);
|
||||
|
@ -1386,8 +1396,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
editor.apply();
|
||||
}
|
||||
});
|
||||
final LinearLayout set_custom_tabs_text = rootView.findViewById(R.id.set_custom_tabs_text);
|
||||
set_custom_tabs_text.setOnClickListener(v -> set_custom_tabs.performClick());
|
||||
|
||||
final LinearLayout set_cookies_container = rootView.findViewById(R.id.set_cookies_container);
|
||||
final SwitchCompat set_cookies = rootView.findViewById(R.id.set_cookies);
|
||||
|
@ -1653,7 +1661,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
boolean allow_live_notifications = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + userId + instance, true);
|
||||
TextView set_allow_live_notifications_title = rootView.findViewById(R.id.set_allow_live_notifications_title);
|
||||
set_allow_live_notifications_title.setText(context.getString(R.string.set_allow_live_notifications, account.getAcct() + "@" + account.getInstance()));
|
||||
final CheckBox set_allow_live_notifications = rootView.findViewById(R.id.set_allow_live_notifications);
|
||||
final SwitchCompat set_allow_live_notifications = rootView.findViewById(R.id.set_allow_live_notifications);
|
||||
set_allow_live_notifications.setChecked(allow_live_notifications);
|
||||
set_allow_live_notifications.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -1722,7 +1730,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
if (!split_toot) {
|
||||
set_split_container.setVisibility(View.GONE);
|
||||
}
|
||||
final CheckBox set_split_toot = rootView.findViewById(R.id.set_automatically_split_toot);
|
||||
final SwitchCompat set_split_toot = rootView.findViewById(R.id.set_automatically_split_toot);
|
||||
set_split_toot.setChecked(split_toot);
|
||||
set_split_toot.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -1809,7 +1817,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
});
|
||||
|
||||
//Resize
|
||||
final CheckBox set_resize_picture = rootView.findViewById(R.id.set_resize_picture);
|
||||
final SwitchCompat set_resize_picture = rootView.findViewById(R.id.set_resize_picture);
|
||||
boolean compress = sharedpreferences.getBoolean(Helper.SET_PICTURE_COMPRESSED, true);
|
||||
set_resize_picture.setChecked(compress);
|
||||
set_resize_picture.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1823,7 +1831,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
//Resize
|
||||
final CheckBox set_resize_video = rootView.findViewById(R.id.set_resize_video);
|
||||
final SwitchCompat set_resize_video = rootView.findViewById(R.id.set_resize_video);
|
||||
boolean compressVideo = sharedpreferences.getBoolean(Helper.SET_VIDEO_COMPRESSED, true);
|
||||
set_resize_video.setChecked(compressVideo);
|
||||
set_resize_video.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1851,11 +1859,11 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
final String time_to = sharedpreferences.getString(Helper.SET_TIME_TO, "22:00");
|
||||
|
||||
|
||||
final CheckBox set_notif_follow = rootView.findViewById(R.id.set_notif_follow);
|
||||
final CheckBox set_notif_follow_add = rootView.findViewById(R.id.set_notif_follow_add);
|
||||
final CheckBox set_notif_follow_mention = rootView.findViewById(R.id.set_notif_follow_mention);
|
||||
final CheckBox set_notif_follow_share = rootView.findViewById(R.id.set_notif_follow_share);
|
||||
final CheckBox set_notif_follow_poll = rootView.findViewById(R.id.set_notif_follow_poll);
|
||||
final SwitchCompat set_notif_follow = rootView.findViewById(R.id.set_notif_follow);
|
||||
final SwitchCompat set_notif_follow_add = rootView.findViewById(R.id.set_notif_follow_add);
|
||||
final SwitchCompat set_notif_follow_mention = rootView.findViewById(R.id.set_notif_follow_mention);
|
||||
final SwitchCompat set_notif_follow_share = rootView.findViewById(R.id.set_notif_follow_share);
|
||||
final SwitchCompat set_notif_follow_poll = rootView.findViewById(R.id.set_notif_follow_poll);
|
||||
|
||||
|
||||
final SwitchCompat switchCompatWIFI = rootView.findViewById(R.id.set_wifi_only);
|
||||
|
@ -1978,7 +1986,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
|
||||
|
||||
boolean enable_time_slot = sharedpreferences.getBoolean(Helper.SET_ENABLE_TIME_SLOT, true);
|
||||
final CheckBox set_enable_time_slot = rootView.findViewById(R.id.set_enable_time_slot);
|
||||
final SwitchCompat set_enable_time_slot = rootView.findViewById(R.id.set_enable_time_slot);
|
||||
set_enable_time_slot.setChecked(enable_time_slot);
|
||||
|
||||
set_enable_time_slot.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -2205,6 +2213,211 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
lol.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox nav_news = rootView.findViewById(R.id.nav_news);
|
||||
CheckBox nav_list = rootView.findViewById(R.id.nav_list);
|
||||
CheckBox nav_scheduled = rootView.findViewById(R.id.nav_scheduled);
|
||||
CheckBox nav_archive = rootView.findViewById(R.id.nav_archive);
|
||||
CheckBox nav_archive_notifications = rootView.findViewById(R.id.nav_archive_notifications);
|
||||
CheckBox nav_peertube = rootView.findViewById(R.id.nav_peertube);
|
||||
CheckBox nav_filters = rootView.findViewById(R.id.nav_filters);
|
||||
CheckBox nav_who_to_follow = rootView.findViewById(R.id.nav_who_to_follow);
|
||||
CheckBox nav_blocked = rootView.findViewById(R.id.nav_blocked);
|
||||
CheckBox nav_muted = rootView.findViewById(R.id.nav_muted);
|
||||
CheckBox nav_blocked_domains = rootView.findViewById(R.id.nav_blocked_domains);
|
||||
CheckBox nav_how_to = rootView.findViewById(R.id.nav_how_to);
|
||||
Button validate = rootView.findViewById(R.id.validate);
|
||||
|
||||
MainMenuItem mainMenu = new MainMenuDAO(context, db).getMainMenu();
|
||||
if (mainMenu == null) {
|
||||
mainMenu = new MainMenuItem();
|
||||
}
|
||||
nav_news.setChecked(mainMenu.isNav_news());
|
||||
nav_list.setChecked(mainMenu.isNav_list());
|
||||
nav_scheduled.setChecked(mainMenu.isNav_scheduled());
|
||||
nav_archive.setChecked(mainMenu.isNav_archive());
|
||||
nav_archive_notifications.setChecked(mainMenu.isNav_archive_notifications());
|
||||
nav_peertube.setChecked(mainMenu.isNav_peertube());
|
||||
nav_filters.setChecked(mainMenu.isNav_filters());
|
||||
nav_who_to_follow.setChecked(mainMenu.isNav_how_to_follow());
|
||||
nav_blocked.setChecked(mainMenu.isNav_blocked());
|
||||
nav_muted.setChecked(mainMenu.isNav_muted());
|
||||
nav_blocked_domains.setChecked(mainMenu.isNav_blocked_domains());
|
||||
nav_how_to.setChecked(mainMenu.isNav_howto());
|
||||
|
||||
|
||||
validate.setOnClickListener(view -> {
|
||||
MainMenuItem mainMenuItem = new MainMenuItem();
|
||||
mainMenuItem.setNav_news(nav_news.isChecked());
|
||||
mainMenuItem.setNav_list(nav_list.isChecked());
|
||||
mainMenuItem.setNav_scheduled(nav_scheduled.isChecked());
|
||||
mainMenuItem.setNav_archive(nav_archive.isChecked());
|
||||
mainMenuItem.setNav_archive_notifications(nav_archive_notifications.isChecked());
|
||||
mainMenuItem.setNav_peertube(nav_peertube.isChecked());
|
||||
mainMenuItem.setNav_filters(nav_filters.isChecked());
|
||||
mainMenuItem.setNav_how_to_follow(nav_who_to_follow.isChecked());
|
||||
mainMenuItem.setNav_blocked(nav_blocked.isChecked());
|
||||
mainMenuItem.setNav_muted(nav_muted.isChecked());
|
||||
mainMenuItem.setNav_blocked_domains(nav_blocked_domains.isChecked());
|
||||
mainMenuItem.setNav_howto(nav_how_to.isChecked());
|
||||
MainMenuItem mainMenuItem1 = new MainMenuDAO(context, db).getMainMenu();
|
||||
|
||||
if (mainMenuItem1 != null) {
|
||||
new MainMenuDAO(context, db).updateMenu(mainMenuItem);
|
||||
} else {
|
||||
new MainMenuDAO(context, db).insertMenu(mainMenuItem);
|
||||
}
|
||||
Intent mainActivity = new Intent(context, MainActivity.class);
|
||||
mainActivity.putExtra(Helper.INTENT_ACTION, Helper.REDRAW_MENU);
|
||||
startActivity(mainActivity);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Button about_translation = rootView.findViewById(R.id.about_translation);
|
||||
|
||||
|
||||
about_translation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://crowdin.com/project/mastalab"));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
});
|
||||
|
||||
ExpandableHeightListView lv_translator_manager = rootView.findViewById(R.id.lv_translator_manager);
|
||||
|
||||
lv_translator_manager.setExpanded(true);
|
||||
translatorManager = new AccountSearchDevAdapter(translators);
|
||||
lv_translator_manager.setAdapter(translatorManager);
|
||||
|
||||
if( type == LANGUAGE) {
|
||||
new RetrieveRemoteDataAsyncTask(context, "ButterflyOfFire", "mstdn.fr", ContentSettingsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
String currentLanguage = sharedpreferences.getString(Helper.SET_DEFAULT_LOCALE_NEW, Helper.localeToStringStorage(Locale.getDefault()));
|
||||
Locale currentLocale = Helper.restoreLocaleFromString(currentLanguage);
|
||||
final Spinner set_change_locale = rootView.findViewById(R.id.set_change_locale);
|
||||
ArrayAdapter<String> adapterLocale = new ArrayAdapter<>(context,
|
||||
android.R.layout.simple_spinner_dropdown_item, Helper.getLocales(context));
|
||||
|
||||
set_change_locale.setAdapter(adapterLocale);
|
||||
|
||||
int positionSpinnerLanguage = Helper.languageSpinnerPosition(context);
|
||||
set_change_locale.setSelection(positionSpinnerLanguage);
|
||||
set_change_locale.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (count2 > 0) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
switch (position) {
|
||||
case 0:
|
||||
editor.remove(Helper.SET_DEFAULT_LOCALE_NEW);
|
||||
editor.commit();
|
||||
break;
|
||||
case 1:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "en");
|
||||
editor.commit();
|
||||
break;
|
||||
case 2:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "fr");
|
||||
editor.commit();
|
||||
break;
|
||||
case 3:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "de");
|
||||
editor.commit();
|
||||
break;
|
||||
case 4:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "it");
|
||||
editor.commit();
|
||||
break;
|
||||
case 5:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ja");
|
||||
editor.commit();
|
||||
break;
|
||||
case 6:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "zh-TW");
|
||||
editor.commit();
|
||||
break;
|
||||
case 7:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "zh-CN");
|
||||
editor.commit();
|
||||
break;
|
||||
case 8:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "eu");
|
||||
editor.commit();
|
||||
break;
|
||||
case 9:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ar");
|
||||
editor.commit();
|
||||
break;
|
||||
case 10:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "nl");
|
||||
editor.commit();
|
||||
break;
|
||||
case 11:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "gl");
|
||||
editor.commit();
|
||||
break;
|
||||
case 12:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "el");
|
||||
editor.commit();
|
||||
break;
|
||||
case 13:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "pt");
|
||||
editor.commit();
|
||||
break;
|
||||
case 14:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "es");
|
||||
editor.commit();
|
||||
break;
|
||||
case 15:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "pl");
|
||||
editor.commit();
|
||||
break;
|
||||
case 16:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "sr");
|
||||
editor.commit();
|
||||
break;
|
||||
case 17:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "uk");
|
||||
editor.commit();
|
||||
break;
|
||||
case 18:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ru");
|
||||
editor.commit();
|
||||
break;
|
||||
case 19:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "no");
|
||||
editor.commit();
|
||||
break;
|
||||
case 20:
|
||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "kab");
|
||||
editor.commit();
|
||||
break;
|
||||
}
|
||||
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName());
|
||||
assert intent != null;
|
||||
ComponentName componentName = intent.getComponent();
|
||||
Intent mainIntent = Intent.makeRestartActivityTask(componentName);
|
||||
startActivity(mainIntent);
|
||||
Runtime.getRuntime().exit(0);
|
||||
}
|
||||
count2++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
@ -2214,30 +2427,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeScreenShot() {
|
||||
Thread thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Bitmap bitmap = Bitmap.createBitmap(containerView.getWidth(),
|
||||
containerView.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
containerView.draw(canvas);
|
||||
ContentSettingsFragment.this.bitmap = bitmap;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
thread.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getBitmap() {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
//From: https://gist.github.com/asifmujteba/d89ba9074bc941de1eaa#file-asfurihelper
|
||||
|
|
|
@ -1,198 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2019 Thomas Schneider
|
||||
|
||||
This file is a part of Fedilab
|
||||
|
||||
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.
|
||||
|
||||
Fedilab 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 Fedilab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?colorAccent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/communication_menu_title"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?colorAccent" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_news"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/action_news"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/action_lists"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_scheduled"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/scheduled_toots"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_archive"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/owner_cached_toots"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_archive_notifications"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/owner_cached_notifications"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_peertube"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/peertube_favorites"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_filters"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/filters"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_who_to_follow"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/how_to_follow"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?colorAccent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/neutral_menu_title"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?colorAccent" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_blocked"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/blocked_menu"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_muted"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/muted_menu"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_blocked_domains"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/blocked_domains"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?colorAccent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/neutral_menu_information"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?colorAccent" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/nav_how_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/how_to_videos"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/validate"
|
||||
android:layout_gravity="center"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/validate" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -1,106 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright 2018 Thomas Schneider
|
||||
|
||||
This file is a part of Fedilab
|
||||
|
||||
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.
|
||||
|
||||
Fedilab 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 Fedilab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/fab_margin"
|
||||
android:layout_marginLeft="@dimen/fab_margin"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginRight="@dimen/fab_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!-- About app name -->
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="20sp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/crowdin_translations"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<!-- Change locale -->
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/set_change_locale" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/set_change_locale"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- About translator -->
|
||||
<TextView
|
||||
android:padding="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?colorAccent"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/crowdin_manager"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<app.fedilab.android.helper.ExpandableHeightListView
|
||||
android:id="@+id/lv_translator_manager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null" />
|
||||
|
||||
|
||||
<!-- About translation -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center"
|
||||
android:text="@string/translation_app"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_translation"
|
||||
style="@style/Base.Widget.AppCompat.Button.Colored"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="@string/about_crowdin" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -1,53 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="app.fedilab.android.activities.SettingsActivity"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.circularreveal.CircularRevealFrameLayout
|
||||
android:id="@+id/container_frame"
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/settings_tablayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content_overlay"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:id="@+id/content_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary" />
|
||||
|
||||
</com.google.android.material.circularreveal.CircularRevealFrameLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:scrollbarThumbVertical="@android:color/transparent"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start|bottom">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/left_drawer"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="0dp"
|
||||
android:background="@android:color/transparent">
|
||||
<!-- Layout of Drawer -->
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
android:layout_height="wrap_content"
|
||||
app:tabSelectedTextColor="?attr/colorAccent"
|
||||
app:tabTextColor="?attr/textColor"
|
||||
app:tabMode="scrollable"
|
||||
app:tabGravity="fill" />
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/settings_viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
</LinearLayout>
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,7 @@
|
|||
<dimen name="layout_height_header">180dp</dimen>
|
||||
<dimen name="fab_margin_floating">16dp</dimen>
|
||||
<dimen name="item_offset">5dp</dimen>
|
||||
<dimen name="settings_checkbox_margin">2dp</dimen>
|
||||
<dimen name="settings_option_margin">10dp</dimen>
|
||||
<dimen name="settings_category_label_margin">2dp</dimen>
|
||||
<dimen name="activity_vertical_margin_login">50dp</dimen>
|
||||
<dimen name="badge_count_textsize">12sp</dimen>
|
||||
|
|
Loading…
Reference in New Issue