Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85ed2da518 | ||
|
|
dcc91f75cc | ||
|
|
a40c160ac6 | ||
|
|
e6861c8436 | ||
|
|
e6a5d97fb8 | ||
|
|
ddeb209d51 | ||
|
|
3283b3a607 | ||
|
|
83a41ca6ce | ||
|
|
6c63eb7d66 | ||
|
|
7cf9de8c2a | ||
|
|
a859682954 |
No files matched your search
+2
-2
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1508
|
||||
versionName "0.15.8"
|
||||
versionCode 1509
|
||||
versionName "0.15.9"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -353,7 +353,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// workaround to fix dark theme because https://issuetracker.google.com/issues/37124582
|
||||
new WebView(this);
|
||||
try {
|
||||
new WebView(this);
|
||||
} catch (Exception ex) {
|
||||
// pass (don't fail initialization on some _weird_ device implementations)
|
||||
}
|
||||
AppCompatDelegate.setDefaultNightMode(isDarkMode() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
|
||||
|
||||
initKeyStore();
|
||||
@@ -365,17 +369,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
initSpecialRouteMap();
|
||||
|
||||
LbryAnalytics.init(this);
|
||||
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
||||
@Override
|
||||
public void onComplete(Task<InstanceIdResult> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
return;
|
||||
try {
|
||||
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
||||
@Override
|
||||
public void onComplete(Task<InstanceIdResult> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
return;
|
||||
}
|
||||
// Get new Instance ID token
|
||||
firebaseMessagingToken = task.getResult().getToken();
|
||||
}
|
||||
|
||||
// Get new Instance ID token
|
||||
firebaseMessagingToken = task.getResult().getToken();
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
dbHelper = new DatabaseHelper(this);
|
||||
@@ -395,7 +402,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
return ViewCompat.onApplyWindowInsets(v,
|
||||
insets.replaceSystemWindowInsets(
|
||||
insets.getSystemWindowInsetLeft(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
insets.getSystemWindowInsetBottom()));
|
||||
@@ -739,8 +746,13 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
public void openPublishesOnSuccessfulPublish() {
|
||||
// close publish form
|
||||
getSupportFragmentManager().popBackStack();
|
||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||
try {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
public void openPublishForm(Claim claim) {
|
||||
@@ -1388,6 +1400,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
findViewById(R.id.app_bar_main_container).setFitsSystemWindows(false);
|
||||
lockDrawer();
|
||||
|
||||
View decorView = getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(
|
||||
@@ -1424,6 +1437,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
if (actionBar != null) {
|
||||
actionBar.show();
|
||||
}
|
||||
unlockDrawer();
|
||||
inFullscreenMode = false;
|
||||
}
|
||||
|
||||
@@ -2484,8 +2498,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
!startingSignInFlowActivity) {
|
||||
enteringPIPMode = true;
|
||||
PictureInPictureParams params = new PictureInPictureParams.Builder().build();
|
||||
enterPictureInPictureMode(params);
|
||||
return true;
|
||||
|
||||
try {
|
||||
enterPictureInPictureMode(params);
|
||||
return true;
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
enteringPIPMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -2915,16 +2935,25 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
public static void requestPermission(String permission, int requestCode, String rationale, Context context, boolean forceRequest) {
|
||||
if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
if (!forceRequest && ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
|
||||
Toast.makeText(context, rationale, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(rationale);
|
||||
}
|
||||
} else if (forceRequest) {
|
||||
startingPermissionRequest = true;
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode);
|
||||
} else {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showError(rationale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasPermission(String permission, Context context) {
|
||||
if (context == null) {
|
||||
return false;
|
||||
}
|
||||
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showFetchUserError(error.getMessage());
|
||||
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||
hideLoading();
|
||||
}
|
||||
});
|
||||
@@ -213,7 +213,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
}
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showFetchUserError(error.getMessage());
|
||||
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||
hideLoading();
|
||||
}
|
||||
});
|
||||
@@ -250,7 +250,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showFetchUserError(error.getMessage());
|
||||
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||
hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -327,7 +327,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
}
|
||||
|
||||
boolean isPending = item.getConfirmations() == 0;
|
||||
boolean isSelected = isClaimSelected(item);
|
||||
boolean isSelected = isClaimSelected(original);
|
||||
vh.itemView.setSelected(isSelected);
|
||||
vh.selectedOverlayView.setVisibility(isSelected ? View.VISIBLE : View.GONE);
|
||||
vh.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package io.lbry.browser.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.model.Comment;
|
||||
|
||||
public class CommentListAdapter extends RecyclerView.Adapter<CommentListAdapter.ViewHolder> {
|
||||
private List<Comment> items;
|
||||
private Context context;
|
||||
|
||||
public CommentListAdapter(List<Comment> items, Context context) {
|
||||
this.items = items;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return items != null ? items.size() : 0;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
protected TextView channelName;
|
||||
protected TextView commentText;
|
||||
|
||||
public ViewHolder (View v) {
|
||||
super(v);
|
||||
channelName = v.findViewById(R.id.comment_channel_name);
|
||||
commentText = v.findViewById(R.id.comment_text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(context).inflate(R.layout.list_item_comment, parent, false);
|
||||
return new CommentListAdapter.ViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
Comment comment = items.get(position);
|
||||
holder.channelName.setText(comment.getChannelName());
|
||||
holder.commentText.setText(comment.getText());
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class InlineChannelSpinnerAdapter extends ArrayAdapter<Claim> {
|
||||
public int getItemPosition(Claim item) {
|
||||
for (int i = 0; i < channels.size(); i++) {
|
||||
Claim channel = channels.get(i);
|
||||
if (item.getClaimId().equalsIgnoreCase(channel.getClaimId())) {
|
||||
if (item.getClaimId() != null && item.getClaimId().equalsIgnoreCase(channel.getClaimId())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,11 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||
}
|
||||
|
||||
Claim channel = (Claim) channelSpinner.getSelectedItem();
|
||||
if (channel == null) {
|
||||
showError(getString(R.string.please_select_repost_channel));
|
||||
return;
|
||||
}
|
||||
|
||||
StreamRepostTask task = new StreamRepostTask(name, bid, claim.getClaimId(), channel.getClaimId(), repostProgress, new ClaimResultHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
@@ -256,10 +261,13 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
View view = getView();
|
||||
if (view != null && !Helper.isNullOrEmpty(message)) {
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
private void startLoading() {
|
||||
|
||||
@@ -91,11 +91,13 @@ public class SendTipDialogFragment extends BottomSheetDialogFragment implements
|
||||
|
||||
TextView infoText = view.findViewById(R.id.tip_info);
|
||||
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
infoText.setText(HtmlCompat.fromHtml(
|
||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
if (claim != null) {
|
||||
infoText.setText(HtmlCompat.fromHtml(
|
||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
|
||||
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -289,6 +289,9 @@ public class Claim {
|
||||
Claim signingChannel = new Claim();
|
||||
signingChannel.setClaimId(viewHistory.getPublisherClaimId());
|
||||
signingChannel.setName(viewHistory.getPublisherName());
|
||||
|
||||
LbryUri channelUrl = LbryUri.tryParse(String.format("%s#%s", signingChannel.getName(), signingChannel.getClaimId()));
|
||||
signingChannel.setPermanentUrl(channelUrl != null ? channelUrl.toString() : null);
|
||||
if (!Helper.isNullOrEmpty(viewHistory.getPublisherTitle())) {
|
||||
GenericMetadata channelValue = new GenericMetadata();
|
||||
channelValue.setTitle(viewHistory.getPublisherTitle());
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package io.lbry.browser.model;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Comment {
|
||||
private final String channelName, text, id, parentId;
|
||||
|
||||
public Comment(String channelName, String text, String id, String parentId) {
|
||||
this.channelName = channelName;
|
||||
this.text = text;
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public static Comment fromJSONObject(JSONObject jsonObject) {
|
||||
try {
|
||||
String parentId = null;
|
||||
if (jsonObject.has("parent_id")) {
|
||||
parentId = jsonObject.getString("parent_id");
|
||||
}
|
||||
|
||||
return new Comment(
|
||||
jsonObject.getString("channel_name"),
|
||||
jsonObject.getString("comment"),
|
||||
jsonObject.getString("comment_id"),
|
||||
parentId
|
||||
);
|
||||
} catch (JSONException ex) {
|
||||
// TODO: Throw exception
|
||||
Log.e("Comments", ex.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.model.Comment;
|
||||
|
||||
public interface CommentListHandler {
|
||||
void onSuccess(List<Comment> comments);
|
||||
void onError(Exception error);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
|
||||
private final int page;
|
||||
private final int pageSize;
|
||||
private final String claim;
|
||||
private ProgressBar progressBar;
|
||||
private CommentListHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public CommentListTask(int page, int pageSize, String claim, ProgressBar progressBar, CommentListHandler handler) {
|
||||
this.page = page;
|
||||
this.pageSize = pageSize;
|
||||
this.claim = claim;
|
||||
this.progressBar = progressBar;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
protected void onPreExecute() {
|
||||
Helper.setViewVisibility(progressBar, View.VISIBLE);
|
||||
}
|
||||
|
||||
protected List<Comment> doInBackground(Void... voids) {
|
||||
List<Comment> comments = null;
|
||||
|
||||
try {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
|
||||
options.put("claim_id", claim);
|
||||
options.put("page", page);
|
||||
options.put("page_size", pageSize);
|
||||
options.put("include_replies", false);
|
||||
options.put("is_channel_signature_valid", true);
|
||||
options.put("visible", true);
|
||||
options.put("hidden", false);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_COMMENT_LIST, options);
|
||||
JSONArray items = result.getJSONArray("items");
|
||||
comments = new ArrayList<>();
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
comments.add(Comment.fromJSONObject(items.getJSONObject(i)));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
}
|
||||
return comments;
|
||||
}
|
||||
|
||||
protected void onPostExecute(List<Comment> comments) {
|
||||
Helper.setViewVisibility(progressBar, View.GONE);
|
||||
if (handler != null) {
|
||||
if (comments != null && error == null) {
|
||||
handler.onSuccess(comments);
|
||||
} else {
|
||||
handler.onError(error);
|
||||
if (error != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,14 @@ public class PublishClaimTask extends AsyncTask<Void, Void, Claim> {
|
||||
options.put("license_url", metadata.getLicenseUrl());
|
||||
}
|
||||
|
||||
if (metadata.getReleaseTime() > 0) {
|
||||
options.put("release_time", metadata.getReleaseTime());
|
||||
} else if (claim.getTimestamp() > 0) {
|
||||
options.put("release_time", claim.getTimestamp());
|
||||
} else {
|
||||
options.put("release_time", Double.valueOf(Math.floor(System.currentTimeMillis() / 1000.0)).intValue());
|
||||
}
|
||||
|
||||
Claim claimResult = null;
|
||||
try {
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PUBLISH, options);
|
||||
|
||||
@@ -55,20 +55,22 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
|
||||
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
|
||||
projection, null, null,
|
||||
String.format("%s DESC LIMIT 150", MediaStore.MediaColumns.DATE_MODIFIED));
|
||||
while (cursor.moveToNext()) {
|
||||
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
|
||||
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
||||
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
||||
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
||||
if (cursor != null) {
|
||||
while (cursor.moveToNext()) {
|
||||
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
|
||||
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
||||
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
||||
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
||||
|
||||
GalleryItem item = new GalleryItem();
|
||||
item.setId(cursor.getString(idColumn));
|
||||
item.setName(cursor.getString(nameColumn));
|
||||
item.setType(cursor.getString(typeColumn));
|
||||
item.setFilePath(cursor.getString(pathColumn));
|
||||
item.setDuration(cursor.getLong(durationColumn));
|
||||
items.add(item);
|
||||
GalleryItem item = new GalleryItem();
|
||||
item.setId(cursor.getString(idColumn));
|
||||
item.setName(cursor.getString(nameColumn));
|
||||
item.setType(cursor.getString(typeColumn));
|
||||
item.setFilePath(cursor.getString(pathColumn));
|
||||
item.setDuration(cursor.getLong(durationColumn));
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
} catch (SQLiteException ex) {
|
||||
// failed to load videos. log and pass
|
||||
|
||||
@@ -254,7 +254,13 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||
|
||||
private void checkParams() {
|
||||
Map<String, Object> params = getParams();
|
||||
if (params.containsKey("claim")) {
|
||||
if (params == null) {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).onBackPressed();
|
||||
return;
|
||||
}
|
||||
} else if (params.containsKey("claim")) {
|
||||
Claim claim = (Claim) params.get("claim");
|
||||
if (claim != null && !claim.equals(this.currentClaim)) {
|
||||
this.currentClaim = claim;
|
||||
|
||||
@@ -89,6 +89,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.ClaimListAdapter;
|
||||
import io.lbry.browser.adapter.CommentListAdapter;
|
||||
import io.lbry.browser.adapter.TagListAdapter;
|
||||
import io.lbry.browser.dialog.RepostClaimDialogFragment;
|
||||
import io.lbry.browser.dialog.SendTipDialogFragment;
|
||||
@@ -102,6 +103,7 @@ import io.lbry.browser.listener.StoragePermissionListener;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.ClaimCacheKey;
|
||||
import io.lbry.browser.model.Comment;
|
||||
import io.lbry.browser.model.Fee;
|
||||
import io.lbry.browser.model.LbryFile;
|
||||
import io.lbry.browser.model.NavMenuItem;
|
||||
@@ -110,6 +112,8 @@ import io.lbry.browser.model.UrlSuggestion;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.model.lbryinc.Reward;
|
||||
import io.lbry.browser.model.lbryinc.Subscription;
|
||||
import io.lbry.browser.tasks.CommentListHandler;
|
||||
import io.lbry.browser.tasks.CommentListTask;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.tasks.LighthouseSearchTask;
|
||||
import io.lbry.browser.tasks.ReadTextFileTask;
|
||||
@@ -164,6 +168,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
private Claim claim;
|
||||
private String currentUrl;
|
||||
private ClaimListAdapter relatedContentAdapter;
|
||||
private CommentListAdapter commentListAdapter;
|
||||
private BroadcastReceiver sdkReceiver;
|
||||
private Player.EventListener fileViewPlayerListener;
|
||||
|
||||
@@ -175,6 +180,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
private long startTimeMillis;
|
||||
private GetFileTask getFileTask;
|
||||
|
||||
private boolean storagePermissionRefusedOnce;
|
||||
private View buttonPublishSomething;
|
||||
private View layoutLoadingState;
|
||||
private View layoutNothingAtLocation;
|
||||
@@ -316,6 +322,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
if (claim != null) {
|
||||
Helper.saveViewHistory(currentUrl, claim);
|
||||
checkAndLoadRelatedContent();
|
||||
checkAndLoadComments();
|
||||
renderClaim();
|
||||
if (claim.getFile() == null) {
|
||||
loadFile();
|
||||
@@ -450,6 +457,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
loadFile();
|
||||
}
|
||||
checkOwnClaim();
|
||||
checkAndLoadComments();
|
||||
}
|
||||
|
||||
private String getStreamingUrl() {
|
||||
@@ -531,6 +539,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
if (claim != null) {
|
||||
Helper.saveViewHistory(url, claim);
|
||||
checkAndLoadRelatedContent();
|
||||
checkAndLoadComments();
|
||||
renderClaim();
|
||||
}
|
||||
}
|
||||
@@ -570,7 +579,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
loadAndScheduleDurations();
|
||||
}
|
||||
|
||||
if (Lbry.SDK_READY) {
|
||||
if (!Lbry.SDK_READY) {
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addSdkStatusListener(this);
|
||||
}
|
||||
@@ -651,6 +660,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
loadFile();
|
||||
|
||||
checkAndLoadRelatedContent();
|
||||
checkAndLoadComments();
|
||||
renderClaim();
|
||||
} else {
|
||||
// render nothing at location
|
||||
@@ -770,7 +780,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||
dialog.setListener(new RepostClaimDialogFragment.RepostClaimListener() {
|
||||
@Override
|
||||
public void onClaimReposted(Claim claim) {
|
||||
Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), R.string.content_successfully_reposted, Snackbar.LENGTH_LONG).show();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(R.string.content_successfully_reposted);
|
||||
}
|
||||
}
|
||||
});
|
||||
Context context = getContext();
|
||||
@@ -988,9 +1001,13 @@ public class FileViewFragment extends BaseFragment implements
|
||||
});
|
||||
|
||||
RecyclerView relatedContentList = root.findViewById(R.id.file_view_related_content_list);
|
||||
RecyclerView commentsList = root.findViewById(R.id.file_view_comments_list);
|
||||
relatedContentList.setNestedScrollingEnabled(false);
|
||||
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
||||
relatedContentList.setLayoutManager(llm);
|
||||
commentsList.setNestedScrollingEnabled(false);
|
||||
LinearLayoutManager relatedContentListLLM = new LinearLayoutManager(getContext());
|
||||
LinearLayoutManager commentsListLLM = new LinearLayoutManager(getContext());
|
||||
relatedContentList.setLayoutManager(relatedContentListLLM);
|
||||
commentsList.setLayoutManager(commentsListLLM);
|
||||
}
|
||||
|
||||
private void deleteCurrentClaim() {
|
||||
@@ -1022,6 +1039,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||
if (MainActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, context)) {
|
||||
startDownload();
|
||||
} else {
|
||||
if (storagePermissionRefusedOnce) {
|
||||
showStoragePermissionRefusedError();
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
startDownloadPending = true;
|
||||
MainActivity.requestPermission(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
@@ -1035,6 +1058,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||
private void checkStoragePermissionAndFileGet() {
|
||||
Context context = getContext();
|
||||
if (!MainActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, context)) {
|
||||
if (storagePermissionRefusedOnce) {
|
||||
showStoragePermissionRefusedError();
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
fileGetPending = true;
|
||||
MainActivity.requestPermission(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
@@ -1082,11 +1111,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
public void onStoragePermissionRefused() {
|
||||
storagePermissionRefusedOnce = true;
|
||||
fileGetPending = false;
|
||||
startDownloadPending = false;
|
||||
onDownloadAborted();
|
||||
Snackbar.make(getView(), R.string.storage_permission_rationale_download, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
|
||||
showStoragePermissionRefusedError();
|
||||
}
|
||||
|
||||
public void startDownload() {
|
||||
@@ -1303,13 +1333,29 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndLoadComments() {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
RecyclerView commentsList = root.findViewById(R.id.file_view_comments_list);
|
||||
if (commentsList == null || commentsList.getAdapter() == null || commentsList.getAdapter().getItemCount() == 0) {
|
||||
TextView commentsSDKInitializing = root.findViewById(R.id.file_view_comments_sdk_initializing);
|
||||
if (Lbry.SDK_READY) {
|
||||
Helper.setViewVisibility(commentsSDKInitializing, View.GONE);
|
||||
loadComments();
|
||||
} else {
|
||||
Helper.setViewVisibility(commentsSDKInitializing, View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showUnsupportedView() {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
root.findViewById(R.id.file_view_exoplayer_container).setVisibility(View.GONE);
|
||||
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.VISIBLE);
|
||||
String fileNameString = "";
|
||||
if (claim.getFile() != null) {
|
||||
if (claim.getFile() != null && !Helper.isNullOrEmpty(claim.getFile().getDownloadPath())) {
|
||||
LbryFile lbryFile = claim.getFile();
|
||||
File file = new File(lbryFile.getDownloadPath());
|
||||
fileNameString = String.format("\"%s\" ", file.getName());
|
||||
@@ -1842,6 +1888,39 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
private void loadComments() {
|
||||
View root = getView();
|
||||
ProgressBar relatedLoading = root.findViewById(R.id.file_view_comments_progress);
|
||||
if (claim != null && root != null) {
|
||||
CommentListTask relatedTask = new CommentListTask(1, 999, claim.getClaimId(), relatedLoading, new CommentListHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Comment> comments) {
|
||||
Context ctx = getContext();
|
||||
if (ctx != null) {
|
||||
commentListAdapter = new CommentListAdapter(comments, ctx);
|
||||
|
||||
View v = getView();
|
||||
if (v != null) {
|
||||
RecyclerView relatedContentList = root.findViewById(R.id.file_view_comments_list);
|
||||
relatedContentList.setAdapter(commentListAdapter);
|
||||
commentListAdapter.notifyDataSetChanged();
|
||||
|
||||
Helper.setViewVisibility(
|
||||
v.findViewById(R.id.file_view_no_comments),
|
||||
commentListAdapter == null || commentListAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
|
||||
}
|
||||
});
|
||||
relatedTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
if (isInFullscreenMode()) {
|
||||
disableFullScreenMode();
|
||||
@@ -1901,7 +1980,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
int statusBarHeight = activity.getStatusBarHeight();
|
||||
exoplayerContainer.setPadding(0, 0, 0, statusBarHeight);
|
||||
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2370,4 +2449,12 @@ public class FileViewFragment extends BaseFragment implements
|
||||
playerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showStoragePermissionRefusedError() {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Snackbar.make(root, R.string.storage_permission_rationale_download, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -581,58 +581,63 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
private void updateFieldsFromCurrentClaim() {
|
||||
if (currentClaim != null && !editFieldsLoaded) {
|
||||
Context context = getContext();
|
||||
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||
uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
|
||||
if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
|
||||
Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail);
|
||||
}
|
||||
|
||||
inputTitle.setText(currentClaim.getTitle());
|
||||
inputDescription.setText(currentClaim.getDescription());
|
||||
if (addedTagsAdapter != null && currentClaim.getTagObjects() != null) {
|
||||
addedTagsAdapter.addTags(currentClaim.getTagObjects());
|
||||
updateSuggestedTags(currentFilter, SUGGESTED_LIMIT, true);
|
||||
}
|
||||
|
||||
if (metadata.getFee() != null) {
|
||||
Fee fee = metadata.getFee();
|
||||
switchPrice.setChecked(true);
|
||||
inputPrice.setText(fee.getAmount());
|
||||
priceCurrencySpinner.setSelection("lbc".equalsIgnoreCase(fee.getCurrency()) ? 0 : 1);
|
||||
}
|
||||
|
||||
inputAddress.setText(currentClaim.getName());
|
||||
inputDeposit.setText(currentClaim.getAmount());
|
||||
|
||||
if (metadata.getLanguages() != null && metadata.getLanguages().size() > 0) {
|
||||
// get the first language
|
||||
String langCode = metadata.getLanguages().get(0);
|
||||
int langCodePosition = ((LanguageSpinnerAdapter) languageSpinner.getAdapter()).getItemPosition(langCode);
|
||||
if (langCodePosition > -1) {
|
||||
languageSpinner.setSelection(langCodePosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(metadata.getLicense())) {
|
||||
LicenseSpinnerAdapter adapter = (LicenseSpinnerAdapter) licenseSpinner.getAdapter();
|
||||
int licPosition = adapter.getItemPosition(metadata.getLicense());
|
||||
if (licPosition == -1) {
|
||||
licPosition = adapter.getItemPosition(Predefined.LICENSE_OTHER);
|
||||
}
|
||||
if (licPosition > -1) {
|
||||
licenseSpinner.setSelection(licPosition);
|
||||
try {
|
||||
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||
uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
|
||||
if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
|
||||
Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail);
|
||||
}
|
||||
|
||||
License selectedLicense = (License) licenseSpinner.getSelectedItem();
|
||||
boolean otherLicense = Arrays.asList(
|
||||
Predefined.LICENSE_COPYRIGHTED.toLowerCase(),
|
||||
Predefined.LICENSE_OTHER.toLowerCase()).contains(selectedLicense.getName().toLowerCase());
|
||||
inputOtherLicenseDescription.setText(otherLicense ? metadata.getLicense() : null);
|
||||
}
|
||||
inputTitle.setText(currentClaim.getTitle());
|
||||
inputDescription.setText(currentClaim.getDescription());
|
||||
if (addedTagsAdapter != null && currentClaim.getTagObjects() != null) {
|
||||
addedTagsAdapter.addTags(currentClaim.getTagObjects());
|
||||
updateSuggestedTags(currentFilter, SUGGESTED_LIMIT, true);
|
||||
}
|
||||
|
||||
inputAddress.setEnabled(false);
|
||||
editMode = true;
|
||||
editFieldsLoaded = true;
|
||||
if (metadata.getFee() != null) {
|
||||
Fee fee = metadata.getFee();
|
||||
switchPrice.setChecked(true);
|
||||
inputPrice.setText(fee.getAmount());
|
||||
priceCurrencySpinner.setSelection("lbc".equalsIgnoreCase(fee.getCurrency()) ? 0 : 1);
|
||||
}
|
||||
|
||||
inputAddress.setText(currentClaim.getName());
|
||||
inputDeposit.setText(currentClaim.getAmount());
|
||||
|
||||
if (metadata.getLanguages() != null && metadata.getLanguages().size() > 0) {
|
||||
// get the first language
|
||||
String langCode = metadata.getLanguages().get(0);
|
||||
int langCodePosition = ((LanguageSpinnerAdapter) languageSpinner.getAdapter()).getItemPosition(langCode);
|
||||
if (langCodePosition > -1) {
|
||||
languageSpinner.setSelection(langCodePosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(metadata.getLicense())) {
|
||||
LicenseSpinnerAdapter adapter = (LicenseSpinnerAdapter) licenseSpinner.getAdapter();
|
||||
int licPosition = adapter.getItemPosition(metadata.getLicense());
|
||||
if (licPosition == -1) {
|
||||
licPosition = adapter.getItemPosition(Predefined.LICENSE_OTHER);
|
||||
}
|
||||
if (licPosition > -1) {
|
||||
licenseSpinner.setSelection(licPosition);
|
||||
}
|
||||
|
||||
License selectedLicense = (License) licenseSpinner.getSelectedItem();
|
||||
boolean otherLicense = Arrays.asList(
|
||||
Predefined.LICENSE_COPYRIGHTED.toLowerCase(),
|
||||
Predefined.LICENSE_OTHER.toLowerCase()).contains(selectedLicense.getName().toLowerCase());
|
||||
inputOtherLicenseDescription.setText(otherLicense ? metadata.getLicense() : null);
|
||||
}
|
||||
|
||||
inputAddress.setEnabled(false);
|
||||
editMode = true;
|
||||
editFieldsLoaded = true;
|
||||
} catch (ClassCastException ex) {
|
||||
// invalid claim value type
|
||||
cancelOnFatalCondition(getString(R.string.publish_invalid_claim_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,6 +1043,16 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
metadata.setLicenseUrl(selectedLicense.getUrl());
|
||||
}
|
||||
|
||||
// set release time from current claim (on edit)
|
||||
if (currentClaim != null) {
|
||||
Claim.StreamMetadata currentMetadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||
metadata.setReleaseTime(currentMetadata.getReleaseTime());
|
||||
if (metadata.getReleaseTime() == 0) {
|
||||
metadata.setReleaseTime(currentClaim.getTimestamp());
|
||||
}
|
||||
claim.setTimestamp(currentClaim.getTimestamp());
|
||||
}
|
||||
|
||||
claim.setValueType(Claim.TYPE_STREAM);
|
||||
claim.setValue(metadata);
|
||||
|
||||
@@ -1405,8 +1420,11 @@ public class PublishFormFragment extends BaseFragment implements
|
||||
@Override
|
||||
public void onFilePicked(String filePath) {
|
||||
if (Helper.isNullOrEmpty(filePath)) {
|
||||
Snackbar.make(getView(), R.string.undetermined_image_filepath, Snackbar.LENGTH_LONG).setBackgroundTint(
|
||||
ContextCompat.getColor(getContext(), R.color.red)).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.undetermined_image_filepath, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.camera.core.Camera;
|
||||
@@ -53,7 +52,7 @@ public class PublishFragment extends BaseFragment implements
|
||||
CameraPermissionListener, FilePickerListener, StoragePermissionListener {
|
||||
|
||||
private boolean cameraPreviewInitialized;
|
||||
private boolean storageRefusedOnce;
|
||||
private boolean storagePermissionRefusedOnce;
|
||||
private PreviewView cameraPreview;
|
||||
private RecyclerView galleryGrid;
|
||||
private GalleryGridAdapter adapter;
|
||||
@@ -255,7 +254,9 @@ public class PublishFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
checkStoragePermissionAndLoadVideos();
|
||||
if (!storagePermissionRefusedOnce) {
|
||||
checkStoragePermissionAndLoadVideos();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@@ -400,16 +401,15 @@ public class PublishFragment extends BaseFragment implements
|
||||
|
||||
@Override
|
||||
public void onStoragePermissionRefused() {
|
||||
if (!storageRefusedOnce) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Snackbar.make(root, R.string.storage_permission_rationale_videos, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
Helper.setViewText(noVideosLoaded, R.string.storage_permission_rationale_videos);
|
||||
checkNoVideosLoaded();
|
||||
}
|
||||
storageRefusedOnce = true;
|
||||
storagePermissionRefusedOnce = true;
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Snackbar.make(root, R.string.storage_permission_rationale_videos, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
Helper.setViewText(noVideosLoaded, R.string.storage_permission_rationale_videos);
|
||||
}
|
||||
|
||||
checkNoVideosLoaded();
|
||||
}
|
||||
|
||||
public String getSuggestedPublishUrl() {
|
||||
|
||||
@@ -239,7 +239,8 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba
|
||||
@Override
|
||||
public boolean onPrepareActionMode(androidx.appcompat.view.ActionMode actionMode, Menu menu) {
|
||||
int selectionCount = adapter != null ? adapter.getSelectedCount() : 0;
|
||||
menu.findItem(R.id.action_edit).setVisible(selectionCount == 1);
|
||||
menu.findItem(R.id.action_edit).setVisible(selectionCount == 1 &&
|
||||
Claim.TYPE_STREAM.equalsIgnoreCase(adapter.getSelectedItems().get(0).getValueType()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,12 @@ public class EmailVerificationFragment extends Fragment {
|
||||
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
String layoutHint = !hasFocus ? "" : getString(R.string.email);
|
||||
inputLayoutEmail.setHint(layoutHint);
|
||||
try {
|
||||
String layoutHint = !hasFocus ? "" : getString(R.string.email);
|
||||
inputLayoutEmail.setHint(layoutHint);
|
||||
} catch (IllegalStateException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
});
|
||||
buttonContinue.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -98,9 +102,12 @@ public class EmailVerificationFragment extends Fragment {
|
||||
|
||||
private void addEmail() {
|
||||
currentEmail = Helper.getValue(inputEmail.getText());
|
||||
if (Helper.isNullOrEmpty(currentEmail) || currentEmail.indexOf("@") == -1) {
|
||||
Snackbar.make(getView(), R.string.provide_valid_email, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
if (Helper.isNullOrEmpty(currentEmail) || !currentEmail.contains("@")) {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.provide_valid_email, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -136,8 +143,11 @@ public class EmailVerificationFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
View view = getView();
|
||||
if (view != null && error != null) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
};
|
||||
Helper.setViewVisibility(buttonContinue, View.VISIBLE);
|
||||
}
|
||||
});
|
||||
@@ -194,14 +204,20 @@ public class EmailVerificationFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Snackbar.make(getView(), R.string.please_follow_instructions, Snackbar.LENGTH_LONG).show();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
Snackbar.make(view, R.string.please_follow_instructions, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
Helper.setViewEnabled(buttonResend, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
View view = getView();
|
||||
if (view != null && error != null) {
|
||||
Snackbar.make(view, error.getMessage(), Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
}
|
||||
Helper.setViewEnabled(buttonResend, true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -409,14 +409,22 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
// wallet_send task
|
||||
String recipientAddress = Helper.getValue(inputSendAddress.getText());
|
||||
String amountString = Helper.getValue(inputSendAmount.getText());
|
||||
String amount = new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).
|
||||
format(new BigDecimal(amountString).doubleValue());
|
||||
String amount = null;
|
||||
try {
|
||||
amount = new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).
|
||||
format(new BigDecimal(amountString).doubleValue());
|
||||
} catch (NumberFormatException ex) {
|
||||
Snackbar.make(getView(), R.string.invalid_amount, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||
return;
|
||||
}
|
||||
|
||||
disableSendControls();
|
||||
double actualSendAmount = Double.valueOf(amount);
|
||||
WalletSendTask task = new WalletSendTask(recipientAddress, amount, walletSendProgress, new WalletSendTask.WalletSendHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
double sentAmount = Double.valueOf(amount);
|
||||
double sentAmount = actualSendAmount;
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.you_sent_credits, sentAmount == 1.0 ? 1 : 2,
|
||||
new DecimalFormat("#,###.##").format(sentAmount));
|
||||
@@ -530,8 +538,11 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(String newAddress) {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
sp.edit().putString(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS, newAddress).apply();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
sp.edit().putString(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS, newAddress).apply();
|
||||
}
|
||||
Helper.setViewText(textWalletReceiveAddress, newAddress);
|
||||
Helper.setViewEnabled(buttonGetNewAddress, true);
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ public final class Lbry {
|
||||
public static final String METHOD_STREAM_ABANDON = "stream_abandon";
|
||||
public static final String METHOD_STREAM_REPOST = "stream_repost";
|
||||
|
||||
public static final String METHOD_COMMENT_LIST = "comment_list";
|
||||
|
||||
public static KeyStore KEYSTORE;
|
||||
public static boolean SDK_READY = false;
|
||||
|
||||
|
||||
@@ -66,6 +66,10 @@ public class LbryUri {
|
||||
REGEX_PART_MODIFIER_SEPARATOR));
|
||||
|
||||
String cleanUrl = url, queryString = null;
|
||||
if (Helper.isNullOrEmpty(url)) {
|
||||
throw new LbryUriException("Invalid url parameter.");
|
||||
}
|
||||
|
||||
Matcher qsMatcher = PATTERN_SEPARATE_QUERY_STRING.matcher(url);
|
||||
if (qsMatcher.matches()) {
|
||||
queryString = qsMatcher.group(2);
|
||||
|
||||
@@ -480,23 +480,24 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_name_area"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_publisher_name"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textFontWeight="600" />
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textFontWeight="600"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_follow_unfollow"
|
||||
@@ -611,6 +612,75 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@color/divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_comments_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/file_view_comments_progress"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/comments"
|
||||
android:textSize="16sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_no_comments"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/no_comments"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_comments_sdk_initializing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/sdk_initializing_comments"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/file_view_comments_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_channel_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="channel_name"
|
||||
android:textColor="@color/lbryGreen"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="comment_text" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -59,6 +59,9 @@
|
||||
<string name="report">Report</string>
|
||||
<string name="loading_decentralized_data">Loading decentralized data...</string>
|
||||
<string name="related_content">Related Content</string>
|
||||
<string name="comments">Comments</string>
|
||||
<string name="no_comments">No comments to display.</string>
|
||||
<string name="sdk_initializing_comments">Comments will display once the background service is done initializing.</string>
|
||||
<string name="share_lbry_content">Share LBRY content</string>
|
||||
<string name="view">View</string>
|
||||
<string name="play">Play</string>
|
||||
@@ -78,6 +81,7 @@
|
||||
<string name="confirm_delete_content_message">Are you sure you want to unpublish this content? No files will be removed from your device.</string>
|
||||
<string name="content_deleted">The content was successfully deleted from the blockchain.</string>
|
||||
<string name="content_failed_delete">The content could not be deleted at this time. Please try again later.</string>
|
||||
<string name="please_select_repost_channel">Please select a channel to repost on.</string>
|
||||
<plurals name="view_count">
|
||||
<item quantity="one">%1$s view</item>
|
||||
<item quantity="other">%1$s views</item>
|
||||
@@ -120,6 +124,7 @@
|
||||
<string name="show_extra_fields">Show extra fields</string>
|
||||
<string name="hide_extra_fields">Hide extra fields</string>
|
||||
<string name="no_file_found">No file found to publish.</string>
|
||||
<string name="publish_invalid_claim_type">Invalid claim specified for editing.</string>
|
||||
<string name="video_optimization">Video optimization</string>
|
||||
<string name="thumbnail_creation_failed">A thumbnail could not be automatically created from your content file.</string>
|
||||
<string name="video_being_optimized">Your video is being optimized for better support on a wide range of devices. You can fill out the remaining fields below while this is in progress.</string>
|
||||
@@ -388,6 +393,7 @@
|
||||
<string name="verify">Verify</string>
|
||||
<string name="please_enter_valid_phone">Please enter a valid phone number.</string>
|
||||
<string name="please_enter_verification_code">Please enter the verification code sent to your phone number.</string>
|
||||
<string name="fetch_current_user_error">User account could not be retrieved at this time. Please try again later.</string>
|
||||
|
||||
<!-- Forms -->
|
||||
<string name="no_added_tags">You have not added any tags yet. Add tags to improve discovery.</string>
|
||||
|
||||
Reference in new issue
Block a user