File tree Expand file tree Collapse file tree 5 files changed +25
-19
lines changed
src/main/java/org/amahi/anywhere Expand file tree Collapse file tree 5 files changed +25
-19
lines changed Original file line number Diff line number Diff line change 6868 */
6969public class ServerFileAudioActivity extends Activity implements ServiceConnection , MediaController .MediaPlayerControl
7070{
71- public static final Set <String > SUPPORTED_FORMATS ;
71+ private static final Set <String > SUPPORTED_FORMATS ;
7272
7373 static {
7474 SUPPORTED_FORMATS = new HashSet <String >(Arrays .asList (
@@ -79,6 +79,10 @@ public class ServerFileAudioActivity extends Activity implements ServiceConnecti
7979 ));
8080 }
8181
82+ public static boolean supports (String mime_type ) {
83+ return SUPPORTED_FORMATS .contains (mime_type );
84+ }
85+
8286 private static final class State
8387 {
8488 private State () {
Original file line number Diff line number Diff line change 5555 */
5656public class ServerFileImageActivity extends Activity implements ViewPager .OnPageChangeListener
5757{
58- public static final Set <String > SUPPORTED_FORMATS ;
58+ private static final Set <String > SUPPORTED_FORMATS ;
5959
6060 static {
6161 SUPPORTED_FORMATS = new HashSet <String >(Arrays .asList (
@@ -225,4 +225,8 @@ protected void onPause() {
225225
226226 BusProvider .getBus ().unregister (this );
227227 }
228+
229+ public static boolean supports (String mime_type ) {
230+ return SUPPORTED_FORMATS .contains (mime_type );
231+ }
228232}
Original file line number Diff line number Diff line change @@ -70,18 +70,6 @@ public class ServerFileVideoActivity extends Activity implements ServiceConnecti
7070 MediaController .MediaPlayerControl ,
7171 View .OnSystemUiVisibilityChangeListener
7272{
73- public static final Set <String > SUPPORTED_FORMATS ;
74-
75- static {
76- SUPPORTED_FORMATS = new HashSet <String >(Arrays .asList (
77- "video/avi" ,
78- "video/divx" ,
79- "video/mp4" ,
80- "video/x-matroska" ,
81- "video/x-m4v"
82- ));
83- }
84-
8573 @ Inject
8674 ServerClient serverClient ;
8775
@@ -496,4 +484,10 @@ private void tearDownVideoService() {
496484 Intent intent = new Intent (this , VideoService .class );
497485 stopService (intent );
498486 }
487+
488+ public static boolean supports (String mime_type ) {
489+ String type = mime_type .split ("/" )[0 ];
490+
491+ return "video" .equals (type );
492+ }
499493}
Original file line number Diff line number Diff line change 4747 */
4848public class ServerFileWebActivity extends Activity
4949{
50- public static final Set <String > SUPPORTED_FORMATS ;
50+ private static final Set <String > SUPPORTED_FORMATS ;
5151
5252 static {
5353 SUPPORTED_FORMATS = new HashSet <String >(Arrays .asList (
@@ -154,6 +154,10 @@ private void tearDownWebResourceState(Bundle state) {
154154 getWebView ().saveState (state );
155155 }
156156
157+ public static boolean supports (String mime_type ) {
158+ return SUPPORTED_FORMATS .contains (mime_type );
159+ }
160+
157161 private static final class WebResourceClient extends WebViewClient
158162 {
159163 private final ServerFileWebActivity activity ;
Original file line number Diff line number Diff line change @@ -104,19 +104,19 @@ public boolean isServerFileSupported(ServerFile file) {
104104 private Class <? extends Activity > getServerFileActivity (ServerFile file ) {
105105 String fileFormat = file .getMime ();
106106
107- if (ServerFileAudioActivity .SUPPORTED_FORMATS . contains (fileFormat )) {
107+ if (ServerFileAudioActivity .supports (fileFormat )) {
108108 return ServerFileAudioActivity .class ;
109109 }
110110
111- if (ServerFileImageActivity .SUPPORTED_FORMATS . contains (fileFormat )) {
111+ if (ServerFileImageActivity .supports (fileFormat )) {
112112 return ServerFileImageActivity .class ;
113113 }
114114
115- if (ServerFileVideoActivity .SUPPORTED_FORMATS . contains (fileFormat )) {
115+ if (ServerFileVideoActivity .supports (fileFormat )) {
116116 return ServerFileVideoActivity .class ;
117117 }
118118
119- if (ServerFileWebActivity .SUPPORTED_FORMATS . contains (fileFormat )) {
119+ if (ServerFileWebActivity .supports (fileFormat )) {
120120 return ServerFileWebActivity .class ;
121121 }
122122
You can’t perform that action at this time.
0 commit comments