Native rewrite #878

Merged
akinwale merged 65 commits from native-rewrite into master 2020-05-23 08:49:00 +02:00
16 changed files with 687 additions and 241 deletions
Showing only changes of commit cfa7e07eba - Show all commits

View file

@ -99,6 +99,7 @@ import io.lbry.browser.tasks.wallet.SyncSetTask;
import io.lbry.browser.tasks.wallet.WalletBalanceTask; import io.lbry.browser.tasks.wallet.WalletBalanceTask;
import io.lbry.browser.ui.BaseFragment; import io.lbry.browser.ui.BaseFragment;
import io.lbry.browser.ui.channel.ChannelFragment; import io.lbry.browser.ui.channel.ChannelFragment;
import io.lbry.browser.ui.editorschoice.EditorsChoiceFragment;
import io.lbry.browser.ui.following.FollowingFragment; import io.lbry.browser.ui.following.FollowingFragment;
import io.lbry.browser.ui.search.SearchFragment; import io.lbry.browser.ui.search.SearchFragment;
import io.lbry.browser.ui.settings.SettingsFragment; import io.lbry.browser.ui.settings.SettingsFragment;
@ -202,7 +203,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
private boolean pendingFollowingReload; private boolean pendingFollowingReload;
private final List<Integer> supportedMenuItemIds = Arrays.asList( private final List<Integer> supportedMenuItemIds = Arrays.asList(
NavMenuItem.ID_ITEM_FOLLOWING, NavMenuItem.ID_ITEM_ALL_CONTENT, NavMenuItem.ID_ITEM_WALLET, NavMenuItem.ID_ITEM_SETTINGS NavMenuItem.ID_ITEM_FOLLOWING,
NavMenuItem.ID_ITEM_EDITORS_CHOICE,
NavMenuItem.ID_ITEM_ALL_CONTENT,
NavMenuItem.ID_ITEM_WALLET,
NavMenuItem.ID_ITEM_SETTINGS
); );
@Override @Override
@ -350,6 +355,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
case NavMenuItem.ID_ITEM_FOLLOWING: case NavMenuItem.ID_ITEM_FOLLOWING:
openFragment(FollowingFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING); openFragment(FollowingFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING);
break; break;
case NavMenuItem.ID_ITEM_EDITORS_CHOICE:
openFragment(EditorsChoiceFragment.class, true, NavMenuItem.ID_ITEM_EDITORS_CHOICE);
break;
case NavMenuItem.ID_ITEM_ALL_CONTENT: case NavMenuItem.ID_ITEM_ALL_CONTENT:
openFragment(AllContentFragment.class, true, NavMenuItem.ID_ITEM_ALL_CONTENT); openFragment(AllContentFragment.class, true, NavMenuItem.ID_ITEM_ALL_CONTENT);
break; break;
@ -553,9 +561,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
findViewById(R.id.wunderbar_close).setOnClickListener(new View.OnClickListener() { findViewById(R.id.wunderbar_close).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
findViewById(R.id.wunderbar).clearFocus(); clearWunderbarFocus(view);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
}); });
findViewById(R.id.wunderbar).setOnFocusChangeListener(new View.OnFocusChangeListener() { findViewById(R.id.wunderbar).setOnFocusChangeListener(new View.OnFocusChangeListener() {
@ -612,8 +618,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
openAllContentFragmentWithTag(urlSuggestion.getText()); openAllContentFragmentWithTag(urlSuggestion.getText());
break; break;
} }
findViewById(R.id.wunderbar).clearFocus(); clearWunderbarFocus(findViewById(R.id.wunderbar));
//findViewById(R.id.url_suggestions_container).setVisibility(View.GONE);
} }
}); });
@ -623,6 +628,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
urlSuggestionList.setAdapter(urlSuggestionListAdapter); urlSuggestionList.setAdapter(urlSuggestionListAdapter);
} }
private void clearWunderbarFocus(View view) {
findViewById(R.id.wunderbar).clearFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
private void launchSearch(String text) { private void launchSearch(String text) {
Fragment currentFragment = getCurrentFragment(); Fragment currentFragment = getCurrentFragment();
if (currentFragment instanceof SearchFragment) { if (currentFragment instanceof SearchFragment) {

View file

@ -87,6 +87,8 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
protected TextView titleView; protected TextView titleView;
protected TextView publisherView; protected TextView publisherView;
protected TextView publishTimeView; protected TextView publishTimeView;
protected View repostInfoView;
protected TextView repostChannelView;
public ViewHolder(View v) { public ViewHolder(View v) {
super(v); super(v);
alphaView = v.findViewById(R.id.claim_thumbnail_alpha); alphaView = v.findViewById(R.id.claim_thumbnail_alpha);
@ -97,6 +99,8 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
titleView = v.findViewById(R.id.claim_title); titleView = v.findViewById(R.id.claim_title);
publisherView = v.findViewById(R.id.claim_publisher); publisherView = v.findViewById(R.id.claim_publisher);
publishTimeView = v.findViewById(R.id.claim_publish_time); publishTimeView = v.findViewById(R.id.claim_publish_time);
repostInfoView = v.findViewById(R.id.claim_repost_info);
repostChannelView = v.findViewById(R.id.claim_repost_channel);
} }
} }
@ -111,7 +115,11 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
return VIEW_TYPE_FEATURED; return VIEW_TYPE_FEATURED;
} }
return Claim.TYPE_CHANNEL.equalsIgnoreCase(items.get(position).getValueType()) ? VIEW_TYPE_CHANNEL : VIEW_TYPE_STREAM; Claim claim = items.get(position);
String valueType = items.get(position).getValueType();
Claim actualClaim = Claim.TYPE_REPOST.equalsIgnoreCase(valueType) ? claim.getRepostedClaim() : claim;
return Claim.TYPE_CHANNEL.equalsIgnoreCase(actualClaim.getValueType()) ? VIEW_TYPE_CHANNEL : VIEW_TYPE_STREAM;
} }
@Override @Override
@ -130,7 +138,10 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
@Override @Override
public void onBindViewHolder(ClaimListAdapter.ViewHolder vh, int position) { public void onBindViewHolder(ClaimListAdapter.ViewHolder vh, int position) {
int type = getItemViewType(position); int type = getItemViewType(position);
Claim item = items.get(position);
Claim original = items.get(position);
boolean isRepost = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType());
final Claim item = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType()) ? original.getRepostedClaim() : original;
Claim.GenericMetadata metadata = item.getValue(); Claim.GenericMetadata metadata = item.getValue();
Claim signingChannel = item.getSigningChannel(); Claim signingChannel = item.getSigningChannel();
Claim.StreamMetadata streamMetadata = null; Claim.StreamMetadata streamMetadata = null;
@ -162,6 +173,16 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
} }
}); });
vh.repostInfoView.setVisibility(isRepost ? View.VISIBLE : View.GONE);
vh.repostChannelView.setText(isRepost ? original.getSigningChannel().getName() : null);
vh.repostChannelView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onClaimClicked(original.getSigningChannel());
}
}
});
vh.titleView.setText(Helper.isNullOrEmpty(item.getTitle()) ? item.getName() : item.getTitle()); vh.titleView.setText(Helper.isNullOrEmpty(item.getTitle()) ? item.getName() : item.getTitle());
if (type == VIEW_TYPE_FEATURED) { if (type == VIEW_TYPE_FEATURED) {

View file

@ -0,0 +1,117 @@
package io.lbry.browser.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
import io.lbry.browser.R;
import io.lbry.browser.model.EditorsChoiceItem;
import io.lbry.browser.utils.Helper;
import lombok.Setter;
public class EditorsChoiceItemAdapter extends RecyclerView.Adapter<EditorsChoiceItemAdapter.ViewHolder> {
private static final int VIEW_TYPE_HEADER = 1;
private static final int VIEW_TYPE_CONTENT = 2;
private Context context;
private List<EditorsChoiceItem> items;
@Setter
private EditorsChoiceItemListener listener;
public EditorsChoiceItemAdapter(List<EditorsChoiceItem> items, Context context) {
this.context = context;
this.items = new ArrayList<>(items);
}
public void addFeaturedItem(EditorsChoiceItem item) {
items.add(0, item);
notifyDataSetChanged();
}
public void addItems(List<EditorsChoiceItem> items) {
for (EditorsChoiceItem item : items) {
if (!this.items.contains(item)) {
this.items.add(item);
}
}
notifyDataSetChanged();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
protected ImageView thumbnailView;
protected TextView descriptionView;
protected TextView headerView;
protected TextView titleView;
protected View cardView;
public ViewHolder(View v) {
super(v);
cardView = v.findViewById(R.id.editors_choice_content_card);
descriptionView = v.findViewById(R.id.editors_choice_content_description);
titleView = v.findViewById(R.id.editors_choice_content_title);
thumbnailView = v.findViewById(R.id.editors_choice_content_thumbnail);
headerView = v.findViewById(R.id.editors_choice_header_title);
}
}
@Override
public int getItemCount() {
return items != null ? items.size() : 0;
}
@Override
public int getItemViewType(int position) {
return items.get(position).isHeader() ? VIEW_TYPE_HEADER : VIEW_TYPE_CONTENT;
}
@Override
public EditorsChoiceItemAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.list_item_editors_choice, parent, false);
return new EditorsChoiceItemAdapter.ViewHolder(v);
}
@Override
public void onBindViewHolder(EditorsChoiceItemAdapter.ViewHolder vh, int position) {
int type = getItemViewType(position);
EditorsChoiceItem item = items.get(position);
vh.headerView.setVisibility(type == VIEW_TYPE_HEADER ? View.VISIBLE : View.GONE);
vh.cardView.setVisibility(type == VIEW_TYPE_CONTENT ? View.VISIBLE : View.GONE);
vh.headerView.setText(item.getTitle());
vh.titleView.setText(item.getTitle());
vh.descriptionView.setText(item.getDescription());
if (!Helper.isNullOrEmpty(item.getThumbnailUrl())) {
Glide.with(context.getApplicationContext()).
load(item.getThumbnailUrl()).
centerCrop().
placeholder(R.drawable.bg_thumbnail_placeholder).
into(vh.thumbnailView);
}
vh.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onEditorsChoiceItemClicked(item);
}
}
});
}
public interface EditorsChoiceItemListener {
void onEditorsChoiceItemClicked(EditorsChoiceItem item);
}
}

