fixes for Play Store crash reports #921
12 changed files with 193 additions and 109 deletions
|
@ -353,7 +353,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
// workaround to fix dark theme because https://issuetracker.google.com/issues/37124582
|
// 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);
|
AppCompatDelegate.setDefaultNightMode(isDarkMode() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
|
||||||
initKeyStore();
|
initKeyStore();
|
||||||
|
@ -365,17 +369,20 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
initSpecialRouteMap();
|
initSpecialRouteMap();
|
||||||
|
|
||||||
LbryAnalytics.init(this);
|
LbryAnalytics.init(this);
|
||||||
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
try {
|
||||||
@Override
|
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
||||||
public void onComplete(Task<InstanceIdResult> task) {
|
@Override
|
||||||
if (!task.isSuccessful()) {
|
public void onComplete(Task<InstanceIdResult> task) {
|
||||||
return;
|
if (!task.isSuccessful()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Get new Instance ID token
|
||||||
|
firebaseMessagingToken = task.getResult().getToken();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
// Get new Instance ID token
|
} catch (IllegalStateException ex) {
|
||||||
firebaseMessagingToken = task.getResult().getToken();
|
// pass
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
dbHelper = new DatabaseHelper(this);
|
dbHelper = new DatabaseHelper(this);
|
||||||
|
@ -739,8 +746,13 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
|
|
||||||
public void openPublishesOnSuccessfulPublish() {
|
public void openPublishesOnSuccessfulPublish() {
|
||||||
// close publish form
|
// close publish form
|
||||||
getSupportFragmentManager().popBackStack();
|
try {
|
||||||
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
getSupportFragmentManager().popBackStack();
|
||||||
|
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
|
||||||
|
} catch (IllegalStateException ex) {
|
||||||
|
// pass
|
||||||
|
onBackPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openPublishForm(Claim claim) {
|
public void openPublishForm(Claim claim) {
|
||||||
|
@ -2486,8 +2498,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
!startingSignInFlowActivity) {
|
!startingSignInFlowActivity) {
|
||||||
enteringPIPMode = true;
|
enteringPIPMode = true;
|
||||||
PictureInPictureParams params = new PictureInPictureParams.Builder().build();
|
PictureInPictureParams params = new PictureInPictureParams.Builder().build();
|
||||||
enterPictureInPictureMode(params);
|
|
||||||
return true;
|
try {
|
||||||
|
enterPictureInPictureMode(params);
|
||||||
|
return true;
|
||||||
|
} catch (IllegalStateException ex) {
|
||||||
|
// pass
|
||||||
|
enteringPIPMode = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -2933,6 +2951,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPermission(String permission, Context context) {
|
public static boolean hasPermission(String permission, Context context) {
|
||||||
|
if (context == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception error) {
|
public void onError(Exception error) {
|
||||||
showFetchUserError(error.getMessage());
|
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -213,7 +213,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception error) {
|
public void onError(Exception error) {
|
||||||
showFetchUserError(error.getMessage());
|
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -250,7 +250,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception error) {
|
public void onError(Exception error) {
|
||||||
showFetchUserError(error.getMessage());
|
showFetchUserError(error != null ? error.getMessage() : getString(R.string.fetch_current_user_error));
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -231,6 +231,11 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
Claim channel = (Claim) channelSpinner.getSelectedItem();
|
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() {
|
StreamRepostTask task = new StreamRepostTask(name, bid, claim.getClaimId(), channel.getClaimId(), repostProgress, new ClaimResultHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeStart() {
|
public void beforeStart() {
|
||||||
|
@ -256,10 +261,13 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showError(String message) {
|
private void showError(String message) {
|
||||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
View view = getView();
|
||||||
setBackgroundTint(Color.RED).
|
if (view != null && !Helper.isNullOrEmpty(message)) {
|
||||||
setTextColor(Color.WHITE).
|
Snackbar.make(view, message, Snackbar.LENGTH_LONG).
|
||||||
show();
|
setBackgroundTint(Color.RED).
|
||||||
|
setTextColor(Color.WHITE).
|
||||||
|
show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startLoading() {
|
private void startLoading() {
|
||||||
|
|
|
@ -91,11 +91,13 @@ public class SendTipDialogFragment extends BottomSheetDialogFragment implements
|
||||||
|
|
||||||
TextView infoText = view.findViewById(R.id.tip_info);
|
TextView infoText = view.findViewById(R.id.tip_info);
|
||||||
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
infoText.setText(HtmlCompat.fromHtml(
|
if (claim != null) {
|
||||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
infoText.setText(HtmlCompat.fromHtml(
|
||||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||||
|
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||||
|
}
|
||||||
|
|
||||||
sendButton.setOnClickListener(new View.OnClickListener() {
|
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,20 +55,22 @@ public class LoadGalleryItemsTask extends AsyncTask<Void, GalleryItem, List<Gall
|
||||||
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
|
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
|
||||||
projection, null, null,
|
projection, null, null,
|
||||||
String.format("%s DESC LIMIT 150", MediaStore.MediaColumns.DATE_MODIFIED));
|
String.format("%s DESC LIMIT 150", MediaStore.MediaColumns.DATE_MODIFIED));
|
||||||
while (cursor.moveToNext()) {
|
if (cursor != null) {
|
||||||
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
|
while (cursor.moveToNext()) {
|
||||||
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
int idColumn = cursor.getColumnIndex(MediaStore.MediaColumns._ID);
|
||||||
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
int nameColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||||
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
int typeColumn = cursor.getColumnIndex(MediaStore.MediaColumns.MIME_TYPE);
|
||||||
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
int pathColumn = cursor.getColumnIndex(MediaStore.MediaColumns.DATA);
|
||||||
|
int durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
|
||||||
|
|
||||||
GalleryItem item = new GalleryItem();
|
GalleryItem item = new GalleryItem();
|
||||||
item.setId(cursor.getString(idColumn));
|
item.setId(cursor.getString(idColumn));
|
||||||
item.setName(cursor.getString(nameColumn));
|
item.setName(cursor.getString(nameColumn));
|
||||||
item.setType(cursor.getString(typeColumn));
|
item.setType(cursor.getString(typeColumn));
|
||||||
item.setFilePath(cursor.getString(pathColumn));
|
item.setFilePath(cursor.getString(pathColumn));
|
||||||
item.setDuration(cursor.getLong(durationColumn));
|
item.setDuration(cursor.getLong(durationColumn));
|
||||||
items.add(item);
|
items.add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLiteException ex) {
|
} catch (SQLiteException ex) {
|
||||||
// failed to load videos. log and pass
|
// failed to load videos. log and pass
|
||||||
|
|
|
@ -254,7 +254,13 @@ public class ChannelFormFragment extends BaseFragment implements
|
||||||
|
|
||||||
private void checkParams() {
|
private void checkParams() {
|
||||||
Map<String, Object> params = getParams();
|
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");
|
Claim claim = (Claim) params.get("claim");
|
||||||
if (claim != null && !claim.equals(this.currentClaim)) {
|
if (claim != null && !claim.equals(this.currentClaim)) {
|
||||||
this.currentClaim = claim;
|
this.currentClaim = claim;
|
||||||
|
|
|
@ -780,7 +780,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
dialog.setListener(new RepostClaimDialogFragment.RepostClaimListener() {
|
dialog.setListener(new RepostClaimDialogFragment.RepostClaimListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClaimReposted(Claim claim) {
|
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();
|
Context context = getContext();
|
||||||
|
@ -1352,7 +1355,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||||
root.findViewById(R.id.file_view_exoplayer_container).setVisibility(View.GONE);
|
root.findViewById(R.id.file_view_exoplayer_container).setVisibility(View.GONE);
|
||||||
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.VISIBLE);
|
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.VISIBLE);
|
||||||
String fileNameString = "";
|
String fileNameString = "";
|
||||||
if (claim.getFile() != null) {
|
if (claim.getFile() != null && !Helper.isNullOrEmpty(claim.getFile().getDownloadPath())) {
|
||||||
LbryFile lbryFile = claim.getFile();
|
LbryFile lbryFile = claim.getFile();
|
||||||
File file = new File(lbryFile.getDownloadPath());
|
File file = new File(lbryFile.getDownloadPath());
|
||||||
fileNameString = String.format("\"%s\" ", file.getName());
|
fileNameString = String.format("\"%s\" ", file.getName());
|
||||||
|
|
|
@ -581,58 +581,63 @@ public class PublishFormFragment extends BaseFragment implements
|
||||||
private void updateFieldsFromCurrentClaim() {
|
private void updateFieldsFromCurrentClaim() {
|
||||||
if (currentClaim != null && !editFieldsLoaded) {
|
if (currentClaim != null && !editFieldsLoaded) {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
|
try {
|
||||||
uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
|
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||||
if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
|
uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
|
||||||
Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
License selectedLicense = (License) licenseSpinner.getSelectedItem();
|
inputTitle.setText(currentClaim.getTitle());
|
||||||
boolean otherLicense = Arrays.asList(
|
inputDescription.setText(currentClaim.getDescription());
|
||||||
Predefined.LICENSE_COPYRIGHTED.toLowerCase(),
|
if (addedTagsAdapter != null && currentClaim.getTagObjects() != null) {
|
||||||
Predefined.LICENSE_OTHER.toLowerCase()).contains(selectedLicense.getName().toLowerCase());
|
addedTagsAdapter.addTags(currentClaim.getTagObjects());
|
||||||
inputOtherLicenseDescription.setText(otherLicense ? metadata.getLicense() : null);
|
updateSuggestedTags(currentFilter, SUGGESTED_LIMIT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
inputAddress.setEnabled(false);
|
if (metadata.getFee() != null) {
|
||||||
editMode = true;
|
Fee fee = metadata.getFee();
|
||||||
editFieldsLoaded = true;
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1415,8 +1420,11 @@ public class PublishFormFragment extends BaseFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void onFilePicked(String filePath) {
|
public void onFilePicked(String filePath) {
|
||||||
if (Helper.isNullOrEmpty(filePath)) {
|
if (Helper.isNullOrEmpty(filePath)) {
|
||||||
Snackbar.make(getView(), R.string.undetermined_image_filepath, Snackbar.LENGTH_LONG).setBackgroundTint(
|
View view = getView();
|
||||||
ContextCompat.getColor(getContext(), R.color.red)).show();
|
if (view != null) {
|
||||||
|
Snackbar.make(view, R.string.undetermined_image_filepath, Snackbar.LENGTH_LONG).
|
||||||
|
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,12 @@ public class EmailVerificationFragment extends Fragment {
|
||||||
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFocusChange(View view, boolean hasFocus) {
|
public void onFocusChange(View view, boolean hasFocus) {
|
||||||
String layoutHint = !hasFocus ? "" : getString(R.string.email);
|
try {
|
||||||
inputLayoutEmail.setHint(layoutHint);
|
String layoutHint = !hasFocus ? "" : getString(R.string.email);
|
||||||
|
inputLayoutEmail.setHint(layoutHint);
|
||||||
|
} catch (IllegalStateException ex) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
buttonContinue.setOnClickListener(new View.OnClickListener() {
|
buttonContinue.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -98,9 +102,12 @@ public class EmailVerificationFragment extends Fragment {
|
||||||
|
|
||||||
private void addEmail() {
|
private void addEmail() {
|
||||||
currentEmail = Helper.getValue(inputEmail.getText());
|
currentEmail = Helper.getValue(inputEmail.getText());
|
||||||
if (Helper.isNullOrEmpty(currentEmail) || currentEmail.indexOf("@") == -1) {
|
if (Helper.isNullOrEmpty(currentEmail) || !currentEmail.contains("@")) {
|
||||||
Snackbar.make(getView(), R.string.provide_valid_email, Snackbar.LENGTH_LONG).
|
View view = getView();
|
||||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
if (view != null) {
|
||||||
|
Snackbar.make(view, R.string.provide_valid_email, Snackbar.LENGTH_LONG).
|
||||||
|
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,8 +143,11 @@ public class EmailVerificationFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception error) {
|
public void onError(Exception error) {
|
||||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
View view = getView();
|
||||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
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);
|
Helper.setViewVisibility(buttonContinue, View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -194,14 +204,20 @@ public class EmailVerificationFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
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);
|
Helper.setViewEnabled(buttonResend, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception error) {
|
public void onError(Exception error) {
|
||||||
Snackbar.make(getView(), error.getMessage(), Snackbar.LENGTH_LONG).
|
View view = getView();
|
||||||
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
if (view != null && error != null) {
|
||||||
|
Snackbar.make(view, error.getMessage(), Snackbar.LENGTH_LONG).
|
||||||
|
setBackgroundTint(Color.RED).setTextColor(Color.WHITE).show();
|
||||||
|
}
|
||||||
Helper.setViewEnabled(buttonResend, true);
|
Helper.setViewEnabled(buttonResend, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -409,14 +409,22 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
// wallet_send task
|
// wallet_send task
|
||||||
String recipientAddress = Helper.getValue(inputSendAddress.getText());
|
String recipientAddress = Helper.getValue(inputSendAddress.getText());
|
||||||
String amountString = Helper.getValue(inputSendAmount.getText());
|
String amountString = Helper.getValue(inputSendAmount.getText());
|
||||||
String amount = new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).
|
String amount = null;
|
||||||
format(new BigDecimal(amountString).doubleValue());
|
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();
|
disableSendControls();
|
||||||
|
double actualSendAmount = Double.valueOf(amount);
|
||||||
WalletSendTask task = new WalletSendTask(recipientAddress, amount, walletSendProgress, new WalletSendTask.WalletSendHandler() {
|
WalletSendTask task = new WalletSendTask(recipientAddress, amount, walletSendProgress, new WalletSendTask.WalletSendHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
double sentAmount = Double.valueOf(amount);
|
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));
|
||||||
|
@ -530,8 +538,11 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String newAddress) {
|
public void onSuccess(String newAddress) {
|
||||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
|
Context context = getContext();
|
||||||
sp.edit().putString(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS, newAddress).apply();
|
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.setViewText(textWalletReceiveAddress, newAddress);
|
||||||
Helper.setViewEnabled(buttonGetNewAddress, true);
|
Helper.setViewEnabled(buttonGetNewAddress, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,10 @@ public class LbryUri {
|
||||||
REGEX_PART_MODIFIER_SEPARATOR));
|
REGEX_PART_MODIFIER_SEPARATOR));
|
||||||
|
|
||||||
String cleanUrl = url, queryString = null;
|
String cleanUrl = url, queryString = null;
|
||||||
|
if (Helper.isNullOrEmpty(url)) {
|
||||||
|
throw new LbryUriException("Invalid url parameter.");
|
||||||
|
}
|
||||||
|
|
||||||
Matcher qsMatcher = PATTERN_SEPARATE_QUERY_STRING.matcher(url);
|
Matcher qsMatcher = PATTERN_SEPARATE_QUERY_STRING.matcher(url);
|
||||||
if (qsMatcher.matches()) {
|
if (qsMatcher.matches()) {
|
||||||
queryString = qsMatcher.group(2);
|
queryString = qsMatcher.group(2);
|
||||||
|
|
|
@ -81,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="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_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="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">
|
<plurals name="view_count">
|
||||||
<item quantity="one">%1$s view</item>
|
<item quantity="one">%1$s view</item>
|
||||||
<item quantity="other">%1$s views</item>
|
<item quantity="other">%1$s views</item>
|
||||||
|
@ -123,6 +124,7 @@
|
||||||
<string name="show_extra_fields">Show extra fields</string>
|
<string name="show_extra_fields">Show extra fields</string>
|
||||||
<string name="hide_extra_fields">Hide 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="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="video_optimization">Video optimization</string>
|
||||||
<string name="thumbnail_creation_failed">A thumbnail could not be automatically created from your content file.</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>
|
<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>
|
||||||
|
@ -391,6 +393,7 @@
|
||||||
<string name="verify">Verify</string>
|
<string name="verify">Verify</string>
|
||||||
<string name="please_enter_valid_phone">Please enter a valid phone number.</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="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 -->
|
<!-- Forms -->
|
||||||
<string name="no_added_tags">You have not added any tags yet. Add tags to improve discovery.</string>
|
<string name="no_added_tags">You have not added any tags yet. Add tags to improve discovery.</string>
|
||||||
|
|
Loading…
Reference in a new issue