android.view.View.setKeepScreenOn()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(223)

本文整理了Java中android.view.View.setKeepScreenOn()方法的一些代码示例,展示了View.setKeepScreenOn()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setKeepScreenOn()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setKeepScreenOn

View.setKeepScreenOn介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void run() {
 if ((SystemClock.uptimeMillis() - lastActivity) > TIMEOUT_PERIOD) {
  content.setKeepScreenOn(false);
 }
 content.postDelayed(this, TIMEOUT_POLL_PERIOD);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onBuffering() {
  super.onBuffering();
  getRootView().setKeepScreenOn(true);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onBlocked() {
  super.onBlocked();
  playPauseButton.setImageResource(R.drawable.ic_pause_white);
  animatePlayButtons(false, 100);
  getRootView().setKeepScreenOn(true);
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 content=findViewById(android.R.id.content);
 content.setKeepScreenOn(true);
 run();
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void initViews(View rootView) {
  super.initViews(rootView);
  this.titleTextView = rootView.findViewById(R.id.titleTextView);
  this.channelTextView = rootView.findViewById(R.id.channelTextView);
  this.volumeRelativeLayout = rootView.findViewById(R.id.volumeRelativeLayout);
  this.volumeProgressBar = rootView.findViewById(R.id.volumeProgressBar);
  this.volumeImageView = rootView.findViewById(R.id.volumeImageView);
  this.brightnessRelativeLayout = rootView.findViewById(R.id.brightnessRelativeLayout);
  this.brightnessProgressBar = rootView.findViewById(R.id.brightnessProgressBar);
  this.brightnessImageView = rootView.findViewById(R.id.brightnessImageView);
  this.queueButton = rootView.findViewById(R.id.queueButton);
  this.repeatButton = rootView.findViewById(R.id.repeatButton);
  this.shuffleButton = rootView.findViewById(R.id.shuffleButton);
  this.playPauseButton = rootView.findViewById(R.id.playPauseButton);
  this.playPreviousButton = rootView.findViewById(R.id.playPreviousButton);
  this.playNextButton = rootView.findViewById(R.id.playNextButton);
  this.moreOptionsButton = rootView.findViewById(R.id.moreOptionsButton);
  this.secondaryControls = rootView.findViewById(R.id.secondaryControls);
  this.toggleOrientationButton = rootView.findViewById(R.id.toggleOrientation);
  this.switchBackgroundButton = rootView.findViewById(R.id.switchBackground);
  this.switchPopupButton = rootView.findViewById(R.id.switchPopup);
  this.queueLayout = findViewById(R.id.playQueuePanel);
  this.itemsListCloseButton = findViewById(R.id.playQueueClose);
  this.itemsList = findViewById(R.id.playQueue);
  titleTextView.setSelected(true);
  channelTextView.setSelected(true);
  getRootView().setKeepScreenOn(true);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onCompleted() {
  animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 0, 0, () -> {
    playPauseButton.setImageResource(R.drawable.ic_replay_white);
    animatePlayButtons(true, DEFAULT_CONTROLS_DURATION);
  });
  getRootView().setKeepScreenOn(false);
  super.onCompleted();
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onPausedSeek() {
  super.onPausedSeek();
  animatePlayButtons(false, 100);
  getRootView().setKeepScreenOn(true);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onPlaying() {
  super.onPlaying();
  animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
    playPauseButton.setImageResource(R.drawable.ic_pause_white);
    animatePlayButtons(true, 200);
  });
  getRootView().setKeepScreenOn(true);
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
public void onPaused() {
  super.onPaused();
  animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
    playPauseButton.setImageResource(R.drawable.ic_play_arrow_white);
    animatePlayButtons(true, 200);
  });
  showSystemUi();
  getRootView().setKeepScreenOn(false);
}

代码示例来源:origin: stackoverflow.com

private void mySetVisibility(View v, int visibility) {
  v.setVisibility(visibility);
  if (visibility == View.GONE) {
    v.setKeepScreenOn(false);
  } else {
    v.setKeepScreenOn(true);
  }
}

代码示例来源:origin: cemrich/zapp

@Override
  public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    View view = viewToKeepScreenOn.get();

    if (view == null) {
      return;
    }

    if (playbackState == Player.STATE_IDLE || playbackState == Player.STATE_ENDED || !playWhenReady) {
      view.setKeepScreenOn(false);
    } else {
      // This prevents the screen from getting dim/lock
      view.setKeepScreenOn(true);
    }
  }
}

