Merge upstream lbryio/lbry-android
This commit is contained in:
commit
2393248b3d
8 changed files with 151 additions and 97 deletions
|
@ -14,8 +14,8 @@ android {
|
||||||
applicationId "io.lbry.browser"
|
applicationId "io.lbry.browser"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 1611
|
versionCode 1612
|
||||||
versionName "0.16.11"
|
versionName "0.16.12"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ dependencies {
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
|
||||||
__32bitImplementation 'io.lbry:lbrysdk32:0.86.1'
|
__32bitImplementation 'io.lbry:lbrysdk32:0.87.0'
|
||||||
// __64bitImplementation 'io.lbry:lbrysdk64:0.86.1'
|
// __64bitImplementation 'io.lbry:lbrysdk64:0.87.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import android.view.KeyEvent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
@ -2661,6 +2662,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
|
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
|
// Add 1 pixel to listview height
|
||||||
|
int listHeight = Math.round(getResources().getDisplayMetrics().density);
|
||||||
|
|
||||||
|
for (int i = 0; i < startupStages.size(); i++) {
|
||||||
|
View item = adapter.getView(i, null, listView);
|
||||||
|
item.measure(0, 0);
|
||||||
|
listHeight += item.getMeasuredHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Properly set listview height by adding all seven items and the divider heights
|
||||||
|
// and the additional 1 pixel so no vertical scroll bar is shown
|
||||||
|
ViewGroup.LayoutParams params = listView.getLayoutParams();
|
||||||
|
params.height = listHeight + (listView.getCount() + 1) * listView.getDividerHeight();
|
||||||
|
listView.setLayoutParams(params);
|
||||||
|
listView.invalidate();
|
||||||
|
listView.requestLayout();
|
||||||
|
|
||||||
findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE);
|
findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE);
|
||||||
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
|
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -3007,6 +3025,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
||||||
MainActivity.this.receivedStopService = true;
|
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();
|
MainActivity.this.finish();
|
||||||
} else if (LbrynetService.LBRY_SDK_SERVICE_STARTED.equals(action)) {
|
} else if (LbrynetService.LBRY_SDK_SERVICE_STARTED.equals(action)) {
|
||||||
// Rebuild the service notification
|
// Rebuild the service notification
|
||||||
|
|
|
@ -441,21 +441,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context context = getContext();
|
postComment();
|
||||||
if (context != null) {
|
|
||||||
String titleText = getResources().getString(R.string.comment_confirm_post);
|
|
||||||
String confirmText = getResources().getString(R.string.confirm_post_comment);
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
|
||||||
setTitle(titleText).
|
|
||||||
setMessage(confirmText)
|
|
||||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
postComment();
|
|
||||||
}
|
|
||||||
}).setNegativeButton(R.string.no, null);
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePostAsChannel(Claim channel) {
|
private void updatePostAsChannel(Claim channel) {
|
||||||
|
|
|
@ -252,37 +252,22 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribing = true;
|
|
||||||
boolean isFollowing = Lbryio.isFollowing(claim);
|
boolean isFollowing = Lbryio.isFollowing(claim);
|
||||||
Subscription subscription = Subscription.fromClaim(claim);
|
if (isFollowing) {
|
||||||
view.setEnabled(false);
|
Context context = getContext();
|
||||||
new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||||
@Override
|
setTitle(R.string.confirm_unfollow).
|
||||||
public void onSuccess() {
|
setMessage(R.string.confirm_unfollow_message)
|
||||||
if (isFollowing) {
|
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
Lbryio.removeSubscription(subscription);
|
@Override
|
||||||
Lbryio.removeCachedResolvedSubscription(claim);
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
} else {
|
doFollowUnfollow(isFollowing, view);
|
||||||
Lbryio.addSubscription(subscription);
|
}
|
||||||
Lbryio.addCachedResolvedSubscription(claim);
|
}).setNegativeButton(R.string.no, null);
|
||||||
}
|
builder.show();
|
||||||
buttonFollowUnfollow.setEnabled(true);
|
} else {
|
||||||
subscribing = false;
|
doFollowUnfollow(isFollowing, view);
|
||||||
checkIsFollowing();
|
}
|
||||||
FollowingFragment.resetClaimSearchContent = true;
|
|
||||||
|
|
||||||
Context context = getContext();
|
|
||||||
if (context != null) {
|
|
||||||
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Exception exception) {
|
|
||||||
buttonFollowUnfollow.setEnabled(true);
|
|
||||||
subscribing = false;
|
|
||||||
}
|
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -290,6 +275,39 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||||
return root;
|
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() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
if (isFollowing) {
|
||||||
|
Lbryio.removeSubscription(subscription);
|
||||||
|
Lbryio.removeCachedResolvedSubscription(claim);
|
||||||
|
} else {
|
||||||
|
Lbryio.addSubscription(subscription);
|
||||||
|
Lbryio.addCachedResolvedSubscription(claim);
|
||||||
|
}
|
||||||
|
buttonFollowUnfollow.setEnabled(true);
|
||||||
|
subscribing = false;
|
||||||
|
checkIsFollowing();
|
||||||
|
FollowingFragment.resetClaimSearchContent = true;
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
|
if (context != null) {
|
||||||
|
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception exception) {
|
||||||
|
buttonFollowUnfollow.setEnabled(true);
|
||||||
|
subscribing = false;
|
||||||
|
}
|
||||||
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteCurrentClaim() {
|
private void deleteCurrentClaim() {
|
||||||
if (claim != null) {
|
if (claim != null) {
|
||||||
Helper.setViewVisibility(layoutDisplayArea, View.GONE);
|
Helper.setViewVisibility(layoutDisplayArea, View.GONE);
|
||||||
|
|
|
@ -823,42 +823,64 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
|
|
||||||
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
|
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(final View view) {
|
||||||
if (claim != null && claim.getSigningChannel() != null) {
|
if (claim != null && claim.getSigningChannel() != null) {
|
||||||
Claim publisher = claim.getSigningChannel();
|
Claim publisher = claim.getSigningChannel();
|
||||||
boolean isFollowing = Lbryio.isFollowing(publisher);
|
boolean isFollowing = Lbryio.isFollowing(publisher);
|
||||||
Subscription subscription = Subscription.fromClaim(publisher);
|
if (isFollowing) {
|
||||||
view.setEnabled(false);
|
// show unfollow confirmation
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
||||||
@Override
|
setTitle(R.string.confirm_unfollow).
|
||||||
public void onSuccess() {
|
setMessage(R.string.confirm_unfollow_message)
|
||||||
if (isFollowing) {
|
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
Lbryio.removeSubscription(subscription);
|
@Override
|
||||||
Lbryio.removeCachedResolvedSubscription(publisher);
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
} else {
|
doFollowUnfollow(isFollowing, view);
|
||||||
Lbryio.addSubscription(subscription);
|
}
|
||||||
Lbryio.addCachedResolvedSubscription(publisher);
|
}).setNegativeButton(R.string.no, null);
|
||||||
}
|
builder.show();
|
||||||
view.setEnabled(true);
|
} else {
|
||||||
checkIsFollowing();
|
doFollowUnfollow(isFollowing, view);
|
||||||
FollowingFragment.resetClaimSearchContent = true;
|
}
|
||||||
|
|
||||||
// Save shared user state
|
|
||||||
if (context != null) {
|
|
||||||
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Exception exception) {
|
|
||||||
view.setEnabled(true);
|
|
||||||
}
|
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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();
|
||||||
|
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
if (isFollowing) {
|
||||||
|
Lbryio.removeSubscription(subscription);
|
||||||
|
Lbryio.removeCachedResolvedSubscription(publisher);
|
||||||
|
} else {
|
||||||
|
Lbryio.addSubscription(subscription);
|
||||||
|
Lbryio.addCachedResolvedSubscription(publisher);
|
||||||
|
}
|
||||||
|
view.setEnabled(true);
|
||||||
|
checkIsFollowing();
|
||||||
|
FollowingFragment.resetClaimSearchContent = true;
|
||||||
|
|
||||||
|
// Save shared user state
|
||||||
|
if (context != null) {
|
||||||
|
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception exception) {
|
||||||
|
view.setEnabled(true);
|
||||||
|
}
|
||||||
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void resolveUrl(String url) {
|
private void resolveUrl(String url) {
|
||||||
resolving = true;
|
resolving = true;
|
||||||
Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE);
|
Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE);
|
||||||
|
@ -3033,21 +3055,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context context = getContext();
|
postComment();
|
||||||
if (context != null) {
|
|
||||||
String titleText = getResources().getString(R.string.comment_confirm_post);
|
|
||||||
String confirmText = getResources().getString(R.string.confirm_post_comment);
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context).
|
|
||||||
setTitle(titleText).
|
|
||||||
setMessage(confirmText)
|
|
||||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
postComment();
|
|
||||||
}
|
|
||||||
}).setNegativeButton(R.string.no, null);
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePostAsChannel(Claim channel) {
|
private void updatePostAsChannel(Claim channel) {
|
||||||
|
|
|
@ -463,7 +463,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
double sentAmount = actualSendAmount;
|
double sentAmount = actualSendAmount;
|
||||||
String message = getResources().getQuantityString(
|
String message = getResources().getQuantityString(
|
||||||
R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2,
|
R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2,
|
||||||
new DecimalFormat("#,###.##").format(sentAmount));
|
new DecimalFormat("#,###.####").format(sentAmount));
|
||||||
Helper.setViewText(inputSendAddress, null);
|
Helper.setViewText(inputSendAddress, null);
|
||||||
Helper.setViewText(inputSendAmount, null);
|
Helper.setViewText(inputSendAmount, null);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
|
|
|
@ -159,10 +159,11 @@
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/startup_stage_error_listview"
|
android:id="@+id/startup_stage_error_listview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:divider="@android:color/transparent"
|
android:divider="@android:color/transparent"
|
||||||
android:dividerHeight="8dp"
|
android:dividerHeight="8dp"
|
||||||
|
android:scrollbars="none"
|
||||||
tools:listitem="@layout/list_item_startupstage">
|
tools:listitem="@layout/list_item_startupstage">
|
||||||
|
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
|
@ -88,8 +88,6 @@
|
||||||
<string name="please_enter_comment">Please enter a comment to post.</string>
|
<string name="please_enter_comment">Please enter a comment to post.</string>
|
||||||
<string name="please_select_channel">Please select a channel to post your comment as.</string>
|
<string name="please_select_channel">Please select a channel to post your comment as.</string>
|
||||||
<string name="comment_form_post">Post</string>
|
<string name="comment_form_post">Post</string>
|
||||||
<string name="comment_confirm_post">Confirm your comment</string>
|
|
||||||
<string name="confirm_post_comment">This will post your comment</string>
|
|
||||||
<string name="comment_posted">Your comment was successfully posted.</string>
|
<string name="comment_posted">Your comment was successfully posted.</string>
|
||||||
<string name="please_select_repost_channel">Please select a channel to repost on.</string>
|
<string name="please_select_repost_channel">Please select a channel to repost on.</string>
|
||||||
<string name="reply">Reply</string>
|
<string name="reply">Reply</string>
|
||||||
|
@ -103,6 +101,18 @@
|
||||||
<item quantity="one">This will purchase "%1$s" for %2$s credit</item>
|
<item quantity="one">This will purchase "%1$s" for %2$s credit</item>
|
||||||
<item quantity="other">This will purchase "%1$s" for %2$s credits</item>
|
<item quantity="other">This will purchase "%1$s" for %2$s credits</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
<plurals name="post_and_tip">
|
||||||
|
<item quantity="one">Post and tip %1$s credit?</item>
|
||||||
|
<item quantity="other">Post and tip %1$s credits?</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="post_for_credits">
|
||||||
|
<item quantity="one">Post for %1$s credit</item>
|
||||||
|
<item quantity="other">Post for %1$s credits</item>
|
||||||
|
</plurals>
|
||||||
|
<plurals name="confirm_post_comment">
|
||||||
|
<item quantity="one">This will post your comment with a tip of %1$s credit for %2$s</item>
|
||||||
|
<item quantity="other">This will post your comment with a tip of %1$s credits for %2$s</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
<!-- Channel view -->
|
<!-- Channel view -->
|
||||||
<string name="no_channel_info">There\'s nothing here yet.\nPlease check back later.</string>
|
<string name="no_channel_info">There\'s nothing here yet.\nPlease check back later.</string>
|
||||||
|
@ -111,6 +121,8 @@
|
||||||
<string name="reposted">reposted</string>
|
<string name="reposted">reposted</string>
|
||||||
<string name="receive_all_notifications">You will receive all notifications</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="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">
|
<plurals name="follower_count">
|
||||||
<item quantity="one">%1$s follower</item>
|
<item quantity="one">%1$s follower</item>
|
||||||
<item quantity="other">%1$s followers</item>
|
<item quantity="other">%1$s followers</item>
|
||||||
|
|
Loading…
Add table
Reference in a new issue