Skip to content

Commit

Permalink
Merge branch 'master' into migrate_myth_services_1_0_1
Browse files Browse the repository at this point in the history
Conflicts:
	src/org/mythtv/client/ui/media/GalleryGridAdapter.java
	src/org/mythtv/client/ui/media/PicturesParentFragment.java
  • Loading branch information
Daniel Frey committed Sep 10, 2013
2 parents c282b7f + 55d55a6 commit ea72243
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 11 deletions.
2 changes: 0 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@
<activity
android:name=".client.ui.media.MediaNavigationDrawerActivity"
android:uiOptions="splitActionBarWhenNarrow" />
<activity
android:name=".client.ui.media.GalleryActivity" />
<activity
android:name=".client.ui.media.GalleryPagerActivity" />

Expand Down
Binary file added res/drawable-mdpi/spinner_triangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions res/drawable/frontends_spinner_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of MythTV Android Frontend
MythTV Android Frontend 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, either version 3 of the License, or
(at your option) any later version.
MythTV Android Frontend 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 MythTV Android Frontend. If not, see <http://www.gnu.org/licenses/>.
This software can be found at <https://github.com/MythTV-Clients/MythTV-Android-Frontend/>
-->


<selector xmlns:android="http://schemas.android.com/apk/res/android">

<!-- pressed -->
<item android:state_pressed="true"
android:drawable="@drawable/frontends_spinner_background_selected" />

<!-- focused -->
<item android:state_focused="true"
android:drawable="@drawable/frontends_spinner_background_selected" />

<!-- hovered -->
<item android:state_hovered="true"
android:drawable="@drawable/frontends_spinner_background_selected" />

<!-- default -->
<item android:drawable="@drawable/frontends_spinner_background_normal" />
</selector>
45 changes: 45 additions & 0 deletions res/drawable/frontends_spinner_background_normal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of MythTV Android Frontend
MythTV Android Frontend 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, either version 3 of the License, or
(at your option) any later version.
MythTV Android Frontend 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 MythTV Android Frontend. If not, see <http://www.gnu.org/licenses/>.
This software can be found at <https://github.com/MythTV-Clients/MythTV-Android-Frontend/>
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item>
<bitmap
android:src="@drawable/spinner_triangle"
android:tileMode="disabled"
android:gravity="bottom|right"/>
</item>

<item>
<inset android:drawable="@drawable/transparent_rectangle"
android:insetTop="-2dp"
android:insetLeft="-2dp"
android:insetRight="-2dp"/>
</item>

<item>
<shape android:shape="rectangle">
<stroke android:width="1dip" android:color="@color/text_main_menu" />
</shape>
</item>

</layer-list>
43 changes: 43 additions & 0 deletions res/drawable/frontends_spinner_background_selected.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of MythTV Android Frontend
MythTV Android Frontend 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, either version 3 of the License, or
(at your option) any later version.
MythTV Android Frontend 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 MythTV Android Frontend. If not, see <http://www.gnu.org/licenses/>.
This software can be found at <https://github.com/MythTV-Clients/MythTV-Android-Frontend/>
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">


<item>
<bitmap
android:src="@drawable/spinner_triangle"
android:tileMode="disabled"
android:gravity="bottom|right"/>
</item>

<item >
<shape android:shape="rectangle">
<gradient android:startColor="#acacac"
android:endColor="#8a8a8a"
android:angle="90"/>
<stroke android:width="1dip" android:color="@color/text_main_menu" />
<corners android:radius="0dip" />
</shape>
</item>

</layer-list>
4 changes: 1 addition & 3 deletions res/layout/frontend_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
This software can be found at <https://github.com/MythTV-Clients/MythTV-Android-Frontend/>
-->


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >
android:padding="10dp" >

<TextView
android:id="@+id/frontend_name"
Expand Down
5 changes: 4 additions & 1 deletion src/org/mythtv/client/ui/media/GalleryGridAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public class GalleryGridAdapter extends BaseAdapter implements

private ImageLoader imageLoader;
private String baseUrl;
private String previewWidth = "256";

private boolean hasBackendGallerySG = false;
private boolean backendAndFrontendShareHostname = false;
Expand Down Expand Up @@ -161,6 +160,10 @@ public long getItemId( int position ) {
@Override
public View getView( final int position, View convertView, ViewGroup parent ) {

// 800p screen / 3 columns = 266,67 for each
// 720p screen / 3 columns = 240 for each
String previewWidth = "256";

final ViewHolder holder;

if( convertView == null ) {
Expand Down
10 changes: 6 additions & 4 deletions src/org/mythtv/client/ui/media/PicturesParentFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
import android.view.ViewGroup;
import android.widget.GridView;

import org.mythtv.R;
import org.mythtv.client.ui.AbstractMythFragment;
import org.mythtv.client.ui.preferences.LocationProfile;
import org.mythtv.client.ui.util.MenuHelper;
import org.mythtv.client.ui.util.MenuItemRefreshAnimated;

/**
* @author dmfrey
*
Expand All @@ -29,10 +35,6 @@ public class PicturesParentFragment extends AbstractMythFragment implements Gall

private static final String TAG = PicturesParentFragment.class.getSimpleName();

public static ArrayList<GalleryImageItem> images = new ArrayList<GalleryImageItem>();

public static boolean IMAGE_LIST_DOWNLOADED = false;

private MenuHelper mMenuHelper = MenuHelper.getInstance();
private MenuItemRefreshAnimated mMenuItemRefresh;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ public void onPause() {
public void serviceAdded( ServiceEvent event ) {
Log.v( TAG, "serviceAdded : enter" );

byte[] txtRecord;
boolean isMasterRole = false;

if( null != mProgressDialog ) {
mProgressDialog.dismiss();
mProgressDialog = null;
Expand All @@ -521,11 +524,26 @@ public void serviceAdded( ServiceEvent event ) {
Log.v( TAG, "serviceAdded : " + event.getDNS().getServiceInfo( event.getType(), event.getName() ).toString() );

ServiceInfo info = event.getDNS().getServiceInfo( event.getType(), event.getName() );

// 0.26 and 0.25 have an empty TXT Record. 0.27+ have a 6 followed by "master" or 5/"slave".
// Crude hack because Enumeration<String> txtRecords = info.getPropertyNames(); doesn't
// seem to handle the case of records with (legal) entries with no =. E.g. role=master vs.
// just master.

txtRecord = info.getTextBytes();

Log.v( TAG, "serviceAdded : backend role = " + txtRecord[0] + " ( 0 or 6 = master, 5 = slave)");

if( txtRecord[0] == 0 || txtRecord[0] == 6 )
{
isMasterRole = true;
}

final String hostname = info.getInet4Address().getHostAddress();
final int port = info.getPort();
Log.v( TAG, "serviceAdded : masterbackend=" + ( "http://" + hostname + ":" + port + "/" ) );

if( null != hostname && !hostname.isEmpty() ) {
if( null != hostname && !hostname.isEmpty() && isMasterRole ) {

LocationProfile profile = new LocationProfile();
profile.setId( -1 );
Expand Down

0 comments on commit ea72243

Please sign in to comment.