Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f850685d6 | ||
|
|
5f9674e49c | ||
|
|
53d22dd22d | ||
|
|
ff8ffda3c6 | ||
|
|
64bd540322 | ||
|
|
919f9a48f3 | ||
|
|
746d442051 | ||
|
|
1877b75188 | ||
|
|
6e8c38cace | ||
|
|
eab7bab267 | ||
|
|
aab648c3cf | ||
|
|
f79ff509bd | ||
|
|
1197e990ca | ||
|
|
dce1c0715e | ||
|
|
6a0263c5bc | ||
|
|
ca64db0499 | ||
|
|
39a289e7f1 |
No files matched your search
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1606
|
||||
versionName "0.16.6"
|
||||
versionCode 1608
|
||||
versionName "0.16.8"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -80,9 +80,9 @@ 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:1.1.3'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-ui:2.2.2'
|
||||
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.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
@@ -92,15 +92,16 @@ dependencies {
|
||||
implementation 'androidx.camera:camera-lifecycle:1.0.0-beta03'
|
||||
implementation 'androidx.camera:camera-view:1.0.0-alpha10'
|
||||
implementation 'androidx.browser:browser:1.2.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
||||
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.2'
|
||||
implementation 'com.google.android.gms:play-services-base:17.2.1'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.2.0'
|
||||
implementation 'com.google.firebase:firebase-analytics:17.5.0'
|
||||
implementation 'com.google.android.gms:play-services-base:17.4.0'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.3.0'
|
||||
implementation 'com.google.oauth-client:google-oauth-client:1.30.4'
|
||||
|
||||
implementation 'com.android.billingclient:billing:3.0.0'
|
||||
implementation 'com.android.billingclient:billing:3.0.1'
|
||||
|
||||
implementation 'com.google.code.gson:gson:2.8.6'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
|
||||
@@ -126,11 +127,11 @@ dependencies {
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.81.0'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.81.0'
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.82.0'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.82.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
@@ -68,6 +68,18 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="https" android:host="open.lbry.com"/>
|
||||
<data android:scheme="https" android:host="lbry.tv" android:pathPattern="/..*/*" />
|
||||
<data android:scheme="https" android:host="lbry.tv" android:pathPattern="/.*:.*" />
|
||||
<data android:scheme="https" android:host="lbry.tv" android:pathPattern="/.*#.*" />
|
||||
<data android:scheme="https" android:host="lbry.lat" android:pathPattern="/..*/*" />
|
||||
<data android:scheme="https" android:host="lbry.lat" android:pathPattern="/.*:.*" />
|
||||
<data android:scheme="https" android:host="lbry.lat" android:pathPattern="/.*#.*" />
|
||||
<data android:scheme="https" android:host="lbry.fr" android:pathPattern="/..*/*" />
|
||||
<data android:scheme="https" android:host="lbry.fr" android:pathPattern="/.*:.*" />
|
||||
<data android:scheme="https" android:host="lbry.fr" android:pathPattern="/.*#.*" />
|
||||
<data android:scheme="https" android:host="lbry.in" android:pathPattern="/..*/*" />
|
||||
<data android:scheme="https" android:host="lbry.in" android:pathPattern="/.*:.*" />
|
||||
<data android:scheme="https" android:host="lbry.in" android:pathPattern="/.*#.*" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
@@ -201,7 +201,6 @@ public class FirstRunActivity extends AppCompatActivity {
|
||||
try {
|
||||
writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.write(installId);
|
||||
android.util.Log.d("LbryMain", "Generated install ID=" + installId);
|
||||
} catch (IOException ex) {
|
||||
return false;
|
||||
} finally {
|
||||
|
||||
@@ -100,7 +100,7 @@ public class LbrynetMessagingService extends FirebaseMessagingService {
|
||||
|
||||
@Override
|
||||
public void onNewToken(String token) {
|
||||
Log.d(TAG, "Refreshed token: " + token);
|
||||
//Log.d(TAG, "Refreshed token: " + token);
|
||||
|
||||
// If you want to send messages to this application instance or
|
||||
// manage this apps subscriptions on the server side, send the
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.ClipData;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -36,6 +37,7 @@ import android.text.style.TypefaceSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Menu;
|
||||
import android.view.WindowManager;
|
||||
@@ -75,7 +77,9 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
@@ -98,6 +102,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
@@ -142,6 +147,7 @@ import io.lbry.browser.listener.FilePickerListener;
|
||||
import io.lbry.browser.listener.PIPModeListener;
|
||||
import io.lbry.browser.listener.ScreenOrientationListener;
|
||||
import io.lbry.browser.listener.SdkStatusListener;
|
||||
import io.lbry.browser.listener.SelectionModeListener;
|
||||
import io.lbry.browser.listener.StoragePermissionListener;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
@@ -165,6 +171,7 @@ import io.lbry.browser.tasks.lbryinc.FetchRewardsTask;
|
||||
import io.lbry.browser.tasks.LighthouseAutoCompleteTask;
|
||||
import io.lbry.browser.tasks.MergeSubscriptionsTask;
|
||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||
import io.lbry.browser.tasks.lbryinc.NotificationDeleteTask;
|
||||
import io.lbry.browser.tasks.lbryinc.NotificationListTask;
|
||||
import io.lbry.browser.tasks.lbryinc.NotificationUpdateTask;
|
||||
import io.lbry.browser.tasks.localdata.FetchRecentUrlHistoryTask;
|
||||
@@ -209,7 +216,9 @@ import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements SdkStatusListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public class MainActivity extends AppCompatActivity implements SdkStatusListener,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
ActionMode.Callback, SelectionModeListener {
|
||||
private static final String CHANNEL_ID_PLAYBACK = "io.lbry.browser.LBRY_PLAYBACK_CHANNEL";
|
||||
private static final int PLAYBACK_NOTIFICATION_ID = 3;
|
||||
private static final String SPECIAL_URL_PREFIX = "lbry://?";
|
||||
@@ -244,6 +253,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static boolean startingPermissionRequest = false;
|
||||
public static boolean startingSignInFlowActivity = false;
|
||||
|
||||
private ActionMode actionMode;
|
||||
private BillingClient billingClient;
|
||||
@Getter
|
||||
private boolean enteringPIPMode = false;
|
||||
@@ -366,6 +376,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
private MediaSessionCompat mediaSession;
|
||||
private boolean receivedStopService;
|
||||
private ActionBarDrawerToggle toggle;
|
||||
private SwipeRefreshLayout notificationsSwipeContainer;
|
||||
private SyncSetTask syncSetTask = null;
|
||||
private List<WalletSync> pendingSyncSetQueue;
|
||||
@Getter
|
||||
@@ -581,6 +592,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
});
|
||||
|
||||
notificationsSwipeContainer = findViewById(R.id.notifications_list_swipe_container);
|
||||
notificationsSwipeContainer.setColorSchemeResources(R.color.nextLbryGreen);
|
||||
notificationsSwipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
notificationsSwipeContainer.setRefreshing(true);
|
||||
loadRemoteNotifications(false);
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.global_now_playing_card).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -1041,7 +1062,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
fragment instanceof LibraryFragment ||
|
||||
fragment instanceof SearchFragment;
|
||||
findViewById(R.id.floating_balance_main_container).setVisibility(!canShowFloatingBalance || inFullscreenMode ? View.INVISIBLE : View.VISIBLE);
|
||||
if (!(fragment instanceof FileViewFragment) && !(fragment instanceof ShuffleFragment) && !inFullscreenMode) {
|
||||
if (!(fragment instanceof FileViewFragment) && !(fragment instanceof ShuffleFragment) && !inFullscreenMode && nowPlayingClaim != null) {
|
||||
findViewById(R.id.global_now_playing_card).setVisibility(View.VISIBLE);
|
||||
}
|
||||
/*if (!Lbry.SDK_READY && !inFullscreenMode) {
|
||||
@@ -1874,6 +1895,103 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
this.actionMode = mode;
|
||||
if (isDarkMode()) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
|
||||
actionMode.getMenuInflater().inflate(R.menu.menu_notification, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
if (R.id.action_delete == item.getItemId()) {
|
||||
if (notificationListAdapter != null && notificationListAdapter.getSelectedCount() > 0) {
|
||||
|
||||
final List<LbryNotification> selectedNotifications = new ArrayList<>(notificationListAdapter.getSelectedItems());
|
||||
String message = getResources().getQuantityString(R.plurals.confirm_delete_notifications, selectedNotifications.size());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this).
|
||||
setTitle(R.string.delete_selection).
|
||||
setMessage(message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
handleDeleteSelectedNotifications(selectedNotifications);
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
if (notificationListAdapter != null) {
|
||||
notificationListAdapter.clearSelectedItems();
|
||||
notificationListAdapter.setInSelectionMode(false);
|
||||
notificationListAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (isDarkMode()) {
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
this.actionMode = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnterSelectionMode() {
|
||||
startSupportActionMode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExitSelectionMode() {
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelectionToggled() {
|
||||
if (actionMode != null) {
|
||||
actionMode.setTitle(notificationListAdapter != null ? String.valueOf(notificationListAdapter.getSelectedCount()) : "");
|
||||
actionMode.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDeleteSelectedNotifications(List<LbryNotification> notifications) {
|
||||
List<Long> remoteIds = new ArrayList<>();
|
||||
for (LbryNotification notification : notifications) {
|
||||
remoteIds.add(notification.getRemoteId());
|
||||
}
|
||||
(new AsyncTask<Void, Void, Void>() {
|
||||
protected Void doInBackground(Void... params) {
|
||||
try {
|
||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||
DatabaseHelper.deleteNotifications(notifications, db);
|
||||
} catch (Exception ex) {
|
||||
// pass
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new NotificationDeleteTask(remoteIds).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
if (notificationListAdapter != null) {
|
||||
notificationListAdapter.removeNotifications(notifications);
|
||||
}
|
||||
if (actionMode != null) {
|
||||
actionMode.finish();
|
||||
}
|
||||
}
|
||||
|
||||
private class PlayerNotificationDescriptionAdapter implements PlayerNotificationManager.MediaDescriptionAdapter {
|
||||
|
||||
@Override
|
||||
@@ -2713,11 +2831,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
String claimId = item.getString("claim_id");
|
||||
String channelName = item.getString("channel_name");
|
||||
boolean isNotificationsDisabled = item.getBoolean("is_notifications_disabled");
|
||||
|
||||
LbryUri url = new LbryUri();
|
||||
url.setChannelName(channelName);
|
||||
url.setClaimId(claimId);
|
||||
subscriptions.add(new Subscription(channelName, url.toString()));
|
||||
subscriptions.add(new Subscription(channelName, url.toString(), isNotificationsDisabled));
|
||||
subUrls.add(url.toString());
|
||||
}
|
||||
Lbryio.subscriptions = subscriptions;
|
||||
@@ -2854,9 +2973,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
try {
|
||||
LbryUri uri = LbryUri.parse(url);
|
||||
if (uri.isChannel()) {
|
||||
openChannelUrl(url);
|
||||
openChannelUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
|
||||
} else {
|
||||
openFileUrl(url);
|
||||
openFileUrl(url.startsWith(LbryUri.PROTO_DEFAULT) ? url : uri.toString());
|
||||
}
|
||||
} catch (LbryUriException ex) {
|
||||
// pass
|
||||
@@ -3389,6 +3508,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
if (markRead && findViewById(R.id.notifications_container).getVisibility() == View.VISIBLE) {
|
||||
markNotificationsRead();
|
||||
}
|
||||
|
||||
if (notificationsSwipeContainer != null) {
|
||||
notificationsSwipeContainer.setRefreshing(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3396,6 +3519,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
// pass
|
||||
Log.e(TAG, "error loading remote notifications", exception);
|
||||
loadLocalNotifications();
|
||||
if (notificationsSwipeContainer != null) {
|
||||
notificationsSwipeContainer.setRefreshing(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
@@ -3425,6 +3551,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
if (notificationListAdapter == null) {
|
||||
notificationListAdapter = new NotificationListAdapter(notifications, MainActivity.this);
|
||||
notificationListAdapter.setSelectionModeListener(MainActivity.this);
|
||||
((RecyclerView) findViewById(R.id.notifications_list)).setAdapter(notificationListAdapter);
|
||||
} else {
|
||||
notificationListAdapter.addNotifications(notifications);
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -24,6 +25,7 @@ import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.listener.SelectionModeListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.lbryinc.LbryNotification;
|
||||
import io.lbry.browser.ui.controls.SolidIconView;
|
||||
@@ -43,15 +45,19 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||
|
||||
private Context context;
|
||||
private List<LbryNotification> items;
|
||||
private List<LbryNotification> selectedItems;
|
||||
@Setter
|
||||
private NotificationClickListener clickListener;
|
||||
@Getter
|
||||
@Setter
|
||||
private int customizeMode;
|
||||
private boolean inSelectionMode;
|
||||
@Setter
|
||||
private SelectionModeListener selectionModeListener;
|
||||
|
||||
public NotificationListAdapter(List<LbryNotification> notifications, Context context) {
|
||||
this.context = context;
|
||||
this.items = new ArrayList<>(notifications);
|
||||
this.selectedItems = new ArrayList<>();
|
||||
Collections.sort(items, Collections.reverseOrder(new LbryNotification()));
|
||||
}
|
||||
|
||||
@@ -62,6 +68,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||
protected TextView timeView;
|
||||
protected SolidIconView iconView;
|
||||
protected ImageView thumbnailView;
|
||||
protected View selectedOverlayView;
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
layoutView = v.findViewById(R.id.notification_layout);
|
||||
@@ -70,12 +77,25 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||
timeView = v.findViewById(R.id.notification_time);
|
||||
iconView = v.findViewById(R.id.notification_icon);
|
||||
thumbnailView = v.findViewById(R.id.notification_author_thumbnail);
|
||||
selectedOverlayView = v.findViewById(R.id.notification_selected_overlay);
|
||||
}
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return items != null ? items.size() : 0;
|
||||
}
|
||||
public List<LbryNotification> getSelectedItems() {
|
||||
return this.selectedItems;
|
||||
}
|
||||
public int getSelectedCount() {
|
||||
return selectedItems != null ? selectedItems.size() : 0;
|
||||
}
|
||||
public void clearSelectedItems() {
|
||||
this.selectedItems.clear();
|
||||
}
|
||||
public boolean isNotificationSelected(LbryNotification notification) {
|
||||
return selectedItems.contains(notification);
|
||||
}
|
||||
|
||||
public void insertNotification(LbryNotification notification, int index) {
|
||||
if (!items.contains(notification)) {
|
||||
@@ -90,6 +110,12 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public void removeNotifications(List<LbryNotification> notifications) {
|
||||
for (LbryNotification notification : notifications) {
|
||||
items.remove(notification);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public List<String> getAuthorUrls() {
|
||||
List<String> urls = new ArrayList<>();
|
||||
@@ -158,9 +184,8 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||
@Override
|
||||
public void onBindViewHolder(NotificationListAdapter.ViewHolder vh, int position) {
|
||||
LbryNotification notification = items.get(position);
|
||||
|
||||
|
||||
vh.layoutView.setBackgroundColor(ContextCompat.getColor(context, notification.isSeen() ? android.R.color.transparent : R.color.nextLbryGreenSemiTransparent));
|
||||
vh.selectedOverlayView.setVisibility(isNotificationSelected(notification) ? View.VISIBLE : View.GONE);
|
||||
|
||||
vh.titleView.setVisibility(!Helper.isNullOrEmpty(notification.getTitle()) ? View.VISIBLE : View.GONE);
|
||||
vh.titleView.setText(notification.getTitle());
|
||||
@@ -181,11 +206,49 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||
vh.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (clickListener != null) {
|
||||
clickListener.onNotificationClicked(notification);
|
||||
if (inSelectionMode) {
|
||||
toggleSelectedNotification(notification);
|
||||
} else {
|
||||
if (clickListener != null) {
|
||||
clickListener.onNotificationClicked(notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
vh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
if (!inSelectionMode) {
|
||||
inSelectionMode = true;
|
||||
if (selectionModeListener != null) {
|
||||
selectionModeListener.onEnterSelectionMode();
|
||||
}
|
||||
}
|
||||
toggleSelectedNotification(notification);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void toggleSelectedNotification(LbryNotification notification) {
|
||||
if (selectedItems.contains(notification)) {
|
||||
selectedItems.remove(notification);
|
||||
} else {
|
||||
selectedItems.add(notification);
|
||||
}
|
||||
|
||||
if (selectionModeListener != null) {
|
||||
selectionModeListener.onItemSelectionToggled();
|
||||
}
|
||||
|
||||
if (selectedItems.size() == 0) {
|
||||
inSelectionMode = false;
|
||||
if (selectionModeListener != null) {
|
||||
selectionModeListener.onExitSelectionMode();
|
||||
}
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private long getLocalNotificationTime(LbryNotification notification) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLInput;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -21,13 +22,13 @@ import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.LbryUri;
|
||||
|
||||
public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
public static final int DATABASE_VERSION = 7;
|
||||
public static final int DATABASE_VERSION = 8;
|
||||
public static final String DATABASE_NAME = "LbryApp.db";
|
||||
private static DatabaseHelper instance;
|
||||
|
||||
private static final String[] SQL_CREATE_TABLES = {
|
||||
// local subscription store
|
||||
"CREATE TABLE subscriptions (url TEXT PRIMARY KEY NOT NULL, channel_name TEXT NOT NULL)",
|
||||
"CREATE TABLE subscriptions (url TEXT PRIMARY KEY NOT NULL, channel_name TEXT NOT NULL, is_notifications_disabled INTEGER DEFAULT 0 NOT NULL)",
|
||||
// url entry / suggestion history
|
||||
"CREATE TABLE url_history (id INTEGER PRIMARY KEY NOT NULL, value TEXT NOT NULL, url TEXT, type INTEGER NOT NULL, timestamp TEXT NOT NULL)",
|
||||
// tags (known and followed)
|
||||
@@ -105,11 +106,15 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
"CREATE TABLE shuffle_watched (id INTEGER PRIMARY KEY NOT NULL, claim_id TEXT NOT NULL)",
|
||||
"CREATE UNIQUE INDEX idx_shuffle_watched_claim ON shuffle_watched (claim_id)"
|
||||
};
|
||||
private static final String[] SQL_V7_V8_UPGRADE = {
|
||||
"AlTER TABLE subscriptions ADD COLUMN is_notifications_disabled INTEGER DEFAULT 0 NOT NULL"
|
||||
};
|
||||
|
||||
private static final String SQL_INSERT_SUBSCRIPTION = "REPLACE INTO subscriptions (channel_name, url) VALUES (?, ?)";
|
||||
private static final String SQL_INSERT_SUBSCRIPTION = "REPLACE INTO subscriptions (channel_name, url, is_notifications_disabled) VALUES (?, ?, ?)";
|
||||
private static final String SQL_UPDATE_SUBSCRIPTION_NOTIFICATION = "UPDATE subscriptions SET is_notification_disabled = ? WHERE url = ?";
|
||||
private static final String SQL_CLEAR_SUBSCRIPTIONS = "DELETE FROM subscriptions";
|
||||
private static final String SQL_DELETE_SUBSCRIPTION = "DELETE FROM subscriptions WHERE url = ?";
|
||||
private static final String SQL_GET_SUBSCRIPTIONS = "SELECT channel_name, url FROM subscriptions";
|
||||
private static final String SQL_GET_SUBSCRIPTIONS = "SELECT channel_name, url, is_notifications_disabled FROM subscriptions";
|
||||
|
||||
private static final String SQL_INSERT_URL_HISTORY = "REPLACE INTO url_history (value, url, type, timestamp) VALUES (?, ?, ?, ?)";
|
||||
private static final String SQL_CLEAR_URL_HISTORY = "DELETE FROM url_history";
|
||||
@@ -188,6 +193,11 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
db.execSQL(sql);
|
||||
}
|
||||
}
|
||||
if (oldVersion < 8) {
|
||||
for (String sql : SQL_V7_V8_UPGRADE) {
|
||||
db.execSQL(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
|
||||
@@ -304,7 +314,14 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public static void createOrUpdateSubscription(Subscription subscription, SQLiteDatabase db) {
|
||||
db.execSQL(SQL_INSERT_SUBSCRIPTION, new Object[] { subscription.getChannelName(), subscription.getUrl() });
|
||||
db.execSQL(SQL_INSERT_SUBSCRIPTION, new Object[] {
|
||||
subscription.getChannelName(),
|
||||
subscription.getUrl(),
|
||||
subscription.isNotificationsDisabled() ? 1 : 0
|
||||
});
|
||||
}
|
||||
public static void setSubscriptionNotificationDisabled(boolean flag, String url, SQLiteDatabase db) {
|
||||
db.execSQL(SQL_UPDATE_SUBSCRIPTION_NOTIFICATION, new Object[] { flag ? 1 : 0, url });
|
||||
}
|
||||
public static void deleteSubscription(Subscription subscription, SQLiteDatabase db) {
|
||||
db.execSQL(SQL_DELETE_SUBSCRIPTION, new Object[] { subscription.getUrl() });
|
||||
@@ -321,6 +338,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
Subscription subscription = new Subscription();
|
||||
subscription.setChannelName(cursor.getString(0));
|
||||
subscription.setUrl(cursor.getString(1));
|
||||
subscription.setNotificationsDisabled(cursor.getInt(2) == 1);
|
||||
subscriptions.add(subscription);
|
||||
}
|
||||
} finally {
|
||||
@@ -372,6 +390,20 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
public static void deleteNotifications(List<LbryNotification> notifications, SQLiteDatabase db) {
|
||||
StringBuilder sb = new StringBuilder("DELETE FROM notifications WHERE remote_id IN (");
|
||||
List<Object> remoteIds = new ArrayList<>();
|
||||
String delim = "";
|
||||
for (int i = 0; i < notifications.size(); i++) {
|
||||
remoteIds.add(String.valueOf(notifications.get(i).getRemoteId()));
|
||||
sb.append(delim).append("?");
|
||||
delim = ",";
|
||||
}
|
||||
sb.append(")");
|
||||
|
||||
String sql = sb.toString();
|
||||
db.execSQL(sql, remoteIds.toArray());
|
||||
}
|
||||
public static int getUnreadNotificationsCount(SQLiteDatabase db) {
|
||||
int count = 0;
|
||||
Cursor cursor = null;
|
||||
|
||||
@@ -225,9 +225,10 @@ public class CreateSupportDialogFragment extends BottomSheetDialogFragment imple
|
||||
if (!isTip) {
|
||||
sendButton.setText(R.string.send_revocable_support);
|
||||
} else {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
String amountString = Helper.getValue(inputAmount.getText(), "0");
|
||||
double parsedAmount = Helper.parseDouble(amountString, 0);
|
||||
sendButton.setText(parsedAmount == 0 ? getString(R.string.send_a_tip) : getString(R.string.send_lbc_tip, amountString));
|
||||
String text = getResources().getQuantityString(R.plurals.send_lbc_tip, parsedAmount == 1.0 ? 1 : 2, amountString);
|
||||
sendButton.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,17 +11,21 @@ public class Subscription {
|
||||
@Getter
|
||||
@Setter
|
||||
private String url;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean isNotificationsDisabled;
|
||||
|
||||
public Subscription() {
|
||||
|
||||
}
|
||||
public Subscription(String channelName, String url) {
|
||||
public Subscription(String channelName, String url, boolean isNotificationsDisabled) {
|
||||
this.channelName = channelName;
|
||||
this.url = url;
|
||||
this.isNotificationsDisabled = isNotificationsDisabled;
|
||||
}
|
||||
|
||||
public static Subscription fromClaim(Claim claim) {
|
||||
return new Subscription(claim.getName(), claim.getPermanentUrl());
|
||||
return new Subscription(claim.getName(), claim.getPermanentUrl(), false);
|
||||
}
|
||||
public String toString() {
|
||||
return url;
|
||||
|
||||
@@ -52,7 +52,6 @@ public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
|
||||
options.put("visible", true);
|
||||
|
||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_COMMENT_LIST, options);
|
||||
android.util.Log.d("LbryMain", result.toString(2));
|
||||
JSONArray items = result.getJSONArray("items");
|
||||
|
||||
List<Comment> children = new ArrayList<>();
|
||||
@@ -78,7 +77,6 @@ public class CommentListTask extends AsyncTask<Void, Void, List<Comment>> {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
android.util.Log.d("LbryMain", ex.toString(), ex);
|
||||
}
|
||||
return comments;
|
||||
}
|
||||
|
||||
@@ -76,13 +76,15 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
// check for any remote subs that may have been removed, and unsubscribe from them
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
// TODO: Refactor by creating static Subscription.fromJSON method
|
||||
String claimId = item.getString("claim_id");
|
||||
String channelName = item.getString("channel_name");
|
||||
boolean isNotificationsDisabled = item.getBoolean("is_notifications_disabled");
|
||||
|
||||
LbryUri url = new LbryUri();
|
||||
url.setChannelName(channelName);
|
||||
url.setClaimId(claimId);
|
||||
Subscription subscription = new Subscription(channelName, url.toString());
|
||||
Subscription subscription = new Subscription(channelName, url.toString(), isNotificationsDisabled);
|
||||
remoteSubs.add(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ public class ChannelSubscribeTask extends AsyncTask<Void, Void, Boolean> {
|
||||
options.put("claim_id", channelClaimId);
|
||||
if (!isUnsubscribing) {
|
||||
options.put("channel_name", subscription.getChannelName());
|
||||
options.put("notifications_disabled", String.valueOf(subscription.isNotificationsDisabled()).toLowerCase());
|
||||
}
|
||||
|
||||
String action = isUnsubscribing ? "delete" : "new";
|
||||
Lbryio.call("subscription", action, options, context);
|
||||
|
||||
Object response = Lbryio.parseResponse(Lbryio.call("subscription", action, options, context));
|
||||
if (!isUnsubscribing) {
|
||||
Lbryio.addSubscription(subscription);
|
||||
} else {
|
||||
|
||||
@@ -49,11 +49,12 @@ public class FetchSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
String claimId = item.getString("claim_id");
|
||||
String channelName = item.getString("channel_name");
|
||||
boolean isNotificationsDisabled = item.getBoolean("is_notifications_disabled");
|
||||
|
||||
LbryUri url = new LbryUri();
|
||||
url.setChannelName(channelName);
|
||||
url.setClaimId(claimId);
|
||||
Subscription subscription = new Subscription(channelName, url.toString());
|
||||
Subscription subscription = new Subscription(channelName, url.toString(), isNotificationsDisabled);
|
||||
subscriptions.add(subscription);
|
||||
// Persist the subscription locally if it doesn't exist
|
||||
if (db != null) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.lbry.browser.tasks.lbryinc;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class NotificationDeleteTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private List<Long> ids;
|
||||
|
||||
public NotificationDeleteTask(List<Long> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("notification_ids", Helper.joinL(ids, ","));
|
||||
|
||||
try {
|
||||
Object result = Lbryio.parseResponse(Lbryio.call("notification", "delete", options, null));
|
||||
return "ok".equalsIgnoreCase(result.toString());
|
||||
} catch (LbryioResponseException | LbryioRequestException ex) {
|
||||
// pass
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
private View buttonShare;
|
||||
private View buttonTip;
|
||||
private View buttonFollowUnfollow;
|
||||
private View buttonBell;
|
||||
private SolidIconView iconBell;
|
||||
private int subCount;
|
||||
private OutlineIconView iconFollow;
|
||||
private SolidIconView iconUnfollow;
|
||||
@@ -112,6 +114,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
buttonFollowUnfollow = root.findViewById(R.id.channel_view_follow_unfollow);
|
||||
iconFollow = root.findViewById(R.id.channel_view_icon_follow);
|
||||
iconUnfollow = root.findViewById(R.id.channel_view_icon_unfollow);
|
||||
buttonBell = root.findViewById(R.id.channel_view_subscribe_notify);
|
||||
iconBell = root.findViewById(R.id.channel_view_icon_bell);
|
||||
|
||||
tabPager = root.findViewById(R.id.channel_view_pager);
|
||||
tabLayout = root.findViewById(R.id.channel_view_tabs);
|
||||
@@ -202,6 +206,39 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
}
|
||||
});
|
||||
|
||||
buttonBell.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (claim != null) {
|
||||
boolean isNotificationsDisabled = Lbryio.isNotificationsDisabled(claim);
|
||||
final Subscription subscription = Subscription.fromClaim(claim);
|
||||
subscription.setNotificationsDisabled(!isNotificationsDisabled);
|
||||
view.setEnabled(false);
|
||||
Context context = getContext();
|
||||
new ChannelSubscribeTask(context, claim.getClaimId(), subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
view.setEnabled(true);
|
||||
Lbryio.updateSubscriptionNotificationsDisabled(subscription);
|
||||
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(subscription.isNotificationsDisabled() ?
|
||||
R.string.receive_no_notifications : R.string.receive_all_notifications);
|
||||
}
|
||||
|
||||
checkIsFollowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
view.setEnabled(true);
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
buttonFollowUnfollow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -213,7 +250,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
subscribing = true;
|
||||
boolean isFollowing = Lbryio.isFollowing(claim);
|
||||
Subscription subscription = Subscription.fromClaim(claim);
|
||||
buttonFollowUnfollow.setEnabled(false);
|
||||
view.setEnabled(false);
|
||||
new ChannelSubscribeTask(getContext(), claim.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
@@ -280,8 +317,14 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
private void checkIsFollowing() {
|
||||
if (claim != null) {
|
||||
boolean isFollowing = Lbryio.isFollowing(claim);
|
||||
boolean notificationsDisabled = Lbryio.isNotificationsDisabled(claim);
|
||||
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(buttonBell, isFollowing ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (iconBell != null) {
|
||||
iconBell.setText(notificationsDisabled ? R.string.fa_bell : R.string.fa_bell_slash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -784,6 +785,38 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
private View.OnClickListener bellIconListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
Claim publisher = claim.getSigningChannel();
|
||||
boolean isNotificationsDisabled = Lbryio.isNotificationsDisabled(publisher);
|
||||
final Subscription subscription = Subscription.fromClaim(publisher);
|
||||
subscription.setNotificationsDisabled(!isNotificationsDisabled);
|
||||
view.setEnabled(false);
|
||||
Context context = getContext();
|
||||
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, false, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
view.setEnabled(true);
|
||||
Lbryio.updateSubscriptionNotificationsDisabled(subscription);
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).showMessage(subscription.isNotificationsDisabled() ?
|
||||
R.string.receive_no_notifications : R.string.receive_all_notifications);
|
||||
}
|
||||
checkIsFollowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
view.setEnabled(true);
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -1015,30 +1048,39 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
boolean isOwnClaim = Lbry.ownClaims.contains(claim);
|
||||
if (isOwnClaim) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
||||
setTitle(R.string.delete_content).
|
||||
setMessage(R.string.confirm_delete_content_message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
deleteCurrentClaim();
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
||||
setTitle(R.string.delete_file).
|
||||
setMessage(R.string.confirm_delete_file_message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
deleteClaimFile();
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
||||
setTitle(R.string.delete_file).
|
||||
setMessage(R.string.confirm_delete_file_message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
deleteClaimFile();
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
root.findViewById(R.id.file_view_action_unpublish).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (!Lbry.SDK_READY) {
|
||||
Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
||||
setTitle(R.string.delete_content).
|
||||
setMessage(R.string.confirm_delete_content_message)
|
||||
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
deleteCurrentClaim();
|
||||
}
|
||||
}).setNegativeButton(R.string.no, null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1160,8 +1202,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||
|
||||
View buttonFollow = root.findViewById(R.id.file_view_icon_follow);
|
||||
View buttonUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
|
||||
View buttonBell = root.findViewById(R.id.file_view_icon_bell);
|
||||
buttonFollow.setOnClickListener(followUnfollowListener);
|
||||
buttonUnfollow.setOnClickListener(followUnfollowListener);
|
||||
buttonBell.setOnClickListener(bellIconListener);
|
||||
|
||||
commentChannelSpinnerAdapter = new InlineChannelSpinnerAdapter(getContext(), R.layout.spinner_item_channel, new ArrayList<>());
|
||||
commentChannelSpinnerAdapter.addPlaceholder(false);
|
||||
@@ -2514,13 +2558,18 @@ public class FileViewFragment extends BaseFragment implements
|
||||
private void checkIsFollowing() {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
boolean isFollowing = Lbryio.isFollowing(claim.getSigningChannel());
|
||||
boolean notificationsDisabled = Lbryio.isNotificationsDisabled(claim.getSigningChannel());
|
||||
Context context = getContext();
|
||||
View root = getView();
|
||||
if (context != null && root != null) {
|
||||
OutlineIconView iconFollow = root.findViewById(R.id.file_view_icon_follow);
|
||||
SolidIconView iconUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
|
||||
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE: View.INVISIBLE);
|
||||
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.INVISIBLE);
|
||||
SolidIconView iconBell = root.findViewById(R.id.file_view_icon_bell);
|
||||
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE: View.GONE);
|
||||
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(iconBell, isFollowing ? View.VISIBLE : View.GONE);
|
||||
|
||||
iconBell.setText(notificationsDisabled ? R.string.fa_bell : R.string.fa_bell_slash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2778,10 +2827,13 @@ public class FileViewFragment extends BaseFragment implements
|
||||
boolean isOwnClaim = Lbry.ownClaims.contains(claim);
|
||||
View root = getView();
|
||||
if (root != null) {
|
||||
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_download), isOwnClaim ? View.GONE : View.VISIBLE);
|
||||
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_report), isOwnClaim ? View.GONE : View.VISIBLE);
|
||||
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_edit), isOwnClaim ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_delete), isOwnClaim ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(root.findViewById(R.id.file_view_action_unpublish), isOwnClaim ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
||||
LinearLayout fileViewActionsArea = root.findViewById(R.id.file_view_actions_area);
|
||||
fileViewActionsArea.setWeightSum(isOwnClaim ? 6 : 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,6 +348,10 @@ public final class Helper {
|
||||
return cs != null ? cs.toString().trim() : "";
|
||||
}
|
||||
|
||||
public static String getValue(CharSequence cs, String defaultValue) {
|
||||
return cs != null && !Helper.isNullOrEmpty(cs.toString()) ? cs.toString().trim() : defaultValue;
|
||||
}
|
||||
|
||||
public static List<String> buildContentSortOrder(int sortBy) {
|
||||
List<String> sortOrder = new ArrayList<>();
|
||||
switch (sortBy) {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LbryUri {
|
||||
public static final int CLAIM_ID_MAX_LENGTH = 40;
|
||||
|
||||
private static final String REGEX_PART_PROTOCOL = "^((?:lbry://|https://)?)";
|
||||
private static final String REGEX_PART_HOST = "((?:open.lbry.com/)?)";
|
||||
private static final String REGEX_PART_HOST = "((?:open.lbry.com/|lbry.tv/|lbry.lat/|lbry.fr/|lbry.in/)?)";
|
||||
private static final String REGEX_PART_STREAM_OR_CHANNEL_NAME = "([^:$#/]*)";
|
||||
private static final String REGEX_PART_MODIFIER_SEPARATOR = "([:$#]?)([^/]*)";
|
||||
private static final String QUERY_STRING_BREAKER = "^([\\S]+)([?][\\S]*)";
|
||||
@@ -128,9 +128,14 @@ public class LbryUri {
|
||||
boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName);
|
||||
String channelName = includesChannel && streamOrChannelName.length() > 1 ? streamOrChannelName.substring(1) : null;
|
||||
|
||||
// It would have thrown already on the RegEx parser if protocol value was incorrect
|
||||
// open.lbry.com uses ':' as ModSeparators while lbry:// expects '#'
|
||||
if (components.get(1).equals("open.lbry.com/")) {
|
||||
/*
|
||||
* It would have thrown already on the RegEx parser if protocol value was incorrect
|
||||
* or HTTPS host was unknown to us.
|
||||
*
|
||||
* [https://] hosts use ':' as ModSeparators while [lbry://] protocol expects '#'
|
||||
*/
|
||||
|
||||
if (!components.get(1).isEmpty()) {
|
||||
if (primaryModSeparator.equals(":"))
|
||||
primaryModSeparator = "#";
|
||||
if (secondaryModSeparator.equals(":"))
|
||||
|
||||
@@ -333,6 +333,15 @@ public final class Lbryio {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateSubscriptionNotificationsDisabled(Subscription subscription) {
|
||||
synchronized (lock) {
|
||||
int index = subscriptions.indexOf(subscription);
|
||||
if (index > -1) {
|
||||
subscriptions.get(index).setNotificationsDisabled(subscription.isNotificationsDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addSubscription(Subscription subscription) {
|
||||
synchronized (lock) {
|
||||
if (!subscriptions.contains(subscription)) {
|
||||
@@ -364,6 +373,15 @@ public final class Lbryio {
|
||||
public static boolean isFollowing(Claim claim) {
|
||||
return subscriptions.contains(Subscription.fromClaim(claim));
|
||||
}
|
||||
public static boolean isNotificationsDisabled(Claim claim) {
|
||||
Subscription sub = Subscription.fromClaim(claim);
|
||||
int index = subscriptions.indexOf(sub);
|
||||
if (index > -1) {
|
||||
Subscription actual = subscriptions.get(subscriptions.indexOf(sub));
|
||||
return actual.isNotificationsDisabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void updateRewardsLists(List<Reward> rewards) {
|
||||
synchronized (lock) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#FFFFFF"
|
||||
android:alpha="0.8">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13L7,13v-2h10v2z"/>
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 208 B |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 504 B |
@@ -72,10 +72,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/wallet_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -62,10 +62,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/inline_channel_form_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -71,13 +71,18 @@
|
||||
android:textSize="16sp"
|
||||
android:textAlignment="center" />
|
||||
</LinearLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/notifications_list"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/notifications_list_swipe_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="8dp"
|
||||
android:clipToPadding="false"
|
||||
/>
|
||||
android:layout_height="match_parent">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/notifications_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="8dp"
|
||||
android:clipToPadding="false"
|
||||
/>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/floating_wallet_balance" />
|
||||
|
||||
@@ -103,10 +103,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/create_support_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -158,7 +159,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send_lbc_tip"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -127,10 +127,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/repost_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -56,13 +56,11 @@
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="16dp">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:textSize="10dp"
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/fa_coins" />
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -224,9 +224,27 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textColor="@color/foreground"
|
||||
android:textSize="20dp"
|
||||
android:visibility="invisible"/>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/channel_view_subscribe_notify"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:visibility="gone">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/channel_view_icon_bell"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_bell_slash"
|
||||
android:textColor="@color/foreground"
|
||||
android:textSize="20dp"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -215,10 +215,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/channel_form_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/file_view_global_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -83,13 +84,11 @@
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="7dp"
|
||||
android:visibility="gone">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="8dp"
|
||||
android:text="@string/fa_coins"
|
||||
android:textColor="@android:color/black" />
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/file_view_fee"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -433,6 +432,36 @@
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_unpublish"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
<RelativeLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:tint="@color/foreground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_unpublish" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/unpublish"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_action_report"
|
||||
android:clickable="true"
|
||||
@@ -474,7 +503,6 @@
|
||||
android:id="@+id/file_view_publisher_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_info_area"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
@@ -484,7 +512,7 @@
|
||||
android:paddingTop="12dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:layout_toStartOf="@id/file_view_icon_follow">
|
||||
android:layout_toStartOf="@id/file_view_publisher_area_actions">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_avatar"
|
||||
android:layout_width="50dp"
|
||||
@@ -541,33 +569,50 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<io.lbry.browser.ui.controls.OutlineIconView
|
||||
android:id="@+id/file_view_icon_follow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentEnd="true"
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_publisher_area_actions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
android:layout_alignParentEnd="true">
|
||||
<io.lbry.browser.ui.controls.OutlineIconView
|
||||
android:id="@+id/file_view_icon_follow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_unfollow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textSize="20dp"
|
||||
android:visibility="invisible" />
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_unfollow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textColor="@color/foreground"
|
||||
android:textSize="20dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_bell"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/fa_bell_slash"
|
||||
android:textColor="@color/foreground"
|
||||
android:textSize="20dp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
@@ -578,52 +623,56 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_description_area"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_view_description"
|
||||
android:textSize="12sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:autoLink="all"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textColorLink="@color/lbryGreen"
|
||||
android:textFontWeight="300"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp" />
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_view_tag_area"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="10"
|
||||
android:paddingTop="36dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="10"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="36dp">
|
||||
|
||||
<TextView
|
||||
android:layout_weight="2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/tags"
|
||||
android:textSize="12sp"
|
||||
android:textFontWeight="600" />
|
||||
android:textFontWeight="600"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/file_view_tag_list"
|
||||
android:layout_weight="8"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="8" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:background="@color/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="0.5dp" />
|
||||
android:background="@color/divider" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -751,4 +800,5 @@
|
||||
android:visibility="gone">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -436,10 +436,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/publish_form_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -91,12 +91,11 @@
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="2dp"
|
||||
android:visibility="gone">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="12dp"
|
||||
android:text="@string/fa_coins" />
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/claim_fee"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -101,13 +101,11 @@
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="7dp"
|
||||
android:visibility="gone">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="8dp"
|
||||
android:text="@string/fa_coins"
|
||||
android:textColor="@android:color/black"/>
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/claim_fee"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -28,6 +28,20 @@
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:visibility="invisible" />
|
||||
<RelativeLayout
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bg_channel_overlay_icon"
|
||||
android:id="@+id/notification_selected_overlay"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:visibility="gone">
|
||||
<ImageView
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/ic_check"
|
||||
android:tint="@color/nextLbryGreen" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
|
||||
@@ -106,13 +106,11 @@
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="7dp"
|
||||
android:visibility="gone">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textSize="8dp"
|
||||
android:text="@string/fa_coins"
|
||||
android:textColor="@android:color/black"/>
|
||||
android:src="@drawable/ic_credits" />
|
||||
<TextView
|
||||
android:id="@+id/claim_fee"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_delete"
|
||||
android:icon="@drawable/ic_delete"
|
||||
android:title="@string/delete"
|
||||
app:iconTint="@color/actionBarForeground"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
@@ -117,6 +117,8 @@
|
||||
<string name="content">Content</string>
|
||||
<string name="website">Website</string>
|
||||
<string name="reposted">reposted</string>
|
||||
<string name="receive_all_notifications">You will receive all notifications</string>
|
||||
<string name="receive_no_notifications">You will not receive notifications for this channel</string>
|
||||
<plurals name="follower_count">
|
||||
<item quantity="one">%1$s follower</item>
|
||||
<item quantity="other">%1$s followers</item>
|
||||
@@ -208,7 +210,7 @@
|
||||
<string name="cca_nc_nd_4_0_international">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International</string>
|
||||
|
||||
<string-array name="publish_currencies">
|
||||
<item>LBC</item>
|
||||
<item>LBRY Credits</item>
|
||||
<item>USD</item>
|
||||
</string-array>
|
||||
|
||||
@@ -227,7 +229,7 @@
|
||||
<string name="oops_something_went_wrong">Oops! Something went wrong.</string>
|
||||
<string name="installation_id_loaded">Loaded Installation ID.</string>
|
||||
<string name="known_tags_loaded">Loaded local known and followed tags.</string>
|
||||
<string name="exchange_rate_loaded">Loaded LBC/USD exchange rate.</string>
|
||||
<string name="exchange_rate_loaded">Loaded LBRY Credits/USD exchange rate.</string>
|
||||
<string name="user_authenticated">User authenticated.</string>
|
||||
<string name="installation_registered">Installation registered.</string>
|
||||
<string name="subscriptions_loaded">Loaded subscriptions.</string>
|
||||
@@ -298,6 +300,7 @@
|
||||
<string name="receive">Receive</string>
|
||||
<string name="spend">Spend</string>
|
||||
<string name="publish">Publish</string>
|
||||
<string name="unpublish">Unpublish</string>
|
||||
<string name="support">Support</string>
|
||||
<string name="abandon">Abandon</string>
|
||||
<string name="channel">Channel</string>
|
||||
@@ -313,7 +316,7 @@
|
||||
<string name="manual_backup"><a href="https://lbry.com/faq/how-to-backup-wallet#android">Manual backup</a></string>
|
||||
<string name="sync_faq"><a href="https://lbry.com/faq/how-to-backup-wallet#sync">Sync FAQ</a></string>
|
||||
<string name="zero">0</string>
|
||||
<string name="lbc">LBC</string>
|
||||
<string name="lbc" translatable="false">Credits</string>
|
||||
|
||||
<string name="account_recommended">Account Recommended</string>
|
||||
<string name="wallet_account_desc">A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.</string>
|
||||
@@ -337,7 +340,7 @@
|
||||
<string name="confirm_unlock_tips">Are you sure you want to unlock all your tips?</string>
|
||||
<string name="min_spend_required">Please enter an amount more than 0.0001 credits.</string>
|
||||
|
||||
<string name="buy_lbc">Buy LBC</string>
|
||||
<string name="buy_lbc">Buy LBRY Credits</string>
|
||||
<string name="hash_not_supported">Your device does not support the minimum requirements for securing your purchase request.</string>
|
||||
<string name="receive_address_not_set">You do not have a wallet address set. Please generate a new address and try again.</string>
|
||||
|
||||
@@ -381,7 +384,11 @@
|
||||
<string name="channel_to_show_support_as">Channel to show support as</string>
|
||||
<string name="make_this_a_tip">Make this a tip</string>
|
||||
<string name="send_revocable_support">Send Revocable Support</string>
|
||||
<string name="send_lbc_tip">Send a %1$s LBC Tip</string>
|
||||
<string name="send_lbc_tip">Tip %1$s</string>
|
||||
<plurals name="send_lbc_tip">
|
||||
<item quantity="one">Tip %1$s Credit</item>
|
||||
<item quantity="other">Tip %1$s Credits</item>
|
||||
</plurals>
|
||||
<string name="send_tip_info_content">This will appear as a tip for %1$s, which will boost its ability to be discovered while active. <a href="https://lbry.com/faq/tipping">Learn more</a>.</string>
|
||||
<string name="send_tip_info_channel">This will appear as a tip for %1$s, which will boost the channel\'s ability to be discovered while active. <a href="https://lbry.com/faq/tipping">Learn more</a>.</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
@@ -476,7 +483,7 @@
|
||||
<string name="title">Title</string>
|
||||
<string name="at">\@</string>
|
||||
<string name="deposit">Deposit</string>
|
||||
<string name="deposit_remains_yours">This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.</string>
|
||||
<string name="deposit_remains_yours">The credits remains yours. It is a deposit to reserve the name and can be undone at any time.</string>
|
||||
<string name="storage_permission_rationale_download">LBRY requires access to download content to your device.</string>
|
||||
<string name="storage_permission_rationale_images">LBRY requires access to load images from your device storage.</string>
|
||||
<string name="select_thumbnail">Select thumbnail</string>
|
||||
@@ -510,7 +517,7 @@
|
||||
</plurals>
|
||||
|
||||
<!-- Rewards -->
|
||||
<string name="lbry_credits_allow">LBRY credits allow you to publish or purchase content.</string>
|
||||
<string name="lbry_credits_allow">LBRY Credits allow you to publish or purchase content.</string>
|
||||
<string name="free_credits_worth">You can obtain free credits worth $%1$s after you provide an email address.</string>
|
||||
<string name="rewards_learn_more"><a href="https://lbry.com/faq/earn-credits">Learn more</a>.</string>
|
||||
<string name="get_started">Get started</string>
|
||||
@@ -624,6 +631,10 @@
|
||||
|
||||
<!-- Notifications -->
|
||||
<string name="no_notifications">It\'s quiet here! New notifications will be displayed when you receive them.</string>
|
||||
<plurals name="confirm_delete_notifications">
|
||||
<item quantity="one">Are you sure you want to remove the selected notification?</item>
|
||||
<item quantity="other">Are you sure you want to remove the selected notifications?</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<string name="fa_gift" translatable="false"></string>
|
||||
@@ -653,4 +664,7 @@
|
||||
<string name="fa_comment_alt" translatable="false"></string>
|
||||
<string name="fa_broadcast_tower" translatable="false"></string>
|
||||
<string name="fa_random" translatable="false"></string>
|
||||
|
||||
<string name="fa_bell" translatable="false"></string>
|
||||
<string name="fa_bell_slash" translatable="false"></string>
|
||||
</resources>
|
||||
@@ -0,0 +1,130 @@
|
||||
package io.lbry.browser.utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class LbryUriTest {
|
||||
private LbryUri expected;
|
||||
|
||||
/*
|
||||
* Create an LbryUri object and assign fields manually using class methods. This object will be
|
||||
* compared with LbryUri.parse() returned object on each test.
|
||||
*/
|
||||
@Before
|
||||
public void createExpected() {
|
||||
expected = new LbryUri();
|
||||
expected.setChannelName("@lbry");
|
||||
expected.setStreamName("lbryturns4");
|
||||
|
||||
try {
|
||||
LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "3f");
|
||||
LbryUri.UriModifier secondaryMod = LbryUri.UriModifier.parse("#", "6");
|
||||
expected.setChannelClaimId(primaryMod.getClaimId());
|
||||
expected.setStreamClaimId(secondaryMod.getClaimId());
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseOpenLbryComWithChannel() {
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("https://open.lbry.com/@lbry:3f/lbryturns4:6",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals(expected, obtained);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseLbryTvWithChannel() {
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("https://lbry.tv/@lbry:3f/lbryturns4:6",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals(expected, obtained);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseLbryAlterWithChannel() {
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("https://lbry.lat/@lbry:3f/lbryturns4:6",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals(expected, obtained);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseLbryProtocolWithChannel() {
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("lbry://@lbry#3f/lbryturns4#6",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals(expected, obtained);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseLbryProtocolOnlyChannel() {
|
||||
LbryUri expectedForChannel = sinthesizeExpected();
|
||||
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("lbry://@UCBerkeley#d",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals(expectedForChannel, obtained);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseLbryTvProtocolOnlyChannel() {
|
||||
LbryUri expectedForChannel = sinthesizeExpected();
|
||||
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("https://lbry.tv/@UCBerkeley:d",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals(expectedForChannel, obtained);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LbryUri sinthesizeExpected() {
|
||||
LbryUri expectedForChannel = new LbryUri();
|
||||
expectedForChannel.setChannelName("@UCBerkeley");
|
||||
expectedForChannel.setChannel(true);
|
||||
|
||||
try {
|
||||
LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "d");
|
||||
expectedForChannel.setChannelClaimId(primaryMod.getClaimId());
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return expectedForChannel;
|
||||
}
|
||||
}
|
||||