use of com.google.android.flexbox.FlexboxLayoutManager in project BBS-Android by bdpqchen.
the class ForumFragment method initFragment.
@Override
protected void initFragment() {
mActivity = this.getActivity();
mTvTitleToolbar.setText("论坛区");
mPresenter = new ForumPresenter(this);
mAdapter = new ForumAdapter(mContext);
// LinearLayoutManager manager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
mRvForumList.setLayoutManager(new FlexboxLayoutManager(mContext, FlexDirection.ROW));
mRvForumList.setAdapter(mAdapter);
// mSrlForum.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));
// mSrlForum.setOnRefreshListener(() -> {
// getForumList();
// mRefreshing = true;
// });
}
use of com.google.android.flexbox.FlexboxLayoutManager in project Precisely by Pankaj-Baranwal.
the class Filters method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Constants.toolbar_title = "Filters";
setContentView(R.layout.activity_filters);
if (sp.contains(key)) {
try {
JSONArray jO = new JSONArray(sp.getString(key, ""));
Constants.clickedFilters.clear();
for (int i = 0; i < jO.length(); i++) Constants.clickedFilters.add(jO.getInt(i));
} catch (JSONException e) {
e.printStackTrace();
}
}
setupFilters();
proceed = findViewById(R.id.proceed);
proceed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clickedFilters.size() > 0) {
loadActivity(VerticalViewPagerActivity.class);
} else
Toast.makeText(Filters.this, "Please select at least one filter!", Toast.LENGTH_SHORT).show();
}
});
RecyclerView recyclerView = findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
layoutManager.setFlexWrap(FlexWrap.WRAP);
layoutManager.setFlexDirection(FlexDirection.ROW);
layoutManager.setAlignItems(AlignItems.STRETCH);
recyclerView.setLayoutManager(layoutManager);
RecyclerView.Adapter adapter = new FiltersAdapter(this, filters, filters_image_urls);
recyclerView.setAdapter(adapter);
}
use of com.google.android.flexbox.FlexboxLayoutManager in project IITB-App by wncc.
the class AboutFragment method onStart.
@Override
public void onStart() {
super.onStart();
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("About");
final Context context = getContext();
AboutAdapter aboutAdapter = new AboutAdapter(new ArrayList<AboutCategory>() {
{
add(new AboutCategory("Maintainer", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("e.aakash", "E. Aakash", "aakash.jpg"));
}
}, context));
add(new AboutCategory("Core Developers", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("varunpatil", "Varun Patil", "varun.jpg"));
add(new AboutIndividual("sajalnarang", "Sajal Narang", "sajal.jpg"));
add(new AboutIndividual("harshith", "Harshith Goka", "harshith.jpg"));
}
}, context));
add(new AboutCategory("Developers", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("160020012", "Mrunmayi Munkegar", "mrunmayi.jpg"));
add(new AboutIndividual("160110009", "Owais Chunawala", "owais.jpg"));
add(new AboutIndividual("hrushikeshbodas", "Hrushikesh Bodas", "hrushikesh.jpg"));
add(new AboutIndividual("yashkhem", "Yash Khemchandani", "yashkhem.jpg"));
add(new AboutIndividual("bavish.kulur", "Bavish Kulur", "bavish.jpg"));
add(new AboutIndividual("mayubhattu", "Mayuresh Bhattu", "mayu.jpg"));
add(new AboutIndividual("maitreya", "Maitreya Verma", "maitreya.jpg"));
add(new AboutIndividual("safwankdb", "Mohd Safwan", "safwan.jpg"));
add(new AboutIndividual(null, "Shivam Sharma", "sshivam95.jpg"));
}
}, context));
add(new AboutCategory("Design", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("150040007", "Soham Khadtare", "soham.jpg"));
}
}, context));
add(new AboutCategory("Ideation", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("nihal111", "Nihal Singh", "nihal.jpg"));
add(new AboutIndividual("ydidwania", "Yashwarshan Didwania", "ydidwania.jpg"));
add(new AboutIndividual("kumar.ayush", "Kumar Ayush", "cheeku.jpg"));
add(new AboutIndividual("16D110006", "Sarthak Khandelwal", "sarthak.jpg"));
}
}, context));
add(new AboutCategory("Alumni", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("abhijit.tomar", "Abhijit Tomar", "tomar.jpg"));
add(new AboutIndividual(null, "Bijoy Singh Kochar", "bijoy.jpg"));
add(new AboutIndividual(null, "Dheerendra Rathor", "dheerendra.jpg"));
add(new AboutIndividual(null, "Ranveer Aggarwal", "ranveer.jpg"));
add(new AboutIndividual(null, "Aman Gour", "amangour.jpg"));
}
}, context));
add(new AboutCategory("Contribute", new ArrayList<AboutIndividual>() {
{
add(new AboutIndividual("https://github.com/wncc/instiapp-api", "Django API", "python.png", TYPE_LINK));
add(new AboutIndividual("https://github.com/wncc/instiapp-android", "Android App", "android.png", TYPE_LINK));
add(new AboutIndividual("https://github.com/wncc/instiapp-angular", "Angular PWA", "angular.png", TYPE_LINK));
}
}, context));
}
});
RecyclerView aboutRecyclerView = getActivity().findViewById(R.id.about_recycler_view);
aboutRecyclerView.setAdapter(aboutAdapter);
FlexboxLayoutManager manager = new FlexboxLayoutManager(context, FlexDirection.ROW);
manager.setJustifyContent(JustifyContent.CENTER);
aboutRecyclerView.setLayoutManager(manager);
}
use of com.google.android.flexbox.FlexboxLayoutManager in project odysee-android by OdyseeTeam.
the class FileViewFragment method renderClaim.
private void renderClaim() {
Claim claimToRender = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (claimToRender == null) {
return;
}
if (!claimToRender.hasSource()) {
// TODO See if the "publisher is not live yet" UI must be shown
}
if (claimToRender.isPlayable() && MainActivity.appPlayer != null) {
MainActivity.appPlayer.setPlayWhenReady(isPlaying);
}
Helper.setViewVisibility(layoutLoadingState, View.GONE);
Helper.setViewVisibility(layoutNothingAtLocation, View.GONE);
/*
if (claim.getTags().contains("disable-support") || claim.getSigningChannel().getTags().contains("disable-support"))
Helper.setViewVisibility(tipButton, View.GONE);
else
Helper.setViewVisibility(tipButton, View.VISIBLE);
*/
loadViewCount();
loadReactions(claimToRender);
checkIsFollowing();
View root = getView();
if (root != null) {
Context context = getContext();
root.findViewById(R.id.file_view_scroll_view).scrollTo(0, 0);
Helper.setViewVisibility(layoutDisplayArea, View.VISIBLE);
ImageView descIndicator = root.findViewById(R.id.file_view_desc_toggle_arrow);
descIndicator.setImageResource(R.drawable.ic_arrow_dropdown);
boolean hasDescription = !Helper.isNullOrEmpty(claimToRender.getDescription());
boolean hasTags = claimToRender.getTags() != null && claimToRender.getTags().size() > 0;
root.findViewById(R.id.file_view_description).setVisibility(hasDescription ? View.VISIBLE : View.GONE);
root.findViewById(R.id.file_view_tag_area).setVisibility(hasTags ? View.VISIBLE : View.GONE);
if (hasTags && !hasDescription) {
root.findViewById(R.id.file_view_tag_area).setPadding(0, 0, 0, 0);
}
root.findViewById(R.id.file_view_description_area).setVisibility(View.GONE);
((TextView) root.findViewById(R.id.file_view_title)).setText(claimToRender.getTitle());
((TextView) root.findViewById(R.id.file_view_description)).setText(claimToRender.getDescription());
((TextView) root.findViewById(R.id.file_view_publisher_name)).setText(Helper.isNullOrEmpty(claimToRender.getPublisherName()) ? getString(R.string.anonymous) : claimToRender.getPublisherName());
Claim signingChannel = claimToRender.getSigningChannel();
boolean hasPublisher = signingChannel != null;
boolean hasPublisherThumbnail = hasPublisher && !Helper.isNullOrEmpty(signingChannel.getThumbnailUrl());
root.findViewById(R.id.file_view_publisher_avatar).setVisibility(hasPublisher ? View.VISIBLE : View.GONE);
root.findViewById(R.id.file_view_publisher_thumbnail).setVisibility(hasPublisherThumbnail ? View.VISIBLE : View.INVISIBLE);
root.findViewById(R.id.file_view_publisher_no_thumbnail).setVisibility(!hasPublisherThumbnail ? View.VISIBLE : View.INVISIBLE);
if (hasPublisher) {
int bgColor = Helper.generateRandomColorForValue(signingChannel.getClaimId());
Helper.setIconViewBackgroundColor(root.findViewById(R.id.file_view_publisher_no_thumbnail), bgColor, false, context);
if (hasPublisherThumbnail && context != null) {
ViewGroup.LayoutParams lp = root.findViewById(R.id.file_view_publisher_thumbnail).getLayoutParams();
Glide.with(context.getApplicationContext()).load(signingChannel.getThumbnailUrl(lp.width, lp.height, 85)).apply(RequestOptions.circleCropTransform()).into((ImageView) root.findViewById(R.id.file_view_publisher_thumbnail));
}
((TextView) root.findViewById(R.id.file_view_publisher_thumbnail_alpha)).setText(signingChannel.getName() != null ? signingChannel.getName().substring(1, 2).toUpperCase() : null);
}
String publisherTitle = signingChannel != null ? signingChannel.getTitle() : null;
TextView textPublisherTitle = root.findViewById(R.id.file_view_publisher_title);
textPublisherTitle.setVisibility(Helper.isNullOrEmpty(publisherTitle) ? View.GONE : View.VISIBLE);
textPublisherTitle.setText(publisherTitle);
RecyclerView descTagsList = root.findViewById(R.id.file_view_tag_list);
FlexboxLayoutManager flm = new FlexboxLayoutManager(context);
descTagsList.setLayoutManager(flm);
List<Tag> tags = claimToRender.getTagObjects();
TagListAdapter tagListAdapter = new TagListAdapter(tags, context);
tagListAdapter.setClickListener(new TagListAdapter.TagClickListener() {
@Override
public void onTagClicked(Tag tag, int customizeMode) {
if (customizeMode == TagListAdapter.CUSTOMIZE_MODE_NONE) {
Context ctx = getContext();
if (ctx instanceof MainActivity) {
((MainActivity) ctx).openAllContentFragmentWithTag(tag.getName());
}
}
}
});
descTagsList.setAdapter(tagListAdapter);
root.findViewById(R.id.file_view_tag_area).setVisibility(tags.size() > 0 ? View.VISIBLE : View.GONE);
root.findViewById(R.id.file_view_exoplayer_container).setVisibility(View.GONE);
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.GONE);
root.findViewById(R.id.file_view_media_meta_container).setVisibility(View.VISIBLE);
Claim.GenericMetadata metadata = claimToRender.getValue();
if (!Helper.isNullOrEmpty(claimToRender.getThumbnailUrl())) {
ImageView thumbnailView = root.findViewById(R.id.file_view_thumbnail);
Glide.with(context.getApplicationContext()).asBitmap().load(claimToRender.getThumbnailUrl(context.getResources().getDisplayMetrics().widthPixels, thumbnailView.getLayoutParams().height, 85)).centerCrop().into(thumbnailView);
} else {
// display first x letters of claim name, with random background
}
root.findViewById(R.id.file_view_main_action_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onMainActionButtonClicked();
}
});
root.findViewById(R.id.file_view_media_meta_container).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onMainActionButtonClicked();
}
});
root.findViewById(R.id.file_view_open_external_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openClaimExternally(claimToRender, claimToRender.getMediaType());
}
});
if (metadata instanceof Claim.StreamMetadata) {
Claim.StreamMetadata streamMetadata = (Claim.StreamMetadata) metadata;
long publishTime = streamMetadata.getReleaseTime() > 0 ? streamMetadata.getReleaseTime() * 1000 : claimToRender.getTimestamp() * 1000;
((TextView) root.findViewById(R.id.file_view_publish_time)).setText(DateUtils.getRelativeTimeSpanString(publishTime, System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_RELATIVE));
Fee fee = streamMetadata.getFee();
if (fee != null && Helper.parseDouble(fee.getAmount(), 0) > 0) {
root.findViewById(R.id.file_view_fee_container).setVisibility(View.VISIBLE);
((TextView) root.findViewById(R.id.file_view_fee)).setText(Helper.shortCurrencyFormat(claimToRender.getActualCost(Lbryio.LBCUSDRate).doubleValue()));
}
}
boolean isAnonymous = claimToRender.getSigningChannel() == null;
View iconFollow = root.findViewById(R.id.file_view_icon_follow);
View iconUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
if (isAnonymous) {
if (iconFollow.getVisibility() == View.VISIBLE) {
iconFollow.setVisibility(View.INVISIBLE);
}
if (iconUnfollow.getVisibility() == View.VISIBLE) {
iconUnfollow.setVisibility(View.INVISIBLE);
}
}
MaterialButton mainActionButton = root.findViewById(R.id.file_view_main_action_button);
if (claimToRender.isPlayable()) {
mainActionButton.setText(R.string.play);
} else if (claimToRender.isViewable()) {
mainActionButton.setText(R.string.view);
} else {
mainActionButton.setText(R.string.download);
}
}
if (claimToRender.isFree() && Helper.isNullOrEmpty(commentHash)) {
if (claimToRender.isPlayable() || (!Lbry.SDK_READY && Lbryio.isSignedIn())) {
if (MainActivity.nowPlayingClaim != null && MainActivity.nowPlayingClaim.getClaimId().equalsIgnoreCase(claimToRender.getClaimId())) {
// claim already playing
showExoplayerView();
playMedia();
} else {
onMainActionButtonClicked();
}
} else if (claimToRender.isViewable() && Lbry.SDK_READY) {
onMainActionButtonClicked();
} else if (!Lbry.SDK_READY) {
restoreMainActionButton();
}
} else {
restoreMainActionButton();
}
/*if (Lbry.SDK_READY && !claimToRender.isPlayable() && !claimToRender.isViewable() && Helper.isNullOrEmpty(commentHash)) {
if (claimToRender.getFile() == null) {
loadFile();
} else {
// file already loaded, but it's unsupported
showUnsupportedView();
}
}*/
checkRewardsDriver();
checkOwnClaim();
}
use of com.google.android.flexbox.FlexboxLayoutManager in project odysee-android by OdyseeTeam.
the class ChannelFormFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_channel_form, container, false);
scrollView = root.findViewById(R.id.channel_form_scroll_view);
linkCancel = root.findViewById(R.id.channel_form_cancel_link);
linkShowOptional = root.findViewById(R.id.channel_form_toggle_optional);
buttonSave = root.findViewById(R.id.channel_form_save_button);
containerOptionalFields = root.findViewById(R.id.channel_form_optional_fields_container);
inputTitle = root.findViewById(R.id.channel_form_input_title);
inputChannelName = root.findViewById(R.id.channel_form_input_channel_name);
inputDeposit = root.findViewById(R.id.channel_form_input_deposit);
inputDescription = root.findViewById(R.id.channel_form_input_description);
inputWebsite = root.findViewById(R.id.channel_form_input_website);
inputEmail = root.findViewById(R.id.channel_form_input_email);
inputTagFilter = root.findViewById(R.id.form_tag_filter_input);
coverEditArea = root.findViewById(R.id.channel_form_cover_edit_area);
iconContainer = root.findViewById(R.id.channel_form_icon_container);
imageCover = root.findViewById(R.id.channel_form_cover_image);
imageThumbnail = root.findViewById(R.id.channel_form_thumbnail);
balanceView = root.findViewById(R.id.channel_form_balance);
uploadProgress = root.findViewById(R.id.channel_form_upload_progress);
channelSaveProgress = root.findViewById(R.id.channel_form_save_progress);
Context context = getContext();
FlexboxLayoutManager flm1 = new FlexboxLayoutManager(context);
FlexboxLayoutManager flm2 = new FlexboxLayoutManager(context);
addedTagsList = root.findViewById(R.id.form_added_tags);
addedTagsList.setLayoutManager(flm1);
suggestedTagsList = root.findViewById(R.id.form_suggested_tags);
suggestedTagsList.setLayoutManager(flm2);
addedTagsAdapter = new TagListAdapter(new ArrayList<>(), context);
addedTagsAdapter.setCustomizeMode(TagListAdapter.CUSTOMIZE_MODE_REMOVE);
addedTagsAdapter.setClickListener(this);
addedTagsList.setAdapter(addedTagsAdapter);
suggestedTagsAdapter = new TagListAdapter(new ArrayList<>(), getContext());
suggestedTagsAdapter.setCustomizeMode(TagListAdapter.CUSTOMIZE_MODE_ADD);
suggestedTagsAdapter.setClickListener(this);
suggestedTagsList.setAdapter(suggestedTagsAdapter);
noTagsView = root.findViewById(R.id.form_no_added_tags);
noTagResultsView = root.findViewById(R.id.form_no_tag_results);
buttonSave = root.findViewById(R.id.channel_form_save_button);
inputDeposit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
Helper.setViewVisibility(balanceView, hasFocus ? View.VISIBLE : View.INVISIBLE);
}
});
linkShowOptional.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (containerOptionalFields.getVisibility() != View.VISIBLE) {
containerOptionalFields.setVisibility(View.VISIBLE);
linkShowOptional.setText(R.string.hide_optional_fields);
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.fullScroll(NestedScrollView.FOCUS_DOWN);
}
});
} else {
containerOptionalFields.setVisibility(View.GONE);
linkShowOptional.setText(R.string.show_optional_fields);
}
}
});
linkCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clearInputFocus();
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).onBackPressed();
}
}
});
coverEditArea.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (uploading) {
Snackbar.make(getView(), R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
return;
}
checkPermissionsAndLaunchFilePicker(true);
}
});
iconContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (uploading) {
Snackbar.make(view, R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
return;
}
checkPermissionsAndLaunchFilePicker(false);
}
});
buttonSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (uploading) {
Snackbar.make(view, R.string.wait_for_upload, Snackbar.LENGTH_LONG).show();
return;
}
Claim claimToSave = buildChannelClaimToSave();
validateAndSaveClaim(claimToSave);
}
});
inputTagFilter.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
String value = Helper.getValue(charSequence);
setFilter(value);
}
@Override
public void afterTextChanged(Editable editable) {
}
});
return root;
}
Aggregations