Fix conflicts for merging
This commit is contained in:
commit
036516e73c
8 changed files with 130 additions and 70 deletions
|
@ -68,13 +68,13 @@ dependencies {
|
|||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha01'
|
||||
implementation "androidx.cardview:cardview:1.0.0"
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.3.1'
|
||||
implementation 'androidx.navigation:navigation-ui:2.3.1'
|
||||
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-alpha03'
|
||||
implementation 'androidx.webkit:webkit:1.4.0-rc01'
|
||||
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'
|
||||
|
@ -115,7 +115,7 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.82.0'
|
||||
// __64bitImplementation 'io.lbry:lbrysdk64:0.82.0'
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.85.1'
|
||||
// __64bitImplementation 'io.lbry:lbrysdk64:0.85.1'
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,9 @@ import org.json.JSONObject;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.net.ConnectException;
|
||||
import java.net.URI;
|
||||
import java.text.DecimalFormat;
|
||||
|
@ -321,6 +323,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
public static final String PREFERENCE_KEY_KEEP_SDK_BACKGROUND = "io.lbry.browser.preference.other.KeepSdkInBackground";
|
||||
public static final String PREFERENCE_KEY_PARTICIPATE_DATA_NETWORK = "io.lbry.browser.preference.other.ParticipateInDataNetwork";
|
||||
public static final String PREFERENCE_KEY_SEND_BUFFERING_EVENTS = "io.lbry.browser.preference.other.SendBufferingEvents";
|
||||
public static final String PREFERENCE_KEY_SHARE_USAGE_DATA = "io.lbry.browser.preference.other.ShareUsageData";
|
||||
|
||||
// Internal flags / setting preferences
|
||||
public static final String PREFERENCE_KEY_INTERNAL_SKIP_WALLET_ACCOUNT = "io.lbry.browser.preference.internal.WalletSkipAccount";
|
||||
|
@ -1744,7 +1747,21 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
checkSyncedWallet();
|
||||
}
|
||||
|
||||
(new Thread() {
|
||||
public void run() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
try {
|
||||
Log.d(TAG, "Calling settings_get");
|
||||
Log.d(TAG, ((JSONObject) Lbry.parseResponse(Lbry.apiCall("settings_get", params, Lbry.SDK_CONNECTION_STRING))).toString(2));
|
||||
} catch (Exception ex) {
|
||||
// pass
|
||||
Log.d(TAG, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
//findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
checkAndEnableShareUsageData();
|
||||
|
||||
scheduleWalletBalanceUpdate();
|
||||
scheduleWalletSyncTask();
|
||||
|
@ -3601,6 +3618,51 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
||||
}
|
||||
|
||||
private void checkAndEnableShareUsageData() {
|
||||
final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean shareUsageData = sp.getBoolean(PREFERENCE_KEY_SHARE_USAGE_DATA, false);
|
||||
if (shareUsageData) {
|
||||
return;
|
||||
}
|
||||
|
||||
(new AsyncTask<Void, Void, Void>() {
|
||||
protected Void doInBackground(Void... params) {
|
||||
PrintStream out = null;
|
||||
try {
|
||||
String fileContent = "true";
|
||||
String path = String.format("%s/sud", Utils.getAppInternalStorageDir(MainActivity.this));
|
||||
out = new PrintStream(new FileOutputStream(path));
|
||||
out.print(fileContent);
|
||||
} catch (Exception ex) {
|
||||
// pass
|
||||
} finally {
|
||||
Helper.closeCloseable(out);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
updateSdkSetting("share_usage_data", true);
|
||||
sp.edit().putBoolean(PREFERENCE_KEY_SHARE_USAGE_DATA, true).apply();
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
public void updateSdkSetting(String key, Object value) {
|
||||
(new Thread() {
|
||||
public void run() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put(key, value);
|
||||
try {
|
||||
Lbry.parseResponse(Lbry.apiCall("settings_set", params, Lbry.SDK_CONNECTION_STRING));
|
||||
} catch (Exception ex) {
|
||||
// pass
|
||||
Log.d(TAG, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public interface BackPressInterceptor {
|
||||
boolean onBackPressed();
|
||||
}
|
||||
|
|
|
@ -92,6 +92,8 @@ import java.util.Map;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
|
@ -1520,6 +1522,12 @@ public class FileViewFragment extends BaseFragment implements
|
|||
onMainActionButtonClicked();
|
||||
}
|
||||
});
|
||||
root.findViewById(R.id.file_view_open_external_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openClaimExternally(claim, claim.getMediaType());
|
||||
}
|
||||
});
|
||||
|
||||
if (metadata instanceof Claim.StreamMetadata) {
|
||||
Claim.StreamMetadata streamMetadata = (Claim.StreamMetadata) metadata;
|
||||
|
@ -2067,6 +2075,8 @@ public class FileViewFragment extends BaseFragment implements
|
|||
}
|
||||
handled = true;
|
||||
}
|
||||
} else {
|
||||
openClaimExternally(claim, mediaType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2105,7 +2115,17 @@ public class FileViewFragment extends BaseFragment implements
|
|||
@Override
|
||||
public void onSuccess(String text) {
|
||||
String html = buildMarkdownHtml(text);
|
||||
|
||||
if (webView != null) {
|
||||
// Due to a change to Chrome, WebView only displays '#' -and everything after it-
|
||||
// if it is '%23' instead. Problem appears in text like '#2' or #hashtags.
|
||||
Pattern pattern = Pattern.compile("#(\\S+)");
|
||||
Matcher matcher = pattern.matcher(html);
|
||||
|
||||
if (matcher.find()) {
|
||||
html = html.replaceAll(pattern.toString(), "&%2335;" + matcher.group(1));
|
||||
}
|
||||
|
||||
webView.loadData(html, "text/html", "utf-8");
|
||||
}
|
||||
}
|
||||
|
@ -2143,6 +2163,18 @@ public class FileViewFragment extends BaseFragment implements
|
|||
" </html>";
|
||||
}
|
||||
|
||||
private void openClaimExternally(Claim claim, String mediaType) {
|
||||
File file = new File(claim.getFile().getDownloadPath());
|
||||
Uri fileUri = Uri.parse(claim.getFile().getDownloadPath());
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(fileUri, mediaType.toLowerCase());
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
Intent chooser = Intent.createChooser(intent, getString(R.string.choose_app));
|
||||
startActivityForResult(chooser, 419);
|
||||
}
|
||||
|
||||
public void showError(String message) {
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class LbryUri {
|
||||
public static final String LBRY_TV_BASE_URL = "https://lbry.tv";
|
||||
public static final String LBRY_TV_BASE_URL = "https://lbry.tv/";
|
||||
public static final String PROTO_DEFAULT = "lbry://";
|
||||
public static final String REGEX_INVALID_URI = "[ =&#:$@%?;/\\\\\"<>%\\{\\}|^~\\[\\]`\u0000-\u0008\u000b-\u000c\u000e-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]";
|
||||
public static final String REGEX_ADDRESS = "^(b)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$";
|
||||
|
@ -183,7 +183,7 @@ public class LbryUri {
|
|||
return uri;
|
||||
}
|
||||
|
||||
public String build(boolean includeProto, String protoDefault, boolean vanity) {
|
||||
public String build(boolean includeProto, String protocol, boolean vanity) {
|
||||
String formattedChannelName = null;
|
||||
if (channelName != null) {
|
||||
formattedChannelName = channelName.startsWith("@") ? channelName : String.format("@%s", channelName);
|
||||
|
@ -206,7 +206,7 @@ public class LbryUri {
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (includeProto) {
|
||||
sb.append(protoDefault);
|
||||
sb.append(protocol);
|
||||
}
|
||||
sb.append(primaryClaimName);
|
||||
if (vanity) {
|
||||
|
@ -224,79 +224,34 @@ public class LbryUri {
|
|||
|
||||
if (!Helper.isNullOrEmpty(primaryClaimId)) {
|
||||
sb.append('#').append(primaryClaimId);
|
||||
}
|
||||
if (primaryClaimSequence > 0) {
|
||||
} else if (primaryClaimSequence > 0) {
|
||||
sb.append(':').append(primaryClaimSequence);
|
||||
}
|
||||
if (primaryBidPosition > 0) {
|
||||
} else if (primaryBidPosition > 0) {
|
||||
sb.append('$').append(primaryBidPosition);
|
||||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(secondaryClaimName)) {
|
||||
sb.append('/').append(secondaryClaimName);
|
||||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(secondaryClaimId)) {
|
||||
sb.append('#').append(secondaryClaimId);
|
||||
}
|
||||
if (secondaryClaimSequence > 0) {
|
||||
} else if (secondaryClaimSequence > 0) {
|
||||
sb.append(':').append(secondaryClaimSequence);
|
||||
}
|
||||
if (secondaryBidPosition > 0) {
|
||||
} else if (secondaryBidPosition > 0) {
|
||||
sb.append('$').append(secondaryBidPosition);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String toTvString() {
|
||||
String formattedChannelName = null;
|
||||
if (channelName != null) {
|
||||
formattedChannelName = channelName.startsWith("@") ? channelName : String.format("@%s", channelName);
|
||||
}
|
||||
String primaryClaimName = claimName;
|
||||
if (Helper.isNullOrEmpty(primaryClaimName)) {
|
||||
primaryClaimName = contentName;
|
||||
}
|
||||
if (Helper.isNullOrEmpty(primaryClaimName)) {
|
||||
primaryClaimName = formattedChannelName;
|
||||
}
|
||||
if (Helper.isNullOrEmpty(primaryClaimName)) {
|
||||
primaryClaimName = streamName;
|
||||
}
|
||||
|
||||
String primaryClaimId = claimId;
|
||||
if (Helper.isNullOrEmpty(primaryClaimId)) {
|
||||
primaryClaimId = !Helper.isNullOrEmpty(formattedChannelName) ? channelClaimId : streamClaimId;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(LBRY_TV_BASE_URL).append('/');
|
||||
sb.append(primaryClaimName);
|
||||
|
||||
String secondaryClaimName = null;
|
||||
if (Helper.isNullOrEmpty(claimName) && !Helper.isNullOrEmpty(contentName)) {
|
||||
secondaryClaimName = contentName;
|
||||
}
|
||||
if (Helper.isNullOrEmpty(secondaryClaimName)) {
|
||||
secondaryClaimName = !Helper.isNullOrEmpty(formattedChannelName) ? streamName : null;
|
||||
}
|
||||
String secondaryClaimId = !Helper.isNullOrEmpty(secondaryClaimName) ? streamClaimId : null;
|
||||
|
||||
if (!Helper.isNullOrEmpty(primaryClaimId)) {
|
||||
sb.append(':').append(primaryClaimId);
|
||||
}
|
||||
if (!Helper.isNullOrEmpty(secondaryClaimName)) {
|
||||
sb.append('/').append(secondaryClaimName);
|
||||
}
|
||||
if (!Helper.isNullOrEmpty(secondaryClaimId)) {
|
||||
sb.append(':').append(secondaryClaimId);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String normalize(String url) throws LbryUriException {
|
||||
return parse(url).toString();
|
||||
}
|
||||
|
||||
public String toTvString() {
|
||||
return build(true, LBRY_TV_BASE_URL, false);
|
||||
}
|
||||
public String toVanityString() {
|
||||
return build(true, PROTO_DEFAULT, true);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:elevation="4dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/floating_reward_container"
|
||||
|
@ -50,7 +50,7 @@
|
|||
android:foreground="?attr/selectableItemBackground"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/floating_reward_container"
|
||||
android:layout_toEndOf="@id/floating_reward_container"
|
||||
android:layout_marginStart="-36dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
|
|
|
@ -157,6 +157,13 @@
|
|||
android:textFontWeight="300"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/file_view_open_external_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/open" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/>
|
||||
<TextView
|
||||
android:id="@+id/transaction_amount"
|
||||
android:gravity="right"
|
||||
android:gravity="end"
|
||||
android:layout_weight="4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -34,7 +34,9 @@
|
|||
android:fontFamily="@font/inter"
|
||||
android:singleLine="true"
|
||||
android:textSize="14sp"
|
||||
android:textFontWeight="300" />
|
||||
android:textFontWeight="300"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textDirection="ltr"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -60,7 +62,7 @@
|
|||
/>
|
||||
<TextView
|
||||
android:id="@+id/transaction_fee"
|
||||
android:gravity="right"
|
||||
android:gravity="end"
|
||||
android:layout_weight="4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -90,10 +92,11 @@
|
|||
android:textColor="@color/lbryGreen"
|
||||
android:textSize="12sp"
|
||||
android:textFontWeight="300"
|
||||
android:textAlignment="viewStart"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/transaction_date"
|
||||
android:gravity="right"
|
||||
android:gravity="end"
|
||||
android:layout_weight="4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -106,7 +109,7 @@
|
|||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/transaction_pending_text"
|
||||
android:gravity="right"
|
||||
android:gravity="end"
|
||||
android:layout_weight="4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
<string name="please_select_repost_channel">Please select a channel to repost on.</string>
|
||||
<string name="reply">Reply</string>
|
||||
<string name="replying_to">Replying to %1$s</string>
|
||||
<string name="choose_app">Choose app</string>
|
||||
<plurals name="post_and_tip">
|
||||
<item quantity="one">Post and tip %1$s credit?</item>
|
||||
<item quantity="other">Post and tip %1$s credits?</item>
|
||||
|
|
Loading…
Reference in a new issue