Java Code Examples for org.telegram.ui.Components.RecyclerListView#setVerticalScrollBarEnabled()

The following examples show how to use org.telegram.ui.Components.RecyclerListView#setVerticalScrollBarEnabled() . 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: QuickRepliesSettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
	actionBar.setBackButtonImage(R.drawable.ic_ab_back);
	actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies));
	if (AndroidUtilities.isTablet()) {
		actionBar.setOccupyStatusBar(false);
	}
	actionBar.setAllowOverlayTitle(true);
	actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
		@Override
		public void onItemClick(int id) {
			if (id == -1) {
				finishFragment();
			}
		}
	});

	listAdapter = new ListAdapter(context);

	fragmentView = new FrameLayout(context);
	fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
	FrameLayout frameLayout = (FrameLayout) fragmentView;

	listView = new RecyclerListView(context);
	listView.setVerticalScrollBarEnabled(false);
	listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
	frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
	listView.setAdapter(listAdapter);
	listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
		@Override
		public void onItemClick(View view, final int position) {
		}
	});

	frameLayout.addView(actionBar);

	return fragmentView;
}
 
Example 2
Source File: QuickRepliesSettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
	actionBar.setBackButtonImage(R.drawable.ic_ab_back);
	actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies));
	if (AndroidUtilities.isTablet()) {
		actionBar.setOccupyStatusBar(false);
	}
	actionBar.setAllowOverlayTitle(true);
	actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
		@Override
		public void onItemClick(int id) {
			if (id == -1) {
				finishFragment();
			}
		}
	});

	listAdapter = new ListAdapter(context);

	fragmentView = new FrameLayout(context);
	fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
	FrameLayout frameLayout = (FrameLayout) fragmentView;

	listView = new RecyclerListView(context);
	listView.setVerticalScrollBarEnabled(false);
	listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
	frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
	listView.setAdapter(listAdapter);
	listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
		@Override
		public void onItemClick(View view, final int position) {
		}
	});

	frameLayout.addView(actionBar);

	return fragmentView;
}
 
Example 3
Source File: FiltersSetupActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("Filters", R.string.Filters));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));

    listView = new RecyclerListView(context);
    ((DefaultItemAnimator) listView.getItemAnimator()).setDelayAnimations(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollBarEnabled(false);
    itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
    itemTouchHelper.attachToRecyclerView(listView);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(adapter = new ListAdapter(context));
    listView.setOnItemClickListener((view, position, x, y) -> {
        if (position >= filtersStartRow && position < filtersEndRow) {
            presentFragment(new FilterCreateActivity(getMessagesController().dialogFilters.get(position - filtersStartRow)));
        } else if (position == createFilterRow) {
            presentFragment(new FilterCreateActivity());
        }
    });

    return fragmentView;
}
 
Example 4
Source File: QuickRepliesSettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
	actionBar.setBackButtonImage(R.drawable.ic_ab_back);
	actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies));
	if (AndroidUtilities.isTablet()) {
		actionBar.setOccupyStatusBar(false);
	}
	actionBar.setAllowOverlayTitle(true);
	actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
		@Override
		public void onItemClick(int id) {
			if (id == -1) {
				finishFragment();
			}
		}
	});

	listAdapter = new ListAdapter(context);

	fragmentView = new FrameLayout(context);
	fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
	FrameLayout frameLayout = (FrameLayout) fragmentView;

	listView = new RecyclerListView(context);
	listView.setVerticalScrollBarEnabled(false);
	listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
	frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
	listView.setAdapter(listAdapter);

	return fragmentView;
}
 
Example 5
Source File: FiltersSetupActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("Filters", R.string.Filters));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));

    listView = new RecyclerListView(context);
    ((DefaultItemAnimator) listView.getItemAnimator()).setDelayAnimations(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollBarEnabled(false);
    itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
    itemTouchHelper.attachToRecyclerView(listView);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(adapter = new ListAdapter(context));
    listView.setOnItemClickListener((view, position, x, y) -> {
        if (position >= filtersStartRow && position < filtersEndRow) {
            presentFragment(new FilterCreateActivity(getMessagesController().dialogFilters.get(position - filtersStartRow)));
        } else if (position == createFilterRow) {
            presentFragment(new FilterCreateActivity());
        }
    });

    return fragmentView;
}
 
Example 6
Source File: QuickRepliesSettingsActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View createView(Context context) {
	actionBar.setBackButtonImage(R.drawable.ic_ab_back);
	actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies));
	if (AndroidUtilities.isTablet()) {
		actionBar.setOccupyStatusBar(false);
	}
	actionBar.setAllowOverlayTitle(true);
	actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
		@Override
		public void onItemClick(int id) {
			if (id == -1) {
				finishFragment();
			}
		}
	});

	listAdapter = new ListAdapter(context);

	fragmentView = new FrameLayout(context);
	fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
	FrameLayout frameLayout = (FrameLayout) fragmentView;

	listView = new RecyclerListView(context);
	listView.setVerticalScrollBarEnabled(false);
	listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
	frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
	listView.setAdapter(listAdapter);

	return fragmentView;
}
 
Example 7
Source File: ConvertGroupActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("ConvertGroup", R.string.ConvertGroup));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));

    listView = new RecyclerListView(context);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollBarEnabled(false);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            if (position == convertRow) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setMessage(LocaleController.getString("ConvertGroupAlert", R.string.ConvertGroupAlert));
                builder.setTitle(LocaleController.getString("ConvertGroupAlertWarning", R.string.ConvertGroupAlertWarning));
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        MessagesController.getInstance(currentAccount).convertToMegaGroup(getParentActivity(), chat_id);
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            }
        }
    });

    return fragmentView;
}
 
