Alert Dialog and string cleanups

This commit is contained in:
Tim Bentley 2014-11-15 17:22:08 +00:00
parent 0b5c570777
commit 1063eeec53
10 changed files with 101 additions and 86 deletions

View File

@ -35,6 +35,7 @@ import android.view.ViewGroup;
import android.support.v4.widget.DrawerLayout;
import org.openlp.android2.activities.ConnectionActivity;
import org.openlp.android2.activities.SettingsActivity;
import org.openlp.android2.dialogs.AlertDisplayDialog;
import org.openlp.android2.dialogs.BlankDisplayDialog;
import org.openlp.android2.fragments.LiveListFragment;
import org.openlp.android2.fragments.NavigationDrawerFragment;
@ -155,10 +156,14 @@ public class OpenLP extends Activity
startActivity(intent);
return true;
}
if (id == R.id.action_alert) {
if (id == R.id.action_blank) {
new BlankDisplayDialog().show(getFragmentManager(), "BlankDialog");
return true;
}
if (id == R.id.action_alert) {
new AlertDisplayDialog().show(getFragmentManager(), "AlertDialog");
return true;
}
return super.onOptionsItemSelected(item);
}

View File

@ -308,11 +308,11 @@ public class ConnectionActivity extends PreferenceActivity {
title.setOnPreferenceChangeListener(onPreferenceChangeListener);
hostAddress = new EditTextPreference(getActivity());
hostAddress.setTitle(getString(R.string.urlHint));
hostAddress.setTitle(getString(R.string.url_hint));
hostAddress.setKey(KEY_PREFIX + id + ".address");
hostAddress.getEditText().setHint(R.string.urlHint);
hostAddress.setSummary(getString(R.string.urlHint));
hostAddress.setDialogTitle(getString(R.string.urlHint));
hostAddress.getEditText().setHint(R.string.url_hint);
hostAddress.setSummary(getString(R.string.url_hint));
hostAddress.setDialogTitle(getString(R.string.url_hint));
hostAddress.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_URI);
hostAddress.setOnPreferenceChangeListener(onPreferenceChangeListener);

View File

@ -1,3 +1,22 @@
/******************************************************************************
* OpenLP - Open Source Lyrics Projection *
* --------------------------------------------------------------------------- *
* Copyright (c) 2011-2014 Raoul Snyman *
* Portions copyright (c) 2011-2014 Tim Bentley, Johan Mynhardt *
* --------------------------------------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the Free *
* Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
* more details. *
* *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., 59 *
* Temple Place, Suite 330, Boston, MA 02111-1307 USA *
*******************************************************************************/
package org.openlp.android2.common;
import org.apache.http.conn.ssl.SSLSocketFactory;

View File

@ -21,7 +21,6 @@ package org.openlp.android2.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
@ -30,13 +29,11 @@ import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.openlp.android2.R;
import org.openlp.android2.api.Api;
import org.openlp.android2.common.JsonHelpers;
import org.openlp.android2.common.OpenLPDialog;
import org.openlp.android2.common.OpenLPHttpReturn;
import org.openlp.android2.common.OpenLPHttpClient;
public class AlertDisplayDialog extends OpenLPDialog {
private final String LOG_TAG = AlertDisplayDialog.class.getName();
@ -53,6 +50,7 @@ public class AlertDisplayDialog extends OpenLPDialog {
// remove the dialog title, but you must call the superclass to get the Dialog.
context = getActivity();
httpClient = new OpenLPHttpClient(context);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
@ -91,34 +89,20 @@ public class AlertDisplayDialog extends OpenLPDialog {
public void onResume() {
super.onResume();
Log.d(LOG_TAG, "Resuming...");
triggerRequest(Api.POLL_STATUS);
Log.d(LOG_TAG, "Resumed...");
}
private void triggerRequest(String url) {
//ExecuteHttpRequestTask task = new ExecuteHttpRequestTask();
//task.execute(new String[]{url});
}
public void populateDisplay(OpenLPHttpReturn response) {
Log.d(LOG_TAG, "populateDisplay");
if (response.isSecurityError()) {
Toast.makeText(context, R.string.httpreturn_unauthorised, Toast.LENGTH_LONG).show();
} else if (response.isError()) {
Toast.makeText(context, R.string.unable, Toast.LENGTH_LONG).show();
}
public void processUpdate(String response) {
Toast.makeText(context, "Alert Requested", Toast.LENGTH_SHORT).show();
}
public void requestAlert(String text) {
try {
String request = JsonHelpers.createRequestJSON("text", text);
triggerRequest(String.format("%s%s", Api.ALERT, request));
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)",
Api.ALERT, text));
Toast.makeText(getActivity().getBaseContext(), "Alert Requested", Toast.LENGTH_SHORT).show();
triggerTextRequest(String.format("%s%s", Api.ALERT, request));
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)", Api.ALERT, text));
} catch (JsonHelpers.JSONHandlerException e) {
e.printStackTrace();
Toast.makeText(getActivity().getBaseContext(), "Request Failed", Toast.LENGTH_SHORT).show();
Toast.makeText(context, "Request Failed", Toast.LENGTH_SHORT).show();
}
}
}

View File

@ -124,7 +124,6 @@ public class BlankDisplayDialog extends OpenLPDialog {
}
public void populateDisplay(String json) {
Log.d(LOG_TAG, "populateDisplay");
try {
JSONObject item = new JSONObject(json).getJSONObject("results");

View File

@ -11,7 +11,7 @@
android:layout_width="294dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/enterAlertText"
android:text="@string/enter_alert_text"
android:id="@+id/textView"
android:autoText="true"
android:textStyle="bold|italic"

View File

@ -11,7 +11,7 @@
android:layout_width="294dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/displayBlankSummary"
android:text="@string/display_blank_summary"
android:id="@+id/textView"
android:autoText="true"
android:textStyle="bold|italic"
@ -20,7 +20,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/display.Reset"
android:text="@string/display_reset"
android:id="@+id/buttonReset"
android:textSize="20sp"
android:height="40dp"
@ -28,7 +28,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/display.Screen"
android:text="@string/display_screen"
android:id="@+id/buttonScreen"
android:textSize="20sp"
android:height="40dp"
@ -36,7 +36,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/display.Theme"
android:text="@string/display_theme"
android:id="@+id/buttonTheme"
android:textSize="20sp"
android:height="40dp"
@ -44,7 +44,7 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/display.Desktop"
android:text="@string/display_desktop"
android:id="@+id/buttonDesktop"
android:textSize="20sp"
android:height="40dp"

View File

@ -5,12 +5,18 @@
android:icon="@drawable/ic_arrow_back"
android:title="@string/action_back"
android:showAsAction="always" />
<item android:id="@+id/action_alert"
<item android:id="@+id/action_blank"
android:checkable="true"
android:visible="true"
android:icon="@drawable/ic_settings_display"
android:title="@string/action_blank"
android:showAsAction="always" />
<item android:id="@+id/action_alert"
android:checkable="true"
android:visible="true"
android:icon="@drawable/ic_alarm_off"
android:title="@string/action_alert"
android:showAsAction="always" />
<item android:id="@+id/action_refresh"
android:icon="@drawable/ic_refresh"
android:title="@string/action_refresh"

View File

@ -2,64 +2,66 @@
<resources>
<string name="about_text">Version</string>
<string name="about_display_1">OpenLP is free church presentation software</string>
<string name="about_display_2">Find out more about visit the OpenLP website.</string>
<string name="about_display_2">Find out more about visit the OpenLP website_</string>
<string name="about_display_4">Copyright</string>
<string name="about_display_5">Portions copyright</string>
<string name="about_display_6">License</string>
<string name="about_display_7">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.</string>
<string name="about_display_8">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</string>
<string name="about_display_7">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License_</string>
<string name="about_display_8">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE_</string>
<string name="action_settings">Settings</string>
<string name="app_name">OpenLP</string>
<string name="action_about">About</string>
<string name="action_alert">Alert</string>
<string name="action_back">Back</string>
<string name="action_blank">Toggle Display</string>
<string name="action_connections">Connections</string>
<string name="action_preferences">Preferences</string>
<string name="action_refresh">Refresh</string>
<string name="action_search">Search</string>
<string name="app_name">OpenLP</string>
<string name="cancel">Cancel</string>
<string name="connection_timeout">Connection Timeout</string>
<string name="connection_timedout">Connection timed out</string>
<string name="connection_timeout_summary">Select a value (milliseconds)</string>
<string name="connection_available_configurations">List of available profiles</string>
<string name="connection_add_by_menu">Tap to add a new profile</string>
<string name="connection_profile_not_saved">Tap to edit properties</string>
<string name="connection_profile_new_server">New Server</string>
<string name="connection_profile_server">Server</string>
<string name="connection_profile_title">Profile Title</string>
<string name="connection_profile_ssl_use">Use HTTPS</string>
<string name="connection_profile_ssl_summary">Specify whether HTTPS should be used</string>
<string name="connection_userid">Userid</string>
<string name="connection_password">Password</string>
<string name="connection_profile_remove">Remove</string>
<string name="connection_profile_remove_summary">Remove this configuration</string>
<string name="connection_profile_summary_activate">Tap to set active</string>
<string name="connection_profile_activate">Save and Activate</string>
<string name="connection_profile_active_toast">Active Profile</string>
<string name="service_list">Service List</string>
<string name="live_list">Live List</string>
<string name="stage_view">Stage View</string>
<string name="live_view">LiveView</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="action_blank">Toggle Display</string>
<string name="action_search">Search</string>
<string name="action_refresh">Refresh</string>
<string name="action_preferences">Preferences</string>
<string name="action_connections">Connections</string>
<string name="action_about">About</string>
<string name="textSizeType">Text Size Type</string>
<string name="textSizeSummary">Change the Service text size</string>
<string name="connectionTimeout">Connection Timeout</string>
<string name="connectionTimedout">Connection timed out</string>
<string name="connectionTimeoutSummary">Select a value (milliseconds)</string>
<string name="enableCustomTimeouts">Enable Custom Timeouts</string>
<string name="customTimeoutsSummary">Check to modify timeout settings</string>
<string name="text_size_type">Text Size Type</string>
<string name="text_size_summary">Change the Service text size</string>
<string name="enable_custom_timeouts">Enable Custom Timeouts</string>
<string name="custom_timeouts_summary">Check to modify timeout settings</string>
<string name="none">None</string>
<string name="connection.profile.active">Active Profile - Tap to manage</string>
<string name="connection_profile_active">Active Profile - Tap to manage</string>
<string name="url">Server</string>
<string name="urlHint">Hostname or IP</string>
<string name="notSet">Not set</string>
<string name="cancel">Cancel</string>
<string name="connection.available.configurations">List of available profiles</string>
<string name="connection.add.by.menu">Tap to add a new profile</string>
<string name="connection.profile.not.saved">Tap to edit properties</string>
<string name="connection.profile.new.server">New Server</string>
<string name="connection.profile.server">Server</string>
<string name="connection.profile.title">Profile Title</string>
<string name="connection.profile.ssl.use">Use HTTPS</string>
<string name="connection.profile.ssl.summary">Specify whether HTTPS should be used</string>
<string name="connection.userid">Userid</string>
<string name="connection.password">Password</string>
<string name="connection.profile.remove">Remove</string>
<string name="connection.profile.remove.summary">Remove this configuration</string>
<string name="connection.profile.summary.activate">Tap to set active</string>
<string name="connection.profile.activate">Save and Activate</string>
<string name="connection.profile.active.toast">Active Profile</string>
<string name="display.Reset">Reset Display</string>
<string name="display.Screen">Blank display to Blank</string>
<string name="display.Theme">Blank display to Theme</string>
<string name="display.Desktop">Blank display to Desktop</string>
<string name="displayBlankSummary">Select the required blank type</string>
<string name="enterAlertText">Enter Alert Text</string>
<string name="httpreturn.unauthorised">Unauthorised Access, please enter valid userid and password</string>
<string name="url_hint">Hostname or IP</string>
<string name="not_set">Not set</string>
<string name="display_reset">Reset Display</string>
<string name="display_screen">Blank display to Blank</string>
<string name="display_theme">Blank display to Theme</string>
<string name="display_desktop">Blank display to Desktop</string>
<string name="display_blank_summary">Select the required blank type</string>
<string name="enter_alert_text">Enter Alert Text</string>
<string name="httpreturn_unauthorised">Unauthorised Access, please enter valid userid and password</string>
<string name="process">Process</string>
<string name="unable">Unable to load page - check network settings</string>
<string name="unable">Unable to process request - check network settings</string>
<string name="port">Port</string>
</resources>

View File

@ -1,20 +1,20 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory>
<ListPreference
android:title="@string/textSizeType"
android:title="@string/text_size_type"
android:key="@string/keyTextSize"
android:summary="@string/textSizeSummary"
android:summary="@string/text_size_summary"
android:entries="@array/textSizeValueEntries"
android:entryValues="@array/textSizeValues"
android:defaultValue="@integer/textSizeDefaultValue"/>
<CheckBoxPreference
android:title="@string/enableCustomTimeouts"
android:title="@string/enable_custom_timeouts"
android:key="@string/keyEnableCustomTimeout"
android:summary="@string/customTimeoutsSummary"/>
android:summary="@string/custom_timeouts_summary"/>
<ListPreference
android:title="@string/connectionTimeout"
android:title="@string/connection_timeout"
android:key="@string/keyConnectionTimeout"
android:summary="@string/connectionTimeoutSummary"
android:summary="@string/connection_timeout_summary"
android:dependency="@string/keyEnableCustomTimeout"
android:entries="@array/socketValueEntries"
android:entryValues="@array/socketValues"