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).

!7

import android.widget.*;
import android.view.*;

set flag AndroidOnly.

sS androidVisibilityToString(int v) {
  ret v == View.GONE ? "gone"
    : v == View.INVISIBLE ? "invisible"
    : v == View.VISIBLE ? "visible"
    : "unknown (" + v + ")";
}

p {
  androidUI(r {
    TextView view = new TextView(androidActivity()) {
      protected void onWindowVisibilityChanged(int visibility) {
        super.onWindowVisibilityChanged(visibility);
        setText(getText() + "\n" + localTimeWithSeconds() + ": " + androidVisibilityToString(visibility));
      }
      
      public void onWindowFocusChanged(bool b) {
        super.onWindowFocusChanged(b);
        setText(getText() + "\n" + localTimeWithSeconds() + ": windowFocusChanged " + b);
      }
    };
    view.setText("Testi testi");
    aSetView(view);
  });
}

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: 245 / 338
Version history: 1 change(s)
Referenced in: [show references]