Java Code Examples for androidx.recyclerview.widget.RecyclerView#setVisibility()

The following examples show how to use androidx.recyclerview.widget.RecyclerView#setVisibility() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Base.java    From indigenous-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Hide other preview elements.
 *
 * @param hideImage
 *   Whether to hide image or not.
 * @param hideVideo
 *   Whether to hide video or not.
 * @param hideAudio
 *   Whether to hide audio or not.
 */
public void hideMediaPreview(boolean hideImage, boolean hideVideo, boolean hideAudio) {
    if (hideImage) {
        RecyclerView imageRecyclerView = findViewById(R.id.imageRecyclerView);
        imageRecyclerView.setVisibility(View.GONE);
    }

    if (hideVideo) {
        RecyclerView videoRecyclerView = findViewById(R.id.videoRecyclerView);
        videoRecyclerView.setVisibility(View.GONE);
    }

    if (hideAudio) {
        RecyclerView audioRecyclerView = findViewById(R.id.audioRecyclerView);
        audioRecyclerView.setVisibility(View.GONE);
    }
}
 
Example 2
Source File: RVUtils.java    From Bop with Apache License 2.0 5 votes vote down vote up
public static void makenoDataVisible(RecyclerView recyclerView, LinearLayout noData) {
    if (recyclerView.getAdapter().getItemCount() == 0) {
        recyclerView.setVisibility(View.GONE);
        noData.setVisibility(View.VISIBLE);
    } else {
        recyclerView.setVisibility(View.VISIBLE);
        noData.setVisibility(View.GONE);
    }

}
 
Example 3
Source File: Base.java    From indigenous-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Prepare image preview.
 */
public void prepareImagePreview() {
    mediaPreviewGallery.setVisibility(View.VISIBLE);
    ImageGalleryAdapter galleryAdapter = new ImageGalleryAdapter(this, image, caption, isMediaRequest);
    RecyclerView imageRecyclerView = findViewById(R.id.imageRecyclerView);
    imageRecyclerView.setVisibility(View.VISIBLE);
    imageRecyclerView.setAdapter(galleryAdapter);
}
 
Example 4
Source File: Base.java    From indigenous-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Prepare video preview.
 */
public void prepareVideoPreview() {
    mediaPreviewGallery.setVisibility(View.VISIBLE);
    VideoGalleryAdapter galleryAdapter = new VideoGalleryAdapter(this, video, isMediaRequest);
    RecyclerView videoRecyclerView = findViewById(R.id.videoRecyclerView);
    videoRecyclerView.setVisibility(View.VISIBLE);
    videoRecyclerView.setAdapter(galleryAdapter);
}
 
Example 5
Source File: Base.java    From indigenous-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Prepare audio preview.
 */
public void prepareAudioPreview() {
    mediaPreviewGallery.setVisibility(View.VISIBLE);
    AudioGalleryAdapter galleryAdapter = new AudioGalleryAdapter(this, audio, isMediaRequest);
    RecyclerView audioRecyclerView = findViewById(R.id.audioRecyclerView);
    audioRecyclerView.setVisibility(View.VISIBLE);
    audioRecyclerView.setAdapter(galleryAdapter);
}
 
Example 6
Source File: Utility.java    From PixImagePicker with Apache License 2.0 5 votes vote down vote up
public static void manipulateVisibility(AppCompatActivity activity, float slideOffset, View arrow_up,
                                        RecyclerView instantRecyclerView, RecyclerView recyclerView,
                                        View status_bar_bg, View topbar, View clickme, View sendButton, boolean longSelection) {
    instantRecyclerView.setAlpha(1 - slideOffset);
    arrow_up.setAlpha(1 - slideOffset);
    clickme.setAlpha(1 - slideOffset);
    if (longSelection) {
        sendButton.setAlpha(1 - slideOffset);
    }
    topbar.setAlpha(slideOffset);
    recyclerView.setAlpha(slideOffset);
    if ((1 - slideOffset) == 0 && instantRecyclerView.getVisibility() == View.VISIBLE) {
        instantRecyclerView.setVisibility(View.GONE);
        arrow_up.setVisibility(View.GONE);
        clickme.setVisibility(View.GONE);
    } else if (instantRecyclerView.getVisibility() == View.GONE && (1 - slideOffset) > 0) {
        instantRecyclerView.setVisibility(View.VISIBLE);
        arrow_up.setVisibility(View.VISIBLE);
        clickme.setVisibility(View.VISIBLE);
        if (longSelection) {
            sendButton.clearAnimation();
            sendButton.setVisibility(View.VISIBLE);
        }
    }
    if ((slideOffset) > 0 && recyclerView.getVisibility() == View.INVISIBLE) {
        recyclerView.setVisibility(View.VISIBLE);
        status_bar_bg.animate().translationY(0).setDuration(200).start();
        topbar.setVisibility(View.VISIBLE);
        Utility.showStatusBar(activity);
    } else if (recyclerView.getVisibility() == View.VISIBLE && (slideOffset) == 0) {
        Utility.hideStatusBar(activity);
        recyclerView.setVisibility(View.INVISIBLE);
        topbar.setVisibility(View.GONE);
        status_bar_bg.animate().translationY(-(status_bar_bg.getHeight())).setDuration(550).start();
    }
}
 
