Example usage for android.widget RelativeLayout setOnClickListener

List of usage examples for android.widget RelativeLayout setOnClickListener

Introduction

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

Prototype

public void setOnClickListener(@Nullable OnClickListener l) 

Source Link

Document

Register a callback to be invoked when this view is clicked.

Usage

From source file:org.ciasaboark.tacere.activity.SettingsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    context = this;
    // Show the Up button in the action bar.
    setupActionBar();/*  w  w  w  . j a va2 s  .com*/
    RelativeLayout serviceToggleBox = (RelativeLayout) findViewById(id.settings_serviceBox);
    serviceToggleBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onClickToggleService(view);
        }
    });
    drawAllWidgets();
}

From source file:org.ciasaboark.tacere.activity.fragment.SelectCalendarsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = (ViewGroup) inflater.inflate(layout, container, false);

    prefs = new Prefs(getActivity());
    buildSimpleCalendarList();//w w w.  ja v a2 s  .com
    final RelativeLayout syncAllCalendarsBox = (RelativeLayout) rootView.findViewById(R.id.sync_all_calendars);
    syncAllCalendarsBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            prefs.setSyncAllCalendars(!prefs.shouldAllCalendarsBeSynced());
            buildSimpleCalendarList();
            drawSyncBoxSwitch();
            drawDialogBody();
        }
    });

    drawSyncBoxSwitch();
    drawDialogBodyOrError();

    return rootView;
}

From source file:com.example.dell.chihuobao.fragment.SettingFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    hashMap = user.getUser();//from  www. j  av a  2  s . c  o m
    View view = inflater.inflate(R.layout.setting, container, false);
    restaurant_icon = (ImageView) view.findViewById(R.id.restaurant_icon);
    tv_restaurant_name = (TextView) view.findViewById(R.id.tv_restaurant_name);
    tv_owner_phone = (TextView) view.findViewById(R.id.tv_owner_phone);
    tv_owner_cardnumber = (TextView) view.findViewById(R.id.tv_owner_cardnumber);
    shopmessage = (TextView) view.findViewById(R.id.shopmessage);
    if (MyApplication.getUser().getUser().get("name") != null) {
        tv_restaurant_name.setText(MyApplication.getUser().getUser().get("name").toString());
    }
    if (MyApplication.getUser().getUser().get("phone") != null) {
        tv_owner_phone.setText(MyApplication.getUser().getUser().get("phone").toString());
    }
    if (MyApplication.getUser().getUser().get("identify") != null) {
        tv_owner_cardnumber
                .setText(getDisplayStr(MyApplication.getUser().getUser().get("identify").toString()));
    }
    RelativeLayout about_us_layout = (RelativeLayout) view.findViewById(R.id.about_us_layout);
    about_us_layout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(getActivity(), FeedBackActivity.class);
            startActivity(intent);
        }
    });
    RelativeLayout locationUpdate = (RelativeLayout) view.findViewById(R.id.location);
    locationUpdate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(getActivity(), LocationActivity.class);
            startActivity(intent);
        }
    });
    RelativeLayout app_recommend_layout = (RelativeLayout) view.findViewById(R.id.app_recommend_layout);
    app_recommend_layout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(getActivity(), HelpActivity.class);
            startActivity(intent);
        }
    });
    RelativeLayout app_password_layout = (RelativeLayout) view.findViewById(R.id.app_password_layout);
    app_password_layout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(getActivity(), PhoneVerifyActivity.class);
            startActivity(intent);
        }
    });
    TextView settings_logout = (TextView) view.findViewById(R.id.settings_logout);
    settings_logout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            new AlertDialog.Builder(getActivity()).setTitle("??").setMessage("")
                    .setPositiveButton("", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            clearUser();
                            Intent intent = new Intent(getActivity(), LoginActivity.class);
                            startActivity(intent);
                            getActivity().finish();
                        }
                    }).setNegativeButton("?", null).show();
        }
    });
    LinearLayout restaurant_info_container = (LinearLayout) view.findViewById(R.id.restaurant_info_container);
    restaurant_info_container.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /*startActivity(new Intent(getActivity(), UserModifyActivity.class));*/
            startActivity(new Intent(getActivity(), UserUpdateActivity.class));
        }
    });

    if (hashMap.get("shopmessage") != null) {
        shopmessage.setText(hashMap.get("shopmessage").toString());
    }
    LinearLayout shopmessage_layout = (LinearLayout) view.findViewById(R.id.shopmessage_layout);
    shopmessage_layout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final EditText editText = new EditText(getActivity());
            editText.setText(hashMap.get("shopmessage").toString());
            new AlertDialog.Builder(getActivity()).setTitle("?").setView(editText)
                    .setPositiveButton("", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            String text = editText.getText().toString().trim();
                            shopmessage.setText(text);
                            hashMap.put("shopmessage", text);
                            updateUser(hashMap);
                        }
                    }).setNegativeButton("?", null).show();
        }
    });
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {
            downloadBitmap(UserModifyActivity.URL
                    + MyApplication.getUser().getUser().get("shopphoto").toString().replaceAll("\\\\", "/"));

        }
    }

    );
    thread.start();

    /*  SettingsItemView settings_connect_manager= (SettingsItemView) view.findViewById(R.id.settings_connect_manager);
    settings_connect_manager.setOnSettingClickListener(new SettingsItemView.settingClickListener() {
    @Override
    public void rightClick() {
        Toast.makeText(getActivity(), "a", Toast.LENGTH_SHORT).show();
    }
    });*/
    return view;

}

