Merge pull request #1784 from lioncash/android

Android: Fix a few warnings. Misc other things.
This commit is contained in:
Ryan Houdek 2015-01-05 14:32:01 -06:00
commit 7033b371c2
3 changed files with 13 additions and 15 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -9,14 +10,14 @@
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/seekBar"
android:id="@+id/sliderSeekBar"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView"
tools:text="Sample Text"
android:id="@+id/sliderTextView"
android:textStyle="bold"/>
</LinearLayout>

View File

@ -178,7 +178,7 @@
<string name="stereoscopy_descrip">Stereoscopy allows you to get a better feeling of depth if you have the necessary hardware.\nHeavily decreases emulation speed and sometimes causes issues</string>
<string name="stereoscopy_mode">Stereoscopy Mode</string>
<string name="stereoscopy_mode_descrip">Select the stereoscopic 3D mode.</string>
<string name="sterescopy_depth">Depthn</string>
<string name="sterescopy_depth">Depth</string>
<string name="sterescopy_depth_descrip">Control the distance between the virtual cameras.\nA higher value creates a stronger feeling of depth while a lower value is more comfortable.</string>
<string name="convergence">Convergence</string>
<string name="convergence_descrip">Control the distance of the convergence plane, this is the distance at which objects will appear to be in front of the screen.\nA higher value creates stronger out-of-screen effects while a lower value is more comfortable.</string>

View File

@ -5,7 +5,6 @@ import android.content.Context;
import android.os.Bundle;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
@ -19,8 +18,6 @@ public class SliderPreference extends DialogPreference implements SeekBar.OnSeek
{
private static final String androidns = "http://schemas.android.com/apk/res/android";
private Context m_context;
// SeekBar
private int m_max, m_value;
private SeekBar m_seekbar;
@ -30,8 +27,7 @@ public class SliderPreference extends DialogPreference implements SeekBar.OnSeek
public SliderPreference(Context context, AttributeSet attrs)
{
super(context,attrs);
m_context = context;
super(context, attrs);
// Seekbar values
m_value = attrs.getAttributeIntValue(androidns, "defaultValue", 0);
@ -41,11 +37,11 @@ public class SliderPreference extends DialogPreference implements SeekBar.OnSeek
@Override
protected View onCreateDialogView()
{
LayoutInflater inflater = LayoutInflater.from(m_context);
LayoutInflater inflater = LayoutInflater.from(getContext());
LinearLayout layout = (LinearLayout)inflater.inflate(R.layout.slider_layout, null, false);
m_seekbar = (SeekBar)layout.getChildAt(0);
m_textview = (TextView)layout.getChildAt(1);
m_seekbar = (SeekBar)layout.findViewById(R.id.sliderSeekBar);
m_textview = (TextView)layout.findViewById(R.id.sliderTextView);
if (shouldPersist())
m_value = Integer.valueOf(getPersistedString(Integer.toString(m_value)));
@ -77,8 +73,8 @@ public class SliderPreference extends DialogPreference implements SeekBar.OnSeek
}
@Override
public void showDialog(Bundle state) {
public void showDialog(Bundle state)
{
super.showDialog(state);
Button positiveButton = ((AlertDialog) getDialog()).getButton(AlertDialog.BUTTON_POSITIVE);
@ -86,7 +82,8 @@ public class SliderPreference extends DialogPreference implements SeekBar.OnSeek
}
@Override
public void onClick(View v) {
public void onClick(View v)
{
if (shouldPersist())
{
persistString(Integer.toString(m_seekbar.getProgress()));