diff --git a/LocationRinger/res/layout/feature_title_bar.xml b/LocationRinger/res/layout/feature_title_bar.xml
new file mode 100644
index 0000000..ca7ab44
--- /dev/null
+++ b/LocationRinger/res/layout/feature_title_bar.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LocationRinger/res/layout/list.xml b/LocationRinger/res/layout/list.xml
deleted file mode 100644
index d169124..0000000
--- a/LocationRinger/res/layout/list.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
diff --git a/LocationRinger/res/layout/ringtone_fragment.xml b/LocationRinger/res/layout/ringtone_fragment.xml
index bde96f1..aaa1c72 100644
--- a/LocationRinger/res/layout/ringtone_fragment.xml
+++ b/LocationRinger/res/layout/ringtone_fragment.xml
@@ -4,14 +4,12 @@
android:layout_height="wrap_content"
android:orientation="vertical" >
-
+ layout="@layout/feature_title_bar" />
-
+ layout="@layout/feature_title_bar" />
-
+ layout="@layout/feature_title_bar" />
names = this.getAllRingerTitles();
+ final List names = this.getAllRingerTitles();
String ringerName = name;
int count = 1;
@@ -344,8 +350,6 @@ public class RingerDatabase {
}
}
return ringerName;
-
-// return checkRingerName(name, 0);
}
/**
@@ -355,9 +359,9 @@ public class RingerDatabase {
* @throws IOException
* @author ricky barrette
*/
- private void copyFile(File src, File dst) throws IOException {
- FileChannel inChannel = new FileInputStream(src).getChannel();
- FileChannel outChannel = new FileOutputStream(dst).getChannel();
+ private void copyFile(final File src, final File dst) throws IOException {
+ final FileChannel inChannel = new FileInputStream(src).getChannel();
+ final FileChannel outChannel = new FileOutputStream(dst).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} finally {
@@ -421,8 +425,8 @@ public class RingerDatabase {
* @author ricky barrette
*/
public List getAllRingerTitles() {
- List list = new ArrayList();
- Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { KEY_RINGER_NAME }, null, null, null, null, null);
+ final List list = new ArrayList();
+ final Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { KEY_RINGER_NAME }, null, null, null, null, null);
if (cursor.moveToFirst()) {
do {
list.add(cursor.getString(0));
@@ -440,8 +444,8 @@ public class RingerDatabase {
* @author ricky barrette
*/
public List getAllRingerDescriptions() {
- List list = new ArrayList();
- List ringers = getAllRingerTitles();
+ final List list = new ArrayList();
+ final List ringers = getAllRingerTitles();
for(String ringer: ringers){
list.add(getRingerInfo(ringer).getAsString(KEY_RINGER_DESCRIPTION));
}
@@ -464,9 +468,9 @@ public class RingerDatabase {
* @return
* @author ricky barrette
*/
- public ContentValues getRingerInfo(String ringerName){
- ContentValues values = new ContentValues();
- Cursor info = this.mDb.query(RINGER_INFO_TABLE, new String[]{ KEY, KEY_VALUE }, KEY_RINGER_NAME +" = "+ DatabaseUtils.sqlEscapeString(ringerName), null, null, null, null);
+ public ContentValues getRingerInfo(final String ringerName){
+ final ContentValues values = new ContentValues();
+ final Cursor info = this.mDb.query(RINGER_INFO_TABLE, new String[]{ KEY, KEY_VALUE }, KEY_RINGER_NAME +" = "+ DatabaseUtils.sqlEscapeString(ringerName), null, null, null, null);
if (info.moveToFirst()) {
do {
values.put(info.getString(0), info.getString(1));
@@ -484,9 +488,9 @@ public class RingerDatabase {
* @return ringer's name
* @author ricky barrette
*/
- public String getRingerName(long id) {
+ public String getRingerName(final long id) {
String name = null;
- Cursor cursor = this.mDb.query(RINGER_TABLE, new String[]{ KEY_RINGER_NAME }, "id = "+id, null, null, null, null);;
+ final Cursor cursor = this.mDb.query(RINGER_TABLE, new String[]{ KEY_RINGER_NAME }, "id = "+id, null, null, null, null);;
if (cursor.moveToFirst()) {
name = cursor.getString(0);
}
@@ -502,14 +506,14 @@ public class RingerDatabase {
* @param ringerInfo values
* @author ricky barrette
*/
- public void insertRinger(ContentValues ringer, ContentValues ringerInfo){
+ public void insertRinger(final ContentValues ringer, final ContentValues ringerInfo){
ringer.put(RingerDatabase.KEY_RINGER_NAME, checkRingerName(ringer.getAsString(RingerDatabase.KEY_RINGER_NAME)));
mDb.insert(RINGER_TABLE, null, ringer);
- String ringerName = ringer.getAsString(RingerDatabase.KEY_RINGER_NAME);
+ final String ringerName = ringer.getAsString(RingerDatabase.KEY_RINGER_NAME);
//insert the information values
- for(Entry item : ringerInfo.valueSet()){
- ContentValues values = new ContentValues();
+ for(final Entry item : ringerInfo.valueSet()){
+ final ContentValues values = new ContentValues();
values.put(KEY_RINGER_NAME, ringerName);
values.put(KEY, item.getKey());
/*
@@ -540,8 +544,8 @@ public class RingerDatabase {
* @return true if the ringer is enabled
* @author ricky barrette
*/
- public boolean isRingerEnabled(long id) {
- Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { KEY_IS_ENABLED }, "id = "+id, null, null, null, null);
+ public boolean isRingerEnabled(final long id) {
+ final Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { KEY_IS_ENABLED }, "id = "+id, null, null, null, null);
if (cursor.moveToFirst()) {
if(Debug.DEBUG)
Log.d(TAG, "isRingerEnabled("+id+") = "+ cursor.getString(0));
@@ -556,13 +560,14 @@ public class RingerDatabase {
* @author ricky barrette
*/
public void restore(){
- File dbFile = new File(Environment.getDataDirectory() + "/data/"+mContext.getPackageName()+"/databases/"+DATABASE_NAME);
+ final File dbFile = new File(Environment.getDataDirectory() + "/data/"+mContext.getPackageName()+"/databases/"+DATABASE_NAME);
- File exportDir = new File(Environment.getExternalStorageDirectory(), "/"+this.mContext.getString(R.string.app_name));
+ final File exportDir = new File(Environment.getExternalStorageDirectory(), "/"+this.mContext.getString(R.string.app_name));
if (!exportDir.exists()) {
exportDir.mkdirs();
}
- File file = new File(exportDir, dbFile.getName());
+
+ final File file = new File(exportDir, dbFile.getName());
try {
file.createNewFile();
@@ -580,10 +585,10 @@ public class RingerDatabase {
this.mListener.onRestoreComplete();
}
- public int setRingerEnabled(long id, boolean enabled) {
+ public int setRingerEnabled(final long id, final boolean enabled) {
if(Debug.DEBUG)
Log.d(TAG, "setRingerEnabled("+id+") = "+ enabled);
- ContentValues values = new ContentValues();
+ final ContentValues values = new ContentValues();
values.put(KEY_IS_ENABLED, enabled);
return mDb.update(RINGER_TABLE, values, "id" + "= "+ id, null);
}
@@ -595,19 +600,38 @@ public class RingerDatabase {
* @param info values
* @author ricky barrette
*/
- public void updateRinger(long id, ContentValues ringer, ContentValues info) throws NullPointerException{
+ public void updateRinger(final long id, final ContentValues ringer, final ContentValues info) throws NullPointerException{
if(ringer == null || info == null)
throw new NullPointerException("ringer content was null");
- String ringer_name = getRingerName(id);
+ final String ringer_name = getRingerName(id);
+ /*
+ * here we retrive the old values.
+ * we will compare the old value against the new values.
+ * we will delete all values that are NOT included in the new values.
+ */
+ final ContentValues old = getRingerInfo(ringer_name);
+ for(final Entry item : info.valueSet()){
+ if(old.containsKey(item.getKey()))
+ old.remove(item.getKey());
+ }
+ for(final Entry item : old.valueSet()){
+ RingerDatabase.this.mDb.delete(RINGER_INFO_TABLE, KEY +" = "+ DatabaseUtils.sqlEscapeString(item.getKey()) +" and "+ KEY_RINGER_NAME +" = "+DatabaseUtils.sqlEscapeString(ringer_name), null);
+ }
+
+ /*
+ * here we want to update the ringer name if needed
+ */
if(!ringer_name.equals(ringer.getAsString(RingerDatabase.KEY_RINGER_NAME)))
ringer.put(RingerDatabase.KEY_RINGER_NAME, checkRingerName(ringer.getAsString(RingerDatabase.KEY_RINGER_NAME)));
- //update the information values in the info table
- for(Entry item : info.valueSet()){
- ContentValues values = new ContentValues();
+ /*
+ * here we wanr to update the information values in the info table
+ */
+ for(final Entry item : info.valueSet()){
+ final ContentValues values = new ContentValues();
values.put(KEY_RINGER_NAME, ringer.getAsString(KEY_RINGER_NAME));
values.put(KEY, item.getKey());
try {
@@ -619,7 +643,11 @@ public class RingerDatabase {
values.put(KEY_VALUE, (Integer) item.getValue());
}
}
- //try to update, if update fails insert
+
+ /*
+ * here we are going to try to update a row,
+ * if that fails we will insert a row insead
+ */
if(!(mDb.update(RINGER_INFO_TABLE, values, KEY_RINGER_NAME + "="+ DatabaseUtils.sqlEscapeString(ringer_name) +" AND " + KEY +"='"+ item.getKey()+"'", null) > 0))
mDb.insert(RINGER_INFO_TABLE, null, values);
}
@@ -636,7 +664,7 @@ public class RingerDatabase {
private void updateRowIds(long id) {
long currentRow;
ContentValues values = new ContentValues();
- Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { "id" },null, null, null, null, null);
+ final Cursor cursor = this.mDb.query(RINGER_TABLE, new String[] { "id" },null, null, null, null, null);
if (cursor.moveToFirst()) {
do {
currentRow = cursor.getLong(0);
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java
index c3402b6..f93ab8b 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/RingerInformationActivity.java
@@ -14,7 +14,6 @@ import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
-import android.media.AudioManager;
import android.os.Bundle;
import android.os.Looper;
import android.support.v4.app.Fragment;
@@ -35,9 +34,6 @@ import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.fragments.AboutRingerFragment;
import com.TwentyCodes.android.LocationRinger.ui.fragments.FeatureListFragment;
import com.TwentyCodes.android.LocationRinger.ui.fragments.LocationInfomationFragment;
-import com.TwentyCodes.android.LocationRinger.ui.fragments.RingtoneFragment;
-import com.TwentyCodes.android.LocationRinger.ui.fragments.ToggleButtonFragment;
-import com.TwentyCodes.android.LocationRinger.ui.fragments.VolumeFragment;
import com.jakewharton.android.viewpagerindicator.TitlePageIndicator;
import com.jakewharton.android.viewpagerindicator.TitledFragmentAdapter;
@@ -63,12 +59,16 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
Log.d(TAG, item.getKey() +" = "+ item.getValue());
}
+ /**
+ * Called when the activity is first created
+ * (non-Javadoc)
+ * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
+ */
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.ringer_information_activity);
-
/*
* Set up the action bar if required
*/
@@ -112,47 +112,7 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
if(!isDefault)
fragments.add(new LocationInfomationFragment(this.mInfo, this, this));
- /*
- * What page
- * ONLY Dynamically add the required fragments that have already been added.
- *
- * TODO
- * update interval
- */
- ArrayList what = new ArrayList();
- ArrayList added = new ArrayList();
-
- if(this.mInfo.containsKey(RingerDatabase.KEY_RINGTONE_IS_SILENT) || this.mInfo.containsKey(RingerDatabase.KEY_RINGTONE_VOLUME)){
- what.add(new RingtoneFragment(this.mInfo, this, AudioManager.STREAM_RING));
- added.add(0);
- }
-
- if(this.mInfo.containsKey(RingerDatabase.KEY_NOTIFICATION_IS_SILENT) || this.mInfo.containsKey(RingerDatabase.KEY_NOTIFICATION_RINGTONE_VOLUME)){
- what.add(new RingtoneFragment(this.mInfo, this, AudioManager.STREAM_NOTIFICATION));
- added.add(1);
- }
-
- if(this.mInfo.containsKey(RingerDatabase.KEY_ALARM_VOLUME)){
- what.add(new VolumeFragment(this.mInfo, this, this, AudioManager.STREAM_ALARM));
- added.add(2);
- }
-
- if(this.mInfo.containsKey(RingerDatabase.KEY_MUSIC_VOLUME)){
- what.add(new VolumeFragment(this.mInfo, this, this, AudioManager.STREAM_MUSIC));
- added.add(3);
- }
-
- if(this.mInfo.containsKey(RingerDatabase.KEY_BT)){
- what.add(new ToggleButtonFragment(this.getString(R.string.bluetooth), RingerDatabase.KEY_BT, this.mInfo, this));
- added.add(4);
- }
-
- if(this.mInfo.containsKey(RingerDatabase.KEY_WIFI)){
- what.add(new ToggleButtonFragment(this.getString(R.string.wifi), RingerDatabase.KEY_WIFI, this.mInfo, this));
- added.add(5);
- }
-
- fragments.add(new FeatureListFragment(this.mInfo, this, what, added));
+ fragments.add(new FeatureListFragment(this.mInfo, this));
//Populate the pager
this.mPager = (ViewPager)findViewById(R.id.pager);
@@ -165,11 +125,6 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
indicator.setViewPager(this.mPager);
indicator.setOnPageChangeListener(this);
-
- /*
- * TODO
- * button bar
- */
}
/**
@@ -182,6 +137,11 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
return super.onCreateOptionsMenu(menu);
}
+ /**
+ * Called when the ringer info has changed
+ * (non-Javadoc)
+ * @see com.TwentyCodes.android.LocationRinger.OnContentChangedListener#onInfoContentChanged(android.content.ContentValues)
+ */
@Override
public void onInfoContentChanged(ContentValues values) {
if(Debug.DEBUG){
@@ -229,10 +189,13 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
@Override
public void onPageSelected(int arg0) {
- // TODO Auto-generated method stub
-
}
+ /**
+ * Called when the ringer content has been changed
+ * (non-Javadoc)
+ * @see com.TwentyCodes.android.LocationRinger.OnContentChangedListener#onRingerContentChanged(android.content.ContentValues)
+ */
@Override
public void onRingerContentChanged(ContentValues values) {
if(Debug.DEBUG){
@@ -261,10 +224,27 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
}
}).start();
}
-
+
+ /**
+ * Called when the scrolling state of the view pager is changed
+ * (non-Javadoc)
+ * @see com.TwentyCodes.android.LocationRinger.EnableScrollingListener#setScrollEnabled(boolean)
+ */
@Override
public void setScrollEnabled(boolean enabled) {
this.mPager.setScrollEnabled(enabled);
}
+ /**
+ * Called when a feature is removed
+ * (non-Javadoc)
+ * @see com.TwentyCodes.android.LocationRinger.OnContentChangedListener#onInfoContentRemoved(java.lang.String[])
+ */
+ @Override
+ public void onInfoContentRemoved(String... keys) {
+ for(String key : keys)
+ if(this.mInfo.containsKey(key))
+ this.mInfo.remove(key);
+ }
+
}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java
index 9639c8f..5a018d0 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/BaseFragmentListFragment.java
@@ -32,7 +32,7 @@ public abstract class BaseFragmentListFragment extends Fragment {
private final int mLayout;
/**
- * Creates a new BaseFragmentListFragment
+ * Creates a new Populated BaseFragmentListFragment
* @author ricky barrette
*/
public BaseFragmentListFragment(ArrayList fragments, int layout, int container) {
@@ -42,6 +42,18 @@ public abstract class BaseFragmentListFragment extends Fragment {
mContainer = container;
}
+ /**
+ * Creates a new Empty Base Fragment List
+ * @param layout
+ * @param container
+ * @author ricky barrette
+ */
+ public BaseFragmentListFragment(int layout, int container) {
+ mLayout = layout;
+ mContainer = container;
+ mFragments = new ArrayList();
+ }
+
/**
* Adds the fragment to the list
* @param fragment
@@ -54,6 +66,31 @@ public abstract class BaseFragmentListFragment extends Fragment {
transaction.commit();
}
+ /**
+ * Adds a collection ofs fragments to the list
+ * @param fragments
+ * @author ricky barrette
+ */
+ public void addAll(final ArrayList fragments){
+ final FragmentTransaction transaction = this.getFragmentManager().beginTransaction();
+ for(Fragment f : fragments){
+ this.mFragments.add(f);
+ transaction.add(mContainer, f, f.getTag());
+ }
+ transaction.commit();
+ }
+
+ /**
+ * Adds a collection ofs fragments to the list, but doesn't preform any transactions
+ * @param fragment
+ * @author ricky barrette
+ */
+ protected void addAllInit(final ArrayList fragments){
+ for(Fragment f : fragments){
+ this.mFragments.add(f);
+ }
+ }
+
/**
* Loads all the fragments
* @author ricky barrette
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java
index dd4c046..73d3df9 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java
@@ -22,38 +22,132 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
+import com.TwentyCodes.android.LocationRinger.FeatureRemovedListener;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
/**
* This fragment will be used to display a list of features
- * TODO
- * + create button bar that had a plus button and a hint + add/remove features
- *
* @author ricky
*/
-public class FeatureListFragment extends BaseFragmentListFragment implements OnClickListener, android.content.DialogInterface.OnClickListener {
-
- private static final String TAG = "FeatureListFragment";
+public class FeatureListFragment extends BaseFragmentListFragment implements OnClickListener, android.content.DialogInterface.OnClickListener, FeatureRemovedListener {
+
+ private static final int KEY_ADDED_RINGTONE = 0;
+ private static final int KEY_ADDED_NOTIFICATIONTONE = 1;
+ private static final int KEY_ADDED_ALARM_VOLUME = 2;
+ private static final int KEY_ADDED_MUSIC_VOLUME = 3;
+ private static final int KEY_ADDED_BT = 4;
+ private static final int KEY_ADDED_WIFI = 5;
private final ContentValues mInfo;
private final OnContentChangedListener mListener;
private final ArrayList mAdded;
/**
- * Creates a new FeatureListFragment
+ * Creates a new populated FeatureListFragment
* @param info
* @param listener
* @param fragments
* @author ricky barrette
*/
public FeatureListFragment(ContentValues info, OnContentChangedListener listener, ArrayList fragments, ArrayList added) {
- super(fragments, R.layout.fragment_list_contianer, R.id.fragment_list_contianer);
+ super(R.layout.fragment_list_contianer, R.id.fragment_list_contianer);
+
+ if ( info == null )
+ throw new NullPointerException();
+ if ( listener == null )
+ throw new NullPointerException();
+ if ( fragments == null )
+ throw new NullPointerException();
+ if ( added == null )
+ throw new NullPointerException();
+
mInfo = info;
mListener = listener;
mAdded = added;
}
+
+ /**
+ * Creates a new empty feature list fragment
+ * @param info
+ * @param listener
+ * @author ricky barrette
+ */
+ public FeatureListFragment(ContentValues info, OnContentChangedListener listener){
+ this(info, listener, new ArrayList(), new ArrayList());
+ }
+ /**
+ * Initializes a feature fragment
+ * @param fragmentCode
+ * @return
+ * @author ricky barrette
+ */
+ public Fragment initFeatureFragment(int fragmentCode){
+ Fragment f = null;
+ switch(fragmentCode){
+ case KEY_ADDED_RINGTONE:
+ f= new RingtoneFragment(this.mInfo, this.mListener, this, AudioManager.STREAM_RING, KEY_ADDED_RINGTONE);
+ mAdded.add(KEY_ADDED_RINGTONE);
+ break;
+ case KEY_ADDED_NOTIFICATIONTONE:
+ f = new RingtoneFragment(this.mInfo, this.mListener, this, AudioManager.STREAM_NOTIFICATION, KEY_ADDED_NOTIFICATIONTONE);
+ mAdded.add(KEY_ADDED_NOTIFICATIONTONE);
+ break;
+ case KEY_ADDED_ALARM_VOLUME:
+ f = new VolumeFragment(this.mInfo, this.getActivity(), this.mListener, this, AudioManager.STREAM_ALARM, KEY_ADDED_ALARM_VOLUME);
+ mAdded.add(KEY_ADDED_ALARM_VOLUME);
+ break;
+ case KEY_ADDED_MUSIC_VOLUME:
+ f = new VolumeFragment(this.mInfo, this.getActivity(), this.mListener, this, AudioManager.STREAM_MUSIC, KEY_ADDED_MUSIC_VOLUME);
+ mAdded.add(KEY_ADDED_MUSIC_VOLUME);
+ break;
+ case KEY_ADDED_BT:
+ f = new ToggleButtonFragment(android.R.drawable.stat_sys_data_bluetooth, this.getString(R.string.bluetooth), RingerDatabase.KEY_BT, this.mInfo, this.mListener, this, KEY_ADDED_BT);
+ mAdded.add(KEY_ADDED_BT);
+ break;
+ case KEY_ADDED_WIFI:
+ f = new ToggleButtonFragment(android.R.drawable.stat_sys_data_bluetooth, this.getString(R.string.wifi), RingerDatabase.KEY_WIFI, this.mInfo, this.mListener, this, KEY_ADDED_WIFI);
+ mAdded.add(KEY_ADDED_WIFI);
+ break;
+
+ }
+ return f;
+ }
+
+ /**
+ * Initializes feature fragments based upon current records
+ * @author ricky barrette
+ */
+ private ArrayList initList() {
+ ArrayList what = new ArrayList();
+
+ if(this.mInfo.containsKey(RingerDatabase.KEY_RINGTONE_IS_SILENT) || this.mInfo.containsKey(RingerDatabase.KEY_RINGTONE_VOLUME)){
+ what.add(initFeatureFragment(KEY_ADDED_RINGTONE));
+ }
+
+ if(this.mInfo.containsKey(RingerDatabase.KEY_NOTIFICATION_IS_SILENT) || this.mInfo.containsKey(RingerDatabase.KEY_NOTIFICATION_RINGTONE_VOLUME)){
+ what.add(initFeatureFragment(KEY_ADDED_NOTIFICATIONTONE));
+ }
+
+ if(this.mInfo.containsKey(RingerDatabase.KEY_ALARM_VOLUME)){
+ what.add(initFeatureFragment(KEY_ADDED_ALARM_VOLUME));
+ }
+
+ if(this.mInfo.containsKey(RingerDatabase.KEY_MUSIC_VOLUME)){
+ what.add(initFeatureFragment(KEY_ADDED_MUSIC_VOLUME));
+ }
+
+ if(this.mInfo.containsKey(RingerDatabase.KEY_BT)){
+ what.add(initFeatureFragment(KEY_ADDED_BT));
+ }
+
+ if(this.mInfo.containsKey(RingerDatabase.KEY_WIFI)){
+ what.add(initFeatureFragment(KEY_ADDED_WIFI));
+ }
+ return what;
+ }
+
/**
* Called when an item is picked from the add featue list
* (non-Javadoc)
@@ -61,37 +155,7 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
*/
@Override
public void onClick(DialogInterface dialog, int which) {
- Fragment f = null;
- switch(which){
- case 0:
- f= new RingtoneFragment(this.mInfo, this.mListener, AudioManager.STREAM_RING);
- mAdded.add(0);
- break;
- case 1:
- f = new RingtoneFragment(this.mInfo, this.mListener, AudioManager.STREAM_NOTIFICATION);
- mAdded.add(1);
- break;
- case 2:
- f = new VolumeFragment(this.mInfo, this.getActivity(), this.mListener, AudioManager.STREAM_ALARM);
- mAdded.add(2);
- break;
- case 3:
- f = new VolumeFragment(this.mInfo, this.getActivity(), this.mListener, AudioManager.STREAM_MUSIC);
- mAdded.add(3);
- break;
- case 4:
- f = new ToggleButtonFragment(this.getString(R.string.bluetooth), RingerDatabase.KEY_BT, this.mInfo, this.mListener);
- mAdded.add(4);
- break;
- case 5:
- f = new ToggleButtonFragment(this.getString(R.string.wifi), RingerDatabase.KEY_WIFI, this.mInfo, this.mListener);
- mAdded.add(5);
- break;
-// case 6:
-// f =
-// break;
- }
-
+ final Fragment f = initFeatureFragment(which);
if(f != null)
add(f);
}
@@ -150,6 +214,18 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
}
/**
+ * Called when the activity is first created
+ * (non-Javadoc)
+ * @see android.support.v4.app.Fragment#onCreate(android.os.Bundle)
+ */
+ @Override
+ public void onCreate(Bundle arg0) {
+ addAllInit(initList());
+ super.onCreate(arg0);
+ }
+
+ /**
+ * Called when the view needs to be created
* (non-Javadoc)
* @see com.TwentyCodes.android.LocationRinger.ui.fragments.BaseFragmentListFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
*/
@@ -159,4 +235,43 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC
v.findViewById(R.id.add_feature_button).setOnClickListener(this);
return v;
}
+
+ /**
+ * Called when a fragment needs to be removed
+ * (non-Javadoc)
+ * @see com.TwentyCodes.android.LocationRinger.FeatureRemovedListener#onFeatureRemoved(android.support.v4.app.Fragment)
+ */
+ @Override
+ public void onFeatureRemoved(Fragment f) {
+ this.remove(f);
+
+ if(f instanceof IdFragment){
+ final int id = ((IdFragment) f).getFragmentId();
+ mAdded.remove(new Integer(id));
+
+ /*
+ * we need to notify our parent activity that the feature have been removed.
+ */
+ switch(id){
+ case KEY_ADDED_RINGTONE:
+ this.mListener.onInfoContentRemoved(RingerDatabase.KEY_RINGTONE_URI, RingerDatabase.KEY_RINGTONE_IS_SILENT, RingerDatabase.KEY_RINGTONE_VOLUME);
+ break;
+ case KEY_ADDED_NOTIFICATIONTONE:
+ this.mListener.onInfoContentRemoved(RingerDatabase.KEY_NOTIFICATION_RINGTONE_URI, RingerDatabase.KEY_NOTIFICATION_IS_SILENT, RingerDatabase.KEY_NOTIFICATION_RINGTONE_VOLUME);
+ break;
+ case KEY_ADDED_ALARM_VOLUME:
+ this.mListener.onInfoContentRemoved(RingerDatabase.KEY_ALARM_VOLUME);
+ break;
+ case KEY_ADDED_MUSIC_VOLUME:
+ this.mListener.onInfoContentRemoved(RingerDatabase.KEY_MUSIC_VOLUME);
+ break;
+ case KEY_ADDED_BT:
+ this.mListener.onInfoContentRemoved(RingerDatabase.KEY_BT);
+ break;
+ case KEY_ADDED_WIFI:
+ this.mListener.onInfoContentRemoved(RingerDatabase.KEY_WIFI);
+ break;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/IdFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/IdFragment.java
new file mode 100644
index 0000000..c959ed7
--- /dev/null
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/IdFragment.java
@@ -0,0 +1,30 @@
+/**
+ * IdFragment.java
+ * @date May 26, 2012
+ * @author ricky barrette
+ * @author Twenty Codes, LLC
+ */
+package com.TwentyCodes.android.LocationRinger.ui.fragments;
+
+import android.support.v4.app.Fragment;
+
+/**
+ * This is a simple extention of a fragment that will allow for storage of an id
+ * @author ricky barrette
+ */
+public class IdFragment extends Fragment {
+
+ private final int mId;
+
+ public IdFragment(int id){
+ super();
+ mId = id;
+ }
+
+ /**
+ * @return the id of this fragment
+ */
+ public int getFragmentId() {
+ return mId;
+ }
+}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java
index f519fba..a133ce9 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/RingtoneFragment.java
@@ -17,17 +17,18 @@ import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
+import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
+import com.TwentyCodes.android.LocationRinger.FeatureRemovedListener;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
@@ -37,26 +38,37 @@ import com.TwentyCodes.android.LocationRinger.debug.Debug;
* This fragment will be for ringtone settings
* @author ricky
*/
-public class RingtoneFragment extends Fragment implements OnClickListener, OnSeekBarChangeListener {
+public class RingtoneFragment extends IdFragment implements OnClickListener, OnSeekBarChangeListener {
private static final String TAG = "RingtoneFragment";
private final int mStream;
private final int mType;
- private final OnContentChangedListener mListener;
+ private final OnContentChangedListener mChangedListener;
private final String mKeyEnabled;
private final String mKeyUri;
private final String mKeyVolume;
private final ContentValues mInfo;
+ private final FeatureRemovedListener mRemovedListener;
private final int mLabel;
private EditText mRingtone;
private Uri mRingtoneURI;
private SeekBar mVolume;
+ private ImageView mIcon;
- public RingtoneFragment(ContentValues info, OnContentChangedListener listener, int stream){
- super();
- this.mListener = listener;
+ public RingtoneFragment(ContentValues info, OnContentChangedListener changedListener, FeatureRemovedListener removedListener, int stream, int id){
+ super(id);
+
+ if ( info == null )
+ throw new NullPointerException();
+ if ( changedListener == null )
+ throw new NullPointerException();
+ if ( removedListener == null )
+ throw new NullPointerException();
+
+ this.mChangedListener = changedListener;
this.mStream = stream;
this.mInfo = info;
+ this.mRemovedListener = removedListener;
switch(stream){
case AudioManager.STREAM_NOTIFICATION:
@@ -100,11 +112,11 @@ public class RingtoneFragment extends Fragment implements OnClickListener, OnSee
* @author ricky barrette
*/
private void notifyRingtoneChanged(Uri tone) {
- if(this.mListener != null){
+ if(this.mChangedListener != null){
ContentValues info = new ContentValues();
info.put(this.mKeyUri, tone != null ? tone.toString() : null);
info.put(mKeyEnabled, tone == null);
- this.mListener.onInfoContentChanged(info);
+ this.mChangedListener.onInfoContentChanged(info);
}
}
@@ -114,10 +126,11 @@ public class RingtoneFragment extends Fragment implements OnClickListener, OnSee
* @author ricky barrette
*/
private void notifyVolumeChanged(int progress) {
- if(this.mListener != null){
+ mIcon.setImageDrawable(this.getActivity().getResources().getDrawable(progress == 0 ? android.R.drawable.ic_lock_silent_mode : android.R.drawable.ic_lock_silent_mode_off));
+ if(this.mChangedListener != null){
final ContentValues info = new ContentValues();
info.put(this.mKeyVolume, progress);
- this.mListener.onInfoContentChanged(info);
+ this.mChangedListener.onInfoContentChanged(info);
}
}
@@ -133,6 +146,7 @@ public class RingtoneFragment extends Fragment implements OnClickListener, OnSee
this.mRingtone.setText(R.string.silent);
mVolume.setEnabled(false);
mVolume.setProgress(0);
+ notifyVolumeChanged(0);
} else {
mVolume.setEnabled(true);
Ringtone ringtone = RingtoneManager.getRingtone(this.getActivity(), Uri.parse(tone.toString()));
@@ -149,7 +163,16 @@ public class RingtoneFragment extends Fragment implements OnClickListener, OnSee
*/
@Override
public void onClick(View v) {
- getRingtoneURI(this.mType, mRingtoneURI);
+ switch(v.getId()){
+ case R.id.ringtone:
+ getRingtoneURI(this.mType, mRingtoneURI);
+ break;
+ case R.id.close:
+ if(this.mRemovedListener != null)
+ this.mRemovedListener.onFeatureRemoved(this);
+ break;
+
+ }
}
@Override
@@ -164,15 +187,30 @@ public class RingtoneFragment extends Fragment implements OnClickListener, OnSee
/*
* initialize the views
*/
- final TextView label = (TextView) view.findViewById(R.id.label);
+ final TextView label = (TextView) view.findViewById(R.id.title);
label.setText(mLabel);
+ mIcon = (ImageView) view.findViewById(R.id.icon);
+ mIcon.setImageDrawable(this.getActivity().getResources().getDrawable(android.R.drawable.ic_lock_silent_mode_off));
+
this.mRingtone = (EditText) view.findViewById(R.id.ringtone);
mVolume = (SeekBar) view.findViewById(R.id.ringtone_volume);
this.mRingtone.setOnClickListener(this);
mVolume.setMax(audioManager.getStreamMaxVolume(mStream));
+ view.findViewById(R.id.close).setOnClickListener(this);
+
+ /*
+ * volume
+ */
+ if(this.mInfo.containsKey(this.mKeyVolume))
+ mVolume.setProgress(Integer.parseInt(this.mInfo.getAsString(this.mKeyVolume)));
+ else {
+ mVolume.setProgress(audioManager.getStreamVolume(mStream));
+ notifyVolumeChanged(audioManager.getStreamVolume(mStream));
+ }
+
/*
* ringtone & uri
*/
@@ -195,16 +233,8 @@ public class RingtoneFragment extends Fragment implements OnClickListener, OnSee
mRingtone.setText(R.string.silent);
mVolume.setProgress(0);
}
-
- /*
- * volume
- */
- if(this.mInfo.containsKey(this.mKeyVolume))
- mVolume.setProgress(Integer.parseInt(this.mInfo.getAsString(this.mKeyVolume)));
- else {
- mVolume.setProgress(audioManager.getStreamVolume(mStream));
- notifyVolumeChanged(audioManager.getStreamVolume(mStream));
- }
+
+ mIcon.setImageDrawable(this.getActivity().getResources().getDrawable(mVolume.getProgress() == 0 ? android.R.drawable.ic_lock_silent_mode : android.R.drawable.ic_lock_silent_mode_off));
mVolume.setOnSeekBarChangeListener(this);
return view;
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/ToggleButtonFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/ToggleButtonFragment.java
index 2b1f449..127fedb 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/ToggleButtonFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/ToggleButtonFragment.java
@@ -6,64 +6,107 @@
*/
package com.TwentyCodes.android.LocationRinger.ui.fragments;
-import com.TwentyCodes.android.LocationRinger.R;
-import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
-import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
-
import android.content.ContentValues;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ToggleButton;
+import com.TwentyCodes.android.LocationRinger.FeatureRemovedListener;
+import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
+import com.TwentyCodes.android.LocationRinger.R;
+import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
+
/**
* A simple fragment that displays a toggle button and a title label
* @author ricky
*/
-public class ToggleButtonFragment extends Fragment implements OnCheckedChangeListener {
+public class ToggleButtonFragment extends IdFragment implements OnCheckedChangeListener, OnClickListener {
- private String mTitle;
- private String mKey;
- private ContentValues mInfo;
- private OnContentChangedListener mListener;
+ private final String mTitle;
+ private final String mKey;
+ private final ContentValues mInfo;
+ private final OnContentChangedListener mChangedListener;
+ private final int mIcon;
+ private final FeatureRemovedListener mRemovedListener;
/**
* Creates a new ToggleButtonFtagment
* @author ricky barrette
*/
- public ToggleButtonFragment(String title, String key, ContentValues info, OnContentChangedListener listener) {
- super();
+ public ToggleButtonFragment(int icon, String title, String key, ContentValues info, OnContentChangedListener changedListener, FeatureRemovedListener removedListener, int id) {
+ super(id);
+
+ if ( info == null )
+ throw new NullPointerException();
+ if (title == null )
+ throw new NullPointerException();
+ if ( key == null )
+ throw new NullPointerException();
+ if ( changedListener == null )
+ throw new NullPointerException();
+ if ( removedListener == null )
+ throw new NullPointerException();
+
this.mTitle = title;
this.mKey = key;
this.mInfo = info;
- this.mListener = listener;
+ this.mChangedListener = changedListener;
+ this.mIcon = icon;
+ this.mRemovedListener = removedListener;
}
+ /**
+ * Called when the fragment's view needs to be created
+ * (non-Javadoc)
+ * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
+ */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) {
- View view = inflater.inflate(R.layout.toggle_button_fragment, container, false);
- TextView t = (TextView) view.findViewById(R.id.label);
+ final View view = inflater.inflate(R.layout.toggle_button_fragment, container, false);
+ final TextView t = (TextView) view.findViewById(R.id.title);
t.setText(this.mTitle);
- ToggleButton b = (ToggleButton) view.findViewById(R.id.toggle);
+ final ImageView icon = (ImageView) view.findViewById(R.id.icon);
+ icon.setImageDrawable(this.getActivity().getResources().getDrawable(mIcon));
+
+ view.findViewById(R.id.close).setOnClickListener(this);
+
+ final ToggleButton b = (ToggleButton) view.findViewById(R.id.toggle);
if(this.mInfo.containsKey(this.mKey))
b.setChecked(RingerDatabase.parseBoolean(this.mInfo.getAsString(this.mKey)));
b.setOnCheckedChangeListener(this);
return view;
}
+ /**
+ * Called when the toggle button is clicked
+ * (non-Javadoc)
+ * @see android.widget.CompoundButton.OnCheckedChangeListener#onCheckedChanged(android.widget.CompoundButton, boolean)
+ */
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if(this.mListener != null){
+ if(this.mChangedListener != null){
ContentValues info = new ContentValues();
info.put(this.mKey, isChecked);
- this.mListener.onInfoContentChanged(info);
+ this.mChangedListener.onInfoContentChanged(info);
}
}
+ /**
+ * Called when the user clicks the remove button
+ * @param v
+ * @author ricky barrette
+ */
+ @Override
+ public void onClick(View v) {
+ if(this.mRemovedListener != null)
+ this.mRemovedListener.onFeatureRemoved(this);
+ }
}
\ No newline at end of file
diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java
index 252a4d3..0674964 100644
--- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java
+++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/VolumeFragment.java
@@ -12,17 +12,19 @@ import android.content.ContentValues;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
-import com.TwentyCodes.android.LocationRinger.R;
+import com.TwentyCodes.android.LocationRinger.FeatureRemovedListener;
import com.TwentyCodes.android.LocationRinger.OnContentChangedListener;
+import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.db.RingerDatabase;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
@@ -30,30 +32,43 @@ import com.TwentyCodes.android.LocationRinger.debug.Debug;
* This fragment will represent the volume fragments
* @author ricky
*/
-public class VolumeFragment extends Fragment implements OnSeekBarChangeListener {
+public class VolumeFragment extends IdFragment implements OnSeekBarChangeListener, OnClickListener {
private static final String TAG = "VolumeFragment";
private final AudioManager mAudioManager;
private final int mStream;
- private final OnContentChangedListener mListener;
+ private final OnContentChangedListener mChangedListener;
private final String mKey;
private final ContentValues mInfo;
private final int mLabel;
+ private final FeatureRemovedListener mRemovedListener;
+ private ImageView mIcon;
/**
* Creates a new Volume Fragment
* @param info
* @param context
- * @param listener
+ * @param changedListener
* @param stream
* @author ricky barrette
*/
- public VolumeFragment(ContentValues info, Context context, OnContentChangedListener listener, int stream){
- super();
+ public VolumeFragment(ContentValues info, Context context, OnContentChangedListener changedListener, FeatureRemovedListener removedListener, int stream, int id){
+ super(id);
+
+ if ( info == null )
+ throw new NullPointerException();
+ if ( context == null )
+ throw new NullPointerException();
+ if ( changedListener == null )
+ throw new NullPointerException();
+ if ( removedListener == null )
+ throw new NullPointerException();
+
this.mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
this.mStream = stream;
- this.mListener = listener;
+ this.mChangedListener = changedListener;
this.mInfo = info;
+ this.mRemovedListener = removedListener;
switch(this.mStream){
case AudioManager.STREAM_ALARM:
@@ -91,6 +106,11 @@ public class VolumeFragment extends Fragment implements OnSeekBarChangeListener
}
}
+ /**
+ * Called when the fragment's view needs to be created
+ * (non-Javadoc)
+ * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
+ */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -98,27 +118,34 @@ public class VolumeFragment extends Fragment implements OnSeekBarChangeListener
for(Entry item : this.mInfo.valueSet())
Log.d(TAG, item.getKey() +" = "+ item.getValue());
- View view = inflater.inflate(R.layout.volume_fragment, container, false);
- TextView label = (TextView) view.findViewById(R.id.volume_label);
- SeekBar volume = (SeekBar) view.findViewById(R.id.volume);
+ final View view = inflater.inflate(R.layout.volume_fragment, container, false);
+ final TextView label = (TextView) view.findViewById(R.id.title);
+ final SeekBar volume = (SeekBar) view.findViewById(R.id.volume);
volume.setMax(this.mAudioManager.getStreamMaxVolume(mStream));
volume.setProgress(this.mAudioManager.getStreamVolume(mStream));
volume.setOnSeekBarChangeListener(this);
label.setText(mLabel);
+ mIcon = (ImageView) view.findViewById(R.id.icon);
+
+ view.findViewById(R.id.close).setOnClickListener(this);
+
if(this.mInfo.containsKey(this.mKey))
volume.setProgress(Integer.parseInt(this.mInfo.getAsString(this.mKey)));
else
notifyListener(this.mAudioManager.getStreamVolume(mStream));
-
+
+ mIcon.setImageDrawable(this.getActivity().getResources().getDrawable(volume.getProgress() == 0 ? android.R.drawable.ic_lock_silent_mode : android.R.drawable.ic_lock_silent_mode_off));
return view;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if(fromUser)
+ if(fromUser){
notifyListener(progress);
+ mIcon.setImageDrawable(this.getActivity().getResources().getDrawable(progress == 0 ? android.R.drawable.ic_lock_silent_mode : android.R.drawable.ic_lock_silent_mode_off));
+ }
}
/**
@@ -127,21 +154,29 @@ public class VolumeFragment extends Fragment implements OnSeekBarChangeListener
* @author ricky barrette
*/
private void notifyListener(final int progress) {
- if(this.mListener != null){
+ if(this.mChangedListener != null){
final ContentValues info = new ContentValues();
info.put(this.mKey, progress);
- this.mListener.onInfoContentChanged(info);
+ this.mChangedListener.onInfoContentChanged(info);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
- // TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
- // TODO Auto-generated method stub
}
-}
+ /**
+ * Called when the user clicks on the remove button
+ * (non-Javadoc)
+ * @see android.view.View.OnClickListener#onClick(android.view.View)
+ */
+ @Override
+ public void onClick(View v) {
+ if(this.mRemovedListener != null)
+ this.mRemovedListener.onFeatureRemoved(this);
+ }
+}
\ No newline at end of file