Merge branch 'main' into ui/profile-header-tweaks
This commit is contained in:
@@ -73,7 +73,7 @@ public class CacheController{
|
|||||||
status.hasGapAfter=((flags & POST_FLAG_GAP_AFTER)!=0);
|
status.hasGapAfter=((flags & POST_FLAG_GAP_AFTER)!=0);
|
||||||
newMaxID=status.id;
|
newMaxID=status.id;
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(status.getContentStatus().content))
|
if(filter.matches(status))
|
||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
result.add(status);
|
result.add(status);
|
||||||
@@ -145,7 +145,7 @@ public class CacheController{
|
|||||||
newMaxID=ntf.id;
|
newMaxID=ntf.id;
|
||||||
if(ntf.status!=null){
|
if(ntf.status!=null){
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(ntf.status.getContentStatus().content))
|
if(filter.matches(ntf.status))
|
||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ public class CacheController{
|
|||||||
callback.onSuccess(new PaginatedResponse<>(result.stream().filter(ntf->{
|
callback.onSuccess(new PaginatedResponse<>(result.stream().filter(ntf->{
|
||||||
if(ntf.status!=null){
|
if(ntf.status!=null){
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(ntf.status.getContentStatus().content)){
|
if(filter.matches(ntf.status)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ public class HomeTimelineFragment extends StatusListFragment{
|
|||||||
if(idsBelowGap.contains(s.id))
|
if(idsBelowGap.contains(s.id))
|
||||||
break;
|
break;
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(s.getContentStatus().content)){
|
if(filter.matches(s)){
|
||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class ThreadFragment extends StatusListFragment{
|
|||||||
return statuses;
|
return statuses;
|
||||||
return statuses.stream().filter(status->{
|
return statuses.stream().filter(status->{
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(status.getContentStatus().content))
|
if(filter.matches(status))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import java.util.Comparator;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
@@ -295,6 +296,14 @@ public class InstanceCatalogFragment extends BaseRecyclerFragment<CatalogInstanc
|
|||||||
private void proceedWithAuthOrSignup(Instance instance){
|
private void proceedWithAuthOrSignup(Instance instance){
|
||||||
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(contentView.getWindowToken(), 0);
|
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(contentView.getWindowToken(), 0);
|
||||||
if(isSignup){
|
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();
|
Bundle args=new Bundle();
|
||||||
args.putParcelable("instance", Parcels.wrap(instance));
|
args.putParcelable("instance", Parcels.wrap(instance));
|
||||||
Nav.go(getActivity(), InstanceRulesFragment.class, args);
|
Nav.go(getActivity(), InstanceRulesFragment.class, args);
|
||||||
@@ -478,7 +487,7 @@ public class InstanceCatalogFragment extends BaseRecyclerFragment<CatalogInstanc
|
|||||||
instanceProgressDialog=null;
|
instanceProgressDialog=null;
|
||||||
proceedWithAuthOrSignup(result);
|
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;
|
boolean found=false;
|
||||||
for(CatalogInstance ci:filteredData){
|
for(CatalogInstance ci:filteredData){
|
||||||
if(ci.domain.equals(domain)){
|
if(ci.domain.equals(domain)){
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ public class Filter extends BaseModel{
|
|||||||
return pattern.matcher(text).find();
|
return pattern.matcher(text).find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean matches(Status status){
|
||||||
|
return matches(status.getContentStatus().getStrippedText());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return "Filter{"+
|
return "Filter{"+
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.joinmastodon.android.model;
|
|||||||
import org.joinmastodon.android.api.ObjectValidationException;
|
import org.joinmastodon.android.api.ObjectValidationException;
|
||||||
import org.joinmastodon.android.api.RequiredField;
|
import org.joinmastodon.android.api.RequiredField;
|
||||||
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
|
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
|
||||||
|
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||||
import org.parceler.Parcel;
|
import org.parceler.Parcel;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@@ -56,6 +57,7 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
|||||||
|
|
||||||
public transient boolean spoilerRevealed;
|
public transient boolean spoilerRevealed;
|
||||||
public transient boolean hasGapAfter;
|
public transient boolean hasGapAfter;
|
||||||
|
private transient String strippedText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postprocess() throws ObjectValidationException{
|
public void postprocess() throws ObjectValidationException{
|
||||||
@@ -132,4 +134,10 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
|||||||
public Status getContentStatus(){
|
public Status getContentStatus(){
|
||||||
return reblog!=null ? reblog : this;
|
return reblog!=null ? reblog : this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStrippedText(){
|
||||||
|
if(strippedText==null)
|
||||||
|
strippedText=HtmlParser.strip(content);
|
||||||
|
return strippedText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ public class StatusFilterPredicate implements Predicate<Status>{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(Status status){
|
public boolean test(Status status){
|
||||||
CharSequence content=status.getContentStatus().content;
|
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(content))
|
if(filter.matches(status))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<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: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"/>
|
<item android:drawable="@drawable/ic_fluent_arrow_repeat_all_off_24_regular"/>
|
||||||
</selector>
|
</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>
|
||||||
@@ -94,6 +94,7 @@
|
|||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_marginLeft="4dp"
|
android:layout_marginLeft="4dp"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
android:text="·"
|
android:text="·"
|
||||||
android:textAppearance="@style/m3_title_small" />
|
android:textAppearance="@style/m3_title_small" />
|
||||||
|
|
||||||
|
|||||||
@@ -388,4 +388,5 @@
|
|||||||
<string name="privacy_policy_subtitle">Although the Mastodon app does not collect any data, the server you sign up through may have a different policy. Take a minute to review and agree to the Mastodon app privacy policy and your server\'s privacy policy.</string>
|
<string name="privacy_policy_subtitle">Although the Mastodon app does not collect any data, the server you sign up through may have a different policy. Take a minute to review and agree to the Mastodon app privacy policy and your server\'s privacy policy.</string>
|
||||||
<string name="i_agree">I Agree</string>
|
<string name="i_agree">I Agree</string>
|
||||||
<string name="empty_list">This list is empty</string>
|
<string name="empty_list">This list is empty</string>
|
||||||
|
<string name="instance_signup_closed">This server does not accept new registrations.</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user