Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends AppCompatActivity {
- private ActionBar actionbar;
- private Tab tabOne;
- private Tab tabTwo;
- private Fragment register = new RegisterFragment();
- private Fragment browse = new BrowseFragment();
- private Button saveButton, randButton;
- private EditText editTitle,editUser,editPass;
- private RadioGroup radioGroup;
- private RadioButton radioButton;
- private void link()
- {
- saveButton = findViewById(R.id.buttonSave);
- randButton = findViewById(R.id.buttonRand);
- editTitle = findViewById(R.id.acc_title);
- editUser = findViewById(R.id.acc_username);
- editPass = findViewById(R.id.password);
- radioGroup = findViewById(R.id.rGroup);
- }
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- link();
- actionbar = getSupportActionBar();
- actionbar.show();
- actionbar.setNavigationMode(NAVIGATION_MODE_TABS);
- tabOne = actionbar.newTab().setText(R.string.new_account);
- tabTwo = actionbar.newTab().setText(R.string.browse);
- tabOne.setTabListener(new TabAction(register));
- tabTwo.setTabListener(new TabAction(browse));
- actionbar.addTab(tabOne);
- actionbar.addTab(tabTwo);
- saveButtonHandler();
- randomButtonHandler();
- }
- private void saveButtonHandler()
- {
- }
- private void randomButtonHandler()
- {
- }
- private String randomPassword()
- {
- Character[] characters = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
- 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
- '!','@','#','$','%','^','&','*','(',')','_','+','1','2','3','4','5','6','7','8','9','0'};
- List<Character> characterList = new ArrayList<>(Arrays.asList(characters));
- Collections.shuffle(characterList);
- Random rand = new Random();
- String result ="";
- for(int i = 0;i<9;i++)
- {
- int count = rand.nextInt(characterList.size());
- result = result + characterList.get(count).toString();
- }
- return result;
- }
- class TabAction implements ActionBar.TabListener {
- Fragment f;
- public TabAction(Fragment f) {
- this.f = f;
- }
- @Override
- public void onTabSelected(Tab tab, FragmentTransaction ft) {
- ft.replace(R.id.frame, f);
- }
- @Override
- public void onTabUnselected(Tab tab, FragmentTransaction ft) {
- ft.remove(f);
- }
- @Override
- public void onTabReselected(Tab tab, FragmentTransaction ft) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement