Example usage for android.widget ImageView ImageView

List of usage examples for android.widget ImageView ImageView

Introduction

In this page you can find the example usage for android.widget ImageView ImageView.

Prototype

public ImageView(Context context) 

Source Link

Usage

From source file:org.cafemember.ui.DialogsActivity.java

@Override
public View createView(final Context context) {
    Commands.checkChannels(MessagesController.getInstance().getDialogs());
    int today = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
    if (today != Defaults.getInstance().getLastDay()) {
        Defaults.getInstance().setLastDay(today);
        AlertDialog.Builder builder = null;
        /*if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        builder = new AlertDialog.Builder(context, R.style.MyDialog);
        }//from w ww .ja  v a  2s.c o m
        else {*/
        builder = new AlertDialog.Builder(context);
        //            }

        builder.setTitle(" ");
        builder.setMessage(
                AndroidUtilities.replaceTags(LocaleController.getString("giftText", R.string.giftText)));

        builder.setPositiveButton("", null);
        showDialog(builder.create());

    }
    searching = false;
    searchWas = false;

    Theme.loadRecources(context);

    ActionBarMenu menu = actionBar.createMenu();
    if (!onlySelect && searchString == null) {
        passcodeItem = menu.addItem(1, R.drawable.lock_close);
        updatePasscodeButton();
    }
    joinCoins = menu.addItemResource(7, R.layout.join_coins_view);
    FontManager.instance().setTypefaceImmediate(joinCoins);
    //        viewCoins = menu.addItemResource(8, R.layout.view_coins_view);

    //        final ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
    //            @Override
    //            public void onSearchExpand() {
    //                searching = true;
    //                if (listView != null) {
    //                    if (searchString != null) {
    //                        listView.setEmptyView(searchEmptyView);
    //                        progressView.setVisibility(View.GONE);
    //                        emptyView.setVisibility(View.GONE);
    //                    }
    //                    if (!onlySelect) {
    //                        floatingButton.setVisibility(View.GONE);
    //                    }
    //                }
    //                updatePasscodeButton();
    //            }
    //
    //            @Override
    //            public boolean canCollapseSearch() {
    //                if (searchString != null) {
    //                    finishFragment();
    //                    return false;
    //                }
    //                return true;
    //            }
    //
    //            @Override
    //            public void onSearchCollapse() {
    //                searching = false;
    //                searchWas = false;
    //                if (listView != null) {
    //                    searchEmptyView.setVisibility(View.GONE);
    //                    if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
    //                        emptyView.setVisibility(View.GONE);
    //                        listView.setEmptyView(progressView);
    //                    } else {
    //                        progressView.setVisibility(View.GONE);
    //                        listView.setEmptyView(emptyView);
    //                    }
    //                    if (!onlySelect) {
    //                        floatingButton.setVisibility(View.VISIBLE);
    //                        floatingHidden = true;
    //                        ViewProxy.setTranslationY(floatingButton, AndroidUtilities.dp(100));
    //                        hideFloatingButton(false);
    //                    }
    //                    if (listView.getAdapter() != dialogsAdapter) {
    //                        listView.setAdapter(dialogsAdapter);
    //                        dialogsAdapter.notifyDataSetChanged();
    //                    }
    //                }
    //                if (dialogsSearchAdapter != null) {
    //                    dialogsSearchAdapter.searchDialogs(null);
    //                }
    //                updatePasscodeButton();
    //            }
    //
    //            @Override
    //            public void onTextChanged(EditText editText) {
    //                String text = editText.getText().toString();
    //                if (text.length() != 0 || dialogsSearchAdapter != null && dialogsSearchAdapter.hasRecentRearch()) {
    //                    searchWas = true;
    //                    if (dialogsSearchAdapter != null && listView.getAdapter() != dialogsSearchAdapter) {
    //                        listView.setAdapter(dialogsSearchAdapter);
    //                        dialogsSearchAdapter.notifyDataSetChanged();
    //                    }
    //                    if (searchEmptyView != null && listView.getEmptyView() != searchEmptyView) {
    //                        emptyView.setVisibility(View.GONE);
    //                        progressView.setVisibility(View.GONE);
    //                        searchEmptyView.showTextView();
    //                        listView.setEmptyView(searchEmptyView);
    //                    }
    //                }
    //                if (dialogsSearchAdapter != null) {
    //                    dialogsSearchAdapter.searchDialogs(text);
    //                }
    //            }
    //        });
    //        item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));
    if (onlySelect) {
        actionBar.setBackButtonImage(R.drawable.ic_ab_back);
        actionBar.setTitle(LocaleController.getString("SelectChat", R.string.SelectChat));
    } else {
        if (searchString != null) {
            actionBar.setBackButtonImage(R.drawable.ic_ab_back);
        } else {
            actionBar.setBackButtonDrawable(new MenuDrawable());
        }
        if (BuildVars.DEBUG_VERSION) {
            actionBar.setTitle(LocaleController.getString("AppNameBeta", R.string.AppNameBeta));
        } else {
            actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
        }
    }
    actionBar.setAllowOverlayTitle(true);

    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                if (onlySelect) {
                    finishFragment();
                } else if (parentLayout != null) {
                    parentLayout.getDrawerLayoutContainer().openDrawer(false);
                }
            } else if (id == 1) {
                UserConfig.appLocked = !UserConfig.appLocked;
                UserConfig.saveConfig(false);
                updatePasscodeButton();
            }
        }
    });

    FrameLayout frameLayout = new FrameLayout(context);
    //        fragmentView = frameLayout;
    fragmentView = Views.getTabLayout((FragmentActivity) context, this, frameLayout);

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(true);
    listView.setItemAnimator(null);
    listView.setInstantClick(true);
    listView.setLayoutAnimation(null);
    layoutManager = new LinearLayoutManager(context) {
        @Override
        public boolean supportsPredictiveItemAnimations() {
            return false;
        }
    };
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    listView.setLayoutManager(layoutManager);
    if (Build.VERSION.SDK_INT >= 11) {
        listView.setVerticalScrollbarPosition(
                LocaleController.isRTL ? ListView.SCROLLBAR_POSITION_LEFT : ListView.SCROLLBAR_POSITION_RIGHT);
    }
    frameLayout.addView(listView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    listView.setOnAddChannelClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            if (listView == null || listView.getAdapter() == null) {
                return;
            }
            long dialog_id = 0;
            int message_id = 0;
            RecyclerView.Adapter adapter = listView.getAdapter();
            if (adapter == dialogsAdapter) {
                TLRPC.Dialog dialog = dialogsAdapter.getItem(position);
                if (dialog == null) {
                    return;
                }
                int lower_id = (int) dialog.id;
                final TLRPC.Chat chat = MessagesController.getInstance().getChat(-lower_id);
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("MemberBegirTitle", R.string.MemberBegirTitle));

                /*builder.setItems(Defaults.MEMBERS_COUNT , new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Commands.addChannel(chat,Integer.parseInt(Defaults.MEMBERS_COUNT[which]));
                    }
                });*/
                /*builder.setAdapter(new ReserveAdapter(getParentActivity(),R.layout.adapter_buy_coin,1), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Commands.addChannel(chat,Integer.parseInt(Defaults.MEMBERS_COUNT[which]));
                    }
                });*/
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            }
        }
    });

    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {

            if (listView == null || listView.getAdapter() == null) {
                return;
            }
            long dialog_id = 0;
            int message_id = 0;
            RecyclerView.Adapter adapter = listView.getAdapter();
            if (adapter == dialogsAdapter) {
                TLRPC.Dialog dialog = dialogsAdapter.getItem(position);
                if (dialog == null) {
                    return;
                }
                dialog_id = dialog.id;
            } else if (adapter == dialogsSearchAdapter) {
                Object obj = dialogsSearchAdapter.getItem(position);
                if (obj instanceof TLRPC.User) {
                    dialog_id = ((TLRPC.User) obj).id;
                    if (dialogsSearchAdapter.isGlobalSearch(position)) {
                        ArrayList<TLRPC.User> users = new ArrayList<>();
                        users.add((TLRPC.User) obj);
                        MessagesController.getInstance().putUsers(users, false);
                        MessagesStorage.getInstance().putUsersAndChats(users, null, false, true);
                    }
                    if (!onlySelect) {
                        dialogsSearchAdapter.putRecentSearch(dialog_id, (TLRPC.User) obj);
                    }
                } else if (obj instanceof TLRPC.Chat) {
                    if (dialogsSearchAdapter.isGlobalSearch(position)) {
                        ArrayList<TLRPC.Chat> chats = new ArrayList<>();
                        chats.add((TLRPC.Chat) obj);
                        MessagesController.getInstance().putChats(chats, false);
                        MessagesStorage.getInstance().putUsersAndChats(null, chats, false, true);
                    }
                    if (((TLRPC.Chat) obj).id > 0) {
                        dialog_id = -((TLRPC.Chat) obj).id;
                    } else {
                        dialog_id = AndroidUtilities.makeBroadcastId(((TLRPC.Chat) obj).id);
                    }
                    if (!onlySelect) {
                        dialogsSearchAdapter.putRecentSearch(dialog_id, (TLRPC.Chat) obj);
                    }
                } else if (obj instanceof TLRPC.EncryptedChat) {
                    dialog_id = ((long) ((TLRPC.EncryptedChat) obj).id) << 32;
                    if (!onlySelect) {
                        dialogsSearchAdapter.putRecentSearch(dialog_id, (TLRPC.EncryptedChat) obj);
                    }
                } else if (obj instanceof MessageObject) {
                    MessageObject messageObject = (MessageObject) obj;
                    dialog_id = messageObject.getDialogId();
                    message_id = messageObject.getId();
                    dialogsSearchAdapter.addHashtagsFromMessage(dialogsSearchAdapter.getLastSearchString());
                } else if (obj instanceof String) {
                    actionBar.openSearchField((String) obj);
                }
            }

            if (dialog_id == 0) {
                return;
            }

            if (onlySelect) {
                didSelectResult(dialog_id, true, false);
            } else {
                Bundle args = new Bundle();
                int lower_part = (int) dialog_id;
                int high_id = (int) (dialog_id >> 32);
                if (lower_part != 0) {
                    if (high_id == 1) {
                        args.putInt("chat_id", lower_part);
                    } else {
                        if (lower_part > 0) {
                            args.putInt("user_id", lower_part);
                        } else if (lower_part < 0) {
                            if (message_id != 0) {
                                TLRPC.Chat chat = MessagesController.getInstance().getChat(-lower_part);
                                if (chat != null && chat.migrated_to != null) {
                                    args.putInt("migrated_to", lower_part);
                                    lower_part = -chat.migrated_to.channel_id;
                                }
                            }
                            args.putInt("chat_id", -lower_part);
                        }
                    }
                } else {
                    args.putInt("enc_id", high_id);
                }
                if (message_id != 0) {
                    args.putInt("message_id", message_id);
                } else {
                    if (actionBar != null) {
                        actionBar.closeSearchField();
                    }
                }
                if (AndroidUtilities.isTablet()) {
                    if (openedDialogId == dialog_id && adapter != dialogsSearchAdapter) {
                        return;
                    }
                    if (dialogsAdapter != null) {
                        dialogsAdapter.setOpenedDialogId(openedDialogId = dialog_id);
                        updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
                    }
                }
                if (searchString != null) {
                    if (MessagesController.checkCanOpenChat(args, DialogsActivity.this)) {
                        NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);
                        presentFragment(new ChatActivity(args));
                    }
                } else {
                    if (MessagesController.checkCanOpenChat(args, DialogsActivity.this)) {
                        presentFragment(new ChatActivity(args));
                    }
                }
            }
        }
    });
    listView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
        @Override
        public boolean onItemClick(View view, int position) {
            if (onlySelect || searching && searchWas || getParentActivity() == null) {
                if (searchWas && searching || dialogsSearchAdapter.isRecentSearchDisplayed()) {
                    RecyclerView.Adapter adapter = listView.getAdapter();
                    if (adapter == dialogsSearchAdapter) {
                        Object item = dialogsSearchAdapter.getItem(position);
                        if (item instanceof String || dialogsSearchAdapter.isRecentSearchDisplayed()) {
                            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                            builder.setMessage(LocaleController.getString("ClearSearch", R.string.ClearSearch));
                            builder.setPositiveButton(LocaleController
                                    .getString("ClearButton", R.string.ClearButton).toUpperCase(),
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            if (dialogsSearchAdapter.isRecentSearchDisplayed()) {
                                                dialogsSearchAdapter.clearRecentSearch();
                                            } else {
                                                dialogsSearchAdapter.clearRecentHashtags();
                                            }
                                        }
                                    });
                            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel),
                                    null);
                            showDialog(builder.create());
                            return true;
                        }
                    }
                }
                return false;
            }
            TLRPC.Dialog dialog;
            ArrayList<TLRPC.Dialog> dialogs = getDialogsArray();
            if (position < 0 || position >= dialogs.size()) {
                return false;
            }
            dialog = dialogs.get(position);
            selectedDialog = dialog.id;

            BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity());
            int lower_id = (int) selectedDialog;
            int high_id = (int) (selectedDialog >> 32);

            if (dialog instanceof TLRPC.TL_dialogChannel) {
                final TLRPC.Chat chat = MessagesController.getInstance().getChat(-lower_id);
                CharSequence items[];
                if (chat != null && chat.megagroup) {
                    items = new CharSequence[] {
                            LocaleController.getString("ClearHistoryCache", R.string.ClearHistoryCache),
                            chat == null || !chat.creator
                                    ? LocaleController.getString("LeaveMegaMenu", R.string.LeaveMegaMenu)
                                    : LocaleController.getString("DeleteMegaMenu", R.string.DeleteMegaMenu) };
                } else {
                    items = new CharSequence[] {
                            LocaleController.getString("ClearHistoryCache", R.string.ClearHistoryCache),
                            chat == null || !chat.creator
                                    ? LocaleController.getString("LeaveChannelMenu", R.string.LeaveChannelMenu)
                                    : LocaleController.getString("ChannelDeleteMenu",
                                            R.string.ChannelDeleteMenu),
                            LocaleController.getString("MemberBegir", R.string.MemberBegir) };
                }
                builder.setItems(items, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, final int which) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                        if (which == 0) {
                            if (chat != null && chat.megagroup) {
                                builder.setMessage(LocaleController.getString("AreYouSureClearHistorySuper",
                                        R.string.AreYouSureClearHistorySuper));
                            } else {
                                builder.setMessage(LocaleController.getString("AreYouSureClearHistoryChannel",
                                        R.string.AreYouSureClearHistoryChannel));
                            }
                            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            MessagesController.getInstance().deleteDialog(selectedDialog, 2);
                                        }
                                    });
                        } else if (which == 2) {
                            builder.setTitle(
                                    LocaleController.getString("MemberBegirTitle", R.string.MemberBegirTitle));

                            /*builder.setAdapter(new ReserveAdapter(getParentActivity(),R.layout.adapter_buy_coin,1), new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                Commands.addChannel(chat,Integer.parseInt(Defaults.MEMBERS_COUNT[which]));
                            }
                            });*/

                            /*builder.setItems(Defaults.MEMBERS_COUNT , new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                Commands.addChannel(chat,Integer.parseInt(Defaults.MEMBERS_COUNT[which]));
                            }
                            });*/
                        } else {
                            if (chat != null && chat.megagroup) {
                                if (!chat.creator) {
                                    builder.setMessage(LocaleController.getString("MegaLeaveAlert",
                                            R.string.MegaLeaveAlert));
                                } else {
                                    builder.setMessage(LocaleController.getString("MegaDeleteAlert",
                                            R.string.MegaDeleteAlert));
                                }
                            } else {
                                if (chat == null || !chat.creator) {
                                    builder.setMessage(LocaleController.getString("ChannelLeaveAlert",
                                            R.string.ChannelLeaveAlert));
                                } else {
                                    builder.setMessage(LocaleController.getString("ChannelDeleteAlert",
                                            R.string.ChannelDeleteAlert));
                                }
                            }
                            builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            MessagesController.getInstance().deleteUserFromChat(
                                                    (int) -selectedDialog, UserConfig.getCurrentUser(), null);
                                            if (AndroidUtilities.isTablet()) {
                                                NotificationCenter.getInstance().postNotificationName(
                                                        NotificationCenter.closeChats, selectedDialog);
                                            }
                                        }
                                    });
                        }
                        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                        showDialog(builder.create());
                    }
                });
                showDialog(builder.create());
            } else {
                final boolean isChat = lower_id < 0 && high_id != 1;
                TLRPC.User user = null;
                if (!isChat && lower_id > 0 && high_id != 1) {
                    user = MessagesController.getInstance().getUser(lower_id);
                }
                final boolean isBot = user != null && user.bot;
                builder.setItems(
                        new CharSequence[] { LocaleController.getString("ClearHistory", R.string.ClearHistory),
                                isChat ? LocaleController.getString("DeleteChat", R.string.DeleteChat)
                                        : isBot ? LocaleController.getString("DeleteAndStop",
                                                R.string.DeleteAndStop)
                                                : LocaleController.getString("Delete", R.string.Delete) },
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, final int which) {
                                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                                if (which == 0) {
                                    builder.setMessage(LocaleController.getString("AreYouSureClearHistory",
                                            R.string.AreYouSureClearHistory));
                                } else {
                                    if (isChat) {
                                        builder.setMessage(LocaleController.getString("AreYouSureDeleteAndExit",
                                                R.string.AreYouSureDeleteAndExit));
                                    } else {
                                        builder.setMessage(LocaleController.getString(
                                                "AreYouSureDeleteThisChat", R.string.AreYouSureDeleteThisChat));
                                    }
                                }
                                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK),
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialogInterface, int i) {
                                                if (which != 0) {
                                                    if (isChat) {
                                                        TLRPC.Chat currentChat = MessagesController
                                                                .getInstance().getChat((int) -selectedDialog);
                                                        if (currentChat != null
                                                                && ChatObject.isNotInChat(currentChat)) {
                                                            MessagesController.getInstance()
                                                                    .deleteDialog(selectedDialog, 0);
                                                        } else {
                                                            MessagesController.getInstance().deleteUserFromChat(
                                                                    (int) -selectedDialog,
                                                                    MessagesController.getInstance().getUser(
                                                                            UserConfig.getClientUserId()),
                                                                    null);
                                                        }
                                                    } else {
                                                        MessagesController.getInstance()
                                                                .deleteDialog(selectedDialog, 0);
                                                    }
                                                    if (isBot) {
                                                        MessagesController.getInstance()
                                                                .blockUser((int) selectedDialog);
                                                    }
                                                    if (AndroidUtilities.isTablet()) {
                                                        NotificationCenter.getInstance().postNotificationName(
                                                                NotificationCenter.closeChats, selectedDialog);
                                                    }
                                                } else {
                                                    MessagesController.getInstance()
                                                            .deleteDialog(selectedDialog, 1);
                                                }
                                            }
                                        });
                                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel),
                                        null);
                                showDialog(builder.create());
                            }
                        });
                showDialog(builder.create());
            }
            return true;
        }
    });

    searchEmptyView = new EmptyTextProgressView(context);
    searchEmptyView.setVisibility(View.GONE);
    searchEmptyView.setShowAtCenter(true);
    searchEmptyView.setText(LocaleController.getString("NoResult", R.string.NoResult));
    frameLayout.addView(searchEmptyView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    emptyView = new LinearLayout(context);
    emptyView.setOrientation(LinearLayout.VERTICAL);
    emptyView.setVisibility(View.GONE);
    emptyView.setGravity(Gravity.CENTER);
    frameLayout.addView(emptyView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    emptyView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    TextView textView = new TextView(context);
    textView.setText(LocaleController.getString("NoChats", R.string.NoChats));
    textView.setTextColor(0xff959595);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    emptyView.addView(textView,
            LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));

    textView = new TextView(context);
    String help = LocaleController.getString("NoChatsHelp", R.string.NoChatsHelp);
    if (AndroidUtilities.isTablet() && !AndroidUtilities.isSmallTablet()) {
        help = help.replace('\n', ' ');
    }
    textView.setText(help);
    textView.setTextColor(0xff959595);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    textView.setGravity(Gravity.CENTER);
    textView.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(8), 0);
    textView.setLineSpacing(AndroidUtilities.dp(2), 1);
    emptyView.addView(textView,
            LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));

    progressView = new ProgressBar(context);
    progressView.setVisibility(View.GONE);
    frameLayout.addView(progressView,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));

    floatingButton = new ImageView(context);
    floatingButton.setVisibility(onlySelect ? View.GONE : View.VISIBLE);
    floatingButton.setScaleType(ImageView.ScaleType.CENTER);
    floatingButton.setBackgroundResource(R.drawable.floating_states);
    floatingButton.setImageResource(R.drawable.floating_pencil);
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed },
                ObjectAnimator
                        .ofFloat(floatingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                        .setDuration(200));
        animator.addState(new int[] {},
                ObjectAnimator
                        .ofFloat(floatingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                        .setDuration(200));
        floatingButton.setStateListAnimator(animator);
        floatingButton.setOutlineProvider(new ViewOutlineProvider() {
            @SuppressLint("NewApi")
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
            }
        });
    }
    frameLayout.addView(floatingButton,
            LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT,
                    (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM,
                    LocaleController.isRTL ? 14 : 0, 0, LocaleController.isRTL ? 0 : 14, 14));
    floatingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Bundle args = new Bundle();
            args.putBoolean("destroyAfterSelect", true);
            presentFragment(new ContactsActivity(args));
        }
    });

    listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_DRAGGING && searching && searchWas) {
                AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
            }
        }

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
            int visibleItemCount = Math.abs(layoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
            int totalItemCount = recyclerView.getAdapter().getItemCount();

            if (searching && searchWas) {
                if (visibleItemCount > 0 && layoutManager.findLastVisibleItemPosition() == totalItemCount - 1
                        && !dialogsSearchAdapter.isMessagesSearchEndReached()) {
                    dialogsSearchAdapter.loadMoreSearchMessages();
                }
                return;
            }
            if (visibleItemCount > 0) {
                if (layoutManager.findLastVisibleItemPosition() >= getDialogsArray().size() - 10) {
                    MessagesController.getInstance().loadDialogs(-1, 100,
                            !MessagesController.getInstance().dialogsEndReached);
                }
            }

            if (floatingButton.getVisibility() != View.GONE) {
                final View topChild = recyclerView.getChildAt(0);
                int firstViewTop = 0;
                if (topChild != null) {
                    firstViewTop = topChild.getTop();
                }
                boolean goingDown;
                boolean changed = true;
                if (prevPosition == firstVisibleItem) {
                    final int topDelta = prevTop - firstViewTop;
                    goingDown = firstViewTop < prevTop;
                    changed = Math.abs(topDelta) > 1;
                } else {
                    goingDown = firstVisibleItem > prevPosition;
                }
                if (changed && scrollUpdated) {
                    hideFloatingButton(goingDown);
                }
                prevPosition = firstVisibleItem;
                prevTop = firstViewTop;
                scrollUpdated = true;
            }
        }
    });

    if (searchString == null) {
        dialogsAdapter = new DialogsAdapter(context, dialogsType);
        if (AndroidUtilities.isTablet() && openedDialogId != 0) {
            dialogsAdapter.setOpenedDialogId(openedDialogId);
        }
        listView.setAdapter(dialogsAdapter);
    }
    int type = 0;
    if (searchString != null) {
        type = 2;
    } else if (!onlySelect) {
        type = 1;
    }
    dialogsSearchAdapter = new DialogsSearchAdapter(context, type, dialogsType);
    dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.MessagesActivitySearchAdapterDelegate() {
        @Override
        public void searchStateChanged(boolean search) {
            if (searching && searchWas && searchEmptyView != null) {
                if (search) {
                    searchEmptyView.showProgress();
                } else {
                    searchEmptyView.showTextView();
                }
            }
        }
    });

    if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
        searchEmptyView.setVisibility(View.GONE);
        emptyView.setVisibility(View.GONE);
        listView.setEmptyView(progressView);
    } else {
        searchEmptyView.setVisibility(View.GONE);
        progressView.setVisibility(View.GONE);
        listView.setEmptyView(emptyView);
    }
    if (searchString != null) {
        actionBar.openSearchField(searchString);
    }

    if (!onlySelect && dialogsType == 0) {
        frameLayout.addView(new PlayerView(context, this), LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
                39, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
    }

    //        fragmentView = Views.getTabLayout((FragmentActivity) context, this, frameLayout);
    return fragmentView;
}

