Create app to save all passwords, protected using voice key


1. Create a new app in Sketchware.

2. Apart from main.xml, add three new pages, list.xml, add.xml, password.xml.

3. In main.xml/MainActivity:
i. add two TextViews: textview1 and textview2.

ii. Add following components: Intent i, SpeechToText spttxt, and SharedPreferences sp:sp.

iii. In onCreate event, if some password is saved in SharedPreferences, make textview2 GONE, and set textview1 to empty.
iv. In textview1 onClick event, if saved password is '-none' use Intent to move to ListActivity, else set SpeechToText start listening.

v. In the event SpeechToText: onSpeechResponse, if result equals saved password, or if result equals 'ON' and no password is saved, use Intent to move to ListActivity, else FinishActivity.
vi. In the event SpeechToText: onSpeechError, FinishActivity.

4. In Image Manager add images ic_add_white and ic_settings_white.

5. Create a new CustomView items.xml. Here add textview1 for site, textview2 for username, textview3 for password, and textview4 for more details.

6. In list.xml/ListActivity:
i. Add a linear1 and inside that add listview1. Change background colour of linear1.

ii. Add following components: Intent intent, and SharedPreferences sp:sp.

iii. Add a Map variable map and a List Map maplist.

iv. In onCreate event, if SharedPreferences key 'all' is not empty, get data from SharedPreferences key 'all' to maplist, and display it in listview1.
v. In onStart event, if SharedPreferences key 'new' is not empty; get data from SharedPreferences key 'new' to map, and add map to maplist. After that save maplist in SharedPreferences key 'all' and display maplist in listview1.

vi. In ListView onBindCustomView event, display data from maplist in TextViews of CustomView.

vii. Add a More block deletes(position), and here delete the position in maplist, save maplist in SharedPreferences and display maplist in ListView.

viii. Add another More block extra, and here create an OptionsMenu with two items; ADD and PASSWORD. Then add onOptionsItemSelected method to move to AddActivity when ADD is selected and move to PasswordActivity when PASSWORD is selected.
Code in first add source directly block:
}
private static final int ADD = 1;
private static final int PASSWORD = 2;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(Menu.NONE, ADD, 0, "Add items").setIcon(R.drawable.ic_add_white).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(Menu.NONE, PASSWORD, 0, "Change Password").setIcon(R.drawable.ic_settings_white).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case ADD:

Code in centre add source directly block:
return true;
case PASSWORD:

Code in last add source directly block:
return true;
default: return false; }

ix. In the event ListView onItemClicked, create an PopupMenu with two items; Delete and Edit. Then setOnMenuItemClickListener method. When 'Delete' is clicked, use more block deletes(position), and when 'Edit' is clicked, save the position and the data at that position of maplist and move to AddActivity.
Code in first add source directly block:
PopupMenu popup = new PopupMenu(ListActivity.this, listview1);
Menu menu = popup.getMenu();
menu.add("Delete");
menu.add("Edit");

popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
@Override
public boolean onMenuItemClick(MenuItem item){
switch (item.getTitle().toString()){
case "Delete":

Code in centre add source directly block:
break;
case "Edit":

Code in last add source directly block:
break;}
return true;
}
});
popup.show();

7. In add.xml/AddActivity:
i. Add four EditText and a Button as shown in image below.

ii. Add following components: SharedPreferences sp:sp.

iii. Add a Map variable map.

iv. In onCreate event, use blocks to get data to be edited in case edit was clicked, and display it in the EditText fields.
v. In Button onClick event, create a new Map and add data from EditText fields to the Map variable. Save the Map in SharedPreferences using key 'new' and FinishActivity.

8. In password.xml/PasswordActivity:
i. Add a TextView textview1, an EditText edittext1, a CheckBox checkbox1, and a Button button1.

ii. Add following components: SharedPreferences sp:sp, and SpeechToText sptt.

iii. In textview1 onClick event, set SpeechToText start listening.

iv. In the event SpeechToText: onSpeechResponse, set text of edittext1 to result and set checkbox1 setChecked false.

v. In the event checkbox1 onCheckChanged, if checkbox1 is checked, make edittext1 empty.

vi. In the event button1 onClick, if checkbox1 is checked, set SharedPreferences key 'password' to '-none', else set SharedPreferences key 'password' to the text in edittext1. After that FinishActivity.

9. Save and run the project.

10. Initial speak 'ON' to move to ListActivity. After that the password can be changed by clicking on the settings symbol on top.

Comments

  1. شكرا لك شروحاتك كلها حسنة

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. In the beginning you have to say 'ON' to enter the app. Check this https://youtu.be/PzbCkZUg58E

      Delete
    2. Sir how to create custom view event in list view

      Delete

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

Simple car racing android game in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity