Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

43
LINES

< > BotCompany Repo | #1023323 // Android login screen test

JavaX source code (Android) [tags: use-pretranspiled] - run with: the app

Libraryless. Click here for Pure Java version (3987L/27K/101K).

1  
!7
2  
3  
set flag Android.
4  
5  
p {
6  
  final EditText tvEmail = aTextInput(androidAssistant_userEmail());
7  
  final EditText tvPW = aPasswordInput();
8  
  final TextView tvResult = aFontSize(20, aForeground(aRed(), aCenteredTextView()));
9  
  
10  
  aShow(aVerticalStack(
11  
    aForeground(aBlack(), aBold(aFontSize(24, aCenteredTextView("Log in to your assistant!")))),
12  
    aVerticalSpacer(25),
13  
    tvResult,
14  
    aVerticalSpacer(25),
15  
    aBold(aFontSize(20, aCenteredTextView("Your e-mail address:"))),
16  
    aCenterTextView(tvEmail),
17  
    aVerticalSpacer(25),
18  
    aFontSize(20, aCenteredTextView("Password:")),
19  
    aCenterTextView(tvPW),
20  
    aVerticalSpacer(30),
21  
    aButton("Log in", r {
22  
      fS mail = trim(aGetText(tvEmail));
23  
      if (empty(mail))
24  
        ret with aSetText(tvResult, "Please enter your e-mail address");
25  
      if (!isValidEmailAddress_simple(mail))
26  
        ret with aSetText(tvResult, "Invalid e-mail address");
27  
28  
      S pw = trim(aGetText(tvPW));
29  
      saveTextFile(androidAssistant_userEmailFile(), mail);
30  
      if (empty(pw))
31  
        ret with aSetText(tvResult, "Please enter the password!");
32  
33  
      fS hash = assistant_hashPassword(pw);
34  
      saveTextFile(androidAssistant_hashedPWFile(), hash);
35  
      
36  
      final Button btn = heldInstance(Button);
37  
      thread {
38  
        temp aTempDisable(btn);
39  
        temp aTempSetText(btn, "Logging in...");
40  
        aSetText(tvResult, postPage("http://botcompany.de:8083/checkPW", email := mail, pwHash := hash));
41  
      }
42  
    })));
43  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, odkhaoglnmdk, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023323
Snippet name: Android login screen test
Eternal ID of this version: #1023323/25
Text MD5: 1242ac117b18996973921741415ec6a6
Transpilation MD5: 82773fd45ffe436f1e55092f8b35f6fc
Author: stefan
Category: javax / android
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-07 10:05:19
Source code size: 1514 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 263 / 535
Version history: 24 change(s)
Referenced in: [show references]