Special entry for translations and language picker
This commit is contained in:
parent
6d36e41263
commit
593fc547ee
|
@ -182,6 +182,11 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
/>
|
/>
|
||||||
|
<activity android:name=".activities.LanguageActivity"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
/>
|
||||||
<activity android:name=".activities.AboutActivity"
|
<activity android:name=".activities.AboutActivity"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
|
|
@ -2074,6 +2074,10 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
Intent intent = new Intent(getApplicationContext(), AboutActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return false;
|
return false;
|
||||||
|
} else if( id == R.id.nav_language) {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), LanguageActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return false;
|
||||||
} else if( id == R.id.nav_partnership) {
|
} else if( id == R.id.nav_partnership) {
|
||||||
Intent intent = new Intent(getApplicationContext(), PartnerShipActivity.class);
|
Intent intent = new Intent(getApplicationContext(), PartnerShipActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -0,0 +1,319 @@
|
||||||
|
/* Copyright 2018 Thomas Schneider
|
||||||
|
*
|
||||||
|
* This file is a part of Mastalab
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Mastalab 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 Mastalab; if not,
|
||||||
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
package fr.gouv.etalab.mastodon.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
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 android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.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.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
import fr.gouv.etalab.mastodon.R;
|
||||||
|
import fr.gouv.etalab.mastodon.asynctasks.RetrieveRelationshipAsyncTask;
|
||||||
|
import fr.gouv.etalab.mastodon.asynctasks.RetrieveRemoteDataAsyncTask;
|
||||||
|
import fr.gouv.etalab.mastodon.client.Entities.Account;
|
||||||
|
import fr.gouv.etalab.mastodon.client.Entities.Error;
|
||||||
|
import fr.gouv.etalab.mastodon.client.Entities.Relationship;
|
||||||
|
import fr.gouv.etalab.mastodon.client.Entities.Results;
|
||||||
|
import fr.gouv.etalab.mastodon.drawers.AccountSearchDevAdapter;
|
||||||
|
import fr.gouv.etalab.mastodon.helper.ExpandableHeightListView;
|
||||||
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRelationshipInterface;
|
||||||
|
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRemoteAccountInterface;
|
||||||
|
|
||||||
|
import static fr.gouv.etalab.mastodon.helper.Helper.THEME_LIGHT;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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, Context.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(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
assert inflater != null;
|
||||||
|
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.simple_bar, null);
|
||||||
|
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 == 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(LanguageActivity.this, 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.putString(Helper.SET_DEFAULT_LOCALE_NEW, Locale.getDefault().getLanguage());
|
||||||
|
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();
|
||||||
|
case 18:
|
||||||
|
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ru");
|
||||||
|
editor.commit();
|
||||||
|
case 19:
|
||||||
|
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "no");
|
||||||
|
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, Context.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, Context.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,13 +16,11 @@ package fr.gouv.etalab.mastodon.fragments;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.ContentUris;
|
import android.content.ContentUris;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -52,8 +50,6 @@ import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
import fr.gouv.etalab.mastodon.R;
|
import fr.gouv.etalab.mastodon.R;
|
||||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||||
|
@ -636,117 +632,6 @@ public class SettingsFragment extends Fragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
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.putString(Helper.SET_DEFAULT_LOCALE_NEW, Locale.getDefault().getLanguage());
|
|
||||||
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();
|
|
||||||
case 18:
|
|
||||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "ru");
|
|
||||||
editor.commit();
|
|
||||||
case 19:
|
|
||||||
editor.putString(Helper.SET_DEFAULT_LOCALE_NEW, "no");
|
|
||||||
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);
|
|
||||||
context.startActivity(mainIntent);
|
|
||||||
Runtime.getRuntime().exit(0);
|
|
||||||
}
|
|
||||||
count2++;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// NSFW Timeout
|
// NSFW Timeout
|
||||||
SeekBar nsfwTimeoutSeekBar = rootView.findViewById(R.id.set_nsfw_timeout);
|
SeekBar nsfwTimeoutSeekBar = rootView.findViewById(R.id.set_nsfw_timeout);
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12.87,15.07l-2.54,-2.51 0.03,-0.03c1.74,-1.94 2.98,-4.17 3.71,-6.53L17,6L17,4h-7L10,2L8,2v2L1,4v1.99h11.17C11.5,7.92 10.44,9.75 9,11.35 8.07,10.32 7.3,9.19 6.69,8h-2c0.73,1.63 1.73,3.17 2.98,4.56l-5.09,5.02L4,19l5,-5 3.11,3.11 0.76,-2.04zM18.5,10h-2L12,22h2l1.12,-3h4.75L21,22h2l-4.5,-12zM15.88,17l1.62,-4.33L19.12,17h-3.24z"/>
|
||||||
|
</vector>
|
|
@ -239,24 +239,6 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 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>
|
|
||||||
|
|
||||||
<!-- Translation engine -->
|
<!-- Translation engine -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2018 Thomas Schneider
|
||||||
|
|
||||||
|
This file is a part of Mastalab
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Mastalab 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 Mastalab; 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"/>
|
||||||
|
<fr.gouv.etalab.mastodon.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>
|
|
@ -237,23 +237,7 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 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>
|
|
||||||
|
|
||||||
<!-- Translation engine -->
|
<!-- Translation engine -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
android:icon="@drawable/ic_block"
|
android:icon="@drawable/ic_block"
|
||||||
android:title="@string/blocked_domains" />
|
android:title="@string/blocked_domains" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_how_to"
|
android:id="@+id/nav_language"
|
||||||
android:icon="@drawable/ic_videocam"
|
android:icon="@drawable/ic_translate_menu"
|
||||||
android:title="@string/how_to_videos" />
|
android:title="@string/languages" />
|
||||||
</group>
|
</group>
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
@ -87,6 +87,10 @@
|
||||||
android:id="@+id/nav_main_info">
|
android:id="@+id/nav_main_info">
|
||||||
<menu>
|
<menu>
|
||||||
<group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_how_to"
|
||||||
|
android:icon="@drawable/ic_videocam"
|
||||||
|
android:title="@string/how_to_videos" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_bug_report"
|
android:id="@+id/nav_bug_report"
|
||||||
android:icon="@drawable/ic_bug_report"
|
android:icon="@drawable/ic_bug_report"
|
||||||
|
|
|
@ -743,6 +743,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- languages not translated -->
|
<!-- languages not translated -->
|
||||||
|
<string name="languages">Languages</string>
|
||||||
<string name="english" translatable="false">English</string>
|
<string name="english" translatable="false">English</string>
|
||||||
<string name="french" translatable="false">Français</string>
|
<string name="french" translatable="false">Français</string>
|
||||||
<string name="arabic" translatable="false">العربية</string>
|
<string name="arabic" translatable="false">العربية</string>
|
||||||
|
@ -768,6 +769,10 @@
|
||||||
<string name="norwegian" translatable="false">Norsk</string>
|
<string name="norwegian" translatable="false">Norsk</string>
|
||||||
<string name="show_media_only">Media only</string>
|
<string name="show_media_only">Media only</string>
|
||||||
<string name="show_media_nsfw">Show NSFW</string>
|
<string name="show_media_nsfw">Show NSFW</string>
|
||||||
|
<string name="crowdin_translations">Crowdin translations</string>
|
||||||
|
<string name="crowdin_manager">Crowdin manager</string>
|
||||||
|
<string name="translation_app">Translation of the application</string>
|
||||||
|
<string name="about_crowdin">About Crowdin</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue