2012-07-13 Santiago Munín <burning1@gmail.com>

* ChangeLog: Fixed a line.
	* src/pandroid_event_viewer/pandorafms/Main.java: Fixed a bug. Default profile can't be deleted.
	* res/layout/main.xml,
	  res/layout/item_list_event_layout.xml,
	  res/layout/about.xml,
	  res/layout/item_list_event_extended.xml,
	  res/layout/options.xml,
	  res/values/styles.xml: UI improvements.
	* res/values/strings.xml


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6767 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
santimunin 2012-07-12 22:07:02 +00:00
parent b95f135a14
commit a96a2d8b6c
9 changed files with 78 additions and 64 deletions

View File

@ -1,7 +1,18 @@
2012-07-13 Santiago Munín <burning1@gmail.com>
* ChangeLog: Fixed a line.
* src/pandroid_event_viewer/pandorafms/Main.java: Fixed a bug. Default profile can't be deleted.
* res/layout/main.xml,
res/layout/item_list_event_layout.xml,
res/layout/about.xml,
res/layout/item_list_event_extended.xml,
res/layout/options.xml,
res/values/styles.xml: UI improvements.
* res/values/strings.xml
2012-07-11 Santiago Munín <burning1@gmail.com> 2012-07-11 Santiago Munín <burning1@gmail.com>
* src/pandroid_event_viewer/pandorafms/API.java, * src/pandroid_event_viewer/pandorafms/API.java,
src/pandroid_event_viewer/pandorafms/Main.java: Added some SupressWarning annotations. src/pandroid_event_viewer/pandorafms/Main.java: Added some SupressWarning annotations.
* res/layout/options.xml: Textview * res/layout/options.xml: Textview color changed.
* res/drawable-ldpi/incident.png, * res/drawable-ldpi/incident.png,
res/drawable-ldpi/house.png, res/drawable-ldpi/house.png,
res/drawable-ldpi/lightning_go.png: Removed, no longer needed. res/drawable-ldpi/lightning_go.png: Removed, no longer needed.

View File

@ -46,7 +46,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/develop_team_str" android:text="@string/develop_team_str"
android:gravity="center_horizontal" android:gravity="left"
/> />
<TextView <TextView
android:id="@+id/url_pandora" android:id="@+id/url_pandora"

View File

@ -19,9 +19,7 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="#FFFFFF" > android:background="#FFFFFF" >
<TableRow <TableRow style="@style/table_row" >
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -39,7 +37,7 @@
android:textColor="#000" /> android:textColor="#000" />
</TableRow> </TableRow>
<TableRow> <TableRow style="@style/table_row" >
<TextView <TextView
android:paddingRight="5dip" android:paddingRight="5dip"
@ -57,6 +55,7 @@
<TableRow <TableRow
android:id="@+id/row_agent" android:id="@+id/row_agent"
style="@style/table_row"
android:visibility="gone" > android:visibility="gone" >
<TextView <TextView
@ -70,7 +69,7 @@
android:textColor="#000" /> android:textColor="#000" />
</TableRow> </TableRow>
<TableRow> <TableRow style="@style/table_row" >
<TextView <TextView
android:paddingRight="5dip" android:paddingRight="5dip"
@ -86,23 +85,8 @@
android:text="@string/all_str" android:text="@string/all_str"
android:textColor="#000" /> android:textColor="#000" />
</TableRow> </TableRow>
<!--
<TableRow>
<TextView
android:textColor="#000"
android:text="Count"
android:paddingRight="5dip"
/>
<TextView
android:textColor="#000"
android:text="1"
/>
</TableRow>
-->
<TableRow <TableRow style="@style/table_row" >
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView <TextView
android:paddingRight="5dip" android:paddingRight="5dip"
@ -117,7 +101,7 @@
android:textColor="#000" /> android:textColor="#000" />
</TableRow> </TableRow>
<TableRow> <TableRow style="@style/table_row" >
<TextView <TextView
android:paddingRight="5dip" android:paddingRight="5dip"

View File

