What on Default
Updated default ringer to only display the what fragment, and added the default ringer description to the ringer list view closes #48 Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
13
LocationRinger/res/values/pagerTitles.xml
Normal file
13
LocationRinger/res/values/pagerTitles.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="ringer_info_titles">
|
||||
<item>About</item>
|
||||
<item>Location</item>
|
||||
<item>What</item>
|
||||
</string-array>
|
||||
<string-array name="ringer_info_titles_default">
|
||||
<item>What</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
@@ -190,6 +190,10 @@ private class OpenHelper extends SQLiteOpenHelper {
|
||||
createDatabase(db);
|
||||
//insert the default ringer into this table
|
||||
db.execSQL("insert into " + RINGER_TABLE + "(" + KEY_RINGER_NAME + ") values ('"+RingerDatabase.this.mContext.getString(R.string.default_ringer)+"')");
|
||||
db.execSQL("insert into " + RINGER_INFO_TABLE + "(" + KEY_RINGER_NAME + ", " + KEY + ", " + KEY_VALUE +
|
||||
") values ('"+RingerDatabase.this.mContext.getString(R.string.default_ringer)
|
||||
+ "', '" + KEY_RINGER_DESCRIPTION
|
||||
+ "', '" + RingerDatabase.this.mContext.getString(R.string.about_default_ringer)+"')");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,20 +270,6 @@ private class OpenHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string boolean from the database
|
||||
* @param bool
|
||||
* @return true or false
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static boolean parseBoolean(String bool){
|
||||
try {
|
||||
return bool == null ? false : Integer.parseInt(bool) == 1 ? true : false;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new RingerDatabase
|
||||
* @param context
|
||||
@@ -296,6 +286,20 @@ private class OpenHelper extends SQLiteOpenHelper {
|
||||
this.mDb = new OpenHelper(this.mContext).getWritableDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string boolean from the database
|
||||
* @param bool
|
||||
* @return true or false
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static boolean parseBoolean(String bool){
|
||||
try {
|
||||
return bool == null ? false : Integer.parseInt(bool) == 1 ? true : false;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Backs up the database
|
||||
* @return true if successful
|
||||
|
||||
@@ -75,30 +75,28 @@ public class RingerInformationActivity extends FragmentActivity implements OnCon
|
||||
/*
|
||||
* set the title
|
||||
*/
|
||||
if(this.mRinger.containsKey(RingerDatabase.KEY_RINGER_NAME))
|
||||
this.setTitle(this.getString(R.string.editing)+" "+this.mRinger.getAsString(RingerDatabase.KEY_RINGER_NAME));
|
||||
else
|
||||
this.setTitle(R.string.new_ringer);
|
||||
this.setTitle(this.mRinger.containsKey(RingerDatabase.KEY_RINGER_NAME) ?this.getString(R.string.editing)+" "+this.mRinger.getAsString(RingerDatabase.KEY_RINGER_NAME)
|
||||
: getString(R.string.new_ringer));
|
||||
|
||||
boolean isDefault = getString(R.string.default_ringer).equals(this.mRinger.getAsString(RingerDatabase.KEY_RINGER_NAME));
|
||||
|
||||
/*
|
||||
* Page titles
|
||||
*/
|
||||
String[] titles = new String[]{
|
||||
this.getString(R.string.about),
|
||||
this.getString(R.string.location),
|
||||
this.getString(R.string.what)
|
||||
};
|
||||
String[] titles = this.getResources().getStringArray(isDefault ? R.array.ringer_info_titles_default : R.array.ringer_info_titles);
|
||||
|
||||
ArrayList<Fragment> fragments = new ArrayList<Fragment>();
|
||||
|
||||
/*
|
||||
* about page
|
||||
*/
|
||||
if(!isDefault)
|
||||
fragments.add(new AboutRingerFragment(this.mRinger, this.mInfo, this));
|
||||
|
||||
/*
|
||||
* Location page
|
||||
*/
|
||||
if(!isDefault)
|
||||
fragments.add(new LocationInfomationFragment(this.mInfo, this, this));
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user