View file

@ -32,6 +32,7 @@ public class Claim {
public static final String TYPE_STREAM = "stream"; public static final String TYPE_STREAM = "stream";
public static final String TYPE_CHANNEL = "channel"; public static final String TYPE_CHANNEL = "channel";
public static final String TYPE_REPOST = "repost";
public static final String STREAM_TYPE_AUDIO = "audio"; public static final String STREAM_TYPE_AUDIO = "audio";
public static final String STREAM_TYPE_IMAGE = "image"; public static final String STREAM_TYPE_IMAGE = "image";
@ -73,7 +74,8 @@ public class Claim {
private String shortUrl; private String shortUrl;
private String txid; private String txid;
private String type; // claim | update | support private String type; // claim | update | support
private String valueType; // stream | channel private String valueType; // stream | channel | repost
private Claim repostedClaim;
private Claim signingChannel; private Claim signingChannel;
private String repostChannelUrl; private String repostChannelUrl;
private boolean isChannelSignatureValid; private boolean isChannelSignatureValid;
@ -158,18 +160,23 @@ public class Claim {
} }
public static Claim fromJSONObject(JSONObject claimObject) { public static Claim fromJSONObject(JSONObject claimObject) {
Claim claim = null;
String claimJson = claimObject.toString(); String claimJson = claimObject.toString();
Type type = new TypeToken<Claim>(){}.getType(); Type type = new TypeToken<Claim>(){}.getType();
Type streamMetadataType = new TypeToken<StreamMetadata>(){}.getType(); Type streamMetadataType = new TypeToken<StreamMetadata>(){}.getType();
Type channelMetadataType = new TypeToken<ChannelMetadata>(){}.getType(); Type channelMetadataType = new TypeToken<ChannelMetadata>(){}.getType();
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
Claim claim = gson.fromJson(claimJson, type); claim = gson.fromJson(claimJson, type);
// Specific value parsing
try { try {
JSONObject value = claimObject.getJSONObject("value");
String valueType = claim.getValueType(); String valueType = claim.getValueType();
// Specific value type parsing
if (TYPE_REPOST.equalsIgnoreCase(valueType)) {
JSONObject repostedClaimObject = claimObject.getJSONObject("reposted_claim");
claim.setRepostedClaim(Claim.fromJSONObject(repostedClaimObject));
} else {
JSONObject value = claimObject.getJSONObject("value");
if (value != null) { if (value != null) {
String valueJson = value.toString(); String valueJson = value.toString();
if (TYPE_STREAM.equalsIgnoreCase(valueType)) { if (TYPE_STREAM.equalsIgnoreCase(valueType)) {
@ -178,6 +185,7 @@ public class Claim {
claim.setValue(gson.fromJson(valueJson, channelMetadataType)); claim.setValue(gson.fromJson(valueJson, channelMetadataType));
} }
} }
}
} catch (JSONException ex) { } catch (JSONException ex) {
// pass // pass
} }

View file

@ -376,7 +376,7 @@ public class AllContentFragment extends BaseFragment implements SharedPreference
boolean canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false); boolean canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false);
return Lbry.buildClaimSearchOptions( return Lbry.buildClaimSearchOptions(
Claim.TYPE_STREAM, null,
(currentContentScope == ContentScopeDialogFragment.ITEM_EVERYONE) ? null : tags, (currentContentScope == ContentScopeDialogFragment.ITEM_EVERYONE) ? null : tags,
canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS), canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),
null, null,

View file

@ -203,7 +203,7 @@ public class ChannelContentFragment extends Fragment implements SharedPreference
boolean canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false); boolean canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false);
return Lbry.buildClaimSearchOptions( return Lbry.buildClaimSearchOptions(
Claim.TYPE_STREAM, null,
null, null,
canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS), canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),
Arrays.asList(channelId), Arrays.asList(channelId),

