More minor fixes

closes #612
This commit is contained in:
Grishka 2023-06-30 20:28:52 +03:00
parent eb822282c0
commit 9a8cf61e38
4 changed files with 17 additions and 4 deletions

View File

@ -121,8 +121,10 @@ public class SearchFragment extends BaseStatusListFragment<SearchResult>{
}else{
type=null;
}
if(currentQuery==null)
if(currentQuery==null){
dataLoaded();
return;
}
currentRequest=new GetSearchResults(currentQuery, type, true)
.setCallback(new Callback<>(){
@Override

View File

@ -54,6 +54,7 @@ import java.util.stream.Stream;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.RecyclerView;
import me.grishka.appkit.Nav;
import me.grishka.appkit.api.SimpleCallback;
@ -287,6 +288,14 @@ public class SearchQueryFragment extends MastodonRecyclerFragment<SearchResultVi
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(getActivity().getWindow().getDecorView().getWindowToken(), 0);
}
@RequiresApi(api = Build.VERSION_CODES.S)
private float getScreenCornerRadius(WindowInsets insets, int pos){
RoundedCorner corner=insets.getRoundedCorner(pos);
if(corner==null)
return 0;
return corner.getRadius();
}
private Animator createTransition(View prev, View container, boolean enter){
int[] loc={0, 0};
View searchBtn=prev.findViewById(R.id.search_wrap);
@ -299,8 +308,8 @@ public class SearchQueryFragment extends MastodonRecyclerFragment<SearchResultVi
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.S){
WindowInsets insets=container.getRootWindowInsets();
screenRadius=Math.min(
Math.min(insets.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT).getRadius(), insets.getRoundedCorner(RoundedCorner.POSITION_TOP_RIGHT).getRadius()),
Math.min(insets.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_LEFT).getRadius(), insets.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT).getRadius())
Math.min(getScreenCornerRadius(insets, RoundedCorner.POSITION_TOP_LEFT), getScreenCornerRadius(insets, RoundedCorner.POSITION_TOP_RIGHT)),
Math.min(getScreenCornerRadius(insets, RoundedCorner.POSITION_BOTTOM_LEFT), getScreenCornerRadius(insets, RoundedCorner.POSITION_BOTTOM_RIGHT))
);
}else{
screenRadius=0;

View File

@ -315,6 +315,8 @@ public class ComposeMediaViewController{
.setProgressListener(new ProgressListener(){
@Override
public void onProgress(long transferred, long total){
if(fragment.getActivity()==null)
return;
float progressFraction=transferred/(float)total;
int progress=Math.round(progressFraction*attachment.progressBar.getMax());
if(Build.VERSION.SDK_INT>=24)

View File

@ -8,7 +8,7 @@
<item name="android:windowBackground">@color/m3_sys_light_surface</item>
<item name="android:editTextStyle">@style/Widget.Mastodon.EditText</item>
<item name="android:buttonStyle">@style/Widget.Mastodon.M3.Button</item>
<item name="android:buttonStyle">@style/Widget.Mastodon.M3.Button.Filled</item>
<item name="android:actionBarTheme">@style/Theme.Mastodon.Toolbar</item>
<item name="android:alertDialogTheme">@style/Theme.Mastodon.Dialog.Alert</item>