Fix crash bug for anonymous repost claim results. Better handle channel repost navigation.
This commit is contained in:
parent
28212808f8
commit
e1d51c881a
4 changed files with 17 additions and 8 deletions
|
@ -3402,6 +3402,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
return String.format("%s-%d", fragmentClass.getName(), navItemId);
|
return String.format("%s-%d", fragmentClass.getName(), navItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void popFragment(Class fragmentClass, int navItemId, Map<String, Object> params) {
|
||||||
|
String key = buildNavFragmentKey(fragmentClass, navItemId, params);
|
||||||
|
openNavFragments.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
public void openFragment(Class fragmentClass, boolean allowNavigateBack, int navItemId, Map<String, Object> params) {
|
public void openFragment(Class fragmentClass, boolean allowNavigateBack, int navItemId, Map<String, Object> params) {
|
||||||
try {
|
try {
|
||||||
String key = buildNavFragmentKey(fragmentClass, navItemId, params);
|
String key = buildNavFragmentKey(fragmentClass, navItemId, params);
|
||||||
|
|
|
@ -404,7 +404,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||||
vh.publishTimeView.setVisibility(!isPending ? View.VISIBLE : View.GONE);
|
vh.publishTimeView.setVisibility(!isPending ? View.VISIBLE : View.GONE);
|
||||||
vh.pendingTextView.setVisibility(isPending && !item.isLoadingPlaceholder() ? View.VISIBLE : View.GONE);
|
vh.pendingTextView.setVisibility(isPending && !item.isLoadingPlaceholder() ? View.VISIBLE : View.GONE);
|
||||||
vh.repostInfoView.setVisibility(isRepost && type != VIEW_TYPE_FEATURED ? View.VISIBLE : View.GONE);
|
vh.repostInfoView.setVisibility(isRepost && type != VIEW_TYPE_FEATURED ? View.VISIBLE : View.GONE);
|
||||||
vh.repostChannelView.setText(isRepost ? original.getSigningChannel().getName() : null);
|
vh.repostChannelView.setText(isRepost && original.getSigningChannel() != null ? original.getSigningChannel().getName() : null);
|
||||||
vh.repostChannelView.setOnClickListener(new View.OnClickListener() {
|
vh.repostChannelView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
|
@ -310,8 +311,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
String mediaSourceUrl = getStreamingUrl();
|
String mediaSourceUrl = getStreamingUrl();
|
||||||
long duration = MainActivity.appPlayer.getDuration();
|
long duration = MainActivity.appPlayer.getDuration();
|
||||||
long position = MainActivity.appPlayer.getCurrentPosition();
|
long position = MainActivity.appPlayer.getCurrentPosition();
|
||||||
// TODO: Determine a hash for the userId
|
String userIdHash = Lbryio.currentUser != null ? String.valueOf(Lbryio.currentUser.getId()) : "0";
|
||||||
String userIdHash = Helper.SHA256(Lbryio.currentUser != null ? String.valueOf(Lbryio.currentUser.getId()) : "0");
|
|
||||||
if (mediaSourceUrl.startsWith(CDN_PREFIX)) {
|
if (mediaSourceUrl.startsWith(CDN_PREFIX)) {
|
||||||
BufferEventTask bufferEvent = new BufferEventTask(claim.getPermanentUrl(), duration, position, 1, userIdHash);
|
BufferEventTask bufferEvent = new BufferEventTask(claim.getPermanentUrl(), duration, position, 1, userIdHash);
|
||||||
bufferEvent.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
bufferEvent.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
||||||
|
@ -430,7 +430,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
} else if (claim.getName().startsWith("@")) {
|
} else if (claim.getName().startsWith("@")) {
|
||||||
// this is a reposted channel, so launch the channel url
|
// this is a reposted channel, so launch the channel url
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
((MainActivity) context).openChannelUrl(!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
MainActivity activity = (MainActivity) context;
|
||||||
|
//activity.onBackPressed(); // remove the reposted url page from the back stack
|
||||||
|
activity.getSupportFragmentManager().popBackStack();
|
||||||
|
activity.openChannelUrl(!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -899,7 +902,9 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
// this is a reposted channel, so finish this activity and launch the channel url
|
// this is a reposted channel, so finish this activity and launch the channel url
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
((MainActivity) context).openChannelUrl(!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
MainActivity activity = (MainActivity) context;
|
||||||
|
activity.getSupportFragmentManager().popBackStack();
|
||||||
|
activity.openChannelUrl(!Helper.isNullOrEmpty(claim.getShortUrl()) ? claim.getShortUrl() : claim.getPermanentUrl());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,7 @@ public class ShuffleFragment extends BaseFragment {
|
||||||
String mediaSourceUrl = getStreamingUrl();
|
String mediaSourceUrl = getStreamingUrl();
|
||||||
long duration = MainActivity.appPlayer.getDuration();
|
long duration = MainActivity.appPlayer.getDuration();
|
||||||
long position = MainActivity.appPlayer.getCurrentPosition();
|
long position = MainActivity.appPlayer.getCurrentPosition();
|
||||||
// TODO: Determine a hash for the userId
|
String userIdHash = Lbryio.currentUser != null ? String.valueOf(Lbryio.currentUser.getId()) : "0";
|
||||||
String userIdHash = Helper.SHA256(Lbryio.currentUser != null ? String.valueOf(Lbryio.currentUser.getId()) : "0");
|
|
||||||
if (mediaSourceUrl.startsWith(FileViewFragment.CDN_PREFIX)) {
|
if (mediaSourceUrl.startsWith(FileViewFragment.CDN_PREFIX)) {
|
||||||
BufferEventTask bufferEvent = new BufferEventTask(current.getPermanentUrl(), duration, position, 1, userIdHash);
|
BufferEventTask bufferEvent = new BufferEventTask(current.getPermanentUrl(), duration, position, 1, userIdHash);
|
||||||
bufferEvent.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
bufferEvent.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
||||||
|
|
Loading…
Reference in a new issue