Example 7
Source File: NotificationStore.java    From AndroidAPS with GNU Affero General Public License v3.0 5 votes vote down vote up
public synchronized void updateNotifications(RecyclerView notificationsView) {
    removeExpired();
    unSnooze();
    if (store.size() > 0) {
        NotificationRecyclerViewAdapter adapter = new NotificationRecyclerViewAdapter(cloneStore());
        notificationsView.setAdapter(adapter);
        notificationsView.setVisibility(View.VISIBLE);
    } else {
        notificationsView.setVisibility(View.GONE);
    }
}
 
Example 8
Source File: DialogFragmentFavorite.java    From privatelocation with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
@SuppressLint("InflateParams")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    Context context = getContext();

    //setup alert builder
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(getString(R.string.dialog_favorites_title));

    //set listview as view
    LayoutInflater inflater = getActivity().getLayoutInflater();
    final View view = inflater.inflate(R.layout.dialog_favorites, null);
    builder.setView(view);

    RecyclerView favoriteView = (RecyclerView) view.findViewById(R.id.favorite_list);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);

    //empty view
    TextView tvEmpty = view.findViewById(R.id.tvEmpty);

    favoriteView.setLayoutManager(linearLayoutManager);
    favoriteView.setHasFixedSize(true);

    //db
    mDatabase = new SQLiteDB(context);
    List<Favorite> allFavorites = mDatabase.listFavorites();

    //if db empty
    if(allFavorites.isEmpty()) {
        favoriteView.setVisibility(View.GONE);
        tvEmpty.setVisibility(View.VISIBLE);

    } else {
        favoriteView.setVisibility(View.VISIBLE);
        tvEmpty.setVisibility(View.GONE);
        //pass mainActivity so we can callback in FavoriteAdapter
        FavoriteAdapter mAdapter = new FavoriteAdapter(context, allFavorites, mainActivity, DialogFragmentFavorite.this);
        favoriteView.setAdapter(mAdapter);
    }

    return builder.create();
}
 
