forked from dooreelko/MeditationTracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dim pref works now, do resource id migration
- Loading branch information
doo
committed
Jan 25, 2012
1 parent
c6aae96
commit 04d9d56
Showing
19 changed files
with
465 additions
and
221 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="horizontal" android:paddingLeft="10dp" android:paddingRight="15dp"> | ||
|
||
<ImageView | ||
android:id="@+id/imageView1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/ic_moon" android:paddingLeft="10dip" android:adjustViewBounds="true" android:layout_marginTop="3dp"/> | ||
|
||
<SeekBar | ||
android:id="@+id/prefSeekBar" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" /> | ||
|
||
<ImageView | ||
android:id="@+id/imageView2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/ic_sun" android:layout_marginTop="3dp"/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
MeditationTracker/src/com/meditationtracker/preferences/SliderPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.meditationtracker.preferences; | ||
|
||
import com.meditationtracker.R; | ||
|
||
import android.content.Context; | ||
import android.content.res.TypedArray; | ||
import android.preference.Preference; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.SeekBar; | ||
import android.widget.SeekBar.OnSeekBarChangeListener; | ||
|
||
public class SliderPreference extends Preference { | ||
|
||
private static final int DEFAULT = 3; | ||
private int max; | ||
private int cur; | ||
|
||
public SliderPreference(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
|
||
TypedArray a=getContext().obtainStyledAttributes(attrs,R.styleable.ActionPreference); | ||
max = a.getInteger(R.styleable.SliderPreference_max, 100); | ||
} | ||
|
||
@Override | ||
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) { | ||
cur = restorePersistedValue ? getPersistedInt(DEFAULT) : Integer.getInteger(defaultValue.toString(), DEFAULT); | ||
} | ||
|
||
@Override | ||
protected View onCreateView(ViewGroup parent) { | ||
setLayoutResource(R.layout.slider_pref); | ||
|
||
View result = super.onCreateView(parent); | ||
SeekBar sb = (SeekBar) result.findViewById(R.id.prefSeekBar); | ||
sb.setMax(max); | ||
sb.setProgress(cur); | ||
sb.setOnSeekBarChangeListener(seekChanged); | ||
|
||
return result; | ||
} | ||
|
||
private OnSeekBarChangeListener seekChanged = new OnSeekBarChangeListener() { | ||
|
||
@Override | ||
public void onStopTrackingTouch(SeekBar seekBar) { | ||
|
||
} | ||
|
||
@Override | ||
public void onStartTrackingTouch(SeekBar seekBar) { | ||
|
||
} | ||
|
||
@Override | ||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | ||
SliderPreference.this.persistInt(progress); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
/* AUTO-GENERATED FILE. DO NOT MODIFY. | ||
* | ||
* This class was automatically generated by the | ||
* aapt tool from the resource data it found. It | ||
* should not be modified by hand. | ||
*/ | ||
|
||
package doo.util.root; | ||
|
||
public final class R { | ||
public static final class attr { | ||
} | ||
public static final class drawable { | ||
public static final int icon=0x7f020000; | ||
} | ||
public static final class id { | ||
public static final int prefTimePicker=0x7f050000; | ||
} | ||
public static final class layout { | ||
public static final int main=0x7f030000; | ||
public static final int timepicker=0x7f030001; | ||
} | ||
public static final class string { | ||
public static final int app_name=0x7f040001; | ||
public static final int hello=0x7f040000; | ||
} | ||
} | ||
/* AUTO-GENERATED FILE. DO NOT MODIFY. | ||
* | ||
* This class was automatically generated by the | ||
* aapt tool from the resource data it found. It | ||
* should not be modified by hand. | ||
*/ | ||
|
||
package doo.util.root; | ||
|
||
public final class R { | ||
public static final class attr { | ||
} | ||
public static final class drawable { | ||
public static int icon=0x7f020000; | ||
} | ||
public static final class id { | ||
public static int prefTimePicker=0x7f050000; | ||
} | ||
public static final class layout { | ||
public static int timepicker=0x7f030000; | ||
} | ||
public static final class string { | ||
public static int app_name=0x7f040001; | ||
public static int hello=0x7f040000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ | |
|
||
android.library=true | ||
# Project target. | ||
target=android-3 | ||
target=android-15 |