@ -18,14 +18,16 @@
android:id="@+id/item_linear_layout" android:id="@+id/item_linear_layout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingBottom="5dp"
android:orientation="vertical" > android:orientation="vertical" >
<RelativeLayout <RelativeLayout
android:id="@+id/content_event_item" android:id="@+id/content_event_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_weight="1" > android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp" >
<TextView <TextView
android:id="@+id/event_name" android:id="@+id/event_name"
@ -50,6 +52,7 @@
android:textColor="#000" android:textColor="#000"
android:textColorHighlight="#000" android:textColorHighlight="#000"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/timestamp" android:id="@+id/timestamp"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -27,7 +27,8 @@
<TableLayout <TableLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" > android:layout_marginTop="10dp"
android:stretchColumns="0" >
<TableRow <TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
@ -44,12 +45,15 @@
<Spinner <Spinner
android:id="@+id/profile_combo" android:id="@+id/profile_combo"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="20dp" android:layout_height="wrap_content"
android:layout_marginRight="20dp" android:layout_marginLeft="20dp" />
android:layout_height="wrap_content" />
<ImageView <ImageView
android:id="@+id/delete_profile" android:id="@+id/delete_profile"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:contentDescription="@string/profile_delete" android:contentDescription="@string/profile_delete"
android:src="@drawable/cross" /> android:src="@drawable/cross" />
</TableRow> </TableRow>
@ -130,7 +134,8 @@
<ProgressBar <ProgressBar
android:id="@+id/loading_tag" android:id="@+id/loading_tag"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_gravity="right" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>

View File

@ -118,9 +118,8 @@
<Spinner <Spinner
android:id="@+id/refresh_combo" android:id="@+id/refresh_combo"
android:layout_width="150dp" android:layout_width="155dp"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
android:gravity="left" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -133,7 +132,9 @@
android:id="@+id/check_connection_status" android:id="@+id/check_connection_status"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:drawableBottom="@drawable/help" android:drawableBottom="@drawable/help"
android:gravity="center_horizontal"
android:text="@string/check_connection" android:text="@string/check_connection"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
</LinearLayout> </LinearLayout>

View File

@ -68,7 +68,7 @@
<string name="event_search_label_str">Event search</string> <string name="event_search_label_str">Event search</string>
<string name="max_time_old_event_str">Oldest event</string> <string name="max_time_old_event_str">Oldest event</string>
<string name="licensed_under_gpl_str">Licensed under GPL v2</string> <string name="licensed_under_gpl_str">Licensed under GPL v2</string>
<string name="develop_team_str">Developer: Miguel de Dios</string> <string name="develop_team_str">Developers:\nMiguel de Dios and Santiago Munín</string>
<string name="alert_recovered_str">Alert recovered</string> <string name="alert_recovered_str">Alert recovered</string>
<string name="alert_manual_validation_str">Alert manually validated</string> <string name="alert_manual_validation_str">Alert manually validated</string>
<string name="going_up_warning_str">Going from critical to warning</string> <string name="going_up_warning_str">Going from critical to warning</string>
@ -120,5 +120,6 @@
<string name="connection_settings_problem">The operation can not be performed until you configure a correct connection.</string> <string name="connection_settings_problem">The operation can not be performed until you configure a correct connection.</string>
<string name="unknown_version">Unknown version</string> <string name="unknown_version">Unknown version</string>
<string name="enable_background_service">Check events in background</string> <string name="enable_background_service">Check events in background</string>
<string name="default_profile_can_not_remove">Default profile can not be removed</string>
</resources> </resources>

View File

@ -12,13 +12,15 @@
<item name="android:textSize">20dp</item> <item name="android:textSize">20dp</item>
<item name="android:textColor">#FFFFFF</item> <item name="android:textColor">#FFFFFF</item>
</style> </style>
<!--
<style name="options_section"> <style name="table_row">
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:orientation">vertical</item> <item name="android:layout_marginRight">2dp</item>
<item name="android:layout_margin">5dp</item> <item name="android:layout_marginLeft">2dp</item>
</style>--> <item name="android:layout_marginTop">1dp</item>
<item name="android:layout_marginBottom">2dp</item>
</style>
<style name="options_entry_text"> <style name="options_entry_text">
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
@ -26,6 +28,6 @@
<item name="android:textSize">20dp</item> <item name="android:textSize">20dp</item>
<item name="android:layout_margin">5dp</item> <item name="android:layout_margin">5dp</item>
<item name="android:textColor">#FFFFFF</item> <item name="android:textColor">#FFFFFF</item>
</style> </style>
</resources> </resources>

