mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
Add prefs activity.
This commit is contained in:
parent
4425eaa99e
commit
0649597d90
3 changed files with 138 additions and 2 deletions
|
@ -62,13 +62,22 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="PrefsActivity"
|
||||
android:theme="@android:style/Theme.Light"
|
||||
android:label="@string/title_game"
|
||||
android:screenOrientation="sensor"
|
||||
>
|
||||
<!-- Do I need an intent at all here? -->
|
||||
<intent-filter android:label="@string/resolve_edit">
|
||||
<action android:name="android.intent.action.EDIT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="DictActivity"
|
||||
android:theme="@android:style/Theme.Light"
|
||||
android:label="@string/title_game"
|
||||
android:screenOrientation="sensor"
|
||||
>
|
||||
<!-- This filter says that we can view or edit the data of
|
||||
a single note -->
|
||||
<intent-filter android:label="@string/resolve_edit">
|
||||
<action android:name="android.intent.action.EDIT" />
|
||||
</intent-filter>
|
||||
|
|
70
xwords4/android/XWords4/res/layout/prefs.xml
Normal file
70
xwords4/android/XWords4/res/layout/prefs.xml
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2007 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<CheckBox android:id="@+id/color_tiles"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/color_tiles"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/show_arrow"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/show_arrow"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/explain_robot"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/explain_robot"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/skip_confirm_turn"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/skip_confirm_turn"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/hide_values"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hide_values"
|
||||
/>
|
||||
|
||||
<!-- expandable color editor goes here -->
|
||||
|
||||
|
||||
<!-- Move this into a menu. Can't have it scrolling... Or have
|
||||
the back button trigger a save-or-toss dialog.... -->
|
||||
<Button android:id="@+id/prefs_done"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:text="@string/button_save"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- compile-command: "cd ../../../../../; ant reinstall"; -*- */
|
||||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.content.Intent;
|
||||
import android.app.Dialog;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Configuration;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import org.eehouse.android.xw4.jni.*;
|
||||
|
||||
public class PrefsActivity extends Activity implements View.OnClickListener {
|
||||
|
||||
private Button m_doneB;
|
||||
private CommonPrefs m_cp;
|
||||
|
||||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState )
|
||||
{
|
||||
Utils.logf( "PrefsActivity::onCreate() called" );
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
m_cp = new CommonPrefs( Utils.getCP() );
|
||||
|
||||
setContentView( R.layout.prefs );
|
||||
|
||||
Utils.setChecked( this, R.id.color_tiles, m_cp.showColors );
|
||||
Utils.setChecked( this, R.id.show_arrow, m_cp.showBoardArrow );
|
||||
Utils.setChecked( this, R.id.explain_robot, m_cp.showRobotScores );
|
||||
Utils.setChecked( this, R.id.skip_confirm_turn, m_cp.skipCommitConfirm );
|
||||
Utils.setChecked( this, R.id.hide_values, m_cp.hideTileValues );
|
||||
|
||||
m_doneB = (Button)findViewById(R.id.prefs_done);
|
||||
m_doneB.setOnClickListener( this );
|
||||
}
|
||||
|
||||
public void onClick( View view )
|
||||
{
|
||||
if ( m_doneB == view ) {
|
||||
|
||||
m_cp.showColors = Utils.getChecked( this, R.id.color_tiles );
|
||||
m_cp.showBoardArrow = Utils.getChecked( this, R.id.show_arrow );
|
||||
m_cp.showRobotScores = Utils.getChecked( this, R.id.explain_robot );
|
||||
m_cp.skipCommitConfirm = Utils.getChecked( this, R.id.skip_confirm_turn );
|
||||
m_cp.hideTileValues = Utils.getChecked( this, R.id.hide_values );
|
||||
|
||||
Utils.setCP( m_cp );
|
||||
|
||||
finish();
|
||||
}
|
||||
} // onClick
|
||||
}
|
Loading…
Reference in a new issue