From source file:com.android.contacts.common.list.ContactListItemView.java

/**
 * Adds or updates the presence icon view.
 *///from  w ww.  j av a2 s  .  co  m
public void setPresence(Drawable icon) {
    if (icon != null) {
        if (mPresenceIcon == null) {
            mPresenceIcon = new ImageView(getContext());
            addView(mPresenceIcon);
        }
        mPresenceIcon.setImageDrawable(icon);
        mPresenceIcon.setScaleType(ScaleType.CENTER);
        mPresenceIcon.setVisibility(View.VISIBLE);
    } else {
        if (mPresenceIcon != null) {
            mPresenceIcon.setVisibility(View.GONE);
        }
    }
}

From source file:com.mishiranu.dashchan.ui.navigator.DrawerForm.java

private View makeHeader(ViewGroup parent, boolean button, float density) {
    if (C.API_LOLLIPOP) {
        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
        View divider = makeSimpleDivider();
        int paddingTop = divider.getPaddingBottom();
        divider.setPadding(divider.getPaddingLeft(), divider.getPaddingTop(), divider.getPaddingRight(), 0);
        linearLayout.addView(divider, LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        LinearLayout linearLayout2 = new LinearLayout(context);
        linearLayout2.setOrientation(LinearLayout.HORIZONTAL);
        linearLayout.addView(linearLayout2, LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        TextView textView = makeCommonTextView(true);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(0, (int) (32f * density), 1);
        layoutParams.setMargins((int) (16f * density), paddingTop, (int) (16f * density), (int) (8f * density));
        linearLayout2.addView(textView, layoutParams);
        ViewHolder holder = new ViewHolder();
        holder.text = textView;// w  w w .ja v  a2  s  .  c om
        if (button) {
            ImageView imageView = new ImageView(context);
            imageView.setScaleType(ImageView.ScaleType.CENTER);
            imageView.setBackgroundResource(ResourceUtils.getResourceId(context,
                    android.R.attr.borderlessButtonStyle, android.R.attr.background, 0));
            imageView.setOnClickListener(headerButtonListener);
            imageView.setImageAlpha(0x5e);
            int size = (int) (48f * density);
            layoutParams = new LinearLayout.LayoutParams(size, size);
            layoutParams.rightMargin = (int) (4f * density);
            linearLayout2.addView(imageView, layoutParams);
            holder.extra = imageView;
            holder.icon = imageView;
        }
        linearLayout.setTag(holder);
        return linearLayout;
    } else {
        View view = LayoutInflater.from(context)
                .inflate(ResourceUtils.getResourceId(context, android.R.attr.preferenceCategoryStyle,
                        android.R.attr.layout, android.R.layout.preference_category), parent, false);
        ViewHolder holder = new ViewHolder();
        holder.text = (TextView) view.findViewById(android.R.id.title);
        if (button) {
            int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
            view.measure(measureSpec, measureSpec);
            int size = view.getMeasuredHeight();
            if (size == 0) {
                size = (int) (32f * density);
            }
            FrameLayout frameLayout = new FrameLayout(context);
            frameLayout.addView(view);
            view = frameLayout;
            ImageView imageView = new ImageView(context);
            imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            int padding = (int) (4f * density);
            imageView.setPadding(padding, padding, padding, padding);
            frameLayout.addView(imageView,
                    new FrameLayout.LayoutParams((int) (48f * density), size, Gravity.END));
            View buttonView = new View(context);
            buttonView.setBackgroundResource(
                    ResourceUtils.getResourceId(context, android.R.attr.selectableItemBackground, 0));
            buttonView.setOnClickListener(headerButtonListener);
            frameLayout.addView(buttonView, FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT);
            holder.extra = buttonView;
            holder.icon = imageView;
        }
        view.setTag(holder);
        return view;
    }
}

From source file:com.android.contacts.common.list.ContactListItemView.java

/**
 * Set to display work profile icon or not
 *
 * @param enabled set to display work profile icon or not
 *///from   w  w  w  . ja va2s.c o  m
public void setWorkProfileIconEnabled(boolean enabled) {
    if (mWorkProfileIcon != null) {
        mWorkProfileIcon.setVisibility(enabled ? View.VISIBLE : View.GONE);
    } else if (enabled) {
        mWorkProfileIcon = new ImageView(getContext());
        addView(mWorkProfileIcon);
        mWorkProfileIcon.setImageResource(R.drawable.ic_work_profile);
        mWorkProfileIcon.setScaleType(ScaleType.CENTER_INSIDE);
        mWorkProfileIcon.setVisibility(View.VISIBLE);
    }
}

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

private RelativeLayout createParticipantView(MemberStatusTO ms) {
    RelativeLayout rl = new RelativeLayout(this);
    int rlW = UIUtils.convertDipToPixels(this, 55);
    rl.setLayoutParams(new RelativeLayout.LayoutParams(rlW, rlW));

    getLayoutInflater().inflate(R.layout.avatar, rl);
    ImageView avatar = (ImageView) rl.getChildAt(rl.getChildCount() - 1);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(avatar.getLayoutParams());
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    avatar.setLayoutParams(params);//  w  w  w  .  j  a v  a 2  s . c  o m
    setAvatar(avatar, ms.member);

    ImageView statusView = new ImageView(this);
    int w = UIUtils.convertDipToPixels(this, 12);
    RelativeLayout.LayoutParams iconParams = new RelativeLayout.LayoutParams(w, w);
    iconParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    iconParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    statusView.setLayoutParams(iconParams);
    statusView.setAdjustViewBounds(true);
    statusView.setScaleType(ScaleType.CENTER_CROP);
    setStatusIcon(statusView, ms);
    rl.addView(statusView);
    return rl;
}

From source file:com.wewow.MainActivity.java

private void setUpViewPagerBanner(final List<Banner> banners) {

    group = (ViewGroup) findViewById(R.id.viewGroup);

    LayoutInflater inflater = getLayoutInflater();

    pageview = new ArrayList<View>();
    for (int i = 0; i < banners.size(); i++) {

        View view = inflater.inflate(R.layout.banner_item, null);
        ImageView imageBanner = (ImageView) view.findViewById(R.id.imageViewIcon);
        TextView textViewBannerTitle = (TextView) view.findViewById(R.id.textViewBannerTitle);
        textViewBannerTitle.setText(banners.get(i).getTitle());
        Glide.with(context).load(banners.get(i).getImage()).placeholder(R.drawable.banner_loading_spinner)
                .crossFade(300).into(imageBanner);
        view.setClickable(true);/*  w  w  w  .j  a v a2s. c o  m*/
        view.setFocusable(true);
        view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    AppBarLayout.LayoutParams mParams = (AppBarLayout.LayoutParams) mAppBarLayout.getChildAt(0)
                            .getLayoutParams();
                    mParams.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
                            | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP);
                } else {

                    AppBarLayout.LayoutParams mParams = (AppBarLayout.LayoutParams) mAppBarLayout.getChildAt(0)
                            .getLayoutParams();
                    mParams.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
                            | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
                            | AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP);
                }
            }
        });

        pageview.add(view);
        final int j = i;
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Banner banner = banners.get(j);
                String type = banner.getType();
                if (type.equals(CommonUtilities.BANNER_TYPE_SUBJECT)) {
                    Intent intent = new Intent(MainActivity.this, SubjectActivity.class);
                    intent.putExtra("id", banner.getId());
                    startActivity(intent);

                } else if (type.equals(CommonUtilities.BANNER_TYPE_COLLECTION)) {
                    LabCollection lc = new LabCollection();
                    lc.image = banner.getImage();
                    lc.title = banner.getTitle();
                    lc.id = Long.parseLong(banner.getId());
                    Intent intent = new Intent(MainActivity.this, LifeLabItemActivity.class);
                    intent.putExtra(LifeLabItemActivity.LIFELAB_COLLECTION, lc);

                    startActivity(intent);
                } else if (type.equals(CommonUtilities.BANNER_TYPE_POST)) {
                    Intent intent = new Intent(MainActivity.this, LifePostActivity.class);
                    intent.putExtra(LifePostActivity.POST_ID, Integer.parseInt(banner.getId()));
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(MainActivity.this, WebPageActivity.class);
                    intent.putExtra("url", banner.getUrl());
                    startActivity(intent);

                }
            }
        });
    }

    group.removeAllViews();
    //
    imageViews = new ImageView[pageview.size()];
    for (int i = 0; i < pageview.size(); i++) {
        imageView = new ImageView(MainActivity.this);
        imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        imageView.setPadding(12, 0, 12, 0);
        imageViews[i] = imageView;

        //
        if (i == 0) {
            imageViews[i].setBackgroundResource(R.drawable.dot_b);
        } else {
            imageViews[i].setBackgroundResource(R.drawable.dot);
        }

        group.addView(imageViews[i]);
    }

    PagerAdapter mPagerAdapter = new PagerAdapter() {

        @Override

        public int getCount() {
            // TODO Auto-generated method stub
            return pageview.size();
        }

        @Override

        public boolean isViewFromObject(View arg0, Object arg1) {
            // TODO Auto-generated method stub
            return arg0 == arg1;
        }

        public void destroyItem(View arg0, int arg1, Object arg2) {
            ((ViewPager) arg0).removeView(pageview.get(arg1));
        }

        public Object instantiateItem(View arg0, int arg1) {
            ((ViewPager) arg0).addView(pageview.get(arg1));
            return pageview.get(arg1);
        }

    };

    //set adapter
    viewPager.setAdapter(mPagerAdapter);
    if (Build.VERSION.SDK_INT >= 21) {
        viewPager.setNestedScrollingEnabled(false);
    }

    //set page change listener
    viewPager.setOnPageChangeListener(new GuidePageChangeListener());

}

