Compare commits
45 Commits
v1.1.4+for
...
v1.1.4+for
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adf628de44 | ||
|
|
7e4169644d | ||
|
|
e42988b51e | ||
|
|
7c2fd2b734 | ||
|
|
569e4e13ea | ||
|
|
b7b5785a97 | ||
|
|
95d6e51ae0 | ||
|
|
fc43d919e5 | ||
|
|
a8d19529cd | ||
|
|
c2c44ab25e | ||
|
|
96a56873c3 | ||
|
|
0100967597 | ||
|
|
5769b378e2 | ||
|
|
2c61551e5c | ||
|
|
c9b11a23a1 | ||
|
|
456d05a489 | ||
|
|
8ca7d9d7b4 | ||
|
|
2321549dca | ||
|
|
5ae96328d5 | ||
|
|
dbf3da3629 | ||
|
|
9a351de9b4 | ||
|
|
f871fa6743 | ||
|
|
85f6441a56 | ||
|
|
dd8354f91b | ||
|
|
21d78de3cc | ||
|
|
158af27309 | ||
|
|
b0446af54a | ||
|
|
064f0155f6 | ||
|
|
fbf4522260 | ||
|
|
8918bd5ce2 | ||
|
|
187693883c | ||
|
|
40868f90f9 | ||
|
|
1f89acec34 | ||
|
|
d75ce99a68 | ||
|
|
0a8846fa2a | ||
|
|
5253e2e24a | ||
|
|
3565223611 | ||
|
|
2343d7a046 | ||
|
|
8256fbadb6 | ||
|
|
b898dc010e | ||
|
|
de369633ec | ||
|
|
3f075eab13 | ||
|
|
96e5f854a5 | ||
|
|
0f5211f718 | ||
|
|
480915f377 |
41
README.md
41
README.md
@@ -6,8 +6,11 @@
|
||||
|
||||
[](https://github.com/sk22/mastodos/releases/latest/download/mastodos.apk)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
|
||||
## Key features
|
||||
|
||||
### **Unlisted posting**
|
||||
@@ -52,6 +55,28 @@ To install this app on your Android device, download the [latest release from Gi
|
||||
|
||||
Mastodos makes use of [Mastodon for Android](https://github.com/mastodon/mastodon-android)’s automatic update checker. Mastodos will check for new updates available on GitHub and offer to download and install them. You can also manually press “Check for updates” at the bottom of the settings page!
|
||||
|
||||
### Other sources
|
||||
|
||||
* **[Izzy's F-Droid repository](https://apt.izzysoft.de/fdroid/repo)**: https://apt.izzysoft.de/fdroid/index/apk/org.joinmastodon.android.sk
|
||||
|
||||
---
|
||||
|
||||
## Release variants
|
||||
|
||||
All downloads can be found on the [Releases](https://github.com/sk22/mastodos/releases) page.
|
||||
|
||||
**`mastodos.apk`**
|
||||
|
||||
Variant with an integrated updater. If you download Mastodos from here (and not from an app store), just download the regular `mastodos.apk`.
|
||||
|
||||
**`mastodon-1234abc.apk`**
|
||||
|
||||
This is an **unmodified version** of the official [Mastodon for Android](https://github.com/mastodon/mastodon-android) app the respective Mastodos release is based on. Should you find any bugs in Mastodos (which you will), try to see if it occurs with this variant, too. The last 7 digits of the file name are important to know which version of the official app you're using.
|
||||
|
||||
<!-- **`mastodon-fdroid.apk`**
|
||||
|
||||
Variant without the integrated updater. This is the variant to be published to F-Droid.org where an integrated updater is not necessary. -->
|
||||
|
||||
---
|
||||
|
||||
## Detailed changes
|
||||
@@ -76,7 +101,8 @@ Mastodos makes use of [Mastodon for Android](https://github.com/mastodon/mastodo
|
||||
* [Display content warning title above text](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/cw-above-text)
|
||||
* [Add notifications tab for posts](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/posts-notifications-tab)
|
||||
* [Show visibility of original post when replying](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/display-reply-visibility)
|
||||
* [Improvements to the true black mode](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:true-black-improvements)
|
||||
* [Clickable reply/boost line above posts](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:clickable-boost-reply-line)
|
||||
* [Long-click to copy username from profile](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/copy-username)
|
||||
|
||||
### Behavior
|
||||
|
||||
@@ -84,18 +110,23 @@ Mastodos makes use of [Mastodon for Android](https://github.com/mastodon/mastodo
|
||||
* [Always preserve content warnings when replying](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/always-preserve-cw) ([Closes issue](https://github.com/mastodon/mastodon-android/issues/113))
|
||||
* [Display full image when adding image description](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/compose-image-description-full-image) ([Pull request](https://github.com/mastodon/mastodon-android/pull/182))
|
||||
* [Set spoiler height independently to content height](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:spoiler-height-independent) ([Closes issue](https://github.com/mastodon/mastodon-android/issues/166))
|
||||
* [Custom extended footer redesign](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:compact-extended-footer)
|
||||
* [Option to hide interaction numbers](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:settings/hide-interaction-numbers)
|
||||
* [Option to always reveal content warnings](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:feature/cw-above-text)
|
||||
* [Option to disable scrolling title bars](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:settings/disable-marquee)
|
||||
|
||||
### Visual
|
||||
|
||||
* [Custom extended footer redesign](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:compact-extended-footer)
|
||||
* [Improvements to the true black mode](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:true-black-improvements)
|
||||
* [Profile header tweaks](https://github.com/mastodon/mastodon-android/compare/master...sk22:mastodos:ui/profile-header-tweaks)
|
||||
|
||||
### Branding
|
||||
|
||||
* App name “Mastodos”
|
||||
* Pink primary color
|
||||
* Custom icon: Modulate upstream icon using ImageMagick
|
||||
```bash
|
||||
mogrify -modulate 90,100,140 mastodon/src/main/res/mipmap-*/ic_launcher*.png
|
||||
mogrify -modulate 90,100,140 mastodon/src/main/res/mipmap-*/ic_launcher*.png mastodon/src/main/ic_launcher-playstore.png
|
||||
```
|
||||
|
||||
## Building
|
||||
@@ -109,3 +140,7 @@ As this app is using Java 17 features, you need JDK 17 or newer to build it. Oth
|
||||
## License
|
||||
|
||||
This project is released under the [GPL-3 License](./LICENSE).
|
||||
|
||||
## Links
|
||||
|
||||
<a rel="me" href="https://floss.social/@mastodos">@mastodos@floss.social</a>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
title: Mastodos
|
||||
theme: minima
|
||||
layout: default
|
||||
|
||||
17
_layouts/default.html
Normal file
17
_layouts/default.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mastodos</title>
|
||||
<link rel="icon" href="mastodon/src/main/res/mipmap-mdpi/ic_launcher_round.png">
|
||||
<link rel="me" href="https://floss.social/@mastodon">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown.min.css">
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<div style="margin: 0 auto; max-width: 45rem; padding: 2rem 1rem">
|
||||
{{ content }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
3
get-upstream-commit.sh
Executable file
3
get-upstream-commit.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
git rev-parse --short --verify upstream/master
|
||||
BIN
img/banner.png
Normal file
BIN
img/banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 501 KiB |
@@ -9,8 +9,8 @@ android {
|
||||
applicationId "org.joinmastodon.android.sk"
|
||||
minSdk 23
|
||||
targetSdk 33
|
||||
versionCode 45
|
||||
versionName "1.1.4+fork.45"
|
||||
versionCode 47
|
||||
versionName "1.1.4+fork.47"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resConfigs "en", "ar-rSA", "bs-rBA", "ca-rES", "cs-rCZ", "de-rDE", "el-rGR", "es-rES",
|
||||
"eu-rES", "fi-rFI", "fr-rFR", "gl-rES", "hr-rHR", "hy-rAM", "it-rIT", "iw-rIL",
|
||||
@@ -20,12 +20,13 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
// minifyEnabled true
|
||||
// shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug{
|
||||
debuggable true
|
||||
versionNameSuffix '-debug'
|
||||
}
|
||||
appcenterPrivateBeta{
|
||||
initWith release
|
||||
|
||||
@@ -139,7 +139,7 @@ public class GithubSelfUpdaterImpl extends GithubSelfUpdater{
|
||||
curForkNumber=Integer.parseInt(matcher.group(4));
|
||||
long newVersion=((long)newMajor << 32) | ((long)newMinor << 16) | newRevision;
|
||||
long curVersion=((long)curMajor << 32) | ((long)curMinor << 16) | curRevision;
|
||||
if(newVersion>curVersion || newForkNumber>curForkNumber || BuildConfig.DEBUG){
|
||||
if(newVersion>curVersion || newForkNumber>curForkNumber){
|
||||
String version=newMajor+"."+newMinor+"."+newRevision+"+fork."+newForkNumber;
|
||||
Log.d(TAG, "actuallyCheckForUpdates: new version: "+version);
|
||||
for(JsonElement el:obj.getAsJsonArray("assets")){
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 48 KiB |
@@ -73,7 +73,7 @@ public class CacheController{
|
||||
status.hasGapAfter=((flags & POST_FLAG_GAP_AFTER)!=0);
|
||||
newMaxID=status.id;
|
||||
for(Filter filter:filters){
|
||||
if(filter.matches(status.getContentStatus().content))
|
||||
if(filter.matches(status))
|
||||
continue outer;
|
||||
}
|
||||
result.add(status);
|
||||
@@ -146,7 +146,7 @@ public class CacheController{
|
||||
newMaxID=ntf.id;
|
||||
if(ntf.status!=null){
|
||||
for(Filter filter:filters){
|
||||
if(filter.matches(ntf.status.getContentStatus().content))
|
||||
if(filter.matches(ntf.status))
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class CacheController{
|
||||
callback.onSuccess(new PaginatedResponse<>(result.stream().filter(ntf->{
|
||||
if(ntf.status!=null){
|
||||
for(Filter filter:filters){
|
||||
if(filter.matches(ntf.status.getContentStatus().content)){
|
||||
if(filter.matches(ntf.status)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class HomeTimelineFragment extends StatusListFragment{
|
||||
if(idsBelowGap.contains(s.id))
|
||||
break;
|
||||
for(Filter filter:filters){
|
||||
if(filter.matches(s.getContentStatus().content)){
|
||||
if(filter.matches(s)){
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package org.joinmastodon.android.fragments;
|
||||
|
||||
import static android.content.Context.CLIPBOARD_SERVICE;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Outline;
|
||||
@@ -14,6 +19,8 @@ import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ImageSpan;
|
||||
@@ -31,9 +38,11 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
@@ -435,15 +444,25 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
ssb.append(AccountSessionManager.getInstance().getAccount(accountID).domain);
|
||||
}
|
||||
ssb.append(" ");
|
||||
Drawable lock=username.getResources().getDrawable(R.drawable.ic_fluent_lock_closed_20_filled, getActivity().getTheme()).mutate();
|
||||
Drawable lock=username.getResources().getDrawable(R.drawable.ic_lock, getActivity().getTheme()).mutate();
|
||||
lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight());
|
||||
lock.setTint(username.getCurrentTextColor());
|
||||
ssb.append(getString(R.string.manually_approves_followers), new ImageSpan(lock, ImageSpan.ALIGN_BOTTOM), 0);
|
||||
ssb.append(getString(R.string.manually_approves_followers), new ImageSpan(lock, ImageSpan.ALIGN_BASELINE), 0);
|
||||
username.setText(ssb);
|
||||
}else{
|
||||
// noinspection SetTextI18n
|
||||
username.setText('@'+account.acct+(isSelf ? ('@'+AccountSessionManager.getInstance().getAccount(accountID).domain) : ""));
|
||||
}
|
||||
username.setOnLongClickListener(l->{
|
||||
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
|
||||
Vibrator v = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("Username", '@'+account.acct+'@'+AccountSessionManager.getInstance().getAccount(accountID).domain);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(getActivity(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) v.vibrate(VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE));
|
||||
else v.vibrate(50);
|
||||
return true;
|
||||
});
|
||||
CharSequence parsedBio=HtmlParser.parse(account.note, account.emojis, Collections.emptyList(), Collections.emptyList(), accountID);
|
||||
if(TextUtils.isEmpty(parsedBio)){
|
||||
bio.setVisibility(View.GONE);
|
||||
@@ -648,7 +667,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
||||
notifyProgress.setIndeterminateTintList(notifyButton.getTextColors());
|
||||
followsYouView.setVisibility(relationship.followedBy ? View.VISIBLE : View.GONE);
|
||||
notifyButton.setSelected(relationship.notifying);
|
||||
notifyButton.setContentDescription(getString(relationship.notifying ? R.string.user_post_notifications_on : R.string.user_post_notifications_off, '@'+account.username));
|
||||
if (getActivity() != null) notifyButton.setContentDescription(getString(relationship.notifying ? R.string.user_post_notifications_on : R.string.user_post_notifications_off, '@'+account.username));
|
||||
}
|
||||
|
||||
private void onScrollChanged(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY){
|
||||
|
||||
@@ -139,7 +139,7 @@ public class StatusEditHistoryFragment extends StatusListFragment{
|
||||
action=getString(R.string.edit_multiple_changed);
|
||||
}
|
||||
}
|
||||
items.add(0, new ReblogOrReplyLineStatusDisplayItem(s.id, this, action+" · "+date, Collections.emptyList(), 0));
|
||||
items.add(0, new ReblogOrReplyLineStatusDisplayItem(s.id, this, action+" · "+date, Collections.emptyList(), 0, null));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ThreadFragment extends StatusListFragment{
|
||||
return statuses;
|
||||
return statuses.stream().filter(status->{
|
||||
for(Filter filter:filters){
|
||||
if(filter.matches(status.getContentStatus().content))
|
||||
if(filter.matches(status))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -53,6 +53,7 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
@@ -295,6 +296,14 @@ public class InstanceCatalogFragment extends BaseRecyclerFragment<CatalogInstanc
|
||||
private void proceedWithAuthOrSignup(Instance instance){
|
||||
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(contentView.getWindowToken(), 0);
|
||||
if(isSignup){
|
||||
if(!instance.registrations){
|
||||
new M3AlertDialogBuilder(getActivity())
|
||||
.setTitle(R.string.error)
|
||||
.setMessage(R.string.instance_signup_closed)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
Bundle args=new Bundle();
|
||||
args.putParcelable("instance", Parcels.wrap(instance));
|
||||
Nav.go(getActivity(), InstanceRulesFragment.class, args);
|
||||
@@ -478,7 +487,7 @@ public class InstanceCatalogFragment extends BaseRecyclerFragment<CatalogInstanc
|
||||
instanceProgressDialog=null;
|
||||
proceedWithAuthOrSignup(result);
|
||||
}
|
||||
if(domain.equals(currentSearchQuery) || currentSearchQuery.equals(redirects.get(domain)) || currentSearchQuery.equals(redirectsInverse.get(domain))){
|
||||
if(Objects.equals(domain, currentSearchQuery) || Objects.equals(currentSearchQuery, redirects.get(domain)) || Objects.equals(currentSearchQuery, redirectsInverse.get(domain))){
|
||||
boolean found=false;
|
||||
for(CatalogInstance ci:filteredData){
|
||||
if(ci.domain.equals(domain)){
|
||||
|
||||
@@ -50,6 +50,10 @@ public class Filter extends BaseModel{
|
||||
return pattern.matcher(text).find();
|
||||
}
|
||||
|
||||
public boolean matches(Status status){
|
||||
return matches(status.getContentStatus().getStrippedText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "Filter{"+
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.api.ObjectValidationException;
|
||||
import org.joinmastodon.android.api.RequiredField;
|
||||
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
|
||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||
import org.parceler.Parcel;
|
||||
|
||||
import java.time.Instant;
|
||||
@@ -57,6 +58,7 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
||||
|
||||
public transient boolean spoilerRevealed;
|
||||
public transient boolean hasGapAfter;
|
||||
private transient String strippedText;
|
||||
|
||||
@Override
|
||||
public void postprocess() throws ObjectValidationException{
|
||||
@@ -134,4 +136,10 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
||||
public Status getContentStatus(){
|
||||
return reblog!=null ? reblog : this;
|
||||
}
|
||||
|
||||
public String getStrippedText(){
|
||||
if(strippedText==null)
|
||||
strippedText=HtmlParser.strip(content);
|
||||
return strippedText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -17,6 +18,8 @@ import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
|
||||
@@ -25,14 +28,16 @@ public class ReblogOrReplyLineStatusDisplayItem extends StatusDisplayItem{
|
||||
@DrawableRes
|
||||
private int icon;
|
||||
private CustomEmojiHelper emojiHelper=new CustomEmojiHelper();
|
||||
private View.OnClickListener handleClick;
|
||||
|
||||
public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, CharSequence text, List<Emoji> emojis, @DrawableRes int icon){
|
||||
public ReblogOrReplyLineStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, CharSequence text, List<Emoji> emojis, @DrawableRes int icon, @Nullable View.OnClickListener handleClick){
|
||||
super(parentID, parentFragment);
|
||||
SpannableStringBuilder ssb=new SpannableStringBuilder(text);
|
||||
HtmlParser.parseCustomEmoji(ssb, emojis);
|
||||
this.text=ssb;
|
||||
emojiHelper.setText(ssb);
|
||||
this.icon=icon;
|
||||
this.handleClick=handleClick;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +66,7 @@ public class ReblogOrReplyLineStatusDisplayItem extends StatusDisplayItem{
|
||||
public void onBind(ReblogOrReplyLineStatusDisplayItem item){
|
||||
text.setText(item.text);
|
||||
text.setCompoundDrawablesRelativeWithIntrinsicBounds(item.icon, 0, 0, 0);
|
||||
if(item.handleClick!=null) text.setOnClickListener(item.handleClick);
|
||||
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.N)
|
||||
UiUtils.fixCompoundDrawableTintOnAndroid6(text);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.joinmastodon.android.ui.displayitems;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.fragments.BaseStatusListFragment;
|
||||
import org.joinmastodon.android.fragments.ProfileFragment;
|
||||
import org.joinmastodon.android.fragments.ThreadFragment;
|
||||
import org.joinmastodon.android.model.Account;
|
||||
import org.joinmastodon.android.model.Attachment;
|
||||
@@ -16,6 +18,7 @@ import org.joinmastodon.android.model.Poll;
|
||||
import org.joinmastodon.android.model.Status;
|
||||
import org.joinmastodon.android.ui.PhotoLayoutHelper;
|
||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||
import org.parceler.Parcels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -23,6 +26,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import me.grishka.appkit.Nav;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.BindableViewHolder;
|
||||
import me.grishka.appkit.views.UsableRecyclerView;
|
||||
@@ -73,11 +77,19 @@ public abstract class StatusDisplayItem{
|
||||
String parentID=parentObject.getID();
|
||||
ArrayList<StatusDisplayItem> items=new ArrayList<>();
|
||||
Status statusForContent=status.getContentStatus();
|
||||
Bundle args=new Bundle();
|
||||
args.putString("account", accountID);
|
||||
if(status.reblog!=null){
|
||||
items.add(new ReblogOrReplyLineStatusDisplayItem(parentID, fragment, fragment.getString(R.string.user_boosted, status.account.displayName), status.account.emojis, R.drawable.ic_fluent_arrow_repeat_all_20_filled));
|
||||
items.add(new ReblogOrReplyLineStatusDisplayItem(parentID, fragment, fragment.getString(R.string.user_boosted, status.account.displayName), status.account.emojis, R.drawable.ic_fluent_arrow_repeat_all_20_filled, i->{
|
||||
args.putParcelable("profileAccount", Parcels.wrap(status.account));
|
||||
Nav.go(fragment.getActivity(), ProfileFragment.class, args);
|
||||
}));
|
||||
}else if(status.inReplyToAccountId!=null && knownAccounts.containsKey(status.inReplyToAccountId)){
|
||||
Account account=Objects.requireNonNull(knownAccounts.get(status.inReplyToAccountId));
|
||||
items.add(new ReblogOrReplyLineStatusDisplayItem(parentID, fragment, fragment.getString(R.string.in_reply_to, account.displayName), account.emojis, R.drawable.ic_fluent_arrow_reply_20_filled));
|
||||
items.add(new ReblogOrReplyLineStatusDisplayItem(parentID, fragment, fragment.getString(R.string.in_reply_to, account.displayName), account.emojis, R.drawable.ic_fluent_arrow_reply_20_filled, i->{
|
||||
args.putParcelable("profileAccount", Parcels.wrap(account));
|
||||
Nav.go(fragment.getActivity(), ProfileFragment.class, args);
|
||||
}));
|
||||
}
|
||||
HeaderStatusDisplayItem header;
|
||||
items.add(header=new HeaderStatusDisplayItem(parentID, statusForContent.account, statusForContent.createdAt, fragment, accountID, statusForContent, null));
|
||||
|
||||
@@ -21,9 +21,8 @@ public class StatusFilterPredicate implements Predicate<Status>{
|
||||
|
||||
@Override
|
||||
public boolean test(Status status){
|
||||
CharSequence content=status.getContentStatus().content;
|
||||
for(Filter filter:filters){
|
||||
if(filter.matches(content))
|
||||
if(filter.matches(status))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/ic_fluent_arrow_repeat_all_24_filled"/>
|
||||
<item android:state_enabled="true" android:drawable="@drawable/ic_fluent_arrow_repeat_all_24_regular"/>
|
||||
<item android:drawable="@drawable/ic_fluent_arrow_repeat_all_off_24_regular"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M14.712 2.289L14.625 2.21c-0.392-0.31-0.964-0.285-1.327 0.078L13.22 2.376c-0.31 0.392-0.285 0.964 0.078 1.326l1.299 1.297H8.999L8.76 5.003C5.004 5.13 2 8.211 2 11.993c0 1.445 0.438 2.788 1.189 3.899C3.37 16.143 3.666 16.307 4 16.307c0.552 0 1-0.448 1-1 0-0.216-0.069-0.416-0.185-0.578L4.68 14.51C4.248 13.77 4 12.91 4 11.993c0-2.759 2.238-4.995 5-4.995h5.595l-1.297 1.297-0.078 0.087c-0.31 0.392-0.285 0.964 0.078 1.326 0.39 0.39 1.024 0.39 1.414 0l3.006-3.003 0.077-0.087c0.311-0.392 0.285-0.964-0.078-1.326l-3.005-3.003zm6.075 5.771C20.602 7.827 20.319 7.678 20 7.678c-0.552 0-1 0.448-1 1 0 0.208 0.064 0.4 0.172 0.56 0.523 0.79 0.828 1.737 0.828 2.755 0 2.76-2.238 4.996-5 4.996H9.416l1.294-1.292 0.083-0.095c0.281-0.361 0.28-0.871-0.006-1.23l-0.077-0.088-0.095-0.084c-0.362-0.28-0.873-0.278-1.232 0.006l-0.088 0.078-3.005 3.003-0.083 0.095c-0.281 0.361-0.28 0.872 0.006 1.231L6.289 18.7l3.005 3.003 0.095 0.084c0.392 0.304 0.96 0.277 1.32-0.084 0.362-0.362 0.388-0.933 0.077-1.326L10.71 20.29l-1.304-1.303h5.596l0.24-0.003C18.996 18.857 22 15.776 22 11.994c0-1.46-0.448-2.816-1.213-3.937V8.06z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
||||
6
mastodon/src/main/res/drawable/ic_lock.xml
Normal file
6
mastodon/src/main/res/drawable/ic_lock.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="16dp" android:height="16dp" android:viewportWidth="16" android:viewportHeight="16">
|
||||
<group android:translateX="-2" android:translateY="-1">
|
||||
<path android:pathData="M10 2c1.657 0 3 1.343 3 3v1h1c1.105 0 2 0.895 2 2v7c0 1.105-0.895 2-2 2H6c-1.105 0-2-0.895-2-2V8c0-1.105 0.895-2 2-2h1V5c0-1.657 1.343-3 3-3zm0 8.5c-0.552 0-1 0.448-1 1s0.448 1 1 1 1-0.448 1-1-0.448-1-1-1zM10 4C9.448 4 9 4.448 9 5v1h2V5c0-0.552-0.448-1-1-1z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -2,15 +2,16 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-6dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="16dp">
|
||||
android:layout_marginBottom="-12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:textAppearance="@style/m3_title_small"
|
||||
android:drawableStart="@drawable/ic_fluent_arrow_repeat_all_20_filled"
|
||||
android:drawableTint="?android:textColorSecondary"
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
<org.joinmastodon.android.ui.views.CoverImageView
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="229dp"
|
||||
android:background="#808080"
|
||||
android:layout_height="200dp"
|
||||
android:background="?profileHeaderBackground"
|
||||
android:contentDescription="@string/profile_header"
|
||||
android:scaleType="centerCrop"/>
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/follows_you"
|
||||
@@ -54,8 +54,8 @@
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/avatar_border"
|
||||
android:layout_width="102dp"
|
||||
android:layout_height="102dp"
|
||||
android:layout_width="112dp"
|
||||
android:layout_height="112dp"
|
||||
android:layout_below="@id/cover"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="-40dp"
|
||||
@@ -65,8 +65,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="98dp"
|
||||
android:layout_height="98dp"
|
||||
android:layout_width="108dp"
|
||||
android:layout_height="108dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="@string/profile_picture"
|
||||
@@ -234,22 +234,27 @@
|
||||
android:layout_below="@id/avatar_border"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginBottom="0.4dp"
|
||||
android:layout_toStartOf="@id/profile_action_btn_wrap"
|
||||
android:textAppearance="@style/m3_headline_small"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="@style/m3_headline_small"
|
||||
tools:text="Eugen" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_below="@id/name"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_toStartOf="@id/profile_action_btn_wrap"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:textAppearance="@style/m3_title_medium"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="\@Gargron"/>
|
||||
tools:text="\@Gargron" />
|
||||
|
||||
<org.joinmastodon.android.ui.views.LinkedTextView
|
||||
android:id="@+id/bio"
|
||||
@@ -257,7 +262,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/username"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:textAppearance="@style/m3_body_large"
|
||||
android:textSize="16sp"
|
||||
|
||||
@@ -415,4 +415,5 @@
|
||||
<string name="i_agree">Ich stimme zu</string>
|
||||
<string name="settings_always_reveal_content_warnings">Inhaltswarnungen immer ausklappen</string>
|
||||
<string name="disable_marquee">Laufschrift in Titelleisten deaktivieren</string>
|
||||
<string name="copied_to_clipboard">In die Zwischenablage kopiert</string>
|
||||
</resources>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
</plurals>
|
||||
<string name="posts">게시물</string>
|
||||
<string name="posts_and_replies">게시물과 답장</string>
|
||||
<string name="pinned_posts">고정됨</string>
|
||||
<string name="media">미디어</string>
|
||||
<string name="profile_about">정보</string>
|
||||
<string name="button_follow">팔로우</string>
|
||||
@@ -108,9 +109,20 @@
|
||||
<string name="action_vote">투표</string>
|
||||
<string name="tap_to_reveal">눌러서 확인</string>
|
||||
<string name="delete">삭제</string>
|
||||
<string name="delete_and_redraft">삭제하고 다시 쓰기</string>
|
||||
<string name="confirm_delete_title">게시물 삭제</string>
|
||||
<string name="confirm_delete_and_redraft_title">게시물 삭제하고 다시 쓰기</string>
|
||||
<string name="confirm_delete">정말로 이 게시물을 삭제하시겠습니까?</string>
|
||||
<string name="confirm_delete_and_redraft">정말로 이 게시물을 삭제하고 다시 쓰시겠습니까?</string>
|
||||
<string name="deleting">삭제 중…</string>
|
||||
<string name="pin_post">고정</string>
|
||||
<string name="confirm_pin_post_title">게시물 고정</string>
|
||||
<string name="confirm_pin_post">정말로 이 게시물을 고정하시겠습니까?</string>
|
||||
<string name="pinning">고정 중…</string>
|
||||
<string name="unpin_post">고정 해제</string>
|
||||
<string name="confirm_unpin_post_title">게시물 고정 해제</string>
|
||||
<string name="confirm_unpin_post">정말로 이 게시물을 고정 해제하시겠습니까?</string>
|
||||
<string name="unpinning">고정 해제 중…</string>
|
||||
<string name="notification_channel_audio_player">오디오 재생</string>
|
||||
<string name="play">재생</string>
|
||||
<string name="pause">일시정지</string>
|
||||
@@ -189,6 +201,7 @@
|
||||
<string name="compose_hint">무슨 생각을 하고 있는지 입력하거나 붙여넣으세요</string>
|
||||
<string name="content_warning">열람 주의</string>
|
||||
<string name="add_image_description">이미지 설명 추가…</string>
|
||||
<string name="image_description">이미지 설명</string>
|
||||
<string name="retry_upload">업로드 재시도</string>
|
||||
<string name="edit_image">이미지 편집</string>
|
||||
<string name="save">저장</string>
|
||||
@@ -196,6 +209,7 @@
|
||||
<string name="alt_text_subtitle">대체 텍스트는 저시력자나 시각장애인들에게 당신의 사진을 설명합니다. 문맥을 파악할 수 있는 설명들만 넣도록 하세요.</string>
|
||||
<string name="alt_text_hint">예시: 강아지가 의심스러운 가는 눈초리로 카메라를 쳐다보고 있습니다.</string>
|
||||
<string name="visibility_public">공개</string>
|
||||
<string name="visibility_unlisted">타임라인에 비표시</string>
|
||||
<string name="visibility_followers_only">팔로워 전용</string>
|
||||
<string name="visibility_private">멘션한 사람만</string>
|
||||
<string name="search_all">모두</string>
|
||||
@@ -221,8 +235,12 @@
|
||||
<string name="theme_dark">어두움</string>
|
||||
<string name="theme_true_black">진정한 검정 모드</string>
|
||||
<string name="settings_behavior">동작</string>
|
||||
<string name="settings_show_replies">답장 표시</string>
|
||||
<string name="settings_show_boosts">리블로그 표시</string>
|
||||
<string name="settings_load_new_posts">자동으로 새 포스트 불러오기</string>
|
||||
<string name="settings_gif">아바타와 에모지의 애니메이션을 재생</string>
|
||||
<string name="settings_custom_tabs">앱내 브라우저 사용</string>
|
||||
<string name="settings_show_interaction_counts">상호 작용 수 표시</string>
|
||||
<string name="settings_notifications">알림</string>
|
||||
<string name="notify_me_when">알림을 보낼 조건</string>
|
||||
<string name="notify_anyone">누구든</string>
|
||||
@@ -255,8 +273,11 @@
|
||||
<string name="button_reblog">리블로그</string>
|
||||
<string name="button_favorite">좋아요</string>
|
||||
<string name="button_share">공유</string>
|
||||
<string name="button_bookmark">보관</string>
|
||||
<string name="bookmarks">보관함</string>
|
||||
<string name="media_no_description">설명이 없는 미디어</string>
|
||||
<string name="add_media">미디어 추가</string>
|
||||
<string name="mark_media_as_sensitive">미디어를 민감함으로 설정하기</string>
|
||||
<string name="add_poll">투표 추가</string>
|
||||
<string name="emoji">에모지</string>
|
||||
<string name="post_visibility">게시물 공개범위</string>
|
||||
@@ -269,6 +290,8 @@
|
||||
<string name="open_in_browser">브라우저에서 열기</string>
|
||||
<string name="hide_boosts_from_user">%s의 리블로그를 숨기기</string>
|
||||
<string name="show_boosts_from_user">%s의 리블로그를 보이기</string>
|
||||
<string name="user_post_notifications_on">%s의 게시물 알림 켜기</string>
|
||||
<string name="user_post_notifications_off">%s의 게시물 알림 끄기</string>
|
||||
<string name="signup_reason">가입하려는 이유가 무엇인가요?</string>
|
||||
<string name="signup_reason_note">이 정보는 우리가 심사를 하는 데에 참고할 수 있습니다.</string>
|
||||
<string name="clear">모두 지우기</string>
|
||||
@@ -283,11 +306,13 @@
|
||||
<string name="file_saved">파일 저장됨</string>
|
||||
<string name="downloading">다운로드중…</string>
|
||||
<string name="no_app_to_handle_action">이 동작을 처리할 앱이 없습니다</string>
|
||||
<string name="local_timeline">커뮤니티</string>
|
||||
<string name="local_timeline">로컬</string>
|
||||
<string name="federated_timeline">연합</string>
|
||||
<string name="trending_posts_info_banner">당신이 속한 마스토돈 서버에서 관심을 끌고 있는 게시물들입니다.</string>
|
||||
<string name="trending_hashtags_info_banner">당신이 속한 마스토돈 서버에서 관심을 끌고 있는 해시태그들입니다.</string>
|
||||
<string name="trending_links_info_banner">당신이 속한 마스토돈 서버에서 가장 많이 공유되고 있는 소식들입니다.</string>
|
||||
<string name="local_timeline_info_banner">당신과 같은 마스토돈 서버에 존재하는 사람들이 공유한 최신 게시물들입니다.</string>
|
||||
<string name="federated_timeline_info_banner">당신이 속한 연합에 존재하는 사람들이 공유한 최신 게시물들입니다.</string>
|
||||
<string name="dismiss">지우기</string>
|
||||
<string name="see_new_posts">새 게시물 보기</string>
|
||||
<string name="load_missing_posts">빈 게시물 불러오기</string>
|
||||
@@ -356,6 +381,18 @@
|
||||
<!-- %s is file size -->
|
||||
<string name="download_update">다운로드 (%s)</string>
|
||||
<string name="install_update">설치</string>
|
||||
<string name="check_for_update">업데이트 확인</string>
|
||||
<string name="no_update_available">사용 가능한 업데이트 없음</string>
|
||||
<string name="privacy_policy_title">마스토돈 및 개인정보</string>
|
||||
<string name="i_agree">동의합니다</string>
|
||||
<string name="list_timelines">리스트</string>
|
||||
<string name="favorited_posts">좋아요</string>
|
||||
<string name="follow_requests">팔로우 요청</string>
|
||||
<string name="accept_follow_request">팔로우 요청 허가</string>
|
||||
<string name="reject_follow_request">팔로우 요청 거부</string>
|
||||
<string name="lists_with_user">%s 님이 포함된 리스트</string>
|
||||
<string name="empty_list">리스트에 아무 것도 없습니다</string>
|
||||
<string name="instance_signup_closed">이 서버는 가입이 막혀 있는 상태입니다.</string>
|
||||
<string name="settings_always_reveal_content_warnings">열람주의 툿을 항상 펼치기</string>
|
||||
<string name="disable_marquee">제목 표시줄의 텍스트 스크롤 비활성화</string>
|
||||
</resources>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<attr name="colorSearchHint" format="color"/>
|
||||
<attr name="colorTabInactive" format="color"/>
|
||||
<attr name="colorAccentLightest" format="color"/>
|
||||
<attr name="profileHeaderBackground" format="color"/>
|
||||
|
||||
<attr name="primaryLargeButtonStyle" format="reference"/>
|
||||
<attr name="secondaryLargeButtonStyle" format="reference"/>
|
||||
|
||||
@@ -421,6 +421,8 @@
|
||||
<string name="reject_follow_request">Reject follow request</string>
|
||||
<string name="lists_with_user">Lists with %s</string>
|
||||
<string name="empty_list">This list is empty</string>
|
||||
<string name="instance_signup_closed">This server does not accept new registrations.</string>
|
||||
<string name="settings_always_reveal_content_warnings">Always reveal content warnings</string>
|
||||
<string name="disable_marquee">Disable scrolling text in title bars</string>
|
||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||
</resources>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<item name="colorSearchHint">@color/gray_600</item>
|
||||
<item name="colorTabInactive">@color/gray_400</item>
|
||||
<item name="colorAccentLightest">@color/primary_100</item>
|
||||
<item name="profileHeaderBackground">@color/gray_500</item>
|
||||
|
||||
<item name="buttonBackground">@drawable/bg_button_primary_dark_on_light</item>
|
||||
<item name="android:editTextBackground">@drawable/bg_edittext_light</item>
|
||||
@@ -80,6 +81,7 @@
|
||||
<item name="colorAccentLight">@color/primary_600</item>
|
||||
<item name="colorAccentLightest">@color/primary_800</item>
|
||||
<item name="colorTabInactive">@color/gray_400</item>
|
||||
<item name="profileHeaderBackground">?colorWindowBackground</item>
|
||||
|
||||
<!-- TODO dark colors -->
|
||||
<item name="colorSearchField">@color/gray_700</item>
|
||||
|
||||
@@ -1,43 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<locale android:name="en" />
|
||||
<locale android:name="ar" />
|
||||
<locale android:name="bn-BD"/>
|
||||
<locale android:name="bs" />
|
||||
<locale android:name="ca" />
|
||||
<locale android:name="cs" />
|
||||
<locale android:name="de" />
|
||||
<locale android:name="gd-GB"/>
|
||||
<locale android:name="el" />
|
||||
<locale android:name="es" />
|
||||
<locale android:name="eu" />
|
||||
<locale android:name="fi" />
|
||||
<locale android:name="fr" />
|
||||
<loacle android:name="sl"/>
|
||||
<locale android:name="gl" />
|
||||
<locale android:name="hi-IN"/>
|
||||
<locale android:name="hr" />
|
||||
<locale android:name="hy" />
|
||||
<locale android:name="id"/>
|
||||
<locale android:name="it" />
|
||||
<locale android:name="iw" />
|
||||
<locale android:name="ja" />
|
||||
<locale android:name="kab" />
|
||||
<locale android:name="ko" />
|
||||
<locale android:name="nl"/>
|
||||
<locale android:name="oc" />
|
||||
<locale android:name="pl" />
|
||||
<locale android:name="pt-BR" />
|
||||
<locale android:name="pt-PT" />
|
||||
<locale android:name="ro"/>
|
||||
<locale android:name="ru" />
|
||||
<locale android:name="si-LK"/>
|
||||
<locale android:name="sl"/>
|
||||
<locale android:name="sv" />
|
||||
<locale android:name="th" />
|
||||
<locale android:name="tr" />
|
||||
<locale android:name="uk" />
|
||||
<locale android:name="vi" />
|
||||
<locale android:name="zh-Hans" />
|
||||
<locale android:name="zh-Hant" />
|
||||
<locale android:name="ar-SA"/>
|
||||
<locale android:name="bn-BD"/>
|
||||
<locale android:name="bs-BA"/>
|
||||
<locale android:name="ca-ES"/>
|
||||
<locale android:name="cs-CZ"/>
|
||||
<locale android:name="de-DE"/>
|
||||
<locale android:name="el-GR"/>
|
||||
<locale android:name="en"/>
|
||||
<locale android:name="es-ES"/>
|
||||
<locale android:name="eu-ES"/>
|
||||
<locale android:name="fi-FI"/>
|
||||
<locale android:name="fr-FR"/>
|
||||
<locale android:name="gd-GB"/>
|
||||
<locale android:name="gl-ES"/>
|
||||
<locale android:name="hi-IN"/>
|
||||
<locale android:name="hr-HR"/>
|
||||
<locale android:name="hy-AM"/>
|
||||
<locale android:name="in-ID"/>
|
||||
<locale android:name="it-IT"/>
|
||||
<locale android:name="iw-IL"/>
|
||||
<locale android:name="ja-JP"/>
|
||||
<locale android:name="kab"/>
|
||||
<locale android:name="ko-KR"/>
|
||||
<locale android:name="nl-NL"/>
|
||||
<locale android:name="oc-FR"/>
|
||||
<locale android:name="pl-PL"/>
|
||||
<locale android:name="pt-BR"/>
|
||||
<locale android:name="pt-PT"/>
|
||||
<locale android:name="ru-RU"/>
|
||||
<locale android:name="si-LK"/>
|
||||
<locale android:name="sv-SE"/>
|
||||
<locale android:name="th-TH"/>
|
||||
<locale android:name="tr-TR"/>
|
||||
<locale android:name="uk-UA"/>
|
||||
<locale android:name="vi-VN"/>
|
||||
<locale android:name="zh-CN"/>
|
||||
<locale android:name="zh-TW"/>
|
||||
</locale-config>
|
||||
44
tools/GenerateLocaleConfig.java
Normal file
44
tools/GenerateLocaleConfig.java
Normal file
@@ -0,0 +1,44 @@
|
||||
// Run: java tools/GenerateLocaleConfig.java
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class GenerateLocaleConfig{
|
||||
public static void main(String[] args) throws IOException{
|
||||
File dir=new File("../mastodon/src/main/res/");
|
||||
if(!dir.exists())
|
||||
dir=new File("mastodon/src/main/res");
|
||||
if(!dir.exists())
|
||||
throw new RuntimeException("Please run from project directory (can't find mastodon/src/main/res)");
|
||||
|
||||
ArrayList<String> locales=new ArrayList<>();
|
||||
locales.add("en");
|
||||
|
||||
for(File file:dir.listFiles()){
|
||||
String name=file.getName();
|
||||
if(file.isDirectory() && name.startsWith("values-")){
|
||||
if(new File(file, "strings.xml").exists()){
|
||||
locales.add(name.substring(name.indexOf('-')+1).replace("-r", "-"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locales.sort(String::compareTo);
|
||||
try(OutputStreamWriter writer=new OutputStreamWriter(new FileOutputStream(new File(dir, "xml/locales_config.xml")), StandardCharsets.UTF_8)){
|
||||
writer.write("""
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
""");
|
||||
for(String locale : locales){
|
||||
writer.write("\t<locale android:name=\"");
|
||||
writer.write(locale);
|
||||
writer.write("\"/>\n");
|
||||
}
|
||||
writer.write("</locale-config>");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user