View File

@ -151,19 +151,19 @@ public class Main extends Activity {
loadProfiles(); loadProfiles();
combo = (Spinner) findViewById(R.id.profile_combo); combo = (Spinner) findViewById(R.id.profile_combo);
combo.setOnItemSelectedListener(new OnItemSelectedListener() { combo.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) { int pos, long id) {
String selected = parent.getItemAtPosition(pos).toString(); String selected = parent.getItemAtPosition(pos).toString();
setProfile(selected); setProfile(selected);
} }
public void onNothingSelected(AdapterView<?> arg0) { public void onNothingSelected(AdapterView<?> arg0) {
} }
}); });
((ImageView) findViewById(R.id.delete_profile)) ((ImageView) findViewById(R.id.delete_profile))
.setOnClickListener(new OnClickListener() { .setOnClickListener(new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
String profileName = ((Spinner) findViewById(R.id.profile_combo)) String profileName = ((Spinner) findViewById(R.id.profile_combo))
.getSelectedItem().toString(); .getSelectedItem().toString();
@ -194,13 +194,13 @@ public class Main extends Activity {
buttonbuttonSetAsFilterWatcher buttonbuttonSetAsFilterWatcher
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
save_filter_watcher(); save_filter_watcher();
} }
}); });
buttonSaveProfile.setOnClickListener(new OnClickListener() { buttonSaveProfile.setOnClickListener(new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
final EditText profileName = new EditText(getBaseContext()); final EditText profileName = new EditText(getBaseContext());
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@ -262,7 +262,6 @@ public class Main extends Activity {
cb.setChecked(preferences.getBoolean("show_advanced", false)); cb.setChecked(preferences.getBoolean("show_advanced", false));
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) { boolean isChecked) {
LinearLayout advancedOptions = (LinearLayout) findViewById(R.id.show_hide_layout); LinearLayout advancedOptions = (LinearLayout) findViewById(R.id.show_hide_layout);
@ -744,28 +743,36 @@ public class Main extends Activity {
SharedPreferences preferences = getSharedPreferences( SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences), this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE); Activity.MODE_PRIVATE);
if (profileName.equals(DEFAULT_PROFILE_NAME)) {
Toast.makeText(getApplicationContext(),
R.string.default_profile_can_not_remove, Toast.LENGTH_SHORT)
.show();
return;
}
SharedPreferences.Editor editorPreferences = preferences.edit(); SharedPreferences.Editor editorPreferences = preferences.edit();
editorPreferences.remove(PROFILE_PREFIX + profileName); editorPreferences.remove(PROFILE_PREFIX + profileName);
String profiles = preferences.getString("allProfiles", ""); String profiles = preferences.getString("allProfiles", "");
int firstPos = profiles.indexOf(profileName); int firstPos = profiles.indexOf(profileName);
int amount = profileName.length(); int amount = profileName.length();
if (firstPos != 0) { if (profiles.length() > 0) {
// Includes the separator char if (firstPos > 0) {
firstPos--; // Includes the separator char
amount++; firstPos--;
} amount++;
profiles = profiles.substring(0, firstPos) }
+ profiles.substring(firstPos + amount); profiles = profiles.substring(0, firstPos)
if (profiles.startsWith("|")) { + profiles.substring(firstPos + amount);
if (profiles.length() > 1) { if (profiles.startsWith("|")) {
profiles = profiles.substring(1); if (profiles.length() > 1) {
} else { profiles = profiles.substring(1);
profiles = ""; } else {
profiles = "";
}
}
editorPreferences.putString("allProfiles", profiles);
if (editorPreferences.commit()) {
Log.i(TAG, "Removed profile: " + profileName);
} }
}
editorPreferences.putString("allProfiles", profiles);
if (editorPreferences.commit()) {
Log.i(TAG, "Removed profile: " + profileName);
} }
} }