代码示例来源:origin: stackoverflow.com

View view = ...; // I guess something with findViewById() happens here
view.setVisibility(View.GONE);
view.setKeepScreenOn(false);
...
view.setVisibility(View.VISIBLE);
view.setKeepScreenOn(true);

代码示例来源:origin: Tencent/RapidView

public void run(RapidParserObject object, Object view, Var value) {
    ((View)view).setKeepScreenOn(value.getBoolean());
  }
}

代码示例来源:origin: IndoorAtlas/android-sdk-examples

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  // prevent the screen going to sleep while app is on foreground
  findViewById(android.R.id.content).setKeepScreenOn(true);
  // instantiate IALocationManager
  mIALocationManager = IALocationManager.create(this);
}

代码示例来源:origin: vbier/habpanelviewer

private void setKeepScreenOn(boolean keepOn) {
  getScreenOnView().setKeepScreenOn(keepOn);
  if (keepOn) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  } else {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  }
}

代码示例来源:origin: IndoorAtlas/android-sdk-examples

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_maps);
  // prevent the screen going to sleep while app is on foreground
  findViewById(android.R.id.content).setKeepScreenOn(true);
  // instantiate IALocationManager
  mIALocationManager = IALocationManager.create(this);
  // disable indoor-outdoor detection (assume we're indoors)
  mIALocationManager.lockIndoors(true);
  // Request GPS locations
  if (ActivityCompat.checkSelfPermission(this, ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSION_ACCESS_FINE_LOCATION);
    return;
  }
  // Try to obtain the map from the SupportMapFragment.
  ((SupportMapFragment) getSupportFragmentManager()
      .findFragmentById(R.id.map))
      .getMapAsync(this);
}

代码示例来源:origin: IndoorAtlas/android-sdk-examples

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_maps);
  // prevent the screen going to sleep while app is on foreground
  findViewById(android.R.id.content).setKeepScreenOn(true);
  // instantiate IALocationManager
  mIALocationManager = IALocationManager.create(this);
  startListeningPlatformLocations();
  // Try to obtain the map from the SupportMapFragment.
  ((SupportMapFragment) getSupportFragmentManager()
      .findFragmentById(R.id.map))
      .getMapAsync(this);
}

代码示例来源:origin: labexp/osmtracker-android

trackLoggerView.setKeepScreenOn(prefs.getBoolean(OSMTracker.Preferences.KEY_UI_DISPLAY_KEEP_ON, OSMTracker.Preferences.VAL_UI_DISPLAY_KEEP_ON));

代码示例来源:origin: IndoorAtlas/android-sdk-examples

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_image_view);
  // prevent the screen going to sleep while app is on foreground
  findViewById(android.R.id.content).setKeepScreenOn(true);
  mImageView = (BlueDotView) findViewById(R.id.imageView);
  mDownloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
  mIALocationManager = IALocationManager.create(this);
  /* optional setup of floor plan id
    if setLocation is not called, then location manager tries to find
    location automatically */
  final String floorPlanId = getString(R.string.indooratlas_floor_plan_id);
  if (!TextUtils.isEmpty(floorPlanId)) {
    final IALocation location = IALocation.from(IARegion.floorPlan(floorPlanId));
    mIALocationManager.setLocation(location);
  }
  // Setup long click listener for sharing traceId
  ExampleUtils.shareTraceId(findViewById(R.id.imageView), ImageViewActivity.this,
      mIALocationManager);
}

代码示例来源:origin: PrivacyApps/document-viewer

activity.view.getView().setKeepScreenOn(newSettings.keepScreenOn);

相关文章

微信公众号

最新文章

更多

View类方法