(chore) add offer to translate for incomplete lang

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/299/head
androidacy-user 1 year ago
parent 6ff3b23adc
commit 3d92c5e0c5

@ -102,7 +102,6 @@ drawbacks:
(Note: Each module repo can be disabled in the settings of the app)
(Note²: I do not own or actively monitor any of the repos or modules, **download at your own risk**)
#### [https://www.androidacy.com/modules-repo/](https://www.androidacy.com/modules-repo/)
- Accepting new modules [here](https://www.androidacy.com/module-repository-applications/)
@ -118,12 +117,11 @@ Support:
[![Telegram Group](https://img.shields.io/endpoint?color=neon&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fandroidacy_discussions)](https://telegram.dog/androidacy_discussions)
#### [Magisk Alt Repo](https://github.com/Magisk-Modules-Alt-Repo)
- Accepting new modules [here](https://github.com/Magisk-Modules-Alt-Repo/submission)
- Less restrictive than the original repo
- May have lower quality, untested, or otherwise broken modules due to this
- May have lower quality, untested, or otherwise broken modules due to this
- Officially supported by Fox's mmm
Support:
@ -153,11 +151,13 @@ For more information please check the [developer documentation](docs/DEVELOPERS.
## For translators
**We need your help!** The app has started lagging behind in translations, and we need your help to catch up! As a reminder, translations are required to be at 60% or more to be included in the app.
**We need your help!** The app has started lagging behind in translations, and we need your help to
catch up! As a reminder, translations are required to be at 60% or more to be included in the app.
### Weblate (recommended)
We use Weblate for translations: [https://translate.nift4.org/engage/foxmmm/](https://translate.nift4.org/engage/foxmmm/)
We use Weblate for
translations: [https://translate.nift4.org/engage/foxmmm/](https://translate.nift4.org/engage/foxmmm/)
- You can create an account and start translating
- You may need to check your spam folder for the confirmation email
@ -192,13 +192,17 @@ later portions of the code are copyright
2022-present [Androidacy](https://www.androidacy.com/?utm_source=fox-repo&utm_medium=web). See
[LICENSE](LICENCE) for details. Library licenses can be found in the licenses section of the app.
Modules and their files, names, and other assets are not covered by this license, please check the license of each module before using it.
Modules and their files, names, and other assets are not covered by this license, please check the
license of each module before using it.
Some third party backend services may be proprietary or have additional terms, please check their terms of service before
Some third party backend services may be proprietary or have additional terms, please check their
terms of service before
using them.
## EULA
The EULA can be found [here](https://www.androidacy.com/foxmmm-eula/). By downloading, installing, or using this app you agree to the terms of the EULA.
The EULA can be found [here](https://www.androidacy.com/foxmmm-eula/). By downloading, installing,
or using this app you agree to the terms of the EULA. Under no circumstances shall the EULA override
the LGPL-3.0 license, and in the event of a conflict between the EULA and the LGPL-3.0 license, the LGPL-3.0 shall take precedence.
`IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`

@ -307,7 +307,7 @@ dependencies {
// UI
implementation 'androidx.appcompat:appcompat:1.6.1'
//noinspection GradleDependency
implementation "androidx.activity:activity-ktx:1.7.0-beta01"
implementation 'androidx.activity:activity-ktx:1.7.0'
implementation 'androidx.emoji2:emoji2:1.3.0'
implementation 'androidx.emoji2:emoji2-views-helper:1.3.0'
implementation 'androidx.preference:preference-ktx:1.2.0'

@ -50,6 +50,7 @@ import com.fox2code.mmm.utils.io.net.Http;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.progressindicator.LinearProgressIndicator;
import com.google.android.material.snackbar.Snackbar;
import org.chromium.net.CronetEngine;
@ -351,6 +352,11 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
Timber.i("Finished app opening state!");
}
}, true);
// if system lang is not in MainApplication.supportedLocales, show a snackbar to ask user to help translate
if (!MainApplication.supportedLocales.contains(this.getResources().getConfiguration().getLocales().get(0).getLanguage())) {
// call showWeblateSnackbar() with language code and language name
showWeblateSnackbar(this.getResources().getConfiguration().getLocales().get(0).getLanguage(), this.getResources().getConfiguration().getLocales().get(0).getDisplayLanguage());
}
ExternalHelper.INSTANCE.refreshHelper(this);
this.initMode = false;
}
@ -726,4 +732,20 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
}
return doSetupRestarting;
}
/**
* Shows a snackbar offering to take users to Weblate if their language is not available.
* @param language The language code.
* @param languageName The language name.
*/
@SuppressLint("RestrictedApi")
private void showWeblateSnackbar(String language, String languageName) {
Snackbar snackbar = Snackbar.make(findViewById(R.id.root_container), getString(R.string.language_not_available, languageName), Snackbar.LENGTH_LONG);
snackbar.setAction(R.string.ok, v -> {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://translate.nift4.org/engage/foxmmm/?language=" + language));
startActivity(intent);
});
snackbar.show();
}
}

@ -141,23 +141,27 @@ public class CustomRepoManager {
}
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name("ReposList.realm").encryptionKey(MainApplication.getINSTANCE().getExistingKey()).allowQueriesOnUiThread(true).allowWritesOnUiThread(true).directory(MainApplication.getINSTANCE().getDataDirWithPath("realms")).schemaVersion(1).build();
Realm realm = Realm.getInstance(realmConfiguration);
if (realm.isInTransaction()) {
realm.commitTransaction();
}
realm.beginTransaction();
// find the matching entry for repo_0, repo_1, etc.
ReposList reposList = realm.where(ReposList.class).equalTo("id", "repo_" + i).findFirst();
if (reposList == null) {
reposList = realm.createObject(ReposList.class, "repo_" + i);
}
reposList.setUrl(repo);
reposList.setName(name);
reposList.setWebsite(website);
reposList.setSupport(support);
reposList.setDonate(donate);
reposList.setSubmitModule(submitModule);
reposList.setEnabled(true);
realm.commitTransaction();
int finalI = i;
String finalWebsite = website;
String finalSupport = support;
String finalDonate = donate;
String finalSubmitModule = submitModule;
realm.executeTransaction(realm1 -> {
// find the matching entry for repo_0, repo_1, etc.
ReposList reposList = realm1.where(ReposList.class).equalTo("id", "repo_" + finalI).findFirst();
if (reposList == null) {
reposList = realm1.createObject(ReposList.class, "repo_" + finalI);
}
reposList.setUrl(repo);
reposList.setName(name);
reposList.setWebsite(finalWebsite);
reposList.setSupport(finalSupport);
reposList.setDonate(finalDonate);
reposList.setSubmitModule(finalSubmitModule);
reposList.setEnabled(true);
// save the object
realm1.copyToRealmOrUpdate(reposList);
});
customReposCount++;
this.dirty = true;
CustomRepoData customRepoData = (CustomRepoData) this.repoManager.addOrGet(repo);

@ -396,4 +396,5 @@
<string name="setup_scroll_down">To enable the finish button, please scroll down and view all the options.</string>
<string name="empty_field">URL is required</string>
<string name="repo_already_added">Repo already exists.</string>
<string name="language_not_available">Language %s has not been translated. Help translate it?</string>
</resources>

Loading…
Cancel
Save