New icons - text selection, code cleanups

This commit is contained in:
Tim Bentley 2015-05-27 21:05:55 +01:00
parent f4ab1065ca
commit b36fbf3d50
89 changed files with 184 additions and 42 deletions

View File

@ -7,3 +7,4 @@
/app/build
/.idea
/.bzr
.apk

View File

@ -14,7 +14,7 @@
<activity
android:name=".OpenLP"
android:label="@string/app_name"
android:configChanges="orientation">
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -20,7 +20,6 @@ package org.openlp.android2;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.app.ActionBar;
@ -31,6 +30,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.support.v4.widget.DrawerLayout;
import org.openlp.android2.activities.SettingsActivity;
import org.openlp.android2.common.NavigationOptions;
import org.openlp.android2.dialogs.AlertDisplayDialog;
@ -75,7 +75,6 @@ public class OpenLP extends ActionBarActivity
(DrawerLayout) findViewById(R.id.drawer_layout));
}
/**
* Check the preferences have been set at startup and if not redirect them to be set.
*
@ -92,17 +91,6 @@ public class OpenLP extends ActionBarActivity
}
}
/**
*
* @param newConfig
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//here you can handle orientation change
Log.d(LOG_TAG, "Changed direction");
}
@Override
public void onNavigationDrawerItemSelected(int position) {
// update the main content by replacing fragments
@ -249,5 +237,4 @@ public class OpenLP extends ActionBarActivity
fragment.refreshDisplay();
}
}
}

View File

@ -18,6 +18,7 @@
*******************************************************************************/
package org.openlp.android2.fragments;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
@ -127,27 +128,27 @@ public class NavigationDrawerFragment extends Fragment {
List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>();
HashMap<String, String> hm = new HashMap<String, String>();
hm.put("title", getString(R.string.home));
hm.put("icon", Integer.toString(R.drawable.ic_home));
hm.put("icon", Integer.toString(R.drawable.ic_home_black));
aList.add(hm);
HashMap<String, String> hm1 = new HashMap<String, String>();
hm1.put("title", getString(R.string.service_list));
hm1.put("icon", Integer.toString(R.drawable.ic_inbox));
hm1.put("icon", Integer.toString(R.drawable.ic_view_list_black));
aList.add(hm1);
HashMap<String, String> hm2 = new HashMap<String, String>();
hm2.put("title", getString(R.string.live_list));
hm2.put("icon", Integer.toString(R.drawable.ic_list));
hm2.put("icon", Integer.toString(R.drawable.ic_list_black));
aList.add(hm2);
HashMap<String, String> hm3 = new HashMap<String, String>();
hm3.put("title", getString(R.string.stage_view));
hm3.put("icon", Integer.toString(R.drawable.ic_local_play));
hm3.put("icon", Integer.toString(R.drawable.ic_live_tv_black));
aList.add(hm3);
HashMap<String, String> hm4 = new HashMap<String, String>();
hm4.put("title", getString(R.string.live_view));
hm4.put("icon", Integer.toString(R.drawable.ic_desktop_windows));
hm4.put("icon", Integer.toString(R.drawable.ic_ondemand_video_black));
aList.add(hm4);
// Keys used in Hashmap
@ -185,14 +186,15 @@ public class NavigationDrawerFragment extends Fragment {
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setBackgroundDrawable(new ColorDrawable(0xFF000000));
// OpenLP Blue
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4d7bd8")));
// ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon.
mDrawerToggle = new ActionBarDrawerToggle(
getActivity(), /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
R.drawable.ic_menu_white, /* nav drawer image to replace 'Up' caret */
R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
R.string.navigation_drawer_close /* "close drawer" description for accessibility */
) {

View File

@ -21,6 +21,8 @@ package org.openlp.android2.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
@ -47,8 +49,7 @@ import java.util.List;
public class ServiceListFragment extends OpenLPFragment {
private final String LOG_TAG = ServiceListFragment.class.getName();
private boolean noScreenUpdate = false;
private boolean isDoubleClick = false;
private int selected = 0;
public ServiceListFragment() {
}
@ -61,8 +62,6 @@ public class ServiceListFragment extends OpenLPFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
context = getActivity();
noScreenUpdate = false;
isDoubleClick = false;
updateUrl = Api.SERVICE_LIST;
httpClient = new OpenLPHttpClient(context);
return super.onCreateView(inflater, container, savedInstanceState);
@ -84,7 +83,7 @@ public class ServiceListFragment extends OpenLPFragment {
}
@Override
public void refreshDisplay(){
public void refreshDisplay() {
Log.d(LOG_TAG, "Resuming...");
triggerTextRequest(Api.SERVICE_LIST);
}
@ -105,10 +104,6 @@ public class ServiceListFragment extends OpenLPFragment {
@Override
public void populateDisplay(String json, boolean notInError) {
Log.i(LOG_TAG, "populate_display - entry");
if (noScreenUpdate || isDoubleClick) {
noScreenUpdate = false;
return;
}
List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>();
if (notInError) {
@ -132,7 +127,9 @@ public class ServiceListFragment extends OpenLPFragment {
} else {
hm.put("icon", Integer.toString(R.drawable.ic_edit));
}
if (item.getString("selected").equals("true")) {
selected = i;
}
hm.put("title", item.getString("title"));
aList.add(hm);
}
@ -163,6 +160,12 @@ public class ServiceListFragment extends OpenLPFragment {
View view = super.getView(position, convertView, parent);
TextView text1 = (TextView) view.findViewById(R.id.serviceListText);
text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
if (selected == position) {
text1.setTextColor(Color.parseColor("#000000"));
text1.setTypeface(null, Typeface.BOLD_ITALIC);
} else{
text1.setTypeface(null, Typeface.NORMAL);
}
return view;
}
@ -173,13 +176,10 @@ public class ServiceListFragment extends OpenLPFragment {
public void itemClicked(int position) {
try {
noScreenUpdate = true;
String request = JsonHelpers.createRequestJSON("id", Integer.toString(position));
triggerTextRequest(String.format("%s%s", Api.SERVICE_SET, request));
String message = String.format("Setting list data. apiBase(%s), position(%s)",
Api.SERVICE_SET, position);
Log.d(LOG_TAG, message);
Toast.makeText(context, "Service Item selected", Toast.LENGTH_SHORT).show();
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), position(%s)",
Api.SERVICE_SET, position));
} catch (JsonHelpers.JSONHandlerException e) {
e.printStackTrace();
Toast.makeText(context, "Request Failed", Toast.LENGTH_SHORT).show();

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

View File

@ -0,0 +1,46 @@
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/container"
android:layout_weight="1"
android:layout_gravity="start"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/container_right"
android:layout_weight="1"
android:layout_gravity="end"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</LinearLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
If you're not building against API 17 or higher, use
android:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment
android:id="@+id/navigation_drawer"
android:name="org.openlp.android2.fragments.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>

View File

@ -0,0 +1,46 @@
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/container"
android:layout_weight="1"
android:layout_gravity="start"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/container_right"
android:layout_weight="1"
android:layout_gravity="end"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</LinearLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
If you're not building against API 17 or higher, use
android:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment
android:id="@+id/navigation_drawer"
android:name="org.openlp.android2.fragments.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>

View File

@ -0,0 +1,6 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="No Results"
/>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="org.openlp.android2.emptyFragment">
<GridView android:id="@android:id/list" android:layout_width="match_parent"
android:layout_height="match_parent" android:numColumns="2" />
<TextView android:id="@android:id/empty" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="center" />
</FrameLayout>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context="org.openlp.android2.emptyFragment">
<ListView android:id="@android:id/list" android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView android:id="@android:id/empty" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="center" />
</FrameLayout>

View File

@ -0,0 +1,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>

View File

@ -3,21 +3,21 @@
<item android:id="@+id/action_blank"
android:checkable="true"
android:visible="true"
android:icon="@drawable/ic_settings_display"
android:icon="@drawable/ic_settings_display_white"
android:title="@string/action_blank"
app:showAsAction="ifRoom" />
<item android:id="@+id/action_alert"
android:checkable="true"
android:visible="true"
android:icon="@drawable/ic_alarm_add"
android:icon="@drawable/ic_add_alert_white"
android:title="@string/action_alert"
app:showAsAction="ifRoom" />
<item android:id="@+id/action_refresh"
android:icon="@drawable/ic_refresh"
android:icon="@drawable/ic_refresh_white"
android:title="@string/action_refresh"
app:showAsAction="ifRoom" />
<item android:id="@+id/action_search"
android:icon="@drawable/ic_search"
android:icon="@drawable/ic_search_white"
android:title="@string/action_search"
app:showAsAction="never|withText" />
<item android:id="@+id/action_preferences"
@ -25,7 +25,7 @@
android:title="@string/action_preferences"
app:showAsAction="never|withText" />
<item android:id="@+id/action_about"
android:icon="@android:drawable/ic_menu_preferences"
android:icon="@drawable/ic_apps_white"
android:title="@string/action_about"
app:showAsAction="never|withText" />
</menu>

View File

@ -0,0 +1,12 @@
<resources>
<!--
Layout alias to replace the single-pane version of the layout with a
two-pane version on Large screens.
For more on layout aliases, see:
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
-->
<item name="fragment_item" type="layout">@layout/fragment_item_grid</item>
</resources>

View File

@ -0,0 +1,12 @@
<resources>
<!--
Layout alias to replace the single-pane version of the layout with a
two-pane version on Large screens.
For more on layout aliases, see:
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
-->
<item name="fragment_item" type="layout">@layout/fragment_item_grid</item>
</resources>