From source file:com.google.android.apps.santatracker.rocketsleigh.RocketSleighActivity.java

private void addFirstScreenPresents() {
    // First 4 slots have no nothing.
    for (int i = 0; i < Math.min(4, SLOTS_PER_SCREEN); i++) {
        View view = new View(this);
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mSlotWidth, mScreenHeight);
        mObstacleLayout.addView(view, lp);
    }/* w w w  . java 2  s  .co m*/

    // Generate a SIN like pattern;
    float center = (float) ((mScreenHeight - mGiftBoxes[0].getHeight()) / 2);
    float presentHeight = (float) mGiftBoxes[0].getHeight();
    float[] heights = new float[] { center, center - presentHeight, center - (1.5f * presentHeight),
            center - presentHeight, center, center + presentHeight, center + (1.5f * presentHeight),
            center + presentHeight, center };
    // Add presents to the end
    if (SLOTS_PER_SCREEN > 4) {
        for (int i = 0; i < (SLOTS_PER_SCREEN - 4); i++) {
            // Which one?
            Bitmap bmp = mGiftBoxes[mRandom.nextInt(mGiftBoxes.length)];
            ImageView iv = new ImageView(this);
            iv.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            iv.setImageBitmap(bmp);

            // Position the present
            float left = (mSlotWidth - bmp.getWidth()) / 2;
            float top = heights[(i % heights.length)];

            FrameLayout frame = new FrameLayout(this);
            LayoutParams flp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            frame.addView(iv, flp);
            iv.setTranslationX(left);
            iv.setTranslationY(top);

            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mSlotWidth,
                    LinearLayout.LayoutParams.MATCH_PARENT);
            mObstacleLayout.addView(frame, lp);
        }
    }

    // Account for rounding errors in mSlotWidth
    int extra = (mScreenWidth - (SLOTS_PER_SCREEN * mSlotWidth));
    if (extra > 0) {
        // Add filler to ensure sync with background/foreground scrolls!
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(extra,
                LinearLayout.LayoutParams.MATCH_PARENT);
        View view = new View(this);
        mObstacleLayout.addView(view, lp);
    }

    mLastObstacle = 0;
}

