From http://www.jwz.org/xscreensaver/xscreensaver-5.38.tar.gz
[xscreensaver] / android / xscreensaver / src / org / jwz / xscreensaver / XScreenSaverTVActivity.java
1 /* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  *
3  * xscreensaver, Copyright (c) 2017 Jamie Zawinski <jwz@jwz.org>
4  * and Dennis Sheil <dennis@panaceasupplies.com>
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation.  No representations are made about the suitability of this
11  * software for any purpose.  It is provided "as is" without express or 
12  * implied warranty.
13  *
14  * This is the XScreenSaver "application" that just brings up the
15  * Daydream preferences for Android TV.
16  */
17
18 package org.jwz.xscreensaver;
19
20 import android.app.Activity;
21 import android.app.WallpaperManager;
22 import android.content.ComponentName;
23 import android.content.Intent;
24 import android.os.Build;
25 import android.os.Bundle;
26 import android.view.View;
27 import android.provider.Settings;
28
29 public class XScreenSaverTVActivity extends Activity
30   implements View.OnClickListener {
31
32   @Override
33   protected void onCreate(Bundle savedInstanceState) {
34     super.onCreate(savedInstanceState);
35     setContentView(R.layout.activity_tv_xscreensaver);
36     findViewById(R.id.apply_daydream).setOnClickListener(this);
37   }
38
39   @Override
40   public void onClick(View v) {
41     switch (v.getId()) {
42
43     case R.id.apply_daydream:
44       String action;
45       Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
46       startActivityForResult(intent, 0);
47       break;
48     }
49   }
50 }