From source file:com.mycompany.popularmovies.DetailActivity.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    if (cursorLoader == mGeneralInfoLoader) {
        if (cursor != null && cursor.moveToFirst()) {
            int columnIndexPosterPath = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_POSTER_PATH);
            String posterPath = MovieAdapter.POSTER_BASE_URL_W185 + cursor.getString(columnIndexPosterPath);
            Picasso picasso = Picasso.with(getActivity());
            picasso.load(posterPath).into(mPosterImageView);

            int columnIndexTitle = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_TITLE);
            String title = cursor.getString(columnIndexTitle);
            mTitleTextView.setText(title);

            int columnIndexIsFavorite = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_FAVORITED);
            int isFavorite = cursor.getInt(columnIndexIsFavorite);
            mHeartImageView// w w  w . j av a2s  .  com
                    .setImageResource(isFavorite == 1 ? R.drawable.heart_active : R.drawable.heart_inactive);
            mHeartImageView.setOnClickListener(this);

            int columnIndexReleaseDate = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_RELEASE_DATE);
            String releaseDateText = cursor.getString(columnIndexReleaseDate);
            String releaseYearText = releaseDateText.substring(0, Math.min(releaseDateText.length(), 4));
            mReleaseYearTextView.setText(releaseYearText);

            int columnIndexVoteAverage = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_VOTE_AVERAGE);
            float vote_average = cursor.getFloat(columnIndexVoteAverage);
            mRatingBar.setRating(vote_average);

            int columnIndexSynopsis = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_SYNOPSIS);
            mSynopsisTextView.setText(cursor.getString(columnIndexSynopsis));

            // If onCreateOptionsMenu has already happened, we need to update the share intent now.
            if (mShareActionProvider != null) {
                mShareText = title;
                mShareActionProvider.setShareIntent(createShareIntent());
            }
        } else {
            Log.e(LOG_TAG, "Cursor to populate general info was empty or null!");
        }
    } else if (cursorLoader == mTrailerLoader) {
        if (cursor == null || !cursor.moveToFirst()) {
            mTrailerListTitle.setVisibility(View.INVISIBLE);
        } else {
            mTrailerListTitle.setVisibility(View.VISIBLE);
            for (cursor.moveToFirst(); cursor.getPosition() < cursor.getCount(); cursor.moveToNext()) {
                int columnIndexName = cursor.getColumnIndex(MovieContract.TrailersTable.COLUMN_NAME);
                String trailerName = cursor.getString(columnIndexName);

                int columnIndexLanguageCode = cursor
                        .getColumnIndex(MovieContract.TrailersTable.COLUMN_LANGUAGE_CODE);
                String trailerLanguageCode = cursor.getString(columnIndexLanguageCode);

                String trailer_summary = String.format("%s (%s)", trailerName,
                        trailerLanguageCode.toUpperCase());

                int columnIndexSite = cursor.getColumnIndex(MovieContract.TrailersTable.COLUMN_SITE);
                String site = cursor.getString(columnIndexSite);

                int columnIndexKey = cursor.getColumnIndex(MovieContract.TrailersTable.COLUMN_KEY);
                String key = cursor.getString(columnIndexKey);

                String link = null;
                if (site.compareTo("YouTube") == 0) {
                    link = "https://www.youtube.com/watch?v=" + key;
                } else {
                    Log.e(LOG_TAG, "Unsupported site: " + site);
                }

                ImageView trailerThumbnail = (ImageView) mActivity.getLayoutInflater()
                        .inflate(R.layout.detail_fragment_trailer_item, null, false);
                if (site.compareTo("YouTube") == 0) {
                    Picasso picasso = Picasso.with(mActivity);
                    String youtubeThumbnailPath = String.format("http://img.youtube.com/vi/%s/mqdefault.jpg",
                            key);
                    picasso.load(youtubeThumbnailPath).into(trailerThumbnail);
                    trailerThumbnail.setTag(link);
                    trailerThumbnail.setOnClickListener(this);
                }

                mTrailerList.addView(trailerThumbnail);
            }
        }
    } else if (cursorLoader == mReviewLoader) {
        if (cursor == null || !cursor.moveToFirst()) {
            mReviewListTitle.setVisibility(View.INVISIBLE);
        } else {
            mReviewListTitle.setVisibility(View.VISIBLE);
            String colors[] = { "#00BFFF", "#00CED1", "#FF8C00", "#00FA9A", "#9400D3" };
            for (cursor.moveToFirst(); cursor.getPosition() < cursor.getCount(); cursor.moveToNext()) {
                int columnIndexAuthor = cursor.getColumnIndex(MovieContract.ReviewsTable.COLUMN_AUTHOR);
                String author = cursor.getString(columnIndexAuthor);
                String authorAbbreviation = author != null && author.length() >= 1 ? author.substring(0, 1)
                        : "?";

                int columnIndexReviewText = cursor
                        .getColumnIndex(MovieContract.ReviewsTable.COLUMN_REVIEW_TEXT);
                String reviewText = cursor.getString(columnIndexReviewText);

                RelativeLayout review = (RelativeLayout) mActivity.getLayoutInflater()
                        .inflate(R.layout.detail_fragment_review_item, null, false);
                review.setOnClickListener(this);
                review.setTag(TAG_REVIEW_COLLAPSED);

                TextView authorIcon = (TextView) review.findViewById(R.id.author_icon);
                authorIcon.setText(authorAbbreviation);
                int color = Color.parseColor(colors[cursor.getPosition() % colors.length]);
                authorIcon.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);

                TextView authorFullName = (TextView) review.findViewById(R.id.author_full_name);
                authorFullName.setText(author);

                TextView reviewTextView = (TextView) review.findViewById(R.id.review_text);
                reviewTextView.setText(reviewText);

                mReviewList.addView(review);
            }
        }
    }
}

