sdk 0.87.0. Show confirmation for unfollow.
This commit is contained in:
parent
ee1d090e62
commit
b1e0b9af33
5 changed files with 114 additions and 61 deletions
|
@ -131,8 +131,8 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.86.1'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.86.1'
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.87.0'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.87.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
|
|
@ -3091,6 +3091,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
String action = intent.getAction();
|
||||
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
||||
MainActivity.this.receivedStopService = true;
|
||||
|
||||
// STOP is meant to close everything,
|
||||
// So destroy the player at this point (even with background play enabled)
|
||||
if (appPlayer != null) {
|
||||
playerNotificationManager.setPlayer(null);
|
||||
stopExoplayer();
|
||||
nowPlayingClaim = null;
|
||||
nowPlayingClaimUrl = null;
|
||||
nowPlayingClaimBitmap = null;
|
||||
}
|
||||
|
||||
MainActivity.this.finish();
|
||||
} else if (LbrynetService.LBRY_SDK_SERVICE_STARTED.equals(action)) {
|
||||
// Rebuild the service notification
|
||||
|
|
|
@ -252,8 +252,31 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
|||
return;
|
||||
}
|
||||
|
||||
subscribing = true;
|
||||
boolean isFollowing = Lbryio.isFollowing(claim);
|
||||
if (isFollowing) {
|
||||
Context context = getContext();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||
setTitle(R.string.confirm_unfollow).
|
||||
setMessage(R.string.confirm_unfollow_message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
doFollowUnfollow(isFollowing, view);
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
} else {
|
||||
doFollowUnfollow(isFollowing, view);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private void doFollowUnfollow(boolean isFollowing, View view) {
|
||||
subscribing = true;
|
||||
Subscription subscription = Subscription.fromClaim(claim);
|
||||
view.setEnabled(false);
|
||||
new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
|
@ -284,11 +307,6 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
|||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private void deleteCurrentClaim() {
|
||||
if (claim != null) {
|
||||
|
|
|
@ -824,10 +824,33 @@ public class FileViewFragment extends BaseFragment implements
|
|||
|
||||
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
public void onClick(final View view) {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
Claim publisher = claim.getSigningChannel();
|
||||
boolean isFollowing = Lbryio.isFollowing(publisher);
|
||||
if (isFollowing) {
|
||||
// show unfollow confirmation
|
||||
Context context = getContext();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||
setTitle(R.string.confirm_unfollow).
|
||||
setMessage(R.string.confirm_unfollow_message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
doFollowUnfollow(isFollowing, view);
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
} else {
|
||||
doFollowUnfollow(isFollowing, view);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void doFollowUnfollow(boolean isFollowing, View view) {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
Claim publisher = claim.getSigningChannel();
|
||||
Subscription subscription = Subscription.fromClaim(publisher);
|
||||
view.setEnabled(false);
|
||||
Context context = getContext();
|
||||
|
@ -858,7 +881,6 @@ public class FileViewFragment extends BaseFragment implements
|
|||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void resolveUrl(String url) {
|
||||
resolving = true;
|
||||
|
|
|
@ -111,6 +111,8 @@
|
|||
<string name="reposted">reposted</string>
|
||||
<string name="receive_all_notifications">You will receive all notifications</string>
|
||||
<string name="receive_no_notifications">You will not receive notifications for this channel</string>
|
||||
<string name="confirm_unfollow">Stop following channel?</string>
|
||||
<string name="confirm_unfollow_message">Are you sure you want to stop following this channel?</string>
|
||||
<plurals name="follower_count">
|
||||
<item quantity="one">%1$s follower</item>
|
||||
<item quantity="other">%1$s followers</item>
|
||||
|
|
Loading…
Reference in a new issue