Example 9
Source File: SendConfirmActivity.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
private void setup() {
    // Setup views fields
    final TextView noteTextTitle = UI.find(this, R.id.sendMemoTitle);
    final TextView noteText = UI.find(this, R.id.noteText);
    final TextView addressText = UI.find(this, R.id.addressText);

    final JsonNode address = mTxJson.withArray("addressees").get(0);
    final String currentRecipient = address.get("address").asText();
    final boolean isSweeping = mTxJson.get("is_sweep").asBoolean();
    final Integer subaccount = mTxJson.get("subaccount").asInt();
    UI.hideIf(isSweeping, noteTextTitle);
    UI.hideIf(isSweeping, noteText);

    addressText.setText(currentRecipient);
    noteText.setText(mTxJson.get("memo") == null ? "" : mTxJson.get("memo").asText());
    CharInputFilter.setIfNecessary(noteText);

    // Set currency & amount
    final long amount = mTxJson.get("satoshi").asLong();
    final long fee = mTxJson.get("fee").asLong();
    final TextView sendAmount = UI.find(this, R.id.sendAmount);
    final TextView sendFee = UI.find(this, R.id.sendFee);
    final JsonNode assetTag = address.get("asset_tag");
    if (getSession().getNetworkData().getLiquid()) {
        sendAmount.setVisibility(View.GONE);
        UI.find(this, R.id.amountWordSending).setVisibility(View.GONE);
        final String asset = assetTag.asText();
        final Map<String, Long> balances = new HashMap<>();
        balances.put(asset, address.get("satoshi").asLong());
        final RecyclerView assetsList = findViewById(R.id.assetsList);
        assetsList.setLayoutManager(new LinearLayoutManager(this));
        final AssetsAdapter adapter = new AssetsAdapter(balances, getNetwork(), null);
        assetsList.setAdapter(adapter);
        assetsList.setVisibility(View.VISIBLE);
    } else {
        sendAmount.setText(getFormatAmount(amount));
    }
    sendFee.setText(getFormatAmount(fee));

    if (mHwData != null && mTxJson.has("transaction_outputs")) {
        UI.show(UI.find(this, R.id.changeLayout));
        final TextView view = UI.find(this, R.id.changeAddressText);
        final Collection<String> changesList = new ArrayList<>();
        for (final JsonNode output : mTxJson.get("transaction_outputs")) {
            if (output.get("is_change").asBoolean() && !output.get("is_fee").asBoolean() && output.has("address")) {
                changesList.add("- " + output.get("address").asText());
            }
        }
        view.setText(TextUtils.join("\n", changesList));
    }

    mSwipeButton.setOnActiveListener(this);
}
 
Example 10
Source File: AlRichMessage.java    From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void createRichMessage() {
    ALRichMessageModel model = (ALRichMessageModel) GsonUtils.getObjectFromJson(GsonUtils.getJsonFromObject(message.getMetadata(), Map.class), ALRichMessageModel.class);

    LinearLayout listItemlayout = containerView.findViewById(R.id.alListMessageLayout);
    LinearLayout faqReplyLayout = containerView.findViewById(R.id.alFaqReplyLayout);
    LinearLayout faqLayout = containerView.findViewById(R.id.alFaqLayout);
    RecyclerView genericCardRecycler = containerView.findViewById(R.id.alGenericCardContainer);
    RecyclerView imageListRecycler = containerView.findViewById(R.id.alImageListContainer);
    KmFlowLayout flowLayout = containerView.findViewById(R.id.kmFlowLayout);

    listItemlayout.setVisibility(model.getTemplateId() == 7 ? View.VISIBLE : View.GONE);
    genericCardRecycler.setVisibility(model.getTemplateId() == 10 ? View.VISIBLE : View.GONE);
    faqLayout.setVisibility(model.getTemplateId() == 8 ? View.VISIBLE : View.GONE);
    faqReplyLayout.setVisibility(model.getTemplateId() == 8 ? View.VISIBLE : View.GONE);
    imageListRecycler.setVisibility(model.getTemplateId() == 9 ? View.VISIBLE : View.GONE);
    flowLayout.setVisibility((model.getTemplateId() == 3 || model.getTemplateId() == 6 || model.getTemplateId() == 11) ? View.VISIBLE : View.GONE);

    switch (model.getTemplateId()) {
        case 3:
        case 6:
        case 11:
            setUpGridView(flowLayout, model);
            break;

        case 7:
            setupListItemView(listItemlayout, model);
            break;

        case 8:
            setupFaqItemView(faqLayout, faqReplyLayout, model);
            break;

        case 9:
            LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
            imageListRecycler.setLayoutManager(layoutManager);
            AlImageAdapter imageAdapter = new AlImageAdapter(context, model, listener, message, alCustomizationSettings);
            imageListRecycler.setAdapter(imageAdapter);
            break;

        case 10:
            LinearLayoutManager genericCardsLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
            genericCardRecycler.setLayoutManager(genericCardsLayoutManager);
            ALRichMessageAdapter adapter = new ALRichMessageAdapter(context, model, listener, message);
            genericCardRecycler.setAdapter(adapter);
            break;

        default:
            containerView.setVisibility(View.GONE);
    }
}
 
Example 11
Source File: SaveActivity.java    From Chimee with MIT License 4 votes vote down vote up
private void hideRecyclerView() {
    RecyclerView recyclerView = findViewById(R.id.rv_document_list);
    recyclerView.setVisibility(View.INVISIBLE);
}