aboutsummaryrefslogtreecommitdiff
path: root/sample/src/com/example/sampletvinput/ExternalFileTvInputService.java
diff options
context:
space:
mode:
Diffstat (limited to 'sample/src/com/example/sampletvinput/ExternalFileTvInputService.java')
-rw-r--r--sample/src/com/example/sampletvinput/ExternalFileTvInputService.java66
1 files changed, 0 insertions, 66 deletions
diff --git a/sample/src/com/example/sampletvinput/ExternalFileTvInputService.java b/sample/src/com/example/sampletvinput/ExternalFileTvInputService.java
deleted file mode 100644
index 7399132f..00000000
--- a/sample/src/com/example/sampletvinput/ExternalFileTvInputService.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.sampletvinput;
-
-import android.util.Log;
-
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class ExternalFileTvInputService extends BaseTvInputService {
- private static final String TAG = "ExternalFileTvInputService";
- public static final String CHANNEL_XML_PATH = "/sdcard/tvinput/channels.xml";
-
- private static List<ChannelInfo> sSampleChannels = null;
-
- @Override
- public List<ChannelInfo> createSampleChannels() {
- return parseSampleChannels();
- }
-
- public static List<ChannelInfo> parseSampleChannels() {
- synchronized (ExternalFileTvInputService.class) {
- if (sSampleChannels != null) {
- return sSampleChannels;
- }
- File file = new File(CHANNEL_XML_PATH);
- FileInputStream is = null;
- try {
- is = new FileInputStream(file);
- sSampleChannels = ChannelXMLParser.parseChannelXML(is);
- } catch (XmlPullParserException | IOException e) {
- Log.w(TAG, "failed to load channels.");
- sSampleChannels = Collections.emptyList();
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- // Ignore exception.
- }
- }
- }
- return sSampleChannels;
- }
- }
-}