From source file:moose.com.ac.ui.CommentAdapter.java

private RelativeLayout generateQuoteFrame(CommentListWrapper.Comment quote) {
    RelativeLayout quoteFrame = (RelativeLayout) mInflater.inflate(R.layout.comments_quote_item, null);
    TextView username = (TextView) quoteFrame.findViewById(R.id.user_name);
    username.setText(String.format(Locale.getDefault(), "#%d %s", quote.floor, quote.username));
    TextView content = (TextView) quoteFrame.findViewById(R.id.comments_content);
    TextViewUtils.setCommentContent(content, quote.content);
    if (onItemClickListener != null) {
        quoteFrame.setOnClickListener(v -> onItemClickListener.onItemClick(null, v, quote));
    }//w  w w. j  a  v a 2s  .  c o  m
    return quoteFrame;
}

From source file:org.ciasaboark.tacere.activity.fragment.AdvancedSettingsFragment.java

private void drawBetaWidgets() {
    LinearLayout betaSettingsBox = (LinearLayout) rootView.findViewById(R.id.beta_settings_box);
    final BetaPrefs betaPrefs = new BetaPrefs(getActivity());
    if (betaPrefs.isBetaPrefsUnlocked()) {
        betaSettingsBox.setVisibility(View.VISIBLE);
        final CheckBox useLargeDisplayCheckbox = (CheckBox) rootView
                .findViewById(R.id.beta_largedisplay_checkbox);
        final RelativeLayout useLargeDisplayBox = (RelativeLayout) rootView
                .findViewById(R.id.large_display_box);
        if (betaPrefs.getUseLargeDisplay()) {
            useLargeDisplayCheckbox.setChecked(true);
        }// ww  w.  ja va  2s . c  o  m
        useLargeDisplayBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                useLargeDisplayCheckbox.performClick();
                betaPrefs.setUseLargeDisplay(useLargeDisplayCheckbox.isChecked());
            }
        });

        final CheckBox disableNotificationsCheckbox = (CheckBox) rootView
                .findViewById(R.id.beta_notifications_checkbox);
        final RelativeLayout disableNotificationsBox = (RelativeLayout) rootView
                .findViewById(R.id.disable_notifications_box);
        if (betaPrefs.getDisableNotifications()) {
            disableNotificationsCheckbox.setChecked(true);
        }
        disableNotificationsBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                disableNotificationsCheckbox.performClick();
                betaPrefs.setDisableNotifications(disableNotificationsCheckbox.isChecked());
                AlarmManagerWrapper alarmManagerWrapper = new AlarmManagerWrapper(getActivity());
                alarmManagerWrapper.scheduleImmediateAlarm(RequestTypes.NORMAL);
                //                    if (disableNotificationsCheckbox.isChecked()) {
                //                        NotificationManagerWrapper notificationManagerWrapper = new NotificationManagerWrapper(context);
                //                        notificationManagerWrapper.cancelAllNotifications();
                //                    }
            }
        });

        final CheckBox disableVibrationCheckbox = (CheckBox) rootView
                .findViewById(R.id.beta_vibration_checkbox);
        final RelativeLayout disableVibrationBox = (RelativeLayout) rootView
                .findViewById(R.id.disable_vibration_box);
        if (betaPrefs.getDisableVibration()) {
            disableVibrationCheckbox.setChecked(true);
        }
        disableVibrationBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                disableVibrationCheckbox.performClick();
                betaPrefs.setDisableVibration(disableVibrationCheckbox.isChecked());
            }
        });

    } else {
        betaSettingsBox.setVisibility(View.GONE);
    }
}

