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 {
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 'com.google.android.material:material:1.2.0-alpha06'
implementation "androidx.cardview:cardview:1.0.0"
@ -64,7 +64,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
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-camera2: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.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.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.android.exoplayer:exoplayer-core:2.11.4'

View file

@ -746,13 +746,22 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
public void openPublishesOnSuccessfulPublish() {
// close publish form
try {
getSupportFragmentManager().popBackStack();
openFragment(PublishesFragment.class, true, NavMenuItem.ID_ITEM_PUBLISHES);
} catch (IllegalStateException ex) {
// pass
onBackPressed();
}
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
getSupportFragmentManager().popBackStack();
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) {

View file

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

View file

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

View file

@ -66,10 +66,15 @@ public class UpdateSuggestedTagsTask extends AsyncTask<Void, Void, List<Tag>> {
if (excludeMature && knownTag.isMature()) {
continue;
}
if ((knownTag.getLowercaseName().startsWith(filter) || knownTag.getLowercaseName().matches(filter)) &&
(!tags.contains(knownTag) &&
!Lbry.followedTags.contains(knownTag) && (addedTagsAdapter == null || !addedTagsAdapter.getTags().contains(knownTag)))) {
tags.add(knownTag);
try {
if ((knownTag.getLowercaseName().startsWith(filter) ||
knownTag.getLowercaseName().matches(filter)) &&
(!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) {
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));
buttonPostComment.setText(buttonText);
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;
}
fileGetPending = true;
MainActivity.requestPermission(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
MainActivity.REQUEST_STORAGE_PERMISSION,
getString(R.string.storage_permission_rationale_download),
context,
true);
try {
if (context != null) {
fileGetPending = true;
MainActivity.requestPermission(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
MainActivity.REQUEST_STORAGE_PERMISSION,
getString(R.string.storage_permission_rationale_download),
context,
true);
}
} catch (IllegalStateException ex) {
// pass
}
} else {
fileGet(true);
}
@ -2082,6 +2088,7 @@ public class FileViewFragment extends BaseFragment implements
private void resolveCommentPosters() {
if (commentListAdapter != null) {
long st = System.currentTimeMillis();;
List<String> urlsToResolve = new ArrayList<>(commentListAdapter.getClaimUrlsToResolve());
if (urlsToResolve.size() > 0) {
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) {
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));
buttonPostComment.setText(buttonText);
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()));
cameraPreviewInitialized = true;
}
} catch (ExecutionException | InterruptedException ex) {
} catch (ExecutionException | IllegalArgumentException | InterruptedException ex) {
// pass
}
}

View file

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

View file

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

View file

@ -118,6 +118,7 @@
</plurals>
<!-- 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="take_photo">Take a Photo</string>
<string name="upload_file">Upload a file</string>