View file

@ -1,6 +1,154 @@
package io.lbry.browser.ui.editorschoice; package io.lbry.browser.ui.editorschoice;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import io.lbry.browser.FileViewActivity;
import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.adapter.ClaimListAdapter;
import io.lbry.browser.adapter.EditorsChoiceItemAdapter;
import io.lbry.browser.dialog.ContentScopeDialogFragment;
import io.lbry.browser.model.Claim;
import io.lbry.browser.model.EditorsChoiceItem;
import io.lbry.browser.tasks.ClaimSearchTask;
import io.lbry.browser.ui.BaseFragment; import io.lbry.browser.ui.BaseFragment;
import io.lbry.browser.utils.Helper;
import io.lbry.browser.utils.Lbry;
import io.lbry.browser.utils.Predefined;
public class EditorsChoiceFragment extends BaseFragment { public class EditorsChoiceFragment extends BaseFragment {
private static final HashMap<String, String> titleChannelIdsMap = new LinkedHashMap<>();
static {
titleChannelIdsMap.put("Short Films", "7056f8267188fc49cd3f7162b4115d9e3c8216f6");
titleChannelIdsMap.put("Feature-Length Films", "7aad6f36f61da95cb02471fae55f736b28e3bca7");
titleChannelIdsMap.put("Documentaries", "d57c606e11462e821d5596430c336b58716193bb");
titleChannelIdsMap.put("Episodic Content", "ea5fc1bd3e1335776fe2641a539a47850606d7db");
}
private boolean contentLoading;
private ProgressBar loading;
private RecyclerView contentList;
private EditorsChoiceItemAdapter contentListAdapter;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_editors_choice, container, false);
loading = root.findViewById(R.id.editors_choice_loading);
contentList = root.findViewById(R.id.editors_choice_content_list);
LinearLayoutManager llm = new LinearLayoutManager(getContext());
contentList.setLayoutManager(llm);
return root;
}
private Map<String, Object> buildContentOptions() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false);
return Lbry.buildClaimSearchOptions(
Claim.TYPE_REPOST,
null,
null, /*canShowMatureContent ? null : new ArrayList<>(Predefined.MATURE_TAGS),*/
new ArrayList<>(titleChannelIdsMap.values()),
null,
Arrays.asList(Claim.ORDER_BY_RELEASE_TIME),
null,
1,
99);
}
public void onResume() {
super.onResume();
if (contentListAdapter == null || contentListAdapter.getItemCount() == 0) {
fetchClaimSearchContent();
} else {
if (contentList != null) {
contentList.setAdapter(contentListAdapter);
}
}
}
public void fetchClaimSearchContent() {
if (contentLoading) {
return;
}
contentLoading = true;
ClaimSearchTask task = new ClaimSearchTask(buildContentOptions(), Lbry.LBRY_TV_CONNECTION_STRING, loading, new ClaimSearchTask.ClaimSearchResultHandler() {
@Override
public void onSuccess(List<Claim> items, boolean hasReachedEnd) {
List<EditorsChoiceItem> data = buildDataFromClaims(items);
if (contentListAdapter == null) {
contentListAdapter = new EditorsChoiceItemAdapter(data, getContext());
contentListAdapter.setListener(new EditorsChoiceItemAdapter.EditorsChoiceItemListener() {
@Override
public void onEditorsChoiceItemClicked(EditorsChoiceItem item) {
String url = item.getPermanentUrl();
Intent intent = new Intent(getContext(), FileViewActivity.class);
intent.putExtra("url", url);
MainActivity.startingFileViewActivity = true;
startActivity(intent);
}
});
} else {
contentListAdapter.addItems(data);
}
if (contentList != null && contentList.getAdapter() == null) {
contentList.setAdapter(contentListAdapter);
}
contentLoading = false;
}
@Override
public void onError(Exception error) {
contentLoading = false;
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private List<EditorsChoiceItem> buildDataFromClaims(List<Claim> claims) {
List<EditorsChoiceItem> data = new ArrayList<>();
for (String title : titleChannelIdsMap.keySet()) {
EditorsChoiceItem titleItem = new EditorsChoiceItem();
titleItem.setTitle(title);
titleItem.setHeader(true);
data.add(titleItem);
String channelClaimId = titleChannelIdsMap.get(title);
for (Claim c : claims) {
if (c.getSigningChannel() != null && channelClaimId.equalsIgnoreCase(c.getSigningChannel().getClaimId())) {
EditorsChoiceItem item = EditorsChoiceItem.fromClaim(
Claim.TYPE_REPOST.equalsIgnoreCase(c.getValueType()) ? c.getRepostedClaim() : c);
data.add(item);
}
}
}
return data;
}
} }

View file

@ -330,6 +330,9 @@ public class FollowingFragment extends BaseFragment implements
// check if subscriptions exist // check if subscriptions exist
if (suggestedChannelAdapter != null) { if (suggestedChannelAdapter != null) {
showSuggestedChannels(); showSuggestedChannels();
if (suggestedChannelGrid != null) {
suggestedChannelGrid.setAdapter(suggestedChannelAdapter);
}
} }
if (Lbryio.subscriptions != null && Lbryio.subscriptions.size() > 0) { if (Lbryio.subscriptions != null && Lbryio.subscriptions.size() > 0) {

View file

@ -1,11 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <RelativeLayout
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:orientation="vertical"> android:orientation="vertical">
<ProgressBar
android:id="@+id/editors_choice_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/editors_choice_content_list" android:id="@+id/editors_choice_content_list"
android:clipToPadding="false"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
</LinearLayout> android:paddingTop="16dp"
android:paddingBottom="16dp" />
</RelativeLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -8,7 +8,48 @@
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:orientation="vertical"
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">
<LinearLayout
android:id="@+id/claim_repost_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:orientation="horizontal"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="16dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textColor="@color/lightForeground"
android:textSize="12dp"
android:text="@string/fa_repost" />
<TextView
android:id="@+id/claim_repost_channel"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:fontFamily="@font/inter"
android:textColor="@color/lightForeground"
android:textFontWeight="300"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:fontFamily="@font/inter"
android:text="@string/reposted"
android:textColor="@color/lightForeground"
android:textFontWeight="300"
android:textSize="12sp" />
</LinearLayout>w
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <RelativeLayout
android:id="@+id/claim_media_container" android:id="@+id/claim_media_container"
android:layout_width="160dp" android:layout_width="160dp"
@ -74,5 +115,5 @@
android:textFontWeight="300" /> android:textFontWeight="300" />
<!-- download progress bar --> <!-- download progress bar -->
</LinearLayout> </LinearLayout>
</RelativeLayout>
</RelativeLayout> </LinearLayout>

View file

@ -2,26 +2,29 @@
<LinearLayout <LinearLayout
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="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/editors_choice_header_title" android:id="@+id/editors_choice_header_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:textSize="28sp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="16dp" /> android:layout_marginBottom="16dp"
android:fontFamily="@font/inter"
android:textSize="24sp"
android:textColor="@color/lbryGreen" />
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/editors_choice_content_card"
android:clickable="true" android:clickable="true"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"> android:layout_marginRight="16dp"
android:layout_marginBottom="16dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -32,7 +35,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:textSize="20sp" /> android:textSize="18sp"
android:singleLine="true" />
<RelativeLayout <RelativeLayout
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
@ -41,19 +45,20 @@
<ImageView <ImageView
android:id="@+id/editors_choice_content_thumbnail" android:id="@+id/editors_choice_content_thumbnail"
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="90dp" android:layout_height="120dp"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
<TextView <TextView
android:id="@+id/editors_choice_content_description" android:id="@+id/editors_choice_content_description"
android:layout_toRightOf="@id/editors_choice_content_thumbnail" android:layout_toRightOf="@id/editors_choice_content_thumbnail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8dp" android:layout_marginLeft="16dp"
android:layout_centerVertical="true"
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="6" android:maxLines="6"
android:textFontWeight="300" android:textFontWeight="300"
android:textSize="14sp" /> android:textSize="12sp" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="16dp" android:paddingLeft="16dp"
@ -8,7 +8,44 @@
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:orientation="vertical"
android:background="@android:color/black"> android:background="@android:color/black">
<LinearLayout
android:id="@+id/claim_repost_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="20dp"
android:layout_height="20dp"
android:textSize="18dp"
android:layout_gravity="center_vertical"
android:text="@string/fa_repost" />
<TextView
android:id="@+id/claim_repost_channel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:clickable="true"
android:fontFamily="@font/inter"
android:textFontWeight="300"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:fontFamily="@font/inter"
android:text="@string/reposted"
android:textSize="12sp"
android:textFontWeight="300"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <RelativeLayout
android:id="@+id/claim_media_container" android:id="@+id/claim_media_container"
android:layout_width="160dp" android:layout_width="160dp"
@ -96,5 +133,5 @@
<!-- download progress bar --> <!-- download progress bar -->
</LinearLayout> </LinearLayout>
</RelativeLayout>
</RelativeLayout> </LinearLayout>

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingTop="8dp" android:paddingTop="8dp"
@ -9,6 +10,46 @@
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">
<LinearLayout
android:id="@+id/claim_repost_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:orientation="horizontal"
android:visibility="gone">
<io.lbry.browser.ui.controls.SolidIconView
android:layout_width="16dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:textColor="@color/lightForeground"
android:textSize="12dp"
android:text="@string/fa_repost" />
<TextView
android:id="@+id/claim_repost_channel"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:fontFamily="@font/inter"
android:textColor="@color/lightForeground"
android:textFontWeight="300"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:fontFamily="@font/inter"
android:text="@string/reposted"
android:textColor="@color/lightForeground"
android:textFontWeight="300"
android:textSize="12sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout <RelativeLayout
android:id="@+id/claim_media_container" android:id="@+id/claim_media_container"
android:layout_width="160dp" android:layout_width="160dp"
@ -91,5 +132,5 @@
<!-- download progress bar --> <!-- download progress bar -->
</LinearLayout> </LinearLayout>
</RelativeLayout>
</RelativeLayout> </LinearLayout>

View file

@ -13,7 +13,9 @@
<color name="selectedNavItem">#0E0E0E</color> <color name="selectedNavItem">#0E0E0E</color>
<color name="channelCoverBackground">#CC000000</color> <color name="channelCoverBackground">#CC000000</color>
<!-- At some point, these colours have to be renamed -->
<color name="darkForeground">#EEEEEE</color> <color name="darkForeground">#EEEEEE</color>
<color name="lightForeground">#555555</color>
<color name="foreground">#999999</color> <color name="foreground">#999999</color>
<color name="mediaContainerBackground">#333333</color> <color name="mediaContainerBackground">#333333</color>
<color name="borderTextArea">#5F5F5F</color> <color name="borderTextArea">#5F5F5F</color>

View file

@ -14,6 +14,7 @@
<color name="channelCoverBackground">#CC000000</color> <color name="channelCoverBackground">#CC000000</color>
<color name="darkForeground">#222222</color> <color name="darkForeground">#222222</color>
<color name="lightForeground">#AAAAAA</color>
<color name="foreground">#333333</color> <color name="foreground">#333333</color>
<color name="mediaContainerBackground">#333333</color> <color name="mediaContainerBackground">#333333</color>
<color name="borderTextArea">#777777</color> <color name="borderTextArea">#777777</color>

View file

@ -66,6 +66,7 @@
<string name="no_channel_info">There\'s nothing here yet.\nPlease check back later.</string> <string name="no_channel_info">There\'s nothing here yet.\nPlease check back later.</string>
<string name="content">Content</string> <string name="content">Content</string>
<string name="website">Website</string> <string name="website">Website</string>
<string name="reposted">reposted</string>
<!-- Settings --> <!-- Settings -->
<string name="user_interface">Content &amp; User interface</string> <string name="user_interface">Content &amp; User interface</string>
@ -228,4 +229,5 @@
<string name="fa_user_friends">&#xf500;</string> <string name="fa_user_friends">&#xf500;</string>
<string name="fa_cog">&#xf013;</string> <string name="fa_cog">&#xf013;</string>
<string name="fa_mobile_alt">&#xf3cd;</string> <string name="fa_mobile_alt">&#xf3cd;</string>
<string name="fa_repost">&#xf079;</string>
</resources> </resources>