More crash fixes. Change comment cost to 2 LBC.

This commit is contained in:
Akinwale Ariwodola 2020-06-02 08:55:34 +01:00
parent 61263dd59d
commit 9ed8864f23
11 changed files with 55 additions and 30 deletions

View file

@ -54,7 +54,7 @@ task printVersionName {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0-rc01' implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha06' implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
@ -64,7 +64,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.webkit:webkit:1.3.0-alpha02' implementation 'androidx.webkit:webkit:1.3.0-alpha03'
implementation 'androidx.camera:camera-core:1.0.0-beta03' implementation 'androidx.camera:camera-core:1.0.0-beta03'
implementation 'androidx.camera:camera-camera2:1.0.0-beta03' implementation 'androidx.camera:camera-camera2:1.0.0-beta03'
implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03' implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03'
@ -72,9 +72,9 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.squareup.okhttp3:okhttp:4.4.1' implementation 'com.squareup.okhttp3:okhttp:4.4.1'
implementation 'com.google.firebase:firebase-analytics:17.4.1' implementation 'com.google.firebase:firebase-analytics:17.4.2'
implementation 'com.google.android.gms:play-services-base:17.2.1' implementation 'com.google.android.gms:play-services-base:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.1.7' implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4' implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'

View file

@ -746,13 +746,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void openPublishesOnSuccessfulPublish() { public void openPublishesOnSuccessfulPublish() {
// close publish form // close publish form
try { runOnUiThread(new Runnable() {
getSupportFragmentManager().popBackStack(); @Override
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES); public void run() {
} catch (IllegalStateException ex) { try {
// pass getSupportFragmentManager().popBackStack();
onBackPressed(); openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
} } catch (IllegalStateException ex) {
// pass
try {
onBackPressed();
} catch (IllegalStateException iex) {
// if this fails on some devices. what's the solution?
}
}
}
});
} }
public void openPublishForm(Claim claim) { public void openPublishForm(Claim claim) {

View file

@ -192,14 +192,16 @@ public class RepostClaimDialogFragment extends BottomSheetDialogFragment impleme
private void loadChannels(List<Claim> channels) { private void loadChannels(List<Claim> channels) {
if (channelSpinnerAdapter == null) { if (channelSpinnerAdapter == null) {
Context context = getContext(); Context context = getContext();
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels); if (context != null) {
channelSpinnerAdapter.notifyDataSetChanged(); channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels);
channelSpinnerAdapter.notifyDataSetChanged();
}
} else { } else {
channelSpinnerAdapter.clear(); channelSpinnerAdapter.clear();
channelSpinnerAdapter.addAll(channels); channelSpinnerAdapter.addAll(channels);
channelSpinnerAdapter.notifyDataSetChanged(); channelSpinnerAdapter.notifyDataSetChanged();
} }
if (channelSpinner != null) { if (channelSpinner != null && channelSpinnerAdapter != null) {
channelSpinner.setAdapter(channelSpinnerAdapter); channelSpinner.setAdapter(channelSpinnerAdapter);
} }
} }

View file

@ -12,7 +12,7 @@ import lombok.Data;
@Data @Data
public class Comment { public class Comment {
public static final double COST = 0.25; public static final double LBC_COST = 2;
public static final int MAX_LENGTH = 2000; public static final int MAX_LENGTH = 2000;
private Claim poster; private Claim poster;

View file

@ -66,10 +66,15 @@ public class UpdateSuggestedTagsTask extends AsyncTask<Void, Void, List<Tag>> {
if (excludeMature && knownTag.isMature()) { if (excludeMature && knownTag.isMature()) {
continue; continue;
} }
if ((knownTag.getLowercaseName().startsWith(filter) || knownTag.getLowercaseName().matches(filter)) && try {
(!tags.contains(knownTag) && if ((knownTag.getLowercaseName().startsWith(filter) ||
!Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))) { knownTag.getLowercaseName().matches(filter)) &&
tags.add(knownTag); (!tags.contains(knownTag) && !Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))
) {
tags.add(knownTag);
}
} catch (Exception ex) {
// continue
} }
} }
} }

