Add language tab
This commit is contained in:
parent
a1e9fcf224
commit
e7c8aab951
|
@ -284,11 +284,6 @@
|
|||
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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,16 +18,19 @@ package app.fedilab.android.fragments;
|
|||
import android.annotation.TargetApi;
|
||||
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.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -69,18 +72,29 @@ 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.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;
|
||||
|
@ -101,12 +115,48 @@ 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 {
|
||||
public class ContentSettingsFragment extends Fragment implements OnRetrieveRemoteAccountInterface, OnRetrieveRelationshipInterface {
|
||||
|
||||
|
||||
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,
|
||||
|
@ -117,7 +167,8 @@ public class ContentSettingsFragment extends Fragment {
|
|||
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;
|
||||
|
@ -2256,6 +2307,149 @@ public class ContentSettingsFragment extends Fragment {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -2298,7 +2298,81 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
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>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in New Issue