Fix an issue with overlapping views
This commit is contained in:
parent
c5269a3129
commit
3f1883fbbc
|
@ -123,6 +123,22 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("5");
|
||||
if(fragment != null)
|
||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||
fragment = getSupportFragmentManager().findFragmentByTag("4");
|
||||
if(fragment != null)
|
||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||
fragment = getSupportFragmentManager().findFragmentByTag("3");
|
||||
if(fragment != null)
|
||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||
fragment = getSupportFragmentManager().findFragmentByTag("2");
|
||||
if(fragment != null)
|
||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||
fragment = getSupportFragmentManager().findFragmentByTag("1");
|
||||
if(fragment != null)
|
||||
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
|
||||
|
||||
recentFragment = new DisplayVideosFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(Helper.TIMELINE_TYPE, TimelineVM.TimelineType.RECENT);
|
||||
|
@ -161,7 +177,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
fm.beginTransaction().add(R.id.nav_host_fragment, trendingFragment, "2").hide(trendingFragment).commit();
|
||||
fm.beginTransaction().add(R.id.nav_host_fragment, overviewFragment, "1").commit();
|
||||
}
|
||||
|
||||
toolbar.setOnClickListener(v->{
|
||||
if(active instanceof DisplayVideosFragment) {
|
||||
((DisplayVideosFragment) active).scrollToTop();
|
||||
|
|
|
@ -66,7 +66,7 @@ public interface PeertubeService {
|
|||
Call<WellKnownNodeinfo> getWellKnownNodeinfo();
|
||||
|
||||
@GET("{nodeInfoPath}")
|
||||
Call<WellKnownNodeinfo.NodeInfo> getNodeinfo(@Path("nodeInfoPath") String nodeInfoPath);
|
||||
Call<WellKnownNodeinfo.NodeInfo> getNodeinfo(@Path(value = "nodeInfoPath", encoded = true) String nodeInfoPath);
|
||||
|
||||
@GET("{captionContent}")
|
||||
Call<String> getCaptionContent(@Path("captionContent") String captionContent);
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.os.Looper;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -959,13 +960,18 @@ public class RetrofitPeertubeAPI {
|
|||
* @return APIResponse
|
||||
*/
|
||||
public WellKnownNodeinfo.NodeInfo getNodeInfo() {
|
||||
PeertubeService peertubeService = init();
|
||||
PeertubeService peertubeService = initTranslation();
|
||||
try {
|
||||
Call<WellKnownNodeinfo> wellKnownNodeinfoCall = peertubeService.getWellKnownNodeinfo();
|
||||
Response<WellKnownNodeinfo> response = wellKnownNodeinfoCall.execute();
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
if (response.body().getHref() != null) {
|
||||
Call<WellKnownNodeinfo.NodeInfo> nodeinfo = peertubeService.getNodeinfo(response.body().getHref());
|
||||
int size = response.body().getLinks().size();
|
||||
String url = response.body().getLinks().get(size - 1).getHref();
|
||||
if (size > 0 && url != null) {
|
||||
peertubeService = initTranslation();
|
||||
String path = new URL(url).getPath();
|
||||
path = path.replaceFirst("/", "").trim();
|
||||
Call<WellKnownNodeinfo.NodeInfo> nodeinfo = peertubeService.getNodeinfo(path);
|
||||
Response<WellKnownNodeinfo.NodeInfo> responseNodeInfo = nodeinfo.execute();
|
||||
return responseNodeInfo.body();
|
||||
}
|
||||
|
|
|
@ -17,8 +17,24 @@ package app.fedilab.fedilabtube.client.entities;
|
|||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||
public class WellKnownNodeinfo {
|
||||
|
||||
|
||||
@SerializedName("links")
|
||||
private List<NodeInfoLinks> links;
|
||||
|
||||
public List<NodeInfoLinks> getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public void setLinks(List<NodeInfoLinks> links) {
|
||||
this.links = links;
|
||||
}
|
||||
|
||||
public static class NodeInfoLinks {
|
||||
@SerializedName("reel")
|
||||
private String reel;
|
||||
@SerializedName("href")
|
||||
|
@ -39,6 +55,7 @@ public class WellKnownNodeinfo {
|
|||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
}
|
||||
|
||||
public static class NodeInfo {
|
||||
@SerializedName("version")
|
||||
|
|
Loading…
Reference in New Issue