From source file:org.ciasaboark.tacere.activity.SettingsActivity.java

private void drawCalendarWidgets() {
    ImageView calendarIcon = (ImageView) findViewById(id.calendar_icon);
    TextView calendarTV = (TextView) findViewById(id.calendar_text);
    RelativeLayout calendarBox = (RelativeLayout) findViewById(id.select_calendar_box);

    Drawable d = getResources().getDrawable(R.drawable.calendar_icon);
    d.setColorFilter(getResources().getColor(R.color.primary), PorterDuff.Mode.MULTIPLY);

    calendarBox.setOnClickListener(new View.OnClickListener() {
        @Override/* w ww.  ja v  a2 s. co m*/
        public void onClick(View view) {
            Intent i = new Intent(context, SelectCalendarsActivity.class);
            startActivity(i);
        }
    });

    if (prefs.getIsServiceActivated()) {
        int iconColor = getResources().getColor(R.color.primary);
        d.mutate().setColorFilter(iconColor, PorterDuff.Mode.MULTIPLY);
        calendarTV.setTextColor(getResources().getColor(R.color.textcolor));
        calendarBox.setClickable(true);
    } else {
        int iconColor = getResources().getColor(android.R.color.darker_gray);
        d.mutate().setColorFilter(iconColor, PorterDuff.Mode.MULTIPLY);
        calendarTV.setTextColor(getResources().getColor(R.color.textColorDisabled));
        calendarBox.setClickable(false);
    }
    calendarIcon.setBackgroundDrawable(d);

}