View file

@ -350,7 +350,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
} }
private void initCommentForm(View root) { private void initCommentForm(View root) {
double amount = Comment.COST / Lbryio.LBCUSDRate; double amount = Comment.LBC_COST;
String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount)); String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount));
buttonPostComment.setText(buttonText); buttonPostComment.setText(buttonText);
textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH)); textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH));

View file

@ -1171,13 +1171,19 @@ public class FileViewFragment extends BaseFragment implements
return; return;
} }
fileGetPending = true; try {
MainActivity.requestPermission( if (context != null) {
Manifest.permission.WRITE_EXTERNAL_STORAGE, fileGetPending = true;
MainActivity.REQUEST_STORAGE_PERMISSION, MainActivity.requestPermission(
getString(R.string.storage_permission_rationale_download), Manifest.permission.WRITE_EXTERNAL_STORAGE,
context, MainActivity.REQUEST_STORAGE_PERMISSION,
true); getString(R.string.storage_permission_rationale_download),
context,
true);
}
} catch (IllegalStateException ex) {
// pass
}
} else { } else {
fileGet(true); fileGet(true);
} }
@ -2082,6 +2088,7 @@ public class FileViewFragment extends BaseFragment implements
private void resolveCommentPosters() { private void resolveCommentPosters() {
if (commentListAdapter != null) { if (commentListAdapter != null) {
long st = System.currentTimeMillis();;
List<String> urlsToResolve = new ArrayList<>(commentListAdapter.getClaimUrlsToResolve()); List<String> urlsToResolve = new ArrayList<>(commentListAdapter.getClaimUrlsToResolve());
if (urlsToResolve.size() > 0) { if (urlsToResolve.size() > 0) {
ResolveTask task = new ResolveTask(urlsToResolve, Lbry.SDK_CONNECTION_STRING, null, new ClaimListResultHandler() { ResolveTask task = new ResolveTask(urlsToResolve, Lbry.SDK_CONNECTION_STRING, null, new ClaimListResultHandler() {
@ -2723,7 +2730,7 @@ public class FileViewFragment extends BaseFragment implements
} }
private void initCommentForm(View root) { private void initCommentForm(View root) {
double amount = Comment.COST / Lbryio.LBCUSDRate; double amount = Comment.LBC_COST;
String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount)); String buttonText = getResources().getQuantityString(R.plurals.post_for_credits, amount == 1 ? 1 : 2, Helper.LBC_CURRENCY_FORMAT.format(amount));
buttonPostComment.setText(buttonText); buttonPostComment.setText(buttonText);
textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH)); textCommentLimit.setText(String.format("%d / %d", Helper.getValue(inputComment.getText()).length(), Comment.MAX_LENGTH));

View file

@ -140,7 +140,7 @@ public class PublishFragment extends BaseFragment implements
preview.setSurfaceProvider(cameraPreview.createSurfaceProvider(camera.getCameraInfo())); preview.setSurfaceProvider(cameraPreview.createSurfaceProvider(camera.getCameraInfo()));
cameraPreviewInitialized = true; cameraPreviewInitialized = true;
} }
} catch (ExecutionException | InterruptedException ex) { } catch (ExecutionException | IllegalArgumentException | InterruptedException ex) {
// pass // pass
} }
} }

View file

@ -12,6 +12,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;

View file

@ -43,7 +43,7 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:src="@drawable/gerbil_happy" /> android:src="@drawable/gerbil_happy" />
<TextView <TextView
android:text="@string/no_channel_created" android:text="@string/no_publishes_created"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"

View file

@ -118,6 +118,7 @@
</plurals> </plurals>
<!-- Publish --> <!-- Publish -->
<string name="no_publishes_created">It looks like you have not published content to LBRY yet.</string>
<string name="record">Record</string> <string name="record">Record</string>
<string name="take_photo">Take a Photo</string> <string name="take_photo">Take a Photo</string>
<string name="upload_file">Upload a file</string> <string name="upload_file">Upload a file</string>