Some dark theme and crash fixes. Implement publish form.
This commit is contained in:
parent
39b91a8886
commit
7514a81a31
21 changed files with 368 additions and 28 deletions
|
@ -95,6 +95,7 @@ import io.lbry.browser.data.DatabaseHelper;
|
||||||
import io.lbry.browser.dialog.ContentScopeDialogFragment;
|
import io.lbry.browser.dialog.ContentScopeDialogFragment;
|
||||||
import io.lbry.browser.exceptions.LbryUriException;
|
import io.lbry.browser.exceptions.LbryUriException;
|
||||||
import io.lbry.browser.listener.CameraPermissionListener;
|
import io.lbry.browser.listener.CameraPermissionListener;
|
||||||
|
import io.lbry.browser.listener.DarkThemeChangeListener;
|
||||||
import io.lbry.browser.listener.DownloadActionListener;
|
import io.lbry.browser.listener.DownloadActionListener;
|
||||||
import io.lbry.browser.listener.FetchChannelsListener;
|
import io.lbry.browser.listener.FetchChannelsListener;
|
||||||
import io.lbry.browser.listener.SdkStatusListener;
|
import io.lbry.browser.listener.SdkStatusListener;
|
||||||
|
@ -774,6 +775,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
applyNavbarSigninPadding();
|
applyNavbarSigninPadding();
|
||||||
checkFirstRun();
|
checkFirstRun();
|
||||||
checkNowPlaying();
|
checkNowPlaying();
|
||||||
|
if (Lbryio.totalUnclaimedRewardAmount > 0) {
|
||||||
|
showFloatingUnclaimedRewards();
|
||||||
|
}
|
||||||
|
|
||||||
// check (and start) the LBRY SDK service
|
// check (and start) the LBRY SDK service
|
||||||
serviceRunning = isServiceRunning(this, LbrynetService.class);
|
serviceRunning = isServiceRunning(this, LbrynetService.class);
|
||||||
|
@ -962,9 +966,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
|
|
||||||
public void clearWunderbarFocus(View view) {
|
public void clearWunderbarFocus(View view) {
|
||||||
findViewById(R.id.wunderbar).clearFocus();
|
findViewById(R.id.wunderbar).clearFocus();
|
||||||
findViewById(R.id.wunderbar_container).requestFocus();
|
findViewById(R.id.app_bar_main_container).requestFocus();
|
||||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
||||||
}
|
}
|
||||||
public View getWunderbar() {
|
public View getWunderbar() {
|
||||||
return findViewById(R.id.wunderbar);
|
return findViewById(R.id.wunderbar);
|
||||||
|
@ -2486,7 +2488,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment.setRetainInstance(true);
|
//fragment.setRetainInstance(true);
|
||||||
FragmentManager manager = getSupportFragmentManager();
|
FragmentManager manager = getSupportFragmentManager();
|
||||||
FragmentTransaction transaction = manager.beginTransaction().replace(R.id.content_main, fragment);
|
FragmentTransaction transaction = manager.beginTransaction().replace(R.id.content_main, fragment);
|
||||||
if (allowNavigateBack) {
|
if (allowNavigateBack) {
|
||||||
|
@ -2554,6 +2556,16 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
return (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onThemeChanged() {
|
||||||
|
FragmentManager manager = getSupportFragmentManager();
|
||||||
|
for (int i = 0; i < manager.getFragments().size(); i++) {
|
||||||
|
Fragment f = manager.getFragments().get(i);
|
||||||
|
if (f instanceof DarkThemeChangeListener) {
|
||||||
|
((DarkThemeChangeListener) f).onDarkThemeToggled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public interface BackPressInterceptor {
|
public interface BackPressInterceptor {
|
||||||
boolean onBackPressed();
|
boolean onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,19 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeFeaturedItem() {
|
||||||
|
int featuredIndex = -1;
|
||||||
|
for (int i = 0; i < items.size(); i++) {
|
||||||
|
if (items.get(i).isFeatured()) {
|
||||||
|
featuredIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (featuredIndex > -1) {
|
||||||
|
items.remove(featuredIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Claim> getItems() {
|
public List<Claim> getItems() {
|
||||||
return new ArrayList<>(this.items);
|
return new ArrayList<>(this.items);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +338,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inSelectionMode) {
|
if (inSelectionMode) {
|
||||||
toggleSelectedClaim(item);
|
toggleSelectedClaim(original);
|
||||||
} else {
|
} else {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onClaimClicked(item);
|
listener.onClaimClicked(item);
|
||||||
|
@ -351,7 +364,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||||
selectionModeListener.onEnterSelectionMode();
|
selectionModeListener.onEnterSelectionMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toggleSelectedClaim(item);
|
toggleSelectedClaim(original);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package io.lbry.browser.listener;
|
||||||
|
|
||||||
|
public interface DarkThemeChangeListener {
|
||||||
|
void onDarkThemeToggled();
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
import io.lbry.browser.utils.Helper;
|
import io.lbry.browser.utils.Helper;
|
||||||
import io.lbry.browser.utils.LbryUri;
|
import io.lbry.browser.utils.LbryUri;
|
||||||
|
import io.lbry.browser.utils.Predefined;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@ -156,6 +157,17 @@ public class Claim {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public boolean isMature() {
|
||||||
|
List<String> tags = getTags();
|
||||||
|
if (tags != null && tags.size() > 0) {
|
||||||
|
for (String tag : tags) {
|
||||||
|
if (Predefined.MATURE_TAGS.contains(tag.toLowerCase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public String getThumbnailUrl() {
|
public String getThumbnailUrl() {
|
||||||
if (value != null && value.getThumbnail() != null) {
|
if (value != null && value.getThumbnail() != null) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClassCastException | LbryioRequestException | LbryioResponseException | JSONException | SQLiteException ex) {
|
} catch (ClassCastException | LbryioRequestException | LbryioResponseException | JSONException | IllegalStateException | SQLiteException ex) {
|
||||||
error = ex;
|
error = ex;
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package io.lbry.browser.tasks.claim;
|
||||||
|
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.lbry.browser.exceptions.ApiCallException;
|
||||||
|
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||||
|
import io.lbry.browser.utils.Helper;
|
||||||
|
import io.lbry.browser.utils.Lbry;
|
||||||
|
|
||||||
|
public class AbandonStreamTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
|
private List<String> claimIds;
|
||||||
|
private List<String> successfulClaimIds;
|
||||||
|
private List<String> failedClaimIds;
|
||||||
|
private List<Exception> failedExceptions;
|
||||||
|
private View progressView;
|
||||||
|
private AbandonHandler handler;
|
||||||
|
|
||||||
|
public AbandonStreamTask(List<String> claimIds, View progressView, AbandonHandler handler) {
|
||||||
|
this.claimIds = claimIds;
|
||||||
|
this.progressView = progressView;
|
||||||
|
this.handler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPreExecute() {
|
||||||
|
Helper.setViewVisibility(progressView, View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean doInBackground(Void... params) {
|
||||||
|
successfulClaimIds = new ArrayList<>();
|
||||||
|
failedClaimIds = new ArrayList<>();
|
||||||
|
failedExceptions = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String claimId : claimIds) {
|
||||||
|
try {
|
||||||
|
Map<String, Object> options = new HashMap<>();
|
||||||
|
options.put("claim_id", claimId);
|
||||||
|
options.put("blocking", false);
|
||||||
|
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_STREAM_ABANDON, options);
|
||||||
|
android.util.Log.d("#HELP", result.toString());
|
||||||
|
successfulClaimIds.add(claimId);
|
||||||
|
} catch (ApiCallException ex) {
|
||||||
|
android.util.Log.e("#HELP", ex.getMessage(), ex);
|
||||||
|
failedClaimIds.add(claimId);
|
||||||
|
failedExceptions.add(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPostExecute(Boolean result) {
|
||||||
|
Helper.setViewVisibility(progressView, View.GONE);
|
||||||
|
if (handler != null) {
|
||||||
|
handler.onComplete(successfulClaimIds, failedClaimIds, failedExceptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,7 +83,7 @@ public class LoadSharedUserStateTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
DatabaseHelper.createOrUpdateSubscription(subscription, db);
|
DatabaseHelper.createOrUpdateSubscription(subscription, db);
|
||||||
}
|
}
|
||||||
} catch (LbryUriException | SQLiteException ex) {
|
} catch (LbryUriException | SQLiteException | IllegalStateException ex) {
|
||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,7 @@ public class ChannelManagerFragment extends BaseFragment implements ActionMode.C
|
||||||
if (R.id.action_delete == menuItem.getItemId()) {
|
if (R.id.action_delete == menuItem.getItemId()) {
|
||||||
if (adapter != null && adapter.getSelectedCount() > 0) {
|
if (adapter != null && adapter.getSelectedCount() > 0) {
|
||||||
final List<Claim> selectedClaims = new ArrayList<>(adapter.getSelectedItems());
|
final List<Claim> selectedClaims = new ArrayList<>(adapter.getSelectedItems());
|
||||||
|
android.util.Log.d("#HELP", selectedClaims.toString());
|
||||||
String message = getResources().getQuantityString(R.plurals.confirm_delete_channels, selectedClaims.size());
|
String message = getResources().getQuantityString(R.plurals.confirm_delete_channels, selectedClaims.size());
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).
|
||||||
setTitle(R.string.delete_selection).
|
setTitle(R.string.delete_selection).
|
||||||
|
|
|
@ -37,6 +37,7 @@ import io.lbry.browser.dialog.ContentFromDialogFragment;
|
||||||
import io.lbry.browser.dialog.ContentSortDialogFragment;
|
import io.lbry.browser.dialog.ContentSortDialogFragment;
|
||||||
import io.lbry.browser.dialog.DiscoverDialogFragment;
|
import io.lbry.browser.dialog.DiscoverDialogFragment;
|
||||||
import io.lbry.browser.exceptions.LbryUriException;
|
import io.lbry.browser.exceptions.LbryUriException;
|
||||||
|
import io.lbry.browser.listener.DarkThemeChangeListener;
|
||||||
import io.lbry.browser.listener.DownloadActionListener;
|
import io.lbry.browser.listener.DownloadActionListener;
|
||||||
import io.lbry.browser.model.Claim;
|
import io.lbry.browser.model.Claim;
|
||||||
import io.lbry.browser.model.LbryFile;
|
import io.lbry.browser.model.LbryFile;
|
||||||
|
@ -58,6 +59,7 @@ import io.lbry.browser.utils.Predefined;
|
||||||
public class FollowingFragment extends BaseFragment implements
|
public class FollowingFragment extends BaseFragment implements
|
||||||
FetchSubscriptionsTask.FetchSubscriptionsHandler,
|
FetchSubscriptionsTask.FetchSubscriptionsHandler,
|
||||||
ChannelItemSelectionListener,
|
ChannelItemSelectionListener,
|
||||||
|
DarkThemeChangeListener,
|
||||||
DownloadActionListener,
|
DownloadActionListener,
|
||||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
|
@ -802,4 +804,13 @@ public class FollowingFragment extends BaseFragment implements
|
||||||
// invalid file info for download
|
// invalid file info for download
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDarkThemeToggled() {
|
||||||
|
Helper.refreshRecyclerView(contentList);
|
||||||
|
Helper.refreshRecyclerView(horizontalChannelList);
|
||||||
|
Helper.refreshRecyclerView(suggestedChannelGrid);
|
||||||
|
if (discoverDialog != null) {
|
||||||
|
//discoverDialog.onDarkThemeToggled();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,18 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this);
|
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this);
|
||||||
MainActivity activity = (MainActivity) context;
|
MainActivity activity = (MainActivity) context;
|
||||||
LbryAnalytics.setCurrentScreen(activity, "Settings", "Settings");
|
LbryAnalytics.setCurrentScreen(activity, "Settings", "Settings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
PreferenceManager.getDefaultSharedPreferences(getContext()).unregisterOnSharedPreferenceChangeListener(this);
|
Context context = getContext();
|
||||||
|
if (context != null) {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(context).unregisterOnSharedPreferenceChangeListener(this);
|
||||||
|
}
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,9 +72,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||||
|
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
if (context instanceof MainActivity) {
|
if (context instanceof MainActivity) {
|
||||||
MainActivity activity = (MainActivity) context;
|
((MainActivity) context).onThemeChanged();
|
||||||
activity.getDelegate().applyDayNight();
|
|
||||||
activity.recreate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ public class PublishFormFragment extends BaseFragment {
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
View root = inflater.inflate(R.layout.fragment_publishes, container, false);
|
View root = inflater.inflate(R.layout.fragment_publishes, container, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import io.lbry.browser.listener.SelectionModeListener;
|
||||||
import io.lbry.browser.model.Claim;
|
import io.lbry.browser.model.Claim;
|
||||||
import io.lbry.browser.tasks.claim.AbandonChannelTask;
|
import io.lbry.browser.tasks.claim.AbandonChannelTask;
|
||||||
import io.lbry.browser.tasks.claim.AbandonHandler;
|
import io.lbry.browser.tasks.claim.AbandonHandler;
|
||||||
|
import io.lbry.browser.tasks.claim.AbandonStreamTask;
|
||||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||||
import io.lbry.browser.tasks.claim.ClaimListTask;
|
import io.lbry.browser.tasks.claim.ClaimListTask;
|
||||||
import io.lbry.browser.ui.BaseFragment;
|
import io.lbry.browser.ui.BaseFragment;
|
||||||
|
@ -288,7 +289,7 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba
|
||||||
|
|
||||||
Helper.setViewVisibility(contentList, View.INVISIBLE);
|
Helper.setViewVisibility(contentList, View.INVISIBLE);
|
||||||
Helper.setViewVisibility(fabNewPublish, View.INVISIBLE);
|
Helper.setViewVisibility(fabNewPublish, View.INVISIBLE);
|
||||||
AbandonChannelTask task = new AbandonChannelTask(claimIds, bigLoading, new AbandonHandler() {
|
AbandonStreamTask task = new AbandonStreamTask(claimIds, bigLoading, new AbandonHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(List<String> successfulClaimIds, List<String> failedClaimIds, List<Exception> errors) {
|
public void onComplete(List<String> successfulClaimIds, List<String> failedClaimIds, List<Exception> errors) {
|
||||||
View root = getView();
|
View root = getView();
|
||||||
|
|
|
@ -182,16 +182,26 @@ public class SearchFragment extends BaseFragment implements
|
||||||
if (resultListAdapter != null) {
|
if (resultListAdapter != null) {
|
||||||
Claim unresolved = resultListAdapter.getFeaturedItem();
|
Claim unresolved = resultListAdapter.getFeaturedItem();
|
||||||
|
|
||||||
// only set the values we need
|
Context context = getContext();
|
||||||
unresolved.setClaimId(resolved.getClaimId());
|
boolean canShowMatureContent = false;
|
||||||
unresolved.setName(resolved.getName());
|
if (context != null) {
|
||||||
unresolved.setTimestamp(resolved.getTimestamp());
|
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
unresolved.setValueType(resolved.getValueType());
|
canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false);
|
||||||
unresolved.setPermanentUrl(resolved.getPermanentUrl());
|
}
|
||||||
unresolved.setValue(resolved.getValue());
|
if (resolved.isMature() && !canShowMatureContent) {
|
||||||
unresolved.setSigningChannel(resolved.getSigningChannel());
|
resultListAdapter.removeFeaturedItem();
|
||||||
unresolved.setUnresolved(false);
|
} else {
|
||||||
unresolved.setConfirmations(resolved.getConfirmations());
|
// only set the values we need
|
||||||
|
unresolved.setClaimId(resolved.getClaimId());
|
||||||
|
unresolved.setName(resolved.getName());
|
||||||
|
unresolved.setTimestamp(resolved.getTimestamp());
|
||||||
|
unresolved.setValueType(resolved.getValueType());
|
||||||
|
unresolved.setPermanentUrl(resolved.getPermanentUrl());
|
||||||
|
unresolved.setValue(resolved.getValue());
|
||||||
|
unresolved.setSigningChannel(resolved.getSigningChannel());
|
||||||
|
unresolved.setUnresolved(false);
|
||||||
|
unresolved.setConfirmations(resolved.getConfirmations());
|
||||||
|
}
|
||||||
|
|
||||||
resultListAdapter.notifyDataSetChanged();
|
resultListAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,15 @@ import android.provider.DocumentsContract;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -685,4 +689,26 @@ public final class Helper {
|
||||||
public static int getScaledValue(int value, float scale) {
|
public static int getScaledValue(int value, float scale) {
|
||||||
return (int) (value * scale + 0.5f);
|
return (int) (value * scale + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void refreshRecyclerView(RecyclerView rv) {
|
||||||
|
if (rv == null) {
|
||||||
|
android.util.Log.d("#HELP", "rv is null?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
android.util.Log.d("#HELP", "Refereshing recycler view...");
|
||||||
|
RecyclerView.Adapter adapter = rv.getAdapter();
|
||||||
|
int prevScrollPosition = 0;
|
||||||
|
|
||||||
|
RecyclerView.LayoutManager lm = rv.getLayoutManager();
|
||||||
|
if (lm instanceof LinearLayoutManager) {
|
||||||
|
prevScrollPosition = ((LinearLayoutManager) lm).findLastCompletelyVisibleItemPosition();
|
||||||
|
} else if (lm instanceof GridLayoutManager) {
|
||||||
|
prevScrollPosition = ((GridLayoutManager) lm).findLastCompletelyVisibleItemPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
rv.setAdapter(null);
|
||||||
|
rv.setAdapter(adapter);
|
||||||
|
rv.scrollToPosition(prevScrollPosition > 0 ? prevScrollPosition : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,9 @@ public final class Lbry {
|
||||||
public static final String METHOD_CHANNEL_CREATE = "channel_create";
|
public static final String METHOD_CHANNEL_CREATE = "channel_create";
|
||||||
public static final String METHOD_CHANNEL_UPDATE = "channel_update";
|
public static final String METHOD_CHANNEL_UPDATE = "channel_update";
|
||||||
|
|
||||||
|
|
||||||
public static final String METHOD_CLAIM_LIST = "claim_list";
|
public static final String METHOD_CLAIM_LIST = "claim_list";
|
||||||
|
public static final String METHOD_STREAM_ABANDON = "stream_abandon";
|
||||||
public static final String METHOD_STREAM_REPOST = "stream_repost";
|
public static final String METHOD_STREAM_REPOST = "stream_repost";
|
||||||
|
|
||||||
public static KeyStore KEYSTORE;
|
public static KeyStore KEYSTORE;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
|
|
@ -29,6 +29,27 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/form_mature_tags_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:text="@string/mature_tags"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textFontWeight="300" />
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/form_mature_tags"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/form_no_tag_results"
|
android:id="@+id/form_no_tag_results"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
|
@ -293,7 +293,7 @@
|
||||||
android:text="@string/tags"
|
android:text="@string/tags"
|
||||||
android:textFontWeight="600"
|
android:textFontWeight="600"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
<include layout="@layout/form_tag_search" />
|
<include layout="@layout/container_inline_tag_form" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
|
@ -2,15 +2,170 @@
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/pageBackground">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/publish_form_display_area"
|
android:id="@+id/publish_form_display_area"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_weight="10"
|
android:weightSum="10"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/publish_form_media_container"
|
||||||
|
android:clickable="true"
|
||||||
|
android:foreground="?attr/selectableItemBackground"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="3.55"
|
||||||
|
android:background="@android:color/black">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/publish_form_thumbnail_preview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/publish_form_thumbnail_upload_progress"
|
||||||
|
android:background="@color/channelCoverBackground"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="4dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="4dp"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:text="@string/uploading"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textFontWeight="300"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:background="@drawable/bg_small_icon"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@drawable/ic_edit"
|
||||||
|
android:tint="@color/white" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="6.45">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/title">
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/publish_form_input_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:textFontWeight="300"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:hint="@string/description">
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/publish_form_input_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textFontWeight="300"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:text="@string/tags" />
|
||||||
|
<include layout="@layout/container_inline_tag_form" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:fontFamily="@font/inter"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:text="@string/channel" />
|
||||||
|
<androidx.appcompat.widget.AppCompatSpinner
|
||||||
|
android:id="@+id/invites_channel_spinner"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp" />
|
||||||
|
<include layout="@layout/container_inline_channel_form" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -35,7 +35,7 @@
|
||||||
<color name="tagGreen">#329A7E</color>
|
<color name="tagGreen">#329A7E</color>
|
||||||
<color name="tagGrape">#77D510B8</color>
|
<color name="tagGrape">#77D510B8</color>
|
||||||
|
|
||||||
<color name="divider">#454545</color>
|
<color name="divider">#292929</color>
|
||||||
<color name="lightDivider">#0A0A0A</color>
|
<color name="lightDivider">#0A0A0A</color>
|
||||||
|
|
||||||
<color name="lightGrey">#CCCCCC</color>
|
<color name="lightGrey">#CCCCCC</color>
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
<string name="storage_permission_rationale_videos">LBRY requires access to be able to display and publish your videos, images and other files from your device.</string>
|
<string name="storage_permission_rationale_videos">LBRY requires access to be able to display and publish your videos, images and other files from your device.</string>
|
||||||
<string name="camera_permission_rationale_record">LBRY requires access to your camera to record videos.</string>
|
<string name="camera_permission_rationale_record">LBRY requires access to your camera to record videos.</string>
|
||||||
<string name="camera_permission_rationale_photo">LBRY requires access to your camera to take photos.</string>
|
<string name="camera_permission_rationale_photo">LBRY requires access to your camera to take photos.</string>
|
||||||
|
<string name="mature_tags">Mature tags</string>
|
||||||
|
|
||||||
<!-- Publishes -->
|
<!-- Publishes -->
|
||||||
<string name="one_or_more_publishes_failed_abandon">One or more content items could not be deleted at this time. Please try again later.</string>
|
<string name="one_or_more_publishes_failed_abandon">One or more content items could not be deleted at this time. Please try again later.</string>
|
||||||
|
|
Loading…
Reference in a new issue