Example 8
Source File: DataUsageActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    if (currentType == 0) {
        actionBar.setTitle(LocaleController.getString("MobileUsage", R.string.MobileUsage));
    } else if (currentType == 1) {
        actionBar.setTitle(LocaleController.getString("WiFiUsage", R.string.WiFiUsage));
    } else if (currentType == 2) {
        actionBar.setTitle(LocaleController.getString("RoamingUsage", R.string.RoamingUsage));
    }
    if (AndroidUtilities.isTablet()) {
        actionBar.setOccupyStatusBar(false);
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, final int position) {
            if (getParentActivity() == null) {
                return;
            }
            if (position == resetRow) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(LocaleController.getString("ResetStatisticsAlert", R.string.ResetStatisticsAlert));
                builder.setPositiveButton(LocaleController.getString("Reset", R.string.Reset), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        StatsController.getInstance(currentAccount).resetStats(currentType);
                        listAdapter.notifyDataSetChanged();
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            }
        }
    });

    frameLayout.addView(actionBar);

    return fragmentView;
}
 
Example 9
Source File: ConvertGroupActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("ConvertGroup", R.string.ConvertGroup));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));

    listView = new RecyclerListView(context);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollBarEnabled(false);
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            if (position == convertRow) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setMessage(LocaleController.getString("ConvertGroupAlert", R.string.ConvertGroupAlert));
                builder.setTitle(LocaleController.getString("ConvertGroupAlertWarning", R.string.ConvertGroupAlertWarning));
                builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        MessagesController.getInstance(currentAccount).convertToMegaGroup(getParentActivity(), chat_id);
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            }
        }
    });

    return fragmentView;
}
 
Example 10
Source File: DataUsageActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    if (currentType == 0) {
        actionBar.setTitle(LocaleController.getString("MobileUsage", R.string.MobileUsage));
    } else if (currentType == 1) {
        actionBar.setTitle(LocaleController.getString("WiFiUsage", R.string.WiFiUsage));
    } else if (currentType == 2) {
        actionBar.setTitle(LocaleController.getString("RoamingUsage", R.string.RoamingUsage));
    }
    if (AndroidUtilities.isTablet()) {
        actionBar.setOccupyStatusBar(false);
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, final int position) {
            if (getParentActivity() == null) {
                return;
            }
            if (position == resetRow) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(LocaleController.getString("ResetStatisticsAlert", R.string.ResetStatisticsAlert));
                builder.setPositiveButton(LocaleController.getString("Reset", R.string.Reset), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        StatsController.getInstance(currentAccount).resetStats(currentType);
                        listAdapter.notifyDataSetChanged();
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            }
        }
    });

    frameLayout.addView(actionBar);

    return fragmentView;
}
 
Example 11
Source File: LogoutActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setTitle(LocaleController.getString("LogOutTitle", R.string.LogOutTitle));
    if (AndroidUtilities.isTablet()) {
        actionBar.setOccupyStatusBar(false);
    }
    actionBar.setAllowOverlayTitle(true);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener((view, position, x, y) -> {
        if (position == addAccountRow) {
            int freeAccount = -1;
            for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
                if (!UserConfig.getInstance(a).isClientActivated()) {
                    freeAccount = a;
                    break;
                }
            }
            if (freeAccount >= 0) {
                presentFragment(new LoginActivity(freeAccount));
            }
        } else if (position == passcodeRow) {
            presentFragment(new PasscodeActivity(0));
        } else if (position == cacheRow) {
            presentFragment(new CacheControlActivity());
        } else if (position == phoneRow) {
            presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
        } else if (position == supportRow) {
            showDialog(AlertsCreator.createSupportAlert(LogoutActivity.this));
        } else if (position == logoutRow) {
            if (getParentActivity() == null) {
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            UserConfig userConfig = getUserConfig();
            builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout));
            builder.setTitle(LocaleController.getString("LogOut", R.string.LogOut));
            builder.setPositiveButton(LocaleController.getString("LogOut", R.string.LogOut), (dialogInterface, i) -> MessagesController.getInstance(currentAccount).performLogout(1));
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            AlertDialog alertDialog = builder.create();
            showDialog(alertDialog);
            TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
            if (button != null) {
                button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
            }
        }
    });

    return fragmentView;
}
 
Example 12
Source File: LogoutActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setTitle(LocaleController.getString("LogOutTitle", R.string.LogOutTitle));
    if (AndroidUtilities.isTablet()) {
        actionBar.setOccupyStatusBar(false);
    }
    actionBar.setAllowOverlayTitle(true);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener((view, position, x, y) -> {
        if (position == addAccountRow) {
            int freeAccount = -1;
            for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
                if (!UserConfig.getInstance(a).isClientActivated()) {
                    freeAccount = a;
                    break;
                }
            }
            if (freeAccount >= 0) {
                presentFragment(new LoginActivity(freeAccount));
            }
        } else if (position == passcodeRow) {
            presentFragment(new PasscodeActivity(0));
        } else if (position == cacheRow) {
            presentFragment(new CacheControlActivity());
        } else if (position == phoneRow) {
            presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
        } else if (position == supportRow) {
            showDialog(AlertsCreator.createSupportAlert(LogoutActivity.this));
        } else if (position == logoutRow) {
            if (getParentActivity() == null) {
                return;
            }
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            UserConfig userConfig = getUserConfig();
            builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout));
            builder.setTitle(LocaleController.getString("LogOut", R.string.LogOut));
            builder.setPositiveButton(LocaleController.getString("LogOut", R.string.LogOut), (dialogInterface, i) -> MessagesController.getInstance(currentAccount).performLogout(1));
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            AlertDialog alertDialog = builder.create();
            showDialog(alertDialog);
            TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
            if (button != null) {
                button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
            }
        }
    });

    return fragmentView;
}