From source file:com.neu.fragment.BancheTimeFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.banche_info, null);
    screenWidth = getActivity().getWindowManager().getDefaultDisplay().getWidth();
    screenHeight = getActivity().getWindowManager().getDefaultDisplay().getHeight();

    toast = new Toast(getActivity());

    // System.out.println(screenHeight+"px");
    // System.out.println("width:" + screenWidth);
    tableInfo = (TableLayout) view.findViewById(R.id.tableInfo);
    fromHunnan = (RelativeLayout) view.findViewById(R.id.hunnan_bt);
    fromNanhu = (RelativeLayout) view.findViewById(R.id.nanhu_bt);
    from_tx = (TextView) view.findViewById(R.id.from_tx);
    // spinner = (Spinner) view.findViewById(R.id.spinner_type);
    // ???/*from  www.ja va 2 s.c  o  m*/
    selected_image = (ImageView) view.findViewById(R.id.selected_image);
    selected_name = (TextView) view.findViewById(R.id.selected_name);
    searchName = selected_name.getText().toString();
    searchName_fore = searchName;

    stu_show = (LinearLayout) view.findViewById(R.id.stu_show);
    dialog = MyDialog.createLoadingDialog(getActivity(), "...");

    freshInfo = (TextView) view.findViewById(R.id.fresh_info);
    //??
    freshInfo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            new Thread(new Runnable() {
                String result = "";

                @Override
                public void run() {
                    try {
                        // TODO Auto-generated method stub
                        //xml???
                        StoreBancheInfoUtils.storeInfoFromNet(getActivity());

                    } catch (UnkownNetWorkException e) {
                        System.out.println(e.getMessage());

                        Message msg = new Message();
                        msg.what = MSG_NETERROR;
                        handler.sendMessage(msg);

                    } catch (IOException e) {
                        // TODO: handle exception
                    }
                }
            }).start();
        }
    });
    // popMenu
    final PopMenu popMenu = new PopMenu(getActivity(), screenWidth);

    // ??
    RelativeLayout showType = (RelativeLayout) view.findViewById(R.id.select_type);
    showType.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            // TODO Auto-generated method stub
            popMenu.showAsDropDown(view);

        }
    });
    // ? 
    popMenu.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            searchName = ((Person) parent.getItemAtPosition(position)).getItem_name().toString();
            int drawable = ((Person) parent.getItemAtPosition(position)).getItem_image();
            selected_image.setBackgroundResource(drawable);
            selected_name.setText(searchName);
            if (searchName.equals("")) {
                if (!searchName_fore.equals(searchName)) {
                    stu_show.setVisibility(View.VISIBLE);
                    from_tx.setText("");
                    tableInfo.removeAllViews();
                }
            } else if (searchName.equals("?")) {
                if (!searchName_fore.equals(searchName)) {
                    stu_show.setVisibility(View.GONE);
                    from_tx.setText("");
                    tableInfo.removeAllViews();
                }
            }
            searchName_fore = searchName;

            popMenu.dismiss();
        }
    });

    fromHunnan.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            from = "?";
            task = new SearchAsyncTask();
            task.dialog = dialog;
            task.from = from;
            task.stu_show = stu_show;
            task.from_tx = from_tx;
            task.toast = toast;
            task.searchName = searchName;
            task.tableInfo = tableInfo;
            task.execute();
        }
    });
    fromNanhu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            if (searchName.equals(""))
                from = "??";
            else
                from = "?";
            task = new SearchAsyncTask();
            task.dialog = dialog;
            task.from = from;
            task.toast = toast;
            task.stu_show = stu_show;
            task.from_tx = from_tx;
            task.searchName = searchName;
            task.tableInfo = tableInfo;
            task.execute();
        }
    });

    return view;
}

From source file:com.cloud.widget.viewpager.PagerSlidingTabStrip.java

private void addTab(final int position, RelativeLayout tab) {
    tab.setFocusable(true);/* w  w  w.  j a v  a  2 s .  co  m*/
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });
    tab.setPadding(tabPadding, 0, tabPadding, 0);
    tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams);
}