From source file:com.devwang.logcabin.LogCabinMainActivity.java

private void toastDisplay(Context context, CharSequence text, int gravity, int ResImgId, int duration) {
    Toast toast = Toast.makeText(context, text, duration);
    if (gravity != 0) {
        switch (gravity) {
        case Gravity.CENTER:
            toast.setGravity(Gravity.CENTER, 0, 0);//  x,y0
            break;
        case Gravity.FILL:
            toast.setGravity(Gravity.FILL, 0, 0);//  x,y0
            break;
        case Gravity.BOTTOM:
            toast.setGravity(Gravity.BOTTOM, 0, 0);
            break;
        default://  w w w. j  a  v a  2  s. c  om
            break;
        }
    }
    if (ResImgId != 0) {
        LinearLayout toastView = (LinearLayout) toast.getView();
        ImageView imageCodeProject = new ImageView(getApplicationContext());
        imageCodeProject.setImageResource(ResImgId);
        toastView.addView(imageCodeProject, 0);
    }

    toast.show();
}

From source file:com.google.android.apps.santatracker.rocketsleigh.RocketSleighActivity.java

private void addFinalPresentRun() {
    // Two spacers at the begining.
    View view = new View(this);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mSlotWidth, mScreenHeight);
    mObstacleLayout.addView(view, lp);//from w w  w.j  a  v a  2  s  .c  o  m
    view = new View(this);
    mObstacleLayout.addView(view, lp);

    // All of these presents are 500 points (but only if you're awesome)
    if (mElfState == 0) {
        mRainingPresents = true;
    }

    // SIN wave of presents in the middle
    float center = (float) (mScreenHeight / 2);
    float amplitude = (float) (mScreenHeight / 4);

    int count = (3 * SLOTS_PER_SCREEN) - 4;

    for (int i = 0; i < count; i++) {
        float x = (float) ((mSlotWidth - mGiftBoxes[0].getWidth()) / 2);
        float y = center + (amplitude * (float) Math.sin(2.0 * Math.PI * (double) i / (double) count));
        Bitmap bmp = mGiftBoxes[mRandom.nextInt(mGiftBoxes.length)];
        ImageView iv = new ImageView(this);
        iv.setImageBitmap(bmp);
        iv.setLayerType(View.LAYER_TYPE_HARDWARE, null);

        FrameLayout frame = new FrameLayout(this);
        LayoutParams flp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        frame.addView(iv, flp);
        iv.setTranslationX(x);
        iv.setTranslationY(y);
        mObstacleLayout.addView(frame, lp);
    }

    // Two spacers at the end.
    view = new View(this);
    mObstacleLayout.addView(view, lp);
    view = new View(this);
    mObstacleLayout.addView(view, lp);

    // Account for rounding errors in mSlotWidth
    int extra = ((3 * mScreenWidth) - (3 * SLOTS_PER_SCREEN * mSlotWidth));
    if (extra > 0) {
        // Add filler to ensure sync with background/foreground scrolls!
        lp = new LinearLayout.LayoutParams(extra, LinearLayout.LayoutParams.MATCH_PARENT);
        view = new View(this);
        mObstacleLayout.addView(view, lp);
    }
}

From source file:com.aimfire.demo.CameraActivity.java

public void showJpeg(String filePath) {
    /*/*from  w  w  w.  ja va  2 s  .  c  o m*/
     * remove the preview, because it freezes at the last frame camera client
     * feeds it, which appears to be one frame later than the 2nd frame we
     * captured
     */
    mPreviewLayout.removeView(mPreview);

    /*
     * mark previous bitmap for GC (shouldn't be necessary, just to be safe)
     */
    if ((mCapturedFrameBitmap != null) && (!mCapturedFrameBitmap.isRecycled()))
        mCapturedFrameBitmap.recycle();

    if (mCapturedFrameIV == null) {
        mCapturedFrameIV = new ImageView(this);
        mPreviewLayout.addView(mCapturedFrameIV);
    }

    while (true) {
        mCapturedFrameBitmap = BitmapFactory.decodeFile(filePath);
        if (mCapturedFrameBitmap == null) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } else {
            mCapturedFrameIV.setImageBitmap(mCapturedFrameBitmap);
            break;
        }
    }

    if (BuildConfig.DEBUG)
        Log.d(TAG, "showing " + filePath);
}