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

31
LINES

< > BotCompany Repo | #1023258 // Test onWindowVisibilityChanged + onWindowFocusChanged (Android)

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

Libraryless. Click here for Pure Java version (1804L/12K/44K).

1  
!7
2  
3  
import android.widget.*;
4  
import android.view.*;
5  
6  
set flag AndroidOnly.
7  
8  
sS androidVisibilityToString(int v) {
9  
  ret v == View.GONE ? "gone"
10  
    : v == View.INVISIBLE ? "invisible"
11  
    : v == View.VISIBLE ? "visible"
12  
    : "unknown (" + v + ")";
13  
}
14  
15  
p {
16  
  androidUI(r {
17  
    TextView view = new TextView(androidActivity()) {
18  
      protected void onWindowVisibilityChanged(int visibility) {
19  
        super.onWindowVisibilityChanged(visibility);
20  
        setText(getText() + "\n" + localTimeWithSeconds() + ": " + androidVisibilityToString(visibility));
21  
      }
22  
      
23  
      public void onWindowFocusChanged(bool b) {
24  
        super.onWindowFocusChanged(b);
25  
        setText(getText() + "\n" + localTimeWithSeconds() + ": windowFocusChanged " + b);
26  
      }
27  
    };
28  
    view.setText("Testi testi");
29  
    aSetView(view);
30  
  });
31  
}

Author comment

Began life as a copy of #1023256

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: #1023258
Snippet name: Test onWindowVisibilityChanged + onWindowFocusChanged (Android)
Eternal ID of this version: #1023258/2
Text MD5: 9d7fe040c18ac88ec409fe94d6eb4e1c
Transpilation MD5: 56427e1734e4ddd8bf3ccd8c3ca46e69
Author: stefan
Category: javax
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-20 15:26:20
Source code size: 849 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 247 / 341
Version history: 1 change(s)
Referenced in: [show references]