use of com.odysee.app.adapter.InlineChannelSpinnerAdapter in project odysee-android by OdyseeTeam.
the class CreateSupportDialogFragment method updateChannelList.
private void updateChannelList(List<Claim> channels) {
if (channelSpinnerAdapter == null) {
Context context = getContext();
if (context != null) {
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, new ArrayList<>(channels));
channelSpinnerAdapter.addAnonymousPlaceholder();
channelSpinnerAdapter.notifyDataSetChanged();
}
} else {
channelSpinnerAdapter.clear();
channelSpinnerAdapter.addAll(channels);
channelSpinnerAdapter.addAnonymousPlaceholder();
channelSpinnerAdapter.notifyDataSetChanged();
}
if (channelSpinner != null) {
channelSpinner.setAdapter(channelSpinnerAdapter);
}
if (channelSpinnerAdapter != null && channelSpinner != null) {
if (channelSpinnerAdapter.getCount() > 1) {
channelSpinner.setSelection(1);
}
}
}
use of com.odysee.app.adapter.InlineChannelSpinnerAdapter in project odysee-android by OdyseeTeam.
the class RepostClaimDialogFragment method loadChannels.
private void loadChannels(List<Claim> channels) {
if (channelSpinnerAdapter == null) {
Context context = getContext();
if (context != null) {
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, channels);
channelSpinnerAdapter.notifyDataSetChanged();
}
} else {
channelSpinnerAdapter.clear();
channelSpinnerAdapter.addAll(channels);
channelSpinnerAdapter.notifyDataSetChanged();
}
if (channelSpinner != null && channelSpinnerAdapter != null) {
channelSpinner.setAdapter(channelSpinnerAdapter);
}
}
use of com.odysee.app.adapter.InlineChannelSpinnerAdapter in project odysee-android by OdyseeTeam.
the class ChannelCommentsFragment method updateChannelList.
private void updateChannelList(List<Claim> channels) {
if (commentChannelSpinnerAdapter == null) {
Context context = getContext();
if (context != null) {
commentChannelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, new ArrayList<>(channels));
commentChannelSpinnerAdapter.addPlaceholder(false);
commentChannelSpinnerAdapter.notifyDataSetChanged();
}
} else {
commentChannelSpinnerAdapter.clear();
commentChannelSpinnerAdapter.addAll(channels);
commentChannelSpinnerAdapter.addPlaceholder(false);
commentChannelSpinnerAdapter.notifyDataSetChanged();
}
if (commentChannelSpinner != null) {
commentChannelSpinner.setAdapter(commentChannelSpinnerAdapter);
}
if (commentChannelSpinnerAdapter != null && commentChannelSpinner != null) {
if (commentChannelSpinnerAdapter.getCount() > 1) {
commentChannelSpinner.setSelection(1);
}
}
}
use of com.odysee.app.adapter.InlineChannelSpinnerAdapter in project odysee-android by OdyseeTeam.
the class InvitesFragment method initUi.
private void initUi() {
layoutAccountDriver.setVisibility(Lbryio.isSignedIn() ? View.GONE : View.VISIBLE);
Helper.applyHtmlForTextView(textLearnMoreLink);
rewardDriverCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).openRewards();
}
}
});
inputEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
layoutInputEmail.setHint(hasFocus ? getString(R.string.email) : Helper.getValue(inputEmail.getText()).length() > 0 ? getString(R.string.email) : getString(R.string.invite_email_placeholder));
}
});
inputEmail.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) {
Helper.setViewEnabled(buttonInviteByEmail, charSequence.length() > 0);
}
@Override
public void afterTextChanged(Editable editable) {
}
});
buttonInviteByEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = Helper.getValue(inputEmail.getText());
if (!email.contains("@")) {
showError(getString(R.string.provide_valid_email));
return;
}
InviteByEmailTask task = new InviteByEmailTask(email, progressLoadingInviteByEmail, new GenericTaskHandler() {
@Override
public void beforeStart() {
Helper.setViewEnabled(buttonInviteByEmail, false);
}
@Override
public void onSuccess() {
Snackbar.make(getView(), getString(R.string.invite_sent_to, email), Snackbar.LENGTH_LONG).show();
Helper.setViewText(inputEmail, null);
Helper.setViewEnabled(buttonInviteByEmail, true);
fetchInviteStatus();
}
@Override
public void onError(Exception error) {
showError(error.getMessage());
Helper.setViewEnabled(buttonInviteByEmail, true);
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
buttonGetStarted.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context).simpleSignIn(R.id.action_home_menu);
}
}
});
channelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
Object item = adapterView.getItemAtPosition(position);
if (item instanceof Claim) {
Claim claim = (Claim) item;
if (claim.isPlaceholder()) {
if (!fetchingChannels) {
showChannelCreator();
}
} else {
// build invite link
updateInviteLink(claim);
}
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
textInviteLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
copyInviteLink();
}
});
buttonCopyInviteLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
copyInviteLink();
}
});
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(getContext(), R.layout.spinner_item_channel, new ArrayList<>());
channelSpinnerAdapter.addPlaceholder(false);
}
Aggregations