From source file:com.breadwallet.tools.adapter.TransactionListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {
    View tmpLayout = inflater.inflate(R.layout.transaction_list_item, null);
    if (data.size() == 0 && position == 0) {
        RelativeLayout noTransactions = (RelativeLayout) inflater.inflate(R.layout.button_no_transactions,
                null);/*  w  w w .ja  v a2s .  c o  m*/
        noTransactions.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                Utils.getPixelsFromDps(activity, 70)));
        return noTransactions;
    } else if (position == getCount() - (buyBitcoinEnabled ? 5 : 4)) {
        View separator = new View(activity);
        separator.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                Utils.getPixelsFromDps(activity, 30)));
        separator.setBackgroundResource(android.R.color.transparent);
        return separator;
    } else if (buyBitcoinEnabled && position == getCount() - 4) {
        RelativeLayout buyBitcoinLayout = (RelativeLayout) inflater.inflate(R.layout.button_buy_bitcoin, null);
        buyBitcoinLayout.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                Utils.getPixelsFromDps(activity, 50)));
        buyBitcoinLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (BRAnimator.checkTheMultipressingAvailability()) {
                    FragmentWebView fragmentWebView = new FragmentWebView();
                    fragmentWebView.setMode(1);
                    BRAnimator.animateSlideToLeft((MainActivity) activity, fragmentWebView,
                            FragmentSettingsAll.instantiate(activity, FragmentSettingsAll.class.getName()));
                }
            }
        });
        return buyBitcoinLayout;
    } else if (position == getCount() - 3) {
        RelativeLayout importPrivateKeys = (RelativeLayout) inflater.inflate(R.layout.button_import_privkey,
                null);
        importPrivateKeys.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                Utils.getPixelsFromDps(activity, 50)));
        importPrivateKeys.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (BRAnimator.checkTheMultipressingAvailability()) {
                    BRAnimator.animateDecoderFragment();
                }
            }
        });
        return importPrivateKeys;

    } else if (position == getCount() - 2) {
        RelativeLayout settings = (RelativeLayout) inflater.inflate(R.layout.button_settings, null);
        settings.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                Utils.getPixelsFromDps(activity, 50)));
        settings.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (BRAnimator.checkTheMultipressingAvailability()) {
                    MainActivity app = MainActivity.app;
                    if (app == null)
                        return;
                    FragmentSettingsAll fragmentSettingsAll = (FragmentSettingsAll) activity
                            .getFragmentManager().findFragmentByTag(FragmentSettingsAll.class.getName());
                    BRAnimator.animateSlideToLeft(app, new FragmentSettings(), fragmentSettingsAll);
                }
            }
        });
        return settings;
    } else if (position == getCount() - 1) {
        View separator = new View(activity);
        separator.setLayoutParams(new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                Utils.getPixelsFromDps(activity, 30)));
        separator.setBackgroundResource(android.R.color.transparent);
        separator.setClickable(false);
        return separator;
    }

    if (!BreadWalletApp.unlocked) {
        if (getUnconfirmedCount(data) == 0 && position == 0) {
            RelativeLayout txHistory = (RelativeLayout) inflater.inflate(R.layout.button_transaction_history,
                    null);
            txHistory.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    Utils.getPixelsFromDps(activity, 40)));
            txHistory.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (BRAnimator.checkTheMultipressingAvailability()) {
                        ((BreadWalletApp) activity.getApplicationContext()).promptForAuthentication(activity,
                                BRConstants.AUTH_FOR_GENERAL, null, null, null, null, false);
                    }
                }
            });
            return txHistory;
        } else {
            if (position == getUnconfirmedCount(data)) {
                RelativeLayout moreAuth = (RelativeLayout) inflater.inflate(R.layout.button_more, null);
                moreAuth.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                        Utils.getPixelsFromDps(activity, 40)));
                moreAuth.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (BRAnimator.checkTheMultipressingAvailability()) {
                            ((BreadWalletApp) activity.getApplicationContext()).promptForAuthentication(
                                    activity, BRConstants.AUTH_FOR_GENERAL, null, null, null, null, false);
                        }
                    }
                });
                return moreAuth;
            } else {
                return getTxView(tmpLayout, position);
            }
        }
    } else {
        if (showAllTx)
            return getTxView(tmpLayout, position);
        if (data.size() > 5) {
            if (position < 5) {
                return getTxView(tmpLayout, position);
            } else {
                RelativeLayout more = (RelativeLayout) inflater.inflate(R.layout.button_more, null);
                more.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                        Utils.getPixelsFromDps(activity, 40)));
                more.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        showAllTx = true;
                        notifyDataSetChanged();
                    }
                });
                return more;
            }
        } else {
            return getTxView(tmpLayout, position);
        }
    }
}