From 428aacb56f63cb88b667f90810984e2753c7fc4c Mon Sep 17 00:00:00 2001 From: "Thomas G. Kenny Jr" Date: Fri, 30 Aug 2013 17:03:18 -0400 Subject: [PATCH 1/4] * Created a new drawable background for frontends spinner --- res/drawable-mdpi/spinner_triangle.png | Bin 0 -> 250 bytes res/drawable/frontends_spinner_background.xml | 40 ++++++++++++++++++ .../frontends_spinner_background_normal.xml | 39 +++++++++++++++++ res/layout/frontend_row.xml | 4 +- res/layout/navigation_drawer_frontends.xml | 16 ++++--- 5 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 res/drawable-mdpi/spinner_triangle.png create mode 100644 res/drawable/frontends_spinner_background.xml create mode 100644 res/drawable/frontends_spinner_background_normal.xml diff --git a/res/drawable-mdpi/spinner_triangle.png b/res/drawable-mdpi/spinner_triangle.png new file mode 100644 index 0000000000000000000000000000000000000000..a17b01724a867b1c471506d67a628e4814823334 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1(2s1Lwnj--eWH0gbb!ETHAt!9EsBk8^9w;Q684^+AoS&PUnpXnkGB7w7r6!i7 zrYMwWmSiZnd-?{X=%um)#p66(978NluRU{Iu)%?cy)Tw-F7oaI&4#F#Mxzu>c3m> j=5UDK6kcV-0Muz7yWRT6EUyJpASZab`njxgN@xNAf`m@% literal 0 HcmV?d00001 diff --git a/res/drawable/frontends_spinner_background.xml b/res/drawable/frontends_spinner_background.xml new file mode 100644 index 00000000..38ccb08c --- /dev/null +++ b/res/drawable/frontends_spinner_background.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/frontends_spinner_background_normal.xml b/res/drawable/frontends_spinner_background_normal.xml new file mode 100644 index 00000000..a24858c1 --- /dev/null +++ b/res/drawable/frontends_spinner_background_normal.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/frontend_row.xml b/res/layout/frontend_row.xml index 2fc4f9ac..89c52f52 100755 --- a/res/layout/frontend_row.xml +++ b/res/layout/frontend_row.xml @@ -19,13 +19,11 @@ This software can be found at --> - - + android:padding="10dp" > + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="10dp" > + android:background="@drawable/frontends_spinner_background" + android:dropDownSelector="@color/text_main_menu" + android:popupBackground="#353535" + android:prompt="@string/frontends_prompt" + android:spinnerMode="dropdown" /> From ff4d9998451b397713737ce868622d5dbfdeb83e Mon Sep 17 00:00:00 2001 From: "Thomas G. Kenny Jr" Date: Fri, 30 Aug 2013 17:44:46 -0400 Subject: [PATCH 2/4] * Updated frontends spinner background drawables. (Holy shit recreating the Holo design just to change the color took too much effort) * Created a selected frontends spinner drawable --- res/drawable/frontends_spinner_background.xml | 6 +-- .../frontends_spinner_background_normal.xml | 22 ++++++---- .../frontends_spinner_background_selected.xml | 43 +++++++++++++++++++ 3 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 res/drawable/frontends_spinner_background_selected.xml diff --git a/res/drawable/frontends_spinner_background.xml b/res/drawable/frontends_spinner_background.xml index 38ccb08c..43962ef9 100644 --- a/res/drawable/frontends_spinner_background.xml +++ b/res/drawable/frontends_spinner_background.xml @@ -25,15 +25,15 @@ + android:drawable="@drawable/frontends_spinner_background_selected" /> + android:drawable="@drawable/frontends_spinner_background_selected" /> + android:drawable="@drawable/frontends_spinner_background_selected" /> diff --git a/res/drawable/frontends_spinner_background_normal.xml b/res/drawable/frontends_spinner_background_normal.xml index a24858c1..2d5f35c4 100644 --- a/res/drawable/frontends_spinner_background_normal.xml +++ b/res/drawable/frontends_spinner_background_normal.xml @@ -21,19 +21,25 @@ --> - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/frontends_spinner_background_selected.xml b/res/drawable/frontends_spinner_background_selected.xml new file mode 100644 index 00000000..cb80c5f1 --- /dev/null +++ b/res/drawable/frontends_spinner_background_selected.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4153e37e18f5b28bfe5a28cf396a768b790c89a6 Mon Sep 17 00:00:00 2001 From: Bill Meek Date: Mon, 2 Sep 2013 14:03:13 -0500 Subject: [PATCH 3/4] Fixes #158 Detect backend master/slave role in DNS TXT Record Really a hack because info.getPropertyNames() always return null when there is no equal sign in the record. Tested on 0.27 with one host running code prior to the MythTV commit and a 2nd host with the commit running either as a master or a slave. --- .../preferences/MythtvPreferenceActivity.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/org/mythtv/client/ui/preferences/MythtvPreferenceActivity.java b/src/org/mythtv/client/ui/preferences/MythtvPreferenceActivity.java index 9a1fc12b..e06614c2 100644 --- a/src/org/mythtv/client/ui/preferences/MythtvPreferenceActivity.java +++ b/src/org/mythtv/client/ui/preferences/MythtvPreferenceActivity.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.net.InetAddress; +import java.util.Enumeration; import java.util.EventListener; import java.util.List; @@ -507,8 +508,12 @@ public void onPause() { */ @SuppressWarnings( "deprecation" ) public void serviceAdded( ServiceEvent event ) { + Log.v( TAG, "serviceAdded : enter" ); + byte[] txtRecord; + boolean isMasterRole = false; + if( null != mProgressDialog ) { mProgressDialog.dismiss(); mProgressDialog = null; @@ -517,11 +522,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 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 ); From 55d55a6528636677fb546c21859d0b5f325941c7 Mon Sep 17 00:00:00 2001 From: Espen Fossen Date: Wed, 4 Sep 2013 12:54:25 +0200 Subject: [PATCH 4/4] GalleryActivity now handled by PictureParentFragment and GalleryGridAdapter. Also som cleanups and refactoring. --- AndroidManifest.xml | 2 - .../client/ui/media/GalleryActivity.java | 324 ------------------ .../client/ui/media/GalleryGridAdapter.java | 76 ++-- .../ui/media/PicturesParentFragment.java | 20 +- 4 files changed, 41 insertions(+), 381 deletions(-) delete mode 100644 src/org/mythtv/client/ui/media/GalleryActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index c2af6b67..3129e25a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -120,8 +120,6 @@ - diff --git a/src/org/mythtv/client/ui/media/GalleryActivity.java b/src/org/mythtv/client/ui/media/GalleryActivity.java deleted file mode 100644 index a5cbb54b..00000000 --- a/src/org/mythtv/client/ui/media/GalleryActivity.java +++ /dev/null @@ -1,324 +0,0 @@ -/** - * 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 . - * - * This software can be found at - */ -package org.mythtv.client.ui.media; - -import java.util.ArrayList; -import java.util.List; - -import org.mythtv.R; -import org.mythtv.client.MainApplication; -import org.mythtv.client.ui.AbstractMythtvFragmentActivity; -import org.mythtv.client.ui.preferences.LocationProfile; -import org.mythtv.services.api.Bool; -import org.mythtv.services.api.ETagInfo; -import org.mythtv.services.api.StringList; -import org.mythtv.services.api.myth.SettingList; -import org.mythtv.services.api.myth.StorageGroupDirectory; -import org.mythtv.services.api.myth.StorageGroupDirectoryList; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.os.AsyncTask; -import android.os.Bundle; -import android.util.Log; -import android.widget.EditText; -import android.widget.GridView; - -/** - * @author Espen A. Fossen - */ -public class GalleryActivity extends AbstractMythtvFragmentActivity implements GalleryGridAdapter.OnLoadingImagesListener { - - private static final String TAG = GalleryActivity.class.getSimpleName(); - public static List images = new ArrayList(); - - public static boolean IMAGE_LIST_DOWNLOADED = false; - - private boolean hasBackendGallerySG = false; - private LocationProfile mLocationProfile; - - - @Override - public MainApplication getMainApplication() { - return (MainApplication) super.getApplicationContext(); - } - - private GridView gridView; - - /* (non-Javadoc) - * @see org.mythtv.client.ui.AbstractMythtvFragmentActivity#onCreate(android.os.Bundle) - */ - @Override - public void onCreate(Bundle savedInstanceState) { - Log.v(TAG, "onCreate : enter"); - super.onCreate(savedInstanceState); - - // todo: Temp fix for unpredictable .findConnectedProfile() method - List profiles = mLocationProfileDaoHelper.findAll(GalleryActivity.this); - mLocationProfile = profiles.get(0); - - setContentView(R.layout.activity_gallery); - - gridView = (GridView) findViewById(R.id.gallery_gridview); - - if(IMAGE_LIST_DOWNLOADED){ - GalleryGridAdapter adapter = new GalleryGridAdapter(GalleryActivity.this, mLocationProfile, this); - gridView.setAdapter(adapter); - } else { - new LoadFileListTask(this).execute(); - } - - Log.v(TAG, "onCreate : exit"); - } - - /* (non-Javadoc) - * @see org.mythtv.client.ui.media.GalleryGridAdapter.OnLoadingImagesListener#notifyStart() - */ - @Override - public void notifyStart() { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.mythtv.client.ui.media.GalleryGridAdapter.OnLoadingImagesListener#notifyEnd() - */ - @Override - public void notifyEnd() { - // TODO Auto-generated method stub - - } - - private class LoadFileListTask extends AsyncTask { - - GalleryActivity activity; - boolean backendAndFrontendShareHostname = false; - boolean galleryDirPresentInSettings = false; - boolean createStorageGroup = false; - final String gallerySGName = "Gallery"; - final String gallerySetting = "GalleryDir"; - String galleryDir = ""; - - public LoadFileListTask(GalleryActivity galleryActivity) { - activity = galleryActivity; - } - - private GalleryActivity getActivity() { - return activity; - } - - @Override - protected Void doInBackground(Void... params) { - - - try { - ETagInfo eTag = ETagInfo.createEmptyETag(); - - // 800p screen / 3 columns = 266,67 for each - // 720p screen / 3 columns = 240 for each - String previewWidth = "256"; - - // Check if StorageGroup Gallery actually exists, doing an GetFileList will return Default SG if Gallery SG is not present., - ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi(mLocationProfile).mythOperations().getStorageGroupDirectories(gallerySGName, mLocationProfile.getHostname(), eTag); - if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { - StorageGroupDirectoryList storageGroups = responseEntity.getBody(); - for(StorageGroupDirectory sg: storageGroups.getStorageGroupDirectories().getStorageGroupDirectories()){ - if(sg.getGroupName().equals(gallerySGName)) hasBackendGallerySG = true; - } - } - - if(hasBackendGallerySG){ - getImageList(images, gallerySGName, previewWidth); - - } else { - - backendAndFrontendShareHostname = isConnectedProfileInHostsList(); - - if(backendAndFrontendShareHostname){ - ResponseEntity responseEntity2 = mMythtvServiceHelper.getMythServicesApi(mLocationProfile).mythOperations().getSetting(mLocationProfile.getHostname(), gallerySetting, "", eTag); - if(responseEntity2.getStatusCode().equals(HttpStatus.OK)){ - SettingList settingList = responseEntity2.getBody(); - galleryDir = settingList.getSetting().getSettings().get(gallerySetting); - if(galleryDir != null && !"".equalsIgnoreCase(galleryDir)){ - galleryDirPresentInSettings = true; - } - } - } - } - - } catch (Exception e) { - Log.e(TAG, "download : error getting file list", e); - - } - return null; - } - - private boolean isConnectedProfileInHostsList() { - ETagInfo eTag = ETagInfo.createEmptyETag(); - - ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi(mLocationProfile).mythOperations().getHosts(eTag); - if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { - StringList hosts = responseEntity.getBody(); - for (String host : hosts.getStringList()) { - if (host.equals(mLocationProfile.getHostname())) { - return true; - } - } - } - return false; - } - - private void getImageList(List images, String gallerySGName, String previewWidth) { - ETagInfo eTag = ETagInfo.createEmptyETag(); - - ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi(mLocationProfile).contentOperations().getFileList(gallerySGName, eTag); - if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { - StringList filesOnStorageGroup = responseEntity.getBody(); - // TODO: Add different types of sorting, and filtering - //String imageUri = mLocationProfileDaoHelper.findConnectedProfile().getUrl() + "Content/GetImageFile?StorageGroup="+gallerySGName+"&Width="+previewWidth+"&FileName="; - - for(String file: filesOnStorageGroup.getStringList()){ - - // First look for image suffixes, then skip files with reoccurring WxH suffixes made by MythTVs getImageFile scalar. - if(file.matches(".+(?i)(jpg|png|gif|bmp)$") && !file.matches(".+(?i)(jpg|png|gif|bmp).\\d+x\\d.(?i)(jpg|png|gif|bmp)$")){ - images.add(new GalleryImageItem(0, "", file)); - //images.add(new GalleryImageItem(0, "", imageUri+file, true)); - } - } - IMAGE_LIST_DOWNLOADED = true; - } - } - - @Override - protected void onPostExecute(Void aVoid) { - - if(hasBackendGallerySG){ - GalleryGridAdapter adapter = new GalleryGridAdapter(GalleryActivity.this, mLocationProfile, GalleryActivity.this ); - gridView.setAdapter(adapter); - - } else { - - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - - if(backendAndFrontendShareHostname){ - - EditText input = null; - - if(galleryDirPresentInSettings){ - builder.setMessage(getResources().getString(R.string.gallery_sg_exist_create)+mLocationProfile.getHostname()+getResources().getString(R.string.gallery_sg_exist_create2)); - } else { - builder.setMessage(R.string.gallery_sg_create); - - input = new EditText(getActivity()); - input.setHint(R.string.gallery_sg_create_hint); - builder.setView(input); - } - final EditText finalInput = input; - builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - clickedPosButton(id, finalInput); - } - }); - builder.setNegativeButton(R.string.btn_cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - clickedNegButton(id); - } - }); - } else { - builder.setMessage(R.string.gallery_sg_error); - } - - AlertDialog dialog = builder.create(); - dialog.show(); - } - } - - private void clickedPosButton(int result, EditText directoryName){ - - createStorageGroup = true; - if(directoryName != null){ - galleryDir = directoryName.getText().toString(); - } - new CreateSGTask(getActivity()).execute(gallerySGName, galleryDir); - - } - } - - private class CreateSGTask extends AsyncTask { - - GalleryActivity activity; - - private CreateSGTask(GalleryActivity galleryActivity) { - activity = galleryActivity; - } - - private GalleryActivity getActivity() { - return activity; - } - - @Override - protected Bool doInBackground(String... params) { - - Bool bool = new Bool(); - bool.setBool(false); - if(params[1] != null && !"".equalsIgnoreCase(params[1])){ - - // AddStorageGroupDir - ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi(mLocationProfile).mythOperations().addStorageGroupDir(params[0], params[1], mLocationProfile.getHostname()); - if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { - bool = responseEntity.getBody(); - return bool; - } - } - return bool; - } - - @Override - protected void onPostExecute(Bool bool) { - super.onPostExecute(bool); - - if (bool.getBool()) { - // TODO: Check if there is better way to "jump" back to Activity. - Intent gallery = new Intent(getMainApplication().getApplicationContext(), GalleryActivity.class); - startActivity(gallery); - finish(); - } else { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setMessage(R.string.gallery_sg_failed); - builder.setNeutralButton(R.string.btn_ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - clickedNegButton(id); - } - - }); - AlertDialog dialog = builder.create(); - dialog.show(); - } - } - - - } - - private void clickedNegButton(int id) { - finish(); - } -} diff --git a/src/org/mythtv/client/ui/media/GalleryGridAdapter.java b/src/org/mythtv/client/ui/media/GalleryGridAdapter.java index b4b721c6..24422fe0 100644 --- a/src/org/mythtv/client/ui/media/GalleryGridAdapter.java +++ b/src/org/mythtv/client/ui/media/GalleryGridAdapter.java @@ -18,21 +18,6 @@ */ package org.mythtv.client.ui.media; -import java.util.ArrayList; -import java.util.List; - -import org.mythtv.R; -import org.mythtv.client.ui.preferences.LocationProfile; -import org.mythtv.service.util.MythtvServiceHelper; -import org.mythtv.services.api.Bool; -import org.mythtv.services.api.ETagInfo; -import org.mythtv.services.api.StringList; -import org.mythtv.services.api.myth.SettingList; -import org.mythtv.services.api.myth.StorageGroupDirectory; -import org.mythtv.services.api.myth.StorageGroupDirectoryList; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; @@ -58,6 +43,21 @@ import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener; +import org.mythtv.R; +import org.mythtv.client.ui.preferences.LocationProfile; +import org.mythtv.service.util.MythtvServiceHelper; +import org.mythtv.services.api.Bool; +import org.mythtv.services.api.ETagInfo; +import org.mythtv.services.api.StringList; +import org.mythtv.services.api.myth.SettingList; +import org.mythtv.services.api.myth.StorageGroupDirectory; +import org.mythtv.services.api.myth.StorageGroupDirectoryList; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import java.util.ArrayList; +import java.util.List; + /** * @author Espen A. Fossen */ @@ -70,12 +70,11 @@ public class GalleryGridAdapter extends BaseAdapter { private final Context mContext; private final LocationProfile mLocationProfile; - public static List mImageItems = new ArrayList(); - + protected static List mImageItems = new ArrayList(); + protected static String mGallerySGName = "Gallery"; + private ImageLoader imageLoader; private String baseUrl; - private String gallerySGName = "Gallery"; - private String previewWidth = "256"; private boolean hasBackendGallerySG = false; @@ -103,7 +102,7 @@ public GalleryGridAdapter( Context context, LocationProfile locationProfile, OnL imageLoader = ImageLoader.getInstance(); imageLoader.init( ImageLoaderConfiguration.createDefault( context ) ); - baseUrl = locationProfile.getUrl() + "Content/GetImageFile?StorageGroup=" + gallerySGName + "&FileName="; + baseUrl = locationProfile.getUrl() + "Content/GetImageFile?StorageGroup=" + mGallerySGName + "&FileName="; if( mImageItems.isEmpty() ) { @@ -157,6 +156,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 ) { @@ -243,12 +246,11 @@ private void notifyParentEnd() { private class LoadFileListTask extends AsyncTask { - final String gallerySGName = "Gallery"; - final String gallerySetting = "GalleryDir"; + final String mGallerySetting = "GalleryDir"; boolean backendAndFrontendShareHostname = false; boolean galleryDirPresentInSettings = false; - String galleryDir = ""; + String mGalleryDir = ""; /* (non-Javadoc) * @see android.os.AsyncTask#doInBackground(Params[]) @@ -260,19 +262,15 @@ protected Void doInBackground( Void... params ) { try { ETagInfo eTag = ETagInfo.createEmptyETag(); - // 800p screen / 3 columns = 266,67 for each - // 720p screen / 3 columns = 240 for each - String previewWidth = "256"; - // Check if StorageGroup Gallery actually exists, doing an // GetFileList will return Default SG if Gallery SG is not // present., - ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).mythOperations().getStorageGroupDirectories( gallerySGName, mLocationProfile.getHostname(), eTag ); + ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).mythOperations().getStorageGroupDirectories(mGallerySGName, mLocationProfile.getHostname(), eTag ); if( responseEntity.getStatusCode().equals( HttpStatus.OK ) ) { StorageGroupDirectoryList storageGroups = responseEntity.getBody(); for( StorageGroupDirectory sg : storageGroups.getStorageGroupDirectories().getStorageGroupDirectories() ) { - if( sg.getGroupName().equals( gallerySGName ) ) + if( sg.getGroupName().equals(mGallerySGName) ) hasBackendGallerySG = true; } @@ -280,19 +278,19 @@ protected Void doInBackground( Void... params ) { if( hasBackendGallerySG ) { - getImageList( previewWidth ); + getImageList(); } else { backendAndFrontendShareHostname = isConnectedProfileInHostsList(); if( backendAndFrontendShareHostname ) { - ResponseEntity responseEntity2 = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).mythOperations().getSetting( mLocationProfile.getHostname(), gallerySetting, "", eTag ); + ResponseEntity responseEntity2 = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).mythOperations().getSetting( mLocationProfile.getHostname(), mGallerySetting, "", eTag ); if( responseEntity2.getStatusCode().equals( HttpStatus.OK ) ) { SettingList settingList = responseEntity2.getBody(); - galleryDir = settingList.getSetting().getSettings().get( gallerySetting ); - if( galleryDir != null && !"".equalsIgnoreCase( galleryDir ) ) { + mGalleryDir = settingList.getSetting().getSettings().get(mGallerySetting); + if( mGalleryDir != null && !"".equalsIgnoreCase(mGalleryDir) ) { galleryDirPresentInSettings = true; } @@ -335,22 +333,18 @@ private boolean isConnectedProfileInHostsList() { return false; } - private void getImageList( String previewWidth ) { + private void getImageList() { Log.v( TAG, "LoadFileListTask.getImageList : enter" ); ETagInfo eTag = ETagInfo.createEmptyETag(); - ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).contentOperations().getFileList( gallerySGName, eTag ); + ResponseEntity responseEntity = mMythtvServiceHelper.getMythServicesApi( mLocationProfile ).contentOperations().getFileList(mGallerySGName, eTag ); if( responseEntity.getStatusCode().equals( HttpStatus.OK ) ) { mImageItems = new ArrayList(); StringList filesOnStorageGroup = responseEntity.getBody(); // TODO: Add different types of sorting, and filtering - // String imageUri = - // mLocationProfileDaoHelper.findConnectedProfile().getUrl() + - // "Content/GetImageFile?StorageGroup="+gallerySGName+"&Width="+previewWidth+"&FileName="; - for( String file : filesOnStorageGroup.getStringList() ) { // First look for image suffixes, then skip files with @@ -454,9 +448,9 @@ protected void onCancelled() { private void clickedPosButton( int result, EditText directoryName ) { if( directoryName != null ) { - galleryDir = directoryName.getText().toString(); + mGalleryDir = directoryName.getText().toString(); } - new CreateSGTask().execute( gallerySGName, galleryDir ); + new CreateSGTask().execute(mGallerySGName, mGalleryDir); } diff --git a/src/org/mythtv/client/ui/media/PicturesParentFragment.java b/src/org/mythtv/client/ui/media/PicturesParentFragment.java index 49e2c045..57e7bef9 100644 --- a/src/org/mythtv/client/ui/media/PicturesParentFragment.java +++ b/src/org/mythtv/client/ui/media/PicturesParentFragment.java @@ -3,16 +3,6 @@ */ package org.mythtv.client.ui.media; -import java.util.ArrayList; - -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; -import org.mythtv.service.dvr.RecordedService; - -import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -23,6 +13,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 * @@ -31,10 +27,6 @@ public class PicturesParentFragment extends AbstractMythFragment implements Gall private static final String TAG = PicturesParentFragment.class.getSimpleName(); - public static ArrayList images = new ArrayList(); - - public static boolean IMAGE_LIST_DOWNLOADED = false; - private MenuHelper mMenuHelper = MenuHelper.getInstance(); private MenuItemRefreshAnimated mMenuItemRefresh;