├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── androidtvwidget ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── open │ │ └── androidtvwidget │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── open │ │ │ └── androidtvwidget │ │ │ ├── adapter │ │ │ └── BaseTabTitleAdapter.java │ │ │ ├── bridge │ │ │ ├── BaseEffectBridge.java │ │ │ ├── BaseEffectBridgeWrapper.java │ │ │ ├── EffectNoDrawBridge.java │ │ │ ├── MiddleEffectBridge.java │ │ │ ├── OpenEffectBridge.java │ │ │ └── RecyclerViewBridge.java │ │ │ ├── cache │ │ │ └── BitmapMemoryCache.java │ │ │ ├── keyboard │ │ │ ├── KeyRow.java │ │ │ ├── PopupSoftKey.java │ │ │ ├── SaveKeyEvent.java │ │ │ ├── SkbContainer.java │ │ │ ├── SkbPool.java │ │ │ ├── SoftKey.java │ │ │ ├── SoftKeyBoardListener.java │ │ │ ├── SoftKeyBoardable.java │ │ │ ├── SoftKeyboard.java │ │ │ ├── SoftKeyboardView.java │ │ │ └── XmlKeyboardLoader.java │ │ │ ├── menu │ │ │ ├── IOpenMenu.java │ │ │ ├── IOpenMenuItem.java │ │ │ ├── IOpenMenuView.java │ │ │ ├── MenuDataObservable.java │ │ │ ├── MenuSetObserver.java │ │ │ ├── OpenMenu.java │ │ │ ├── OpenMenuItem.java │ │ │ ├── OpenMenuItemView.java │ │ │ ├── OpenMenuView.java │ │ │ └── OpenSubMenu.java │ │ │ ├── recycle │ │ │ ├── GridLayoutManagerTV.java │ │ │ ├── LinearLayoutManagerTV.java │ │ │ ├── OnChildSelectedListener.java │ │ │ ├── RecyclerViewTV.java │ │ │ └── SpacesItemDecoration.java │ │ │ ├── utils │ │ │ ├── AnimateUtils.java │ │ │ ├── CustomApplicationHelper.java │ │ │ ├── DisplayUtil.java │ │ │ ├── DrawUtils.java │ │ │ ├── GenerateViewId.java │ │ │ ├── NetWorkUtils.java │ │ │ ├── OPENLOG.java │ │ │ ├── ShellUtils.java │ │ │ └── Utils.java │ │ │ └── view │ │ │ ├── ExpendGridView.java │ │ │ ├── GridViewTV.java │ │ │ ├── LabelView.java │ │ │ ├── LinearMainLayout.java │ │ │ ├── ListViewTV.java │ │ │ ├── MainLayout.java │ │ │ ├── MainUpView.java │ │ │ ├── OpenTabHost.java │ │ │ ├── ReflectItemView.java │ │ │ ├── RelativeMainLayout.java │ │ │ ├── SmoothHorizontalScrollView.java │ │ │ ├── SmoothVorizontalScrollView.java │ │ │ ├── TextViewWithTTF.java │ │ │ ├── ViewPagerTV.java │ │ │ ├── WaveLoadingView.java │ │ │ └── WidgetTvViewBring.java │ └── res │ │ ├── drawable │ │ └── nocolor.png │ │ ├── layout │ │ ├── list_menu_item_icon.xml │ │ ├── list_menu_item_layout.xml │ │ ├── open_menu_view.xml │ │ ├── softkey_layout_view.xml │ │ └── tabhost_title_head.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── values.xml │ └── test │ └── java │ └── com │ └── open │ └── androidtvwidget │ └── ExampleUnitTest.java ├── app ├── .gitignore ├── build.gradle ├── hs_err_pid1336.log ├── hs_err_pid1592.log ├── hs_err_pid3536.log ├── hs_err_pid4184.log ├── hs_err_pid8164.log ├── hs_err_pid8352.log ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── tv │ │ └── danxx │ │ └── com │ │ └── brisktvlauncher │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── font │ │ │ └── helvetica_neueltpro_thex.otf │ ├── java │ │ └── com │ │ │ └── danxx │ │ │ └── brisktvlauncher │ │ │ ├── adapter │ │ │ ├── BaseAbsListViewAdapter.java │ │ │ ├── BaseRecyclerViewAdapter.java │ │ │ ├── BaseRecyclerViewHolder.java │ │ │ └── FocusGridLayoutManager.java │ │ │ ├── app │ │ │ ├── Common.java │ │ │ └── TvApp.java │ │ │ ├── base │ │ │ └── BaseActivity.java │ │ │ ├── db │ │ │ └── SharedPreferencesUtil.java │ │ │ ├── model │ │ │ ├── AppBean.java │ │ │ ├── AppItem.java │ │ │ ├── FragmentBean.java │ │ │ ├── TaskInfo.java │ │ │ ├── TaskInfoProvider.java │ │ │ └── VideoBean.java │ │ │ ├── module │ │ │ ├── FragmentFactory.java │ │ │ ├── RecentMediaStorage.java │ │ │ └── Settings.java │ │ │ ├── services │ │ │ └── MediaPlayerService.java │ │ │ ├── ui │ │ │ ├── ActivityMain.java │ │ │ ├── ActivityManagerApp.java │ │ │ ├── ActivityQuicken.java │ │ │ ├── ActivitySetting.java │ │ │ ├── FragmentSetAbout.java │ │ │ ├── FragmentSetBackground.java │ │ │ ├── FragmentSetRecommend.java │ │ │ ├── FragmentSetScreensaver.java │ │ │ ├── FullScreenVideoActivity.java │ │ │ ├── LiveVideoActivity.java │ │ │ ├── SettingsFragment.java │ │ │ └── TracksFragment.java │ │ │ ├── utils │ │ │ ├── FileCache.java │ │ │ ├── FileUtils.java │ │ │ ├── FocusAnimUtils.java │ │ │ ├── IOAuthCallBack.java │ │ │ ├── ImageTools.java │ │ │ ├── LogUtil.java │ │ │ ├── MD5Util.java │ │ │ ├── NetWorkUtil.java │ │ │ ├── ReadAllApp.java │ │ │ ├── ToastUtils.java │ │ │ ├── Tools.java │ │ │ ├── UIUtils.java │ │ │ ├── UpdateManager.java │ │ │ └── ZipUtil.java │ │ │ └── widget │ │ │ ├── CheckableLinearLayout.java │ │ │ ├── CheckableRelativeLayout.java │ │ │ ├── FocusHorizontalScrollView.java │ │ │ ├── FocusListenerLinearLayout.java │ │ │ ├── FocusRecyclerView.java │ │ │ ├── FocusViewPager.java │ │ │ ├── HomeLeftWidget.java │ │ │ ├── IjkListPreference.java │ │ │ ├── SpaceItemDecoration.java │ │ │ ├── TitleViewGroup.java │ │ │ ├── TitleViewUtil.java │ │ │ ├── VerticalLabelLayout.java │ │ │ └── media │ │ │ ├── AndroidMediaController.java │ │ │ ├── CustomMediaController.java │ │ │ ├── IMediaController.java │ │ │ ├── IRenderView.java │ │ │ ├── IjkVideoView.java │ │ │ ├── InfoHudViewHolder.java │ │ │ ├── MeasureHelper.java │ │ │ ├── MediaPlayerCompat.java │ │ │ ├── PolicyCompat.java │ │ │ ├── SurfaceRenderView.java │ │ │ ├── TableLayoutBinder.java │ │ │ └── TextureRenderView.java │ └── res │ │ ├── anim │ │ ├── activity_down_in.xml │ │ ├── activity_down_out.xml │ │ ├── activity_up_in.xml │ │ ├── activity_up_out.xml │ │ ├── ppwindow_hide.xml │ │ └── ppwindow_show.xml │ │ ├── drawable-hdpi │ │ ├── border_highlight.9.png │ │ ├── item_shadow.9.png │ │ └── tv_background.jpg │ │ ├── drawable │ │ ├── bg.jpg │ │ ├── bg_menu_shadow.png │ │ ├── blur_bg.9.png │ │ ├── checkbox_selector.xml │ │ ├── default_focus.9.png │ │ ├── delete_btn_focus_bg.xml │ │ ├── delete_btn_unfocus_bg.xml │ │ ├── delete_icon.png │ │ ├── delete_icon_selected.png │ │ ├── dotted_ine.xml │ │ ├── item_foucs_bg.xml │ │ ├── item_rectangle.xml │ │ ├── player_bg_gradient_dark.xml │ │ ├── seek_bar.xml │ │ ├── selector_delete_btn.xml │ │ ├── selector_focus_item_home_left.xml │ │ ├── set_icon.png │ │ ├── shadow7.9.png │ │ ├── shape_clean_bg.xml │ │ ├── shape_clean_btn_bg.xml │ │ ├── shape_delete_flag_bg.xml │ │ ├── shape_focus_bg.xml │ │ ├── shape_focus_item_home_left.xml │ │ ├── shape_popupwindow_bg.xml │ │ ├── shape_select_flag.xml │ │ ├── shape_unfocus_item_home_left.xml │ │ └── shape_unselect_flag.xml │ │ ├── layout │ │ ├── activity_activity_setting.xml │ │ ├── activity_details.xml │ │ ├── activity_focus_test.xml │ │ ├── activity_live_video.xml │ │ ├── activity_main.xml │ │ ├── activity_main2.xml │ │ ├── activity_manager_app.xml │ │ ├── activity_player.xml │ │ ├── fragment_fragment1.xml │ │ ├── fragment_fragment2.xml │ │ ├── fragment_fragment3.xml │ │ ├── fragment_fragment4.xml │ │ ├── fragment_track_list.xml │ │ ├── game_titleview.xml │ │ ├── item_app_launcher.xml │ │ ├── item_app_manager.xml │ │ ├── item_live.xml │ │ ├── item_tab_list.xml │ │ ├── layout_home_left.xml │ │ ├── layout_popupwindow.xml │ │ ├── table_media_info.xml │ │ ├── table_media_info_row1.xml │ │ ├── table_media_info_row2.xml │ │ ├── table_media_info_section.xml │ │ └── vvc_media_controller.xml │ │ ├── menu │ │ └── menu_player.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── vvc_ic_media_ff.png │ │ ├── vvc_ic_media_next.png │ │ ├── vvc_ic_media_pause.png │ │ ├── vvc_ic_media_play.png │ │ ├── vvc_ic_media_previous.png │ │ ├── vvc_ic_media_rew.png │ │ └── wasu_logo.png │ │ ├── mipmap-mdpi │ │ ├── default_focus.9.png │ │ ├── delete_btn.png │ │ ├── ic_launcher.png │ │ ├── networkstate_ethernet.png │ │ ├── networkstate_off.png │ │ ├── networkstate_on.png │ │ ├── vvc_ic_media_ff.png │ │ ├── vvc_ic_media_next.png │ │ ├── vvc_ic_media_pause.png │ │ ├── vvc_ic_media_play.png │ │ ├── vvc_ic_media_previous.png │ │ ├── vvc_ic_media_rew.png │ │ ├── wifi_1.png │ │ ├── wifi_2.png │ │ ├── wifi_3.png │ │ └── wifi_img.png │ │ ├── mipmap-xhdpi │ │ ├── bg.jpg │ │ ├── home_bg.png │ │ ├── ic_launcher.png │ │ ├── launcher_bg_01.jpg │ │ ├── launcher_channel_children.png │ │ ├── launcher_channel_movie.png │ │ ├── launcher_channel_variety.png │ │ ├── vvc_ic_media_ff.png │ │ ├── vvc_ic_media_next.png │ │ ├── vvc_ic_media_pause.png │ │ ├── vvc_ic_media_play.png │ │ ├── vvc_ic_media_previous.png │ │ └── vvc_ic_media_rew.png │ │ ├── mipmap-xxhdpi │ │ ├── back.png │ │ ├── ic_launcher.png │ │ ├── vvc_ic_media_ff.png │ │ ├── vvc_ic_media_next.png │ │ ├── vvc_ic_media_pause.png │ │ ├── vvc_ic_media_play.png │ │ ├── vvc_ic_media_previous.png │ │ └── vvc_ic_media_rew.png │ │ ├── mipmap-xxxhdpi │ │ ├── back.png │ │ ├── ic_launcher.png │ │ └── loadingview_bg.jpg │ │ ├── values-1280x720 │ │ └── dimens.xml │ │ ├── values-1920x1008 │ │ └── dimens.xml │ │ ├── values-1920x1032 │ │ └── dimens.xml │ │ ├── values-1920x1080 │ │ └── dimens.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ ├── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ ├── strings_pref.xml │ │ └── styles.xml │ │ └── xml │ │ └── settings.xml │ └── test │ └── java │ └── tv │ └── danxx │ └── com │ └── brisktvlauncher │ └── ExampleUnitTest.java ├── build.gradle ├── device-2016-05-03-142547.png ├── device-2016-07-05-103951.png ├── device-2016-07-05-104020.png ├── device-2016-07-05-104108.png ├── device-2016-07-05-104705.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── ijkplayer-exo ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── tv │ │ └── danmaku │ │ └── ijk │ │ └── media │ │ └── exo │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── tv │ │ └── danmaku │ │ └── ijk │ │ └── media │ │ └── exo │ │ ├── IjkExoMediaPlayer.java │ │ └── demo │ │ ├── EventLogger.java │ │ └── player │ │ ├── DashRendererBuilder.java │ │ ├── DemoPlayer.java │ │ ├── ExtractorRendererBuilder.java │ │ ├── HlsRendererBuilder.java │ │ └── SmoothStreamingRendererBuilder.java │ └── res │ └── values │ └── strings.xml ├── ijkplayer-java ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── tv │ │ └── danmaku │ │ └── ijk │ │ └── media │ │ └── player │ │ └── ApplicationTest.java │ └── main │ ├── .classpath │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ ├── AndroidManifest.xml │ ├── java │ └── tv │ │ └── danmaku │ │ └── ijk │ │ └── media │ │ └── player │ │ ├── AbstractMediaPlayer.java │ │ ├── AndroidMediaPlayer.java │ │ ├── IMediaPlayer.java │ │ ├── ISurfaceTextureHolder.java │ │ ├── ISurfaceTextureHost.java │ │ ├── IjkLibLoader.java │ │ ├── IjkMediaCodecInfo.java │ │ ├── IjkMediaMeta.java │ │ ├── IjkMediaPlayer.java │ │ ├── MediaInfo.java │ │ ├── MediaPlayerProxy.java │ │ ├── TextureMediaPlayer.java │ │ ├── annotations │ │ ├── AccessedByNative.java │ │ └── CalledByNative.java │ │ ├── exceptions │ │ └── IjkMediaException.java │ │ ├── ffmpeg │ │ └── FFmpegApi.java │ │ ├── misc │ │ ├── AndroidMediaFormat.java │ │ ├── AndroidTrackInfo.java │ │ ├── IMediaDataSource.java │ │ ├── IMediaFormat.java │ │ ├── ITrackInfo.java │ │ ├── IjkMediaFormat.java │ │ └── IjkTrackInfo.java │ │ └── pragma │ │ ├── DebugLog.java │ │ └── Pragma.java │ ├── libs │ ├── arm64-v8a │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── armeabi-v7a │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── armeabi │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── x86 │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ └── x86_64 │ │ ├── libijkffmpeg.so │ │ ├── libijkplayer.so │ │ └── libijksdl.so │ ├── project.properties │ └── res │ └── values │ └── strings.xml └── settings.gradle /.idea/.name: -------------------------------------------------------------------------------- 1 | BriskTVLauncher -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BriskTVLauncher 2 | BriskTVLauncher is a brisk android tv launcher. You can manager app, quicken memory,screen saver and so on. 3 | 4 | 目前还在开发阶段,下面是现在开发出来的主要UI: 5 | 6 | 1. 主界面: 7 | ![Alt text](./device-2016-07-05-103951.png) 8 | ![Alt text](./device-2016-07-05-104108.png) 9 | 10 | 2. 直播界面: 11 | ![Alt text](./device-2016-07-05-104705.png) 12 | ![Alt text](./device-2016-07-05-104020.png) 13 | 14 | 3. App管理界面: 15 | ![Alt text](./device-2016-05-03-142547.png) 16 | 17 | 支持单个卸载和批量卸载。 18 | 19 | 20 | 4. 内存加速界面: 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /androidtvwidget/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /androidtvwidget/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 11 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(include: ['*.jar'], dir: 'libs') 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:23.1.1' 25 | compile 'com.android.support:recyclerview-v7:23.1.1' 26 | compile 'com.android.support:gridlayout-v7:23.1.1' 27 | } 28 | -------------------------------------------------------------------------------- /androidtvwidget/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in F:\dev\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /androidtvwidget/src/androidTest/java/com/open/androidtvwidget/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /androidtvwidget/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/adapter/BaseTabTitleAdapter.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.adapter; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | import android.widget.BaseAdapter; 6 | 7 | public abstract class BaseTabTitleAdapter extends BaseAdapter { 8 | 9 | @Override 10 | public int getCount() { 11 | return 0; 12 | } 13 | 14 | public Integer getTitleWidgetID(int index) { 15 | return 0; 16 | } 17 | 18 | @Override 19 | public Object getItem(int position) { 20 | return null; 21 | } 22 | 23 | @Override 24 | public long getItemId(int position) { 25 | return 0; 26 | } 27 | 28 | @Override 29 | public View getView(int position, View convertView, ViewGroup parent) { 30 | return null; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/bridge/BaseEffectBridge.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.bridge; 2 | 3 | import com.open.androidtvwidget.view.MainUpView; 4 | 5 | import android.graphics.Canvas; 6 | import android.graphics.Rect; 7 | import android.graphics.drawable.Drawable; 8 | import android.view.View; 9 | 10 | /** 11 | * Anim Bridge 抽象类. ----桥接模式. 12 | * 13 | * @author hailongqiu 356752238@qq.com 14 | * 15 | */ 16 | public abstract class BaseEffectBridge { 17 | 18 | public abstract void onInitBridge(MainUpView view); 19 | 20 | /** 21 | * 需要绘制的东西. 22 | */ 23 | public abstract boolean onDrawMainUpView(Canvas canvas); 24 | 25 | /** 26 | * 老的焦点View. 27 | */ 28 | public abstract void onOldFocusView(View oldFocusView, float scaleX, float scaleY); 29 | 30 | /** 31 | * 新的焦点View. 32 | */ 33 | public abstract void onFocusView(View focusView, float scaleX, float scaleY); 34 | 35 | /** 36 | * 最上层移动的view. 37 | */ 38 | public void setMainUpView(MainUpView view) { 39 | 40 | } 41 | 42 | public MainUpView getMainUpView() { 43 | return null; 44 | } 45 | 46 | /** 47 | * 设置边框图片 48 | */ 49 | 50 | public void setUpRectResource(int resId) { 51 | 52 | } 53 | 54 | public void setUpRectDrawable(Drawable upRectDrawable) { 55 | 56 | } 57 | 58 | public Drawable getUpRectDrawable() { 59 | return null; 60 | } 61 | 62 | public void setDrawUpRectPadding(Rect rect) { 63 | 64 | } 65 | 66 | public Rect getDrawUpRect() { 67 | return null; 68 | } 69 | 70 | /** 71 | * 设置边框阴影 72 | */ 73 | 74 | public void setShadowResource(int resId) { 75 | } 76 | 77 | public Drawable getShadowDrawable() { 78 | return null; 79 | } 80 | 81 | public void setShadowDrawable(Drawable shadowDrawable) { 82 | } 83 | 84 | public void setDrawShadowRectPadding(Rect rect) { 85 | } 86 | 87 | public Rect getDrawShadowRect() { 88 | return null; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/bridge/MiddleEffectBridge.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.bridge; 2 | 3 | /** 4 | * 一般这种效果只使用在横向或者纵向的listveiw或者Recycleview
5 | * 假设有20个item,边框开始的时候移动,达到中间就不再移动,
6 | * item懂滚动,如果后面已经快没有了,就开始移动.
7 | * 使用方法 MainUpView.setAnimBridge(new MiddleEffectBridge());
8 | * 9 | * @author hailongqiu 10 | * 11 | */ 12 | public class MiddleEffectBridge extends EffectNoDrawBridge { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/cache/BitmapMemoryCache.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.cache; 2 | 3 | import android.graphics.Bitmap; 4 | import android.support.v4.util.LruCache; 5 | 6 | /** 7 | * Bitmap缓存,简单缓存. 8 | * 9 | * @author hailongqiu 356752238@qq.com 10 | * 11 | */ 12 | public class BitmapMemoryCache { 13 | 14 | private static final String TAG = "BitmapMemoryCache"; 15 | 16 | private static BitmapMemoryCache sInstance = new BitmapMemoryCache(); 17 | 18 | private LruCache mMemoryCache; 19 | 20 | /** 21 | * 单例模式. 22 | */ 23 | public static BitmapMemoryCache getInstance() { 24 | return BitmapMemoryCache.sInstance; 25 | } 26 | 27 | private BitmapMemoryCache() { 28 | int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); 29 | int cacheSize = maxMemory / 8; 30 | mMemoryCache = new LruCache(cacheSize) { 31 | @Override 32 | protected int sizeOf(String key, Bitmap bitmap) { 33 | // 重写此方法来衡量每张图片的大小,默认返回图片数量。 34 | return bitmap.getByteCount() / 1024; 35 | } 36 | }; 37 | } 38 | 39 | public void addBitmapToMemoryCache(String key, Bitmap bitmap) { 40 | if (getBitmapFromMemCache(key) == null) { 41 | mMemoryCache.put(key, bitmap); 42 | } 43 | } 44 | 45 | public Bitmap getBitmapFromMemCache(String key) { 46 | return mMemoryCache.get(key); 47 | } 48 | 49 | /** 50 | * 移除缓存 51 | */ 52 | public synchronized void removeImageCache(String key) { 53 | if (key != null) { 54 | if (mMemoryCache != null) { 55 | Bitmap bm = mMemoryCache.remove(key); 56 | if (bm != null) { 57 | bm.recycle(); 58 | } 59 | } 60 | } 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/keyboard/KeyRow.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.keyboard; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 按键的列数组. 8 | * 9 | * @author hailong.qiu 356752238@qq.com 10 | * 11 | */ 12 | public class KeyRow { 13 | 14 | private List mSoftKeys = new ArrayList(); 15 | 16 | public List getSoftKeys() { 17 | return mSoftKeys; 18 | } 19 | 20 | public void setSoftKeys(List mSoftKeys) { 21 | this.mSoftKeys = mSoftKeys; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/keyboard/PopupSoftKey.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.keyboard; 2 | 3 | import java.util.List; 4 | 5 | /*** 6 | * 用于弹出T9键盘或者弹出其它界面的按键. 7 | * 8 | * @author hailongqiu 9 | * 10 | */ 11 | public class PopupSoftKey extends SoftKey { 12 | } 13 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/keyboard/SaveKeyEvent.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.keyboard; 2 | 3 | /** 4 | * 保存了KEYEVENT.KEYCODE_ 的一些按键 CODE. 5 | */ 6 | public class SaveKeyEvent { 7 | /* 8 | KEYCODE_UNKNOWN=0; 9 | KEYCODE_SOFT_LEFT=1; 10 | KEYCODE_SOFT_RIGHT=2; 11 | KEYCODE_HOME=3; 12 | KEYCODE_BACK=4; 13 | KEYCODE_CALL=5; 14 | KEYCODE_ENDCALL=6; 15 | KEYCODE_0=7; 16 | KEYCODE_1=8; 17 | KEYCODE_2=9; 18 | KEYCODE_3=10; 19 | KEYCODE_4=11; 20 | KEYCODE_5=12; 21 | KEYCODE_6=13; 22 | KEYCODE_7=14; 23 | KEYCODE_8=15; 24 | KEYCODE_9=16; 25 | KEYCODE_STAR=17; 26 | KEYCODE_POUND=18; 27 | KEYCODE_DPAD_UP=19; 28 | KEYCODE_DPAD_DOWN=20; 29 | KEYCODE_DPAD_LEFT=21; 30 | KEYCODE_DPAD_RIGHT=22; 31 | KEYCODE_DPAD_CENTER=23; 32 | KEYCODE_VOLUME_UP=24; 33 | KEYCODE_VOLUME_DOWN=25; 34 | KEYCODE_POWER=26; 35 | KEYCODE_CAMERA=27; 36 | KEYCODE_CLEAR=28; 37 | KEYCODE_A=29; 38 | KEYCODE_B=30; 39 | KEYCODE_C=31; 40 | KEYCODE_D=32; 41 | KEYCODE_E=33; 42 | KEYCODE_F=34; 43 | KEYCODE_G=35; 44 | KEYCODE_H=36; 45 | KEYCODE_I=37; 46 | KEYCODE_J=38; 47 | KEYCODE_K=39; 48 | KEYCODE_L=40; 49 | KEYCODE_M=41; 50 | KEYCODE_N=42; 51 | KEYCODE_O=43; 52 | KEYCODE_P=44; 53 | KEYCODE_Q=45; 54 | KEYCODE_R=46; 55 | KEYCODE_S=47; 56 | KEYCODE_T=48; 57 | KEYCODE_U=49; 58 | KEYCODE_V=50; 59 | KEYCODE_W=51; 60 | KEYCODE_X=52; 61 | KEYCODE_Y=53; 62 | KEYCODE_Z=54; 63 | KEYCODE_COMMA=55; 64 | KEYCODE_PERIOD=56; 65 | KEYCODE_ALT_LEFT=57; 66 | KEYCODE_ALT_RIGHT=58; 67 | KEYCODE_SHIFT_LEFT=59; 68 | KEYCODE_SHIFT_RIGHT=60; 69 | KEYCODE_TAB=61; 70 | KEYCODE_SPACE=62; 71 | KEYCODE_SYM=63; 72 | KEYCODE_EXPLORER=64; 73 | KEYCODE_ENVELOPE=65; 74 | KEYCODE_ENTER=66; 75 | KEYCODE_DEL=67; 76 | KEYCODE_GRAVE=68; 77 | KEYCODE_MINUS=69; 78 | KEYCODE_EQUALS=70; 79 | KEYCODE_LEFT_BRACKET=71; 80 | KEYCODE_RIGHT_BRACKET=72; 81 | KEYCODE_BACKSLASH=73; 82 | KEYCODE_SEMICOLON=74; 83 | KEYCODE_APOSTROPHE=75; 84 | KEYCODE_SLASH=76; 85 | KEYCODE_AT=77; 86 | KEYCODE_NUM=78; 87 | KEYCODE_HEADSETHOOK=79; 88 | KEYCODE_FOCUS=80;//*Camera*focus 89 | KEYCODE_PLUS=81; 90 | KEYCODE_MENU=82; 91 | KEYCODE_NOTIFICATION=83; 92 | KEYCODE_SEARCH=84; 93 | KEYCODE_MEDIA_PLAY_PAUSE=85; 94 | KEYCODE_MEDIA_STOP=86; 95 | KEYCODE_MEDIA_NEXT=87; 96 | KEYCODE_MEDIA_PREVIOUS=88; 97 | KEYCODE_MEDIA_REWIND=89; 98 | KEYCODE_MEDIA_FAST_FORWARD=90; 99 | KEYCODE_MUTE=91 100 | */ 101 | } 102 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/keyboard/SkbPool.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.keyboard; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * 加载XML键盘布局文件. 7 | * 8 | * @author hailong.qiu 356752238@qq.com 9 | * 10 | */ 11 | public class SkbPool { 12 | 13 | private static final String TAG = "SkbPool"; 14 | 15 | private static SkbPool mInstance = new SkbPool(); // 单例模式. 16 | 17 | private SkbPool() { 18 | } 19 | 20 | public static final SkbPool getInstance() { 21 | return SkbPool.mInstance; 22 | } 23 | 24 | public SoftKeyboard getSoftKeyboard(Context context, int skbXmlId) { 25 | if (null != context) { 26 | XmlKeyboardLoader xkbl = new XmlKeyboardLoader(context); 27 | SoftKeyboard skb = xkbl.loadKeyboard(skbXmlId); 28 | return skb; 29 | } 30 | return null; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/keyboard/SoftKeyBoardListener.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.keyboard; 2 | 3 | public interface SoftKeyBoardListener { 4 | public void onCommitText(SoftKey key); 5 | public void onDelete(SoftKey key); 6 | public void onBack(SoftKey key); 7 | } 8 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/keyboard/SoftKeyBoardable.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.keyboard; 2 | 3 | import android.view.KeyEvent; 4 | 5 | /** 6 | * 键盘接口. 7 | * @author hailongqiu 8 | * 9 | */ 10 | public interface SoftKeyBoardable { 11 | 12 | /** 13 | * 设置选中的按键边框在最前面还是最后面 14 | * @param isFront true 最前面, false 反之 (默认为 false). 15 | */ 16 | public void setSelectSofkKeyFront(boolean isFront); 17 | 18 | /** 19 | * 设置移动边框和按键背景相差的间距. 20 | */ 21 | public void setSoftKeySelectPadding(int padding); 22 | 23 | /** 24 | * 设置移动边框的时间. 25 | */ 26 | public void setMoveDuration(int moveDuration); 27 | 28 | /** 29 | * 设置移动边框的标志位. 30 | * @param isMoveRect true : 移动 false : 反之. 31 | */ 32 | public void setMoveSoftKey(boolean isMoveRect); 33 | 34 | public SoftKeyboardView getSoftKeyboardView(); 35 | 36 | /** 37 | * 链接键盘事件处理. 38 | * @param cb 39 | */ 40 | public void setOnSoftKeyBoardListener(SoftKeyBoardListener cb); 41 | 42 | /** 43 | * 设置键盘XML. 44 | * @param layoutID : xml目录下的键盘ID. 45 | */ 46 | public void setSkbLayout(int layoutID); 47 | public int getSkbLayoutId(); 48 | 49 | /** 50 | * 不设置键盘XML,手动编写键盘值. 51 | * @param softSkb 52 | */ 53 | public void setSoftKeyboard(SoftKeyboard softSkb); 54 | 55 | /** 56 | * 设置选中的按键. 57 | * @param softKey 58 | * @return 59 | */ 60 | public boolean setKeySelected(SoftKey softKey); 61 | public void setDefualtSelectKey(int row, int index); 62 | public SoftKey getSelectKey(); 63 | 64 | /** 65 | * 外部处理按键事件. 66 | * @param keyCode 67 | * @param event 68 | * @return 69 | */ 70 | public boolean onSoftKeyDown(int keyCode, KeyEvent event); 71 | public boolean onSoftKeyUp(int keyCode, KeyEvent event); 72 | } 73 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/menu/IOpenMenuItem.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.menu; 2 | 3 | import android.graphics.drawable.Drawable; 4 | import android.widget.CompoundButton; 5 | 6 | /** 7 | * 菜单item接口. 8 | * 9 | * @author hailongqiu 10 | */ 11 | public interface IOpenMenuItem { 12 | static final int NO_ICON = 0; // 默认icon id. 13 | static final int DEFAULT_TEXT_SIZE = 24; // 默认字体 14 | 15 | /** 16 | * 设置菜单item-ID. 17 | */ 18 | public IOpenMenuItem setId(int id); 19 | 20 | public int getId(); 21 | 22 | /** 23 | * 设置菜单图标. 24 | */ 25 | public IOpenMenuItem setIcon(Drawable icon); 26 | 27 | public Drawable getIcon(); 28 | 29 | /** 30 | * 设置菜单文本内容 31 | */ 32 | public IOpenMenuItem setTitle(CharSequence title); 33 | 34 | public CharSequence getTitle(); 35 | 36 | /** 37 | * 设置字体大小. 38 | */ 39 | public IOpenMenuItem setTextSize(int size); 40 | 41 | public int getTextSize(); 42 | 43 | /** 44 | * 设置数据. 45 | */ 46 | public IOpenMenuItem setObjectData(Object data); 47 | 48 | public Object getObjectData(); 49 | 50 | /** 51 | * 保存子菜单. 52 | */ 53 | public IOpenMenuItem setSubMenu(IOpenMenu subMenu); 54 | 55 | public IOpenMenu getSubMenu(); 56 | 57 | /** 58 | * 判断子菜单是否存在. 59 | */ 60 | public boolean hasSubMenu(); 61 | 62 | /** 63 | * 设置checked标志位. 64 | */ 65 | public IOpenMenuItem setChecked(boolean checked); 66 | 67 | public boolean isChecked(); 68 | 69 | /** 70 | * 设置 RadioButton或 CheckBox的view. 71 | */ 72 | public IOpenMenuItem setCheckedView(CompoundButton compoundButton); 73 | 74 | public CompoundButton getCheckedView(); 75 | } 76 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/menu/IOpenMenuView.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.menu; 2 | 3 | import android.view.View; 4 | import android.widget.AdapterView; 5 | 6 | public interface IOpenMenuView { 7 | /** 8 | * 菜单View回调事件. 9 | */ 10 | public interface OnMenuListener { 11 | public boolean onMenuItemClick(AdapterView parent, IOpenMenuItem menuItem, View view, int position, long id); 12 | 13 | public boolean onMenuItemSelected(AdapterView parent, IOpenMenuItem menuItem, View view, int position, long id); 14 | 15 | public boolean onMenuItemFocusChange(AdapterView parent, View view); 16 | } 17 | 18 | /** 19 | * 菜单item接口函数. 20 | */ 21 | public interface ItemView { 22 | public void initialize(IOpenMenuItem itemData); 23 | } 24 | 25 | public IOpenMenuView setMenuData(IOpenMenu openMenu); 26 | 27 | /** 28 | * 设置菜单view事件. 29 | */ 30 | public IOpenMenuView setOnMenuListener(OnMenuListener cb); 31 | 32 | /** 33 | * 添加移动的view 34 | */ 35 | public IOpenMenuView setMoveView(View v); 36 | } 37 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/menu/MenuDataObservable.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.menu; 2 | 3 | import android.database.Observable; 4 | 5 | /** 6 | * 观察者模式. 7 | * Created by hailongqiu on 2016/6/2. 8 | */ 9 | public class MenuDataObservable extends Observable { 10 | 11 | /** 12 | * 显示菜单改变. 13 | */ 14 | public void nofityShow(IOpenMenu openMenu) { 15 | synchronized (mObservers) { 16 | for (int i = mObservers.size() - 1; i >= 0; i--) { 17 | mObservers.get(i).onShow(openMenu); 18 | } 19 | } 20 | } 21 | 22 | /** 23 | * 隐藏菜单的改变. 24 | */ 25 | public void notifyHide(IOpenMenu openMenu) { 26 | synchronized (mObservers) { 27 | for (int i = mObservers.size() - 1; i >= 0; i--) { 28 | mObservers.get(i).onHide(openMenu); 29 | } 30 | } 31 | } 32 | 33 | /** 34 | * 数据改变. 35 | */ 36 | public void notifyChanged(IOpenMenu openMenu) { 37 | synchronized (mObservers) { 38 | for (int i = mObservers.size() - 1; i >= 0; i--) { 39 | mObservers.get(i).onChanged(openMenu); 40 | } 41 | } 42 | } 43 | 44 | public void notifyInvalidated() { 45 | synchronized (mObservers) { 46 | for (int i = mObservers.size() - 1; i >= 0; i--) { 47 | mObservers.get(i).onInvalidated(); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/menu/MenuSetObserver.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.menu; 2 | 3 | /** 4 | * Created by hailongqiu on 2016/6/2. 5 | */ 6 | public abstract class MenuSetObserver { 7 | public void onShow(IOpenMenu openMenu) { 8 | } 9 | 10 | public void onHide(IOpenMenu openMenu) { 11 | } 12 | 13 | public void onChanged(IOpenMenu openMenu) { 14 | } 15 | 16 | public void onInvalidated() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/menu/OpenSubMenu.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.menu; 2 | 3 | /** 4 | * 子菜单. 5 | * 6 | * @author hailongqiu 7 | */ 8 | public class OpenSubMenu extends OpenMenu { 9 | } 10 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/recycle/OnChildSelectedListener.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.recycle; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | public class OnChildSelectedListener { 7 | public void onChildSelected(RecyclerView parent, View view, int position, int dy) { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/recycle/RecyclerViewTV.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.recycle; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.AttributeSet; 6 | import android.util.Log; 7 | import android.view.View; 8 | 9 | import com.open.androidtvwidget.view.WidgetTvViewBring; 10 | 11 | public class RecyclerViewTV extends RecyclerView { 12 | 13 | public RecyclerViewTV(Context context) { 14 | super(context); 15 | init(context); 16 | } 17 | 18 | public RecyclerViewTV(Context context, AttributeSet attrs) { 19 | super(context, attrs); 20 | init(context); 21 | } 22 | 23 | public RecyclerViewTV(Context context, AttributeSet attrs, int defStyle) { 24 | super(context, attrs, defStyle); 25 | init(context); 26 | } 27 | 28 | WidgetTvViewBring mWidgetTvViewBring; 29 | 30 | private void init(Context context) { 31 | setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); 32 | setHasFixedSize(true); 33 | setWillNotDraw(true); 34 | setOverScrollMode(View.OVER_SCROLL_NEVER); 35 | setChildrenDrawingOrderEnabled(true); 36 | mWidgetTvViewBring = new WidgetTvViewBring(this); 37 | } 38 | 39 | @Override 40 | public void bringChildToFront(View child) { 41 | mWidgetTvViewBring.bringChildToFront(this, child); 42 | } 43 | 44 | @Override 45 | protected int getChildDrawingOrder(int childCount, int i) { 46 | Log.d("danxx" ,"childCount-->"+childCount); 47 | Log.d("danxx" ,"i-->"+i); 48 | return mWidgetTvViewBring.getChildDrawingOrder(childCount, i); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/recycle/SpacesItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.recycle; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | /** 8 | * Created by Danxx on 2016/6/28. 9 | * 10 | */ 11 | public class SpacesItemDecoration extends RecyclerView.ItemDecoration { 12 | /**间距**/ 13 | private int space; 14 | /**列数**/ 15 | private int column = 1; 16 | 17 | public SpacesItemDecoration(int space , int column) { 18 | this.space = space; 19 | this.column = column; 20 | } 21 | 22 | @Override 23 | public void getItemOffsets(Rect outRect, View view, 24 | RecyclerView parent, RecyclerView.State state) { 25 | outRect.left = space; 26 | outRect.bottom = space; 27 | outRect.top = space; 28 | outRect.right = space; 29 | /* int position = parent.getChildPosition(view); 30 | if(position%column == 0){ //最左边的item 左间距为0 31 | outRect.left = 0; 32 | outRect.bottom = space*3; 33 | outRect.top = space; 34 | outRect.right = space; 35 | }else if(position%column == (column-1)){ //最右边的item 右间距为0 36 | outRect.right = 0; 37 | outRect.bottom = space*3; 38 | outRect.top = space; 39 | outRect.left = space; 40 | }else{ 41 | outRect.right = space; 42 | outRect.bottom = space*3; 43 | outRect.top = space; 44 | outRect.left = space; 45 | }*/ 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/utils/AnimateUtils.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.utils; 2 | 3 | import android.view.animation.Animation; 4 | import android.view.animation.ScaleAnimation; 5 | 6 | /** 7 | * 动画集合. 8 | * 9 | * @author hailongqiu 356752238@qq.com 10 | * 11 | */ 12 | public class AnimateUtils { 13 | public static Animation zoomAnimation(float startScale, float endScale, long duration) { 14 | ScaleAnimation anim = new ScaleAnimation(startScale, endScale, startScale, endScale, Animation.RELATIVE_TO_SELF, 15 | 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 16 | anim.setFillAfter(true); 17 | anim.setDuration(duration); 18 | return anim; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/utils/DisplayUtil.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.utils; 2 | 3 | import android.content.Context; 4 | 5 | public class DisplayUtil { 6 | public static int dip2px(Context context, float dipValue) { 7 | final float scale = context.getResources().getDisplayMetrics().density; 8 | return (int) (dipValue * scale + 0.5f); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/utils/DrawUtils.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.utils; 2 | 3 | import android.graphics.Path; 4 | import android.graphics.RectF; 5 | 6 | public class DrawUtils { 7 | 8 | public static Path addRoundPath3(int width, int height, float radius) { 9 | Path path = new Path(); 10 | path.addRoundRect(new RectF(0, 0, width, height), radius, radius, Path.Direction.CW); 11 | return path; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/utils/GenerateViewId.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.utils; 2 | 3 | import java.util.concurrent.atomic.AtomicInteger; 4 | 5 | import android.annotation.SuppressLint; 6 | import android.os.Build; 7 | import android.view.View; 8 | 9 | public class GenerateViewId { 10 | private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1); 11 | private static GenerateViewId sGenerateViewId = new GenerateViewId(); 12 | 13 | public static GenerateViewId getSingleton() { 14 | return sGenerateViewId; 15 | } 16 | 17 | /** 18 | * 动态生成View ID API LEVEL 17 以上View.generateViewId()生成 API LEVEL 17 以下需要手动生成 19 | */ 20 | @SuppressLint("NewApi") 21 | public int generateViewId() { 22 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { 23 | for (;;) { 24 | final int result = sNextGeneratedId.get(); 25 | // aapt-generated IDs have the high byte nonzero; clamp to the 26 | // range under that. 27 | int newValue = result + 1; 28 | if (newValue > 0x00FFFFFF) 29 | newValue = 1; // Roll over to 1, not 0. 30 | if (sNextGeneratedId.compareAndSet(result, newValue)) { 31 | return result; 32 | } 33 | } 34 | } else { 35 | return View.generateViewId(); 36 | } 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/utils/NetWorkUtils.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.utils; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * 一些网络常用的接口.
9 | * 记得要添加权限哈.
10 | * 11 | * 12 | * @author hailongqiu 13 | * 14 | */ 15 | public class NetWorkUtils { 16 | 17 | /** 18 | * 网络是否可用 19 | */ 20 | public static boolean isNetWorkdetect(Context context) { 21 | ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 22 | NetworkInfo networkinfo = conn.getActiveNetworkInfo(); 23 | if (networkinfo == null || !networkinfo.isAvailable()) { 24 | return false; 25 | } 26 | return true; 27 | } 28 | 29 | /** 30 | * 判断有线网络. 31 | */ 32 | public static boolean checkEthernet(Context context) { 33 | ConnectivityManager conn = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 34 | NetworkInfo networkInfo = conn.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); 35 | return networkInfo.isConnected(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/utils/Utils.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.utils; 2 | 3 | /** 4 | * 5 | * @author hailongqiu 356752238@qq.com 6 | * 7 | */ 8 | public class Utils { 9 | 10 | /** 11 | * 获取SDK版本 12 | */ 13 | public static int getSDKVersion() { 14 | int version = 0; 15 | try { 16 | version = Integer.valueOf(android.os.Build.VERSION.SDK); 17 | } catch (NumberFormatException e) { 18 | } 19 | return version; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/ExpendGridView.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.GridView; 6 | 7 | /** 8 | * 扩展Gridview.必需嵌套滚动窗口. 9 | * @author hailongqiu 10 | * 11 | */ 12 | public class ExpendGridView extends GridView { 13 | public ExpendGridView(Context context, AttributeSet attrs, int defStyle) { 14 | super(context, attrs, defStyle); 15 | } 16 | 17 | public ExpendGridView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | } 20 | 21 | @Override 22 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 23 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, 24 | MeasureSpec.AT_MOST); 25 | super.onMeasure(widthMeasureSpec, expandSpec); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/GridViewTV.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.GridView; 8 | 9 | /** 10 | * GridView TV版本. 11 | * @author hailongqiu 356752238@qq.com 12 | * 13 | */ 14 | public class GridViewTV extends GridView { 15 | 16 | public GridViewTV(Context context) { 17 | super(context); 18 | init(context, null); 19 | } 20 | 21 | public GridViewTV(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | init(context, attrs); 24 | } 25 | 26 | /** 27 | * 崩溃了. 28 | */ 29 | @Override 30 | protected void dispatchDraw(Canvas canvas) { 31 | try { 32 | super.dispatchDraw(canvas); 33 | } catch (Exception e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | WidgetTvViewBring mWidgetTvViewBring; 39 | 40 | private void init(Context context, AttributeSet attrs) { 41 | this.setChildrenDrawingOrderEnabled(true); 42 | mWidgetTvViewBring = new WidgetTvViewBring(this); 43 | } 44 | 45 | @Override 46 | public void bringChildToFront(View child) { 47 | mWidgetTvViewBring.bringChildToFront(this, child); 48 | } 49 | 50 | @Override 51 | protected int getChildDrawingOrder(int childCount, int i) { 52 | // position = getSelectedItemPosition() - getFirstVisiblePosition(); 53 | return mWidgetTvViewBring.getChildDrawingOrder(childCount, i); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/LinearMainLayout.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.LinearLayout; 7 | 8 | /** 9 | * 如果有控件放大被挡住,可以使用 LinearMainLayout,

10 | * 它继承于 LinearLayout.

11 | * 使用方式和LinerLayout是一样的

12 | * @author hailongqiu 13 | * 14 | */ 15 | public class LinearMainLayout extends LinearLayout { 16 | 17 | public LinearMainLayout(Context context) { 18 | super(context); 19 | init(context); 20 | } 21 | 22 | public LinearMainLayout(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | init(context); 25 | } 26 | 27 | WidgetTvViewBring mWidgetTvViewBring; 28 | 29 | private void init(Context context) { 30 | this.setChildrenDrawingOrderEnabled(true); 31 | mWidgetTvViewBring = new WidgetTvViewBring(this); 32 | } 33 | 34 | @Override 35 | public void bringChildToFront(View child) { 36 | mWidgetTvViewBring.bringChildToFront(this, child); 37 | } 38 | 39 | @Override 40 | protected int getChildDrawingOrder(int childCount, int i) { 41 | return mWidgetTvViewBring.getChildDrawingOrder(childCount, i); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/ListViewTV.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.ListView; 8 | 9 | public class ListViewTV extends ListView { 10 | 11 | public ListViewTV(Context context) { 12 | super(context); 13 | init(context, null); 14 | } 15 | 16 | public ListViewTV(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | init(context, attrs); 19 | } 20 | 21 | /** 22 | * 崩溃了. 23 | */ 24 | @Override 25 | protected void dispatchDraw(Canvas canvas) { 26 | try { 27 | super.dispatchDraw(canvas); 28 | } catch (Exception e) { 29 | e.printStackTrace(); 30 | } 31 | } 32 | 33 | WidgetTvViewBring mWidgetTvViewBring; 34 | 35 | private void init(Context context, AttributeSet attrs) { 36 | this.setChildrenDrawingOrderEnabled(true); 37 | mWidgetTvViewBring = new WidgetTvViewBring(this); 38 | } 39 | 40 | @Override 41 | public void bringChildToFront(View child) { 42 | mWidgetTvViewBring.bringChildToFront(this, child); 43 | } 44 | 45 | @Override 46 | protected int getChildDrawingOrder(int childCount, int i) { 47 | return mWidgetTvViewBring.getChildDrawingOrder(childCount, i); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/MainLayout.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.FrameLayout; 7 | 8 | /** 9 | * 如果有控件放大被挡住,可以使用 MainLayout, 10 | *

11 | * 它继承于 FrameLayout. 12 | *

13 | * 使用方式就和FrameLayout是一样的 14 | *

15 | * 如果你其它的控件也被挡住了,但是这里没有,你可以使用WidgetTvViewBring 16 | *

17 | * 18 | * @author hailongqiu 19 | * 20 | */ 21 | public class MainLayout extends FrameLayout { 22 | 23 | public MainLayout(Context context) { 24 | super(context); 25 | init(context); 26 | } 27 | 28 | public MainLayout(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | init(context); 31 | } 32 | 33 | WidgetTvViewBring mWidgetTvViewBring; 34 | 35 | private void init(Context context) { 36 | this.setChildrenDrawingOrderEnabled(true); 37 | mWidgetTvViewBring = new WidgetTvViewBring(this); 38 | } 39 | 40 | @Override 41 | public void bringChildToFront(View child) { 42 | mWidgetTvViewBring.bringChildToFront(this, child); 43 | } 44 | 45 | @Override 46 | protected int getChildDrawingOrder(int childCount, int i) { 47 | return mWidgetTvViewBring.getChildDrawingOrder(childCount, i); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/RelativeMainLayout.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.RelativeLayout; 7 | 8 | /** 9 | * 如果有控件放大被挡住,可以使用 RelativeMainLayout,

10 | * 它继承于 LinearLayout.

11 | * 使用方式和LinerLayout是一样的

12 | * @author hailongqiu 13 | * 14 | */ 15 | public class RelativeMainLayout extends RelativeLayout { 16 | 17 | public RelativeMainLayout(Context context) { 18 | super(context); 19 | init(context); 20 | } 21 | 22 | public RelativeMainLayout(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | init(context); 25 | } 26 | 27 | WidgetTvViewBring mWidgetTvViewBring; 28 | 29 | private void init(Context context) { 30 | this.setChildrenDrawingOrderEnabled(true); 31 | mWidgetTvViewBring = new WidgetTvViewBring(this); 32 | } 33 | 34 | @Override 35 | public void bringChildToFront(View child) { 36 | mWidgetTvViewBring.bringChildToFront(this, child); 37 | } 38 | 39 | @Override 40 | protected int getChildDrawingOrder(int childCount, int i) { 41 | return mWidgetTvViewBring.getChildDrawingOrder(childCount, i); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/SmoothVorizontalScrollView.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import com.open.androidtvwidget.R; 4 | 5 | import android.content.Context; 6 | import android.graphics.Rect; 7 | import android.util.AttributeSet; 8 | import android.widget.ScrollView; 9 | 10 | /** 11 | * 当你使用滚动窗口焦点错乱的时候,就可以使用这个控件. 12 | *

13 | * 使用方法和滚动窗口是一样的,具体查看DEMO吧. 14 | *

15 | * 如果想改变滚动的系数,R.dimen.fading_edge 16 | *

17 | * 18 | * @author hailongqiu 19 | */ 20 | public class SmoothVorizontalScrollView extends ScrollView { 21 | 22 | public SmoothVorizontalScrollView(Context context) { 23 | super(context, null, 0); 24 | } 25 | 26 | public SmoothVorizontalScrollView(Context context, AttributeSet attrs) { 27 | super(context, attrs, 0); 28 | } 29 | 30 | public SmoothVorizontalScrollView(Context context, AttributeSet attrs, int defStyle) { 31 | super(context, attrs, defStyle); 32 | } 33 | 34 | @Override 35 | protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) { 36 | if (getChildCount() == 0) 37 | return 0; 38 | int height = getHeight(); 39 | int screenTop = getScrollY(); 40 | int screenBottom = screenTop + height; 41 | int fadingEdge = this.getResources().getDimensionPixelSize(R.dimen.fading_edge); 42 | if (rect.top > 0) { 43 | screenTop += fadingEdge; 44 | } 45 | if (rect.bottom < getChildAt(0).getHeight()) { 46 | screenBottom -= fadingEdge; 47 | } 48 | // 49 | int scrollYDelta = 0; 50 | if (rect.bottom > screenBottom && rect.top > screenTop) { 51 | if (rect.height() > height) { 52 | scrollYDelta += (rect.top - screenTop); 53 | } else { 54 | scrollYDelta += (rect.bottom - screenBottom); 55 | } 56 | int bottom = getChildAt(0).getBottom(); 57 | int distanceToBottom = bottom - screenBottom; 58 | scrollYDelta = Math.min(scrollYDelta, distanceToBottom); 59 | } else if (rect.top < screenTop && rect.bottom < screenBottom) { 60 | if (rect.height() > height) { 61 | scrollYDelta -= (screenBottom - rect.bottom); 62 | } else { 63 | scrollYDelta -= (screenTop - rect.top); 64 | } 65 | scrollYDelta = Math.max(scrollYDelta, -getScrollY()); 66 | } 67 | return scrollYDelta; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/TextViewWithTTF.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | 4 | import java.util.HashMap; 5 | 6 | import com.open.androidtvwidget.R; 7 | 8 | import android.content.Context; 9 | import android.content.res.TypedArray; 10 | import android.graphics.Typeface; 11 | import android.util.AttributeSet; 12 | import android.widget.TextView; 13 | 14 | /** 15 | * 一个自定义的TextView控件. 16 | * 加载 /system/font/** 下面的字库. 17 | * @author hailongqiu 18 | * 19 | */ 20 | public class TextViewWithTTF extends TextView { 21 | 22 | private static final TypeFaceMgr SFontMgr = new TypeFaceMgr(); 23 | 24 | public TextViewWithTTF(Context context) { 25 | super(context); 26 | } 27 | 28 | public TextViewWithTTF(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | 31 | TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.TextViewWithTTF); 32 | setTypeface(SFontMgr.getTypeface(array.getString(R.styleable.TextViewWithTTF_ttf_name))); 33 | array.recycle(); 34 | } 35 | 36 | 37 | 38 | public TextViewWithTTF(Context context, String aTTFName) 39 | { 40 | super(context); 41 | setTypeface(SFontMgr.getTypeface(aTTFName)); 42 | } 43 | 44 | public void setFont(String aTTFName) { 45 | setTypeface(SFontMgr.getTypeface(aTTFName)); 46 | } 47 | } 48 | 49 | 50 | class TypeFaceMgr 51 | { 52 | HashMap mTypefaces; 53 | public TypeFaceMgr() 54 | { 55 | mTypefaces = new HashMap(); 56 | } 57 | public Typeface getTypeface(String aTTFName) 58 | { 59 | if(mTypefaces.containsKey(aTTFName)) 60 | { 61 | return mTypefaces.get(aTTFName); 62 | } 63 | else 64 | { 65 | Typeface font; 66 | try 67 | { 68 | font = Typeface.createFromFile("/system/fonts/"+aTTFName); 69 | } 70 | catch (Exception e) 71 | { 72 | e.printStackTrace(); 73 | return null; 74 | } 75 | 76 | mTypefaces.put(aTTFName, font); 77 | return font; 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/ViewPagerTV.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.ViewPager; 5 | import android.util.AttributeSet; 6 | 7 | public class ViewPagerTV extends ViewPager { 8 | 9 | public ViewPagerTV(Context context) { 10 | super(context); 11 | } 12 | 13 | public ViewPagerTV(Context context, AttributeSet attrs) { 14 | super(context, attrs); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/java/com/open/androidtvwidget/view/WidgetTvViewBring.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget.view; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | 6 | /** 7 | * 让ViewGroup中的控件在最上层
8 | * ListView, GridView, ViewGroup中使用. 想要置顶的子控件,不要忘记调用 bringToFront() 噢. 9 | * 10 | * @author hailongqiu 11 | * 12 | */ 13 | public class WidgetTvViewBring { 14 | 15 | private int position = 0; 16 | 17 | public WidgetTvViewBring() { 18 | } 19 | 20 | public WidgetTvViewBring(ViewGroup vg) { 21 | vg.setClipChildren(false); 22 | vg.setClipToPadding(false); 23 | // vg.setChildrenDrawingOrderEnabled(true); 24 | } 25 | 26 | public void bringChildToFront(ViewGroup vg, View child) { 27 | position = vg.indexOfChild(child); 28 | if (position != -1) { 29 | vg.postInvalidate(); 30 | } 31 | } 32 | 33 | /** 34 | * 此函数 dispatchDraw 中调用.
35 | * 原理就是和最后一个要绘制的view,交换了位置.
36 | * 因为dispatchDraw最后一个绘制的view是在最上层的.
37 | * 这样就避免了使用 bringToFront 导致焦点错乱问题.
38 | */ 39 | public int getChildDrawingOrder(int childCount, int i) { 40 | // if (position != -1) { 41 | // if (i == childCount - 1) 42 | // return position; 43 | // if (i == position) 44 | // return childCount - 1; 45 | // } 46 | // return i; 47 | if (position < 0) { 48 | return i; 49 | } 50 | if (i < (childCount - 1)) { 51 | if (position == i) 52 | i = childCount - 1; 53 | } else { 54 | if (position < childCount) 55 | i = position; 56 | } 57 | return i; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/drawable/nocolor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/androidtvwidget/src/main/res/drawable/nocolor.png -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/layout/list_menu_item_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/layout/list_menu_item_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 26 | 27 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/layout/open_menu_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/layout/softkey_layout_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/layout/tabhost_title_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 80dp 6 | 7 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidTvWidget 3 | 4 | -------------------------------------------------------------------------------- /androidtvwidget/src/main/res/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /androidtvwidget/src/test/java/com/open/androidtvwidget/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.open.androidtvwidget; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.danxx.brisktvlauncher" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.3.0' 26 | compile 'com.android.support:recyclerview-v7:23.4.0' 27 | compile 'com.android.support:support-v4:23.3.0' 28 | compile 'com.victor:lib:1.0.4' 29 | compile 'com.github.bumptech.glide:glide:3.4.+' 30 | compile project(':androidtvwidget') 31 | compile 'com.takisoft.fix:preference-v7:23.4.0.4' 32 | compile project(':ijkplayer-java') 33 | compile project(':ijkplayer-exo') 34 | } 35 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/tv/danxx/com/brisktvlauncher/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package tv.danxx.com.brisktvlauncher; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/assets/font/helvetica_neueltpro_thex.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/assets/font/helvetica_neueltpro_thex.otf -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/adapter/BaseAbsListViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.adapter; 2 | 3 | /** 4 | * ListView和GridView的适配器 5 | * Created by Danxx on 2016/4/18. 6 | */ 7 | public abstract class BaseAbsListViewAdapter { 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/adapter/BaseRecyclerViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.adapter; 2 | 3 | import android.animation.AnimatorSet; 4 | import android.animation.ObjectAnimator; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.View; 7 | 8 | /** 9 | * Base RecyclerViewHolder 10 | * Created by Danxingxi on 2016/3/31. 11 | */ 12 | public abstract class BaseRecyclerViewHolder extends RecyclerView.ViewHolder { 13 | 14 | public BaseRecyclerViewHolder(View itemView) { 15 | super(itemView); 16 | } 17 | 18 | protected abstract View getView(); 19 | 20 | /** 21 | * 为item添加动画 22 | * @param view 需要添加动画的item 23 | * @param scale 是否得到焦点 24 | */ 25 | public void animItem(View view,boolean scale){ 26 | float toValue = 1.0f; 27 | if(scale) { //得到焦点 28 | toValue = 1.1f; 29 | ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", toValue); 30 | ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", toValue); 31 | AnimatorSet animatorSet = new AnimatorSet(); 32 | animatorSet.setDuration(300); 33 | animatorSet.playTogether(animatorX, animatorY); 34 | animatorSet.start(); 35 | }else{ //失去焦点 36 | ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", toValue); 37 | ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", toValue); 38 | AnimatorSet animatorSet = new AnimatorSet(); 39 | animatorSet.setDuration(300); 40 | animatorSet.playTogether(animatorX, animatorY); 41 | animatorSet.start(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/app/Common.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.app; 2 | 3 | /** 4 | * 可以根据layout_code的不同来创建对应的fragment模板 5 | * Created by Danxx on 2016/4/28. 6 | */ 7 | public class Common { 8 | 9 | public final static String BACKGROUND = "backgroundFragment"; 10 | public final static String SCREENSAVER = "screensaverFragment"; 11 | public final static String RECOMMEND = "recommendFragment"; 12 | public final static String ABOUT = "aboutFragment"; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/app/TvApp.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.app; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * Created by Danxx on 2016/4/14. 7 | */ 8 | public class TvApp extends Application { 9 | @Override 10 | public void onCreate() { 11 | super.onCreate(); 12 | 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/db/SharedPreferencesUtil.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.db; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | import java.util.Set; 7 | 8 | /** 9 | * @author Droid 10 | */ 11 | public class SharedPreferencesUtil { 12 | 13 | private static final String SHAREDPREFERENCE_NAME = "sharedpreferences_droid"; 14 | private static SharedPreferencesUtil mInstance; 15 | private static SharedPreferences mSharedPreferences; 16 | private static SharedPreferences.Editor mEditor; 17 | public synchronized static SharedPreferencesUtil getInstance(Context context) { 18 | if (mInstance == null) { 19 | mInstance = new SharedPreferencesUtil(context); 20 | } 21 | return mInstance; 22 | } 23 | 24 | private SharedPreferencesUtil(Context context) { 25 | mSharedPreferences = context.getSharedPreferences( 26 | SHAREDPREFERENCE_NAME, Context.MODE_WORLD_READABLE); 27 | mEditor = mSharedPreferences.edit(); 28 | } 29 | 30 | public synchronized boolean putString(String key, String value) { 31 | mEditor.putString(key, value); 32 | return mEditor.commit(); 33 | } 34 | 35 | public synchronized boolean putInt(String key, int value) { 36 | mEditor.putInt(key, value); 37 | return mEditor.commit(); 38 | } 39 | 40 | public synchronized boolean putLong(String key, long value) { 41 | mEditor.putLong(key, value); 42 | return mEditor.commit(); 43 | } 44 | 45 | public synchronized boolean putFloat(String key, float value) { 46 | mEditor.putFloat(key, value); 47 | return mEditor.commit(); 48 | } 49 | 50 | public synchronized boolean putBoolean(String key, boolean value) { 51 | mEditor.putBoolean(key, value); 52 | return mEditor.commit(); 53 | } 54 | 55 | public synchronized boolean putStringSet(String key, Set value) { 56 | mEditor.putStringSet(key, value); 57 | return mEditor.commit(); 58 | } 59 | 60 | public String getString(String key, String value) { 61 | return mSharedPreferences.getString(key, value); 62 | } 63 | 64 | public int getInt(String key, int value) { 65 | return mSharedPreferences.getInt(key, value); 66 | } 67 | 68 | public long getLong(String key, long value) { 69 | return mSharedPreferences.getLong(key, value); 70 | } 71 | 72 | public float getFloat(String key, float value) { 73 | return mSharedPreferences.getFloat(key, value); 74 | } 75 | 76 | public boolean getBoolean(String key, boolean value) { 77 | return mSharedPreferences.getBoolean(key, value); 78 | } 79 | 80 | public Set getStringSet(String key, Set value) { 81 | return mSharedPreferences.getStringSet(key, value); 82 | } 83 | 84 | public boolean remove(String key) { 85 | mEditor.remove(key); 86 | return mEditor.commit(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/model/AppBean.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.model; 2 | 3 | import android.graphics.drawable.Drawable; 4 | 5 | public class AppBean { 6 | private String dataDir; 7 | private Drawable icon; 8 | private String id; 9 | private String name; 10 | private String launcherName; 11 | private String packageName; 12 | private int pageIndex; 13 | private int position; 14 | private boolean sysApp = false; 15 | private String versionName; 16 | 17 | public String getDataDir() { 18 | return this.dataDir; 19 | } 20 | 21 | public Drawable getIcon() { 22 | return this.icon; 23 | } 24 | 25 | public String getId() { 26 | return this.id; 27 | } 28 | 29 | public String getName() { 30 | return this.name; 31 | } 32 | 33 | public String getPackageName() { 34 | return this.packageName; 35 | } 36 | 37 | public int getPageIndex() { 38 | return this.pageIndex; 39 | } 40 | 41 | public int getPosition() { 42 | return this.position; 43 | } 44 | 45 | public void setDataDir(String paramString) { 46 | this.dataDir = paramString; 47 | } 48 | 49 | public void setIcon(Drawable paramDrawable) { 50 | this.icon = paramDrawable; 51 | } 52 | 53 | public void setId(String paramString) { 54 | this.id = paramString; 55 | } 56 | 57 | public void setName(String paramString) { 58 | this.name = paramString; 59 | } 60 | 61 | public void setPackageName(String paramString) { 62 | this.packageName = paramString; 63 | } 64 | 65 | public void setPageIndex(int paramInt) { 66 | this.pageIndex = paramInt; 67 | } 68 | 69 | public void setPosition(int paramInt) { 70 | this.position = paramInt; 71 | } 72 | 73 | public String getVersionName() { 74 | return versionName; 75 | } 76 | 77 | public void setVersionName(String versionName) { 78 | this.versionName = versionName; 79 | } 80 | 81 | public String toString() { 82 | return "AppBean [packageName=" + this.packageName + ", name=" + this.name + ", dataDir=" + this.dataDir + "]"; 83 | } 84 | 85 | public boolean isSysApp() { 86 | return sysApp; 87 | } 88 | 89 | public void setSysApp(boolean sysApp) { 90 | this.sysApp = sysApp; 91 | } 92 | 93 | public String getLauncherName() { 94 | return launcherName; 95 | } 96 | 97 | public void setLauncherName(String launcherName) { 98 | this.launcherName = launcherName; 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/model/AppItem.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.model; 2 | 3 | import android.widget.ImageView; 4 | import android.widget.RelativeLayout; 5 | import android.widget.TextView; 6 | 7 | public class AppItem { 8 | 9 | public RelativeLayout layout; 10 | public ImageView imageView1,imageView2,imageView3; 11 | public TextView textView; 12 | public String packageName = null; 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/model/FragmentBean.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.model; 2 | 3 | /** 4 | * Created by Danxx on 2016/4/27. 5 | */ 6 | public class FragmentBean { 7 | 8 | private String ID; 9 | private int position; 10 | private String name; 11 | private String url; 12 | 13 | public FragmentBean(String ID, int position, String name, String mUrl) { 14 | this.ID = ID; 15 | this.position = position; 16 | this.name = name; 17 | this.url = mUrl; 18 | } 19 | 20 | public String getID() { 21 | return ID; 22 | } 23 | 24 | public void setID(String ID) { 25 | this.ID = ID; 26 | } 27 | 28 | public int getPosition() { 29 | return position; 30 | } 31 | 32 | public void setPosition(int position) { 33 | this.position = position; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public String getUrl() { 45 | return url; 46 | } 47 | 48 | public void setUrl(String url) { 49 | this.url = url; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/model/TaskInfo.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.model; 2 | 3 | import android.graphics.drawable.Drawable; 4 | 5 | public class TaskInfo { 6 | private String name; 7 | private Drawable icon; 8 | private int id; 9 | private int memory; 10 | private Boolean isCheck; 11 | private String packageName; 12 | private Boolean isSystemProcess;// 是否为系统进程 13 | 14 | public String getName() { 15 | return name; 16 | } 17 | 18 | public void setName(String name) { 19 | this.name = name; 20 | } 21 | 22 | public Drawable getIcon() { 23 | return icon; 24 | } 25 | 26 | public void setIcon(Drawable icon) { 27 | this.icon = icon; 28 | } 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | 38 | public int getMemory() { 39 | return memory; 40 | } 41 | 42 | public void setMemory(int memory) { 43 | this.memory = memory; 44 | } 45 | 46 | public Boolean getIsCheck() { 47 | return isCheck; 48 | } 49 | 50 | public void setIsCheck(Boolean isCheck) { 51 | this.isCheck = isCheck; 52 | } 53 | 54 | public String getPackageName() { 55 | return packageName; 56 | } 57 | 58 | public void setPackageName(String packageName) { 59 | this.packageName = packageName; 60 | } 61 | 62 | public Boolean getIsSystemProcess() { 63 | return isSystemProcess; 64 | } 65 | 66 | public void setIsSystemProcess(Boolean isSystemProcess) { 67 | this.isSystemProcess = isSystemProcess; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/model/TaskInfoProvider.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.model; 2 | 3 | import android.app.ActivityManager; 4 | import android.app.ActivityManager.RunningAppProcessInfo; 5 | import android.content.Context; 6 | import android.content.pm.ApplicationInfo; 7 | import android.content.pm.PackageManager; 8 | import android.graphics.drawable.Drawable; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /* 14 | * by:kangzizhaung 15 | */ 16 | public class TaskInfoProvider { 17 | private PackageManager pmManager; 18 | private ActivityManager aManager; 19 | 20 | public TaskInfoProvider(Context context) { 21 | pmManager = context.getPackageManager(); 22 | aManager = (ActivityManager) context 23 | .getSystemService(Context.ACTIVITY_SERVICE); 24 | } 25 | 26 | // 遍历传入的列表,将所有应用的信息传入taskinfo中 27 | public List GetAllTask(List list) { 28 | List taskInfos = new ArrayList(); 29 | for (RunningAppProcessInfo appProcessInfo : list) { 30 | TaskInfo info = new TaskInfo(); 31 | int id = appProcessInfo.pid; 32 | info.setId(id); 33 | String packageName = appProcessInfo.processName; 34 | info.setPackageName(packageName); 35 | try { 36 | // ApplicationInfo是AndroidMainfest文件里面整个Application节点的封装װ 37 | ApplicationInfo applicationInfo = pmManager.getPackageInfo( 38 | packageName, 0).applicationInfo; 39 | Drawable icon = applicationInfo.loadIcon(pmManager); 40 | info.setIcon(icon); 41 | String name = applicationInfo.loadLabel(pmManager).toString(); 42 | info.setName(name); 43 | info.setIsSystemProcess(!IsSystemApp(applicationInfo)); 44 | android.os.Debug.MemoryInfo[] memoryInfo = aManager 45 | .getProcessMemoryInfo(new int[] { id }); 46 | int memory = memoryInfo[0].getTotalPrivateDirty(); 47 | info.setMemory(memory); 48 | //不清除自己的进程 49 | if(!info.getPackageName().equalsIgnoreCase("com.danxx.brisktvlauncher") && !info.getPackageName().equalsIgnoreCase("com.yunos.tv.homeshell")){ 50 | 51 | taskInfos.add(info); 52 | } 53 | info = null; 54 | } catch (Exception e) { 55 | // TODO Auto-generated catch block 56 | e.printStackTrace(); 57 | info.setName(packageName); 58 | info.setIsSystemProcess(true); 59 | } 60 | } 61 | return taskInfos; 62 | } 63 | 64 | public Boolean IsSystemApp(ApplicationInfo info) { 65 | // 有些系统应用是可以更新的,如果用户自己下载了一个系统的应用来更新了原来的, 66 | // 它就不是系统应用啦,这个就是判断这种情况的 67 | if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) { 68 | return true; 69 | } 70 | else if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) { 71 | return true; 72 | } 73 | return false; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/model/VideoBean.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.model; 2 | 3 | /** 4 | * Created by Dawish on 2016/7/3. 5 | */ 6 | public class VideoBean { 7 | private String tvName; 8 | private String tvUrl; 9 | private Boolean isCanPlay; 10 | 11 | public String getTvName() { 12 | return tvName; 13 | } 14 | 15 | public void setTvName(String tvName) { 16 | this.tvName = tvName; 17 | } 18 | 19 | public String getTvUrl() { 20 | return tvUrl; 21 | } 22 | 23 | public void setTvUrl(String tvUrl) { 24 | this.tvUrl = tvUrl; 25 | } 26 | 27 | public Boolean getIsCanPlay() { 28 | return isCanPlay; 29 | } 30 | 31 | public void setIsCanPlay(Boolean isCanPlay) { 32 | this.isCanPlay = isCanPlay; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/module/FragmentFactory.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.module; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | 6 | import com.danxx.brisktvlauncher.app.Common; 7 | import com.danxx.brisktvlauncher.model.FragmentBean; 8 | import com.danxx.brisktvlauncher.ui.FragmentSetAbout; 9 | import com.danxx.brisktvlauncher.ui.FragmentSetBackground; 10 | import com.danxx.brisktvlauncher.ui.FragmentSetRecommend; 11 | import com.danxx.brisktvlauncher.ui.FragmentSetScreensaver; 12 | 13 | import java.util.HashMap; 14 | 15 | /** 16 | * fragment build factory 17 | * Created by Danxx on 2016/4/28. 18 | */ 19 | public class FragmentFactory { 20 | /**fragment缓存**/ 21 | private static HashMap fragments = new HashMap(); 22 | 23 | public static Fragment buildFragment(FragmentBean data ,int pos){ 24 | Fragment fragment = null; 25 | String id = data.getID(); 26 | String name = data.getName(); 27 | int position = data.getPosition(); 28 | String url = data.getUrl(); 29 | 30 | fragment = fragments.get(String.valueOf(pos)); 31 | if(fragment != null){ 32 | return fragment; 33 | } 34 | 35 | if(id.equalsIgnoreCase(Common.BACKGROUND)){ 36 | fragment = new FragmentSetBackground(); 37 | }else if(id.equalsIgnoreCase(Common.RECOMMEND)){ 38 | fragment = new FragmentSetRecommend(); 39 | }else if(id.equalsIgnoreCase(Common.SCREENSAVER)){ 40 | fragment = new FragmentSetScreensaver(); 41 | }else if(id.equalsIgnoreCase(Common.ABOUT)){ 42 | fragment = new FragmentSetAbout(); 43 | } 44 | 45 | Bundle bundle = new Bundle(); 46 | bundle.putString("id" ,id); 47 | bundle.putString("name" ,name); 48 | bundle.putInt("position", position); 49 | bundle.putString("url" , url); 50 | 51 | if(fragment != null){ 52 | fragments.put(String.valueOf(pos), fragment); 53 | fragment.setArguments(bundle); 54 | } 55 | return fragment; 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/services/MediaPlayerService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Zhang Rui 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.danxx.brisktvlauncher.services; 18 | 19 | import android.app.Service; 20 | import android.content.Context; 21 | import android.content.Intent; 22 | import android.os.IBinder; 23 | import android.support.annotation.Nullable; 24 | 25 | import tv.danmaku.ijk.media.player.IMediaPlayer; 26 | 27 | public class MediaPlayerService extends Service { 28 | private static IMediaPlayer sMediaPlayer; 29 | 30 | public static Intent newIntent(Context context) { 31 | Intent intent = new Intent(context, MediaPlayerService.class); 32 | return intent; 33 | } 34 | 35 | public static void intentToStart(Context context) { 36 | context.startService(newIntent(context)); 37 | } 38 | 39 | public static void intentToStop(Context context) { 40 | context.stopService(newIntent(context)); 41 | } 42 | 43 | @Nullable 44 | @Override 45 | public IBinder onBind(Intent intent) { 46 | return null; 47 | } 48 | 49 | public static void setMediaPlayer(IMediaPlayer mp) { 50 | if (sMediaPlayer != null && sMediaPlayer != mp) { 51 | if (sMediaPlayer.isPlaying()) 52 | sMediaPlayer.stop(); 53 | sMediaPlayer.release(); 54 | sMediaPlayer = null; 55 | } 56 | sMediaPlayer = mp; 57 | } 58 | 59 | public static IMediaPlayer getMediaPlayer() { 60 | return sMediaPlayer; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/ui/FragmentSetAbout.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.ui; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Button; 10 | import android.widget.TextView; 11 | 12 | import com.danxx.brisktvlauncher.R; 13 | 14 | 15 | /** 16 | * A simple {@link Fragment} subclass. 17 | */ 18 | public class FragmentSetAbout extends Fragment { 19 | 20 | 21 | private TextView tvUrl; 22 | private Button btnName; 23 | private String url=""; 24 | private String name = ""; 25 | 26 | 27 | public FragmentSetAbout() { 28 | // Required empty public constructor 29 | } 30 | 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle savedInstanceState) { 35 | // Inflate the layout for this fragment 36 | View view = inflater.inflate(R.layout.fragment_fragment4, container, false); 37 | tvUrl = (TextView) view.findViewById(R.id.tvUrl); 38 | btnName = (Button) view.findViewById(R.id.btnName); 39 | tvUrl.setText(url); 40 | btnName.setText(name); 41 | return view; 42 | } 43 | 44 | @Override 45 | public void setArguments(Bundle args) { 46 | super.setArguments(args); 47 | url = args.getString("url" ,""); 48 | name = args.getString("name",""); 49 | 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/ui/FragmentSetBackground.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.ui; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Button; 10 | import android.widget.TextView; 11 | 12 | import com.danxx.brisktvlauncher.R; 13 | 14 | 15 | /** 16 | * A simple {@link Fragment} subclass. 17 | */ 18 | public class FragmentSetBackground extends Fragment { 19 | 20 | private TextView tvUrl; 21 | private Button btnName; 22 | private String url=""; 23 | private String name = ""; 24 | 25 | public FragmentSetBackground() { 26 | // Required empty public constructor 27 | } 28 | 29 | 30 | @Override 31 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 32 | Bundle savedInstanceState) { 33 | // Inflate the layout for this fragment 34 | View view = inflater.inflate(R.layout.fragment_fragment1, container, false); 35 | tvUrl = (TextView) view.findViewById(R.id.tvUrl); 36 | btnName = (Button) view.findViewById(R.id.btnName); 37 | tvUrl.setText(url); 38 | btnName.setText(name); 39 | return view; 40 | } 41 | 42 | @Override 43 | public void setArguments(Bundle args) { 44 | super.setArguments(args); 45 | url = args.getString("url" ,""); 46 | name = args.getString("name",""); 47 | 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/ui/FragmentSetRecommend.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.ui; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Button; 10 | import android.widget.TextView; 11 | 12 | import com.danxx.brisktvlauncher.R; 13 | 14 | /** 15 | * A simple {@link Fragment} subclass. 16 | */ 17 | public class FragmentSetRecommend extends Fragment { 18 | 19 | 20 | private TextView tvUrl; 21 | private Button btnName; 22 | private String url=""; 23 | private String name = ""; 24 | 25 | public FragmentSetRecommend() { 26 | // Required empty public constructor 27 | } 28 | 29 | 30 | @Override 31 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 32 | Bundle savedInstanceState) { 33 | // Inflate the layout for this fragment 34 | View view = inflater.inflate(R.layout.fragment_fragment3, container, false); 35 | tvUrl = (TextView) view.findViewById(R.id.tvUrl); 36 | btnName = (Button) view.findViewById(R.id.btnName); 37 | tvUrl.setText(url); 38 | btnName.setText(name); 39 | return view; 40 | } 41 | 42 | @Override 43 | public void setArguments(Bundle args) { 44 | super.setArguments(args); 45 | url = args.getString("url" ,""); 46 | name = args.getString("name",""); 47 | 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/ui/FragmentSetScreensaver.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.ui; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Button; 10 | import android.widget.TextView; 11 | 12 | import com.danxx.brisktvlauncher.R; 13 | 14 | 15 | /** 16 | * A simple {@link Fragment} subclass. 17 | */ 18 | public class FragmentSetScreensaver extends Fragment { 19 | 20 | private TextView tvUrl; 21 | private Button btnName; 22 | private String url=""; 23 | private String name = ""; 24 | 25 | public FragmentSetScreensaver() { 26 | // Required empty public constructor 27 | } 28 | 29 | 30 | @Override 31 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 32 | Bundle savedInstanceState) { 33 | // Inflate the layout for this fragment 34 | View view = inflater.inflate(R.layout.fragment_fragment2, container, false); 35 | tvUrl = (TextView) view.findViewById(R.id.tvUrl); 36 | btnName = (Button) view.findViewById(R.id.btnName); 37 | tvUrl.setText(url); 38 | btnName.setText(name); 39 | return view; 40 | } 41 | 42 | @Override 43 | public void setArguments(Bundle args) { 44 | super.setArguments(args); 45 | url = args.getString("url" ,""); 46 | name = args.getString("name",""); 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/ui/SettingsFragment.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.preference.PreferenceFragmentCompat; 5 | 6 | import com.danxx.brisktvlauncher.R; 7 | 8 | /** 9 | * 设置Fragment 10 | */ 11 | public class SettingsFragment extends PreferenceFragmentCompat { 12 | // TODO: Rename parameter arguments, choose names that match 13 | private static final String ARG_PARAM1 = "param1"; 14 | private static final String ARG_PARAM2 = "param2"; 15 | 16 | // TODO: Rename and change types of parameters 17 | private String mParam1; 18 | private String mParam2; 19 | 20 | 21 | public SettingsFragment() { 22 | // Required empty public constructor 23 | } 24 | 25 | /** 26 | * Use this factory method to create a new instance of 27 | * this fragment using the provided parameters. 28 | * 29 | * @param param1 Parameter 1. 30 | * @param param2 Parameter 2. 31 | * @return A new instance of fragment SettingsFragment. 32 | */ 33 | public static SettingsFragment newInstance(String param1, String param2) { 34 | SettingsFragment fragment = new SettingsFragment(); 35 | Bundle args = new Bundle(); 36 | args.putString(ARG_PARAM1, param1); 37 | args.putString(ARG_PARAM2, param2); 38 | fragment.setArguments(args); 39 | return fragment; 40 | } 41 | 42 | @Override 43 | public void onCreate(Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | if (getArguments() != null) { 46 | mParam1 = getArguments().getString(ARG_PARAM1); 47 | mParam2 = getArguments().getString(ARG_PARAM2); 48 | } 49 | addPreferencesFromResource(R.xml.settings); 50 | } 51 | 52 | 53 | @Override 54 | public void onCreatePreferences(Bundle bundle, String s) { 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/utils/FileCache.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.utils; 2 | 3 | import android.content.Context; 4 | 5 | import java.io.File; 6 | import java.util.ArrayList; 7 | 8 | public class FileCache { 9 | public File cacheDir; 10 | 11 | public FileCache(Context context) { 12 | if (android.os.Environment.getExternalStorageState().equals( 13 | android.os.Environment.MEDIA_MOUNTED)) { 14 | cacheDir = new File( 15 | android.os.Environment.getExternalStorageDirectory(), 16 | "WoDouCache"); 17 | } else { 18 | cacheDir = context.getCacheDir(); 19 | } 20 | if (!cacheDir.exists()) { 21 | cacheDir.mkdirs(); 22 | } 23 | } 24 | 25 | public ArrayList getFile() { 26 | File file[] = cacheDir.listFiles(); 27 | ArrayList list = new ArrayList(); 28 | for (int i = 0; i < file.length; i++) { 29 | list.add(file[i]); 30 | } 31 | return list; 32 | } 33 | 34 | public String getCacheDir(){ 35 | return cacheDir.toString(); 36 | } 37 | 38 | public void clear() { 39 | File[] files = cacheDir.listFiles(); 40 | for (File f : files) 41 | f.delete(); 42 | } 43 | 44 | public String getCacheSize() { 45 | long size = 0; 46 | if (cacheDir.exists()) { 47 | File[] files = cacheDir.listFiles(); 48 | for (File f : files) { 49 | size += f.length(); 50 | } 51 | } 52 | String cacheSize = String.valueOf(size / 1024 / 1024) + "M"; 53 | return cacheSize; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/utils/FocusAnimUtils.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.utils; 2 | 3 | import android.animation.AnimatorSet; 4 | import android.animation.ObjectAnimator; 5 | import android.view.View; 6 | 7 | /** 8 | * Created by Danxx on 2016/4/18. 9 | */ 10 | public class FocusAnimUtils { 11 | 12 | public static void focusAnim(View view){ 13 | float toValue = 1.1f; 14 | ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", toValue); 15 | ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", toValue); 16 | AnimatorSet animatorSet = new AnimatorSet(); 17 | animatorSet.setDuration(300); 18 | animatorSet.playTogether(animatorX, animatorY); 19 | animatorSet.start(); 20 | 21 | } 22 | 23 | public static void unFocusAnim(View view){ 24 | float toValue = 1.0f; 25 | ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", toValue); 26 | ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", toValue); 27 | AnimatorSet animatorSet = new AnimatorSet(); 28 | animatorSet.setDuration(300); 29 | animatorSet.playTogether(animatorX, animatorY); 30 | animatorSet.start(); 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/utils/IOAuthCallBack.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.utils; 2 | 3 | /** 4 | * 数据回调接口 5 | */ 6 | public interface IOAuthCallBack { 7 | public void getIOAuthCallBack(String result, int state); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/utils/ToastUtils.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | /** 7 | * 8 | */ 9 | public class ToastUtils { 10 | // Toast 11 | private static Toast toast; 12 | 13 | /** 14 | * @param context 15 | * @param message 16 | */ 17 | public static void showShort(Context context, CharSequence message) { 18 | if (null == toast) { 19 | toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); 20 | // toast.setGravity(Gravity.CENTER, 0, 0); 21 | } else { 22 | toast.setText(message); 23 | } 24 | toast.show(); 25 | } 26 | 27 | /** 28 | * @param context 29 | * @param message 30 | */ 31 | public static void showShort(Context context, int message) { 32 | if (null == toast) { 33 | toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); 34 | // toast.setGravity(Gravity.CENTER, 0, 0); 35 | } else { 36 | toast.setText(message); 37 | } 38 | toast.show(); 39 | } 40 | 41 | /** 42 | * @param context 43 | * @param message 44 | */ 45 | public static void showLong(Context context, CharSequence message) { 46 | if (null == toast) { 47 | toast = Toast.makeText(context, message, Toast.LENGTH_LONG); 48 | // toast.setGravity(Gravity.CENTER, 0, 0); 49 | } else { 50 | toast.setText(message); 51 | } 52 | toast.show(); 53 | } 54 | 55 | /** 56 | * @param context 57 | * @param message 58 | */ 59 | public static void showLong(Context context, int message) { 60 | if (null == toast) { 61 | toast = Toast.makeText(context, message, Toast.LENGTH_LONG); 62 | // toast.setGravity(Gravity.CENTER, 0, 0); 63 | } else { 64 | toast.setText(message); 65 | } 66 | toast.show(); 67 | } 68 | 69 | /** 70 | * @param context 71 | * @param message 72 | * @param duration 73 | */ 74 | public static void show(Context context, CharSequence message, int duration) { 75 | if (null == toast) { 76 | toast = Toast.makeText(context, message, duration); 77 | // toast.setGravity(Gravity.CENTER, 0, 0); 78 | } else { 79 | toast.setText(message); 80 | } 81 | toast.show(); 82 | } 83 | 84 | /** 85 | * @param context 86 | * @param message 87 | * @param duration 88 | */ 89 | public static void show(Context context, int message, int duration) { 90 | if (null == toast) { 91 | toast = Toast.makeText(context, message, duration); 92 | // toast.setGravity(Gravity.CENTER, 0, 0); 93 | } else { 94 | toast.setText(message); 95 | } 96 | toast.show(); 97 | } 98 | 99 | /** Hide the toast, if any. */ 100 | public static void hideToast() { 101 | if (null != toast) { 102 | toast.cancel(); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/utils/UIUtils.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.PopupWindow; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | * Created by Danxx on 2016/4/20. 10 | */ 11 | public class UIUtils { 12 | 13 | /** 14 | * Set whether this window is touch modal or if outside touches will be sent 15 | * to 16 | * other windows behind it. 17 | */ 18 | public static void setPopupWindowTouchModal(PopupWindow popupWindow, boolean touchModal) { 19 | if (null == popupWindow) { 20 | return; 21 | } 22 | Method method; 23 | try { 24 | 25 | method = PopupWindow.class.getDeclaredMethod("setTouchModal", 26 | boolean.class); 27 | method.setAccessible(true); 28 | method.invoke(popupWindow, touchModal); 29 | 30 | } catch (Exception e) { 31 | e.printStackTrace(); 32 | } 33 | 34 | } 35 | 36 | /** 37 | * 将px值转换为sp值,保证文字大小不变 38 | * 39 | * @return 40 | */ 41 | public static int px2sp(Context context, float pxValue) { 42 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 43 | return (int) (pxValue / fontScale + 0.5f); 44 | } 45 | 46 | /** 47 | * 将sp值转换为px值,保证文字大小不变 48 | * 49 | * @return 50 | */ 51 | public static int sp2px(Context context, float spValue) { 52 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 53 | return (int) (spValue * fontScale + 0.5f); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/utils/UpdateManager.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.utils; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | import android.os.Message; 6 | 7 | import com.danxx.brisktvlauncher.db.SharedPreferencesUtil; 8 | 9 | import org.json.JSONArray; 10 | import org.json.JSONException; 11 | 12 | /** 13 | * apk更新下载 14 | */ 15 | public class UpdateManager { 16 | private static final String TAG = "UpdateManager"; 17 | private Context mContext; 18 | private static final int DOWN_UPDATE = 1; 19 | private static final int DOWN_OVER = 2; 20 | private String packageVersion; 21 | private String packageDownloadPath; 22 | private String packageMD5; 23 | private JSONArray appList; 24 | private boolean d = true;// debug flag 25 | private SharedPreferencesUtil sp; 26 | private FileCache fileCache; 27 | 28 | public UpdateManager(Context context) { 29 | this.mContext = context; 30 | fileCache = new FileCache(mContext); 31 | sp = SharedPreferencesUtil.getInstance(mContext); 32 | } 33 | 34 | private Handler mHandler = new Handler() { 35 | public void handleMessage(Message msg) { 36 | switch (msg.what) { 37 | case DOWN_UPDATE: 38 | break; 39 | case DOWN_OVER: 40 | break; 41 | default: 42 | break; 43 | } 44 | } 45 | }; 46 | 47 | /** 48 | * 外部接口让主Activity调用 请求服务器并检查服务器apk版本信息 49 | */ 50 | public void checkUpdateInfo() { 51 | 52 | } 53 | 54 | public String getCacheDir() { 55 | return fileCache.getCacheDir(); 56 | } 57 | 58 | /** 59 | * 下载apk 60 | * 61 | */ 62 | private void downloadApk() throws JSONException { 63 | 64 | } 65 | 66 | /** 67 | * 下载zip 68 | */ 69 | private void downloadZip() {} 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/CheckableLinearLayout.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.Checkable; 6 | import android.widget.LinearLayout; 7 | 8 | public class CheckableLinearLayout extends LinearLayout implements Checkable { 9 | 10 | private static final int CHECKABLE_CHILD_INDEX = 1; 11 | private Checkable child; 12 | 13 | public CheckableLinearLayout(Context context, AttributeSet attrs) { 14 | super(context, attrs); 15 | } 16 | 17 | @Override 18 | protected void onFinishInflate() { 19 | super.onFinishInflate(); 20 | child = (Checkable) getChildAt(CHECKABLE_CHILD_INDEX); 21 | } 22 | 23 | @Override 24 | public boolean isChecked() { 25 | return child.isChecked(); 26 | } 27 | 28 | @Override 29 | public void setChecked(boolean checked) { 30 | child.setChecked(checked); 31 | } 32 | 33 | @Override 34 | public void toggle() { 35 | child.toggle(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/CheckableRelativeLayout.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.Checkable; 6 | import android.widget.RelativeLayout; 7 | 8 | /** 9 | * Created by Danxx on 2016/4/29. 10 | */ 11 | public class CheckableRelativeLayout extends RelativeLayout implements Checkable{ 12 | 13 | private static final int CHECKABLE_CHILD_INDEX = 1; 14 | private Checkable child; 15 | 16 | public CheckableRelativeLayout(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | @Override 21 | protected void onFinishInflate() { 22 | super.onFinishInflate(); 23 | child = (Checkable) getChildAt(CHECKABLE_CHILD_INDEX); 24 | } 25 | 26 | @Override 27 | public boolean isChecked() { 28 | return child.isChecked(); 29 | } 30 | 31 | @Override 32 | public void setChecked(boolean checked) { 33 | child.setChecked(checked); 34 | } 35 | 36 | @Override 37 | public void toggle() { 38 | child.toggle(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/FocusRecyclerView.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.Rect; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.util.AttributeSet; 7 | import android.util.Log; 8 | import android.view.View; 9 | 10 | /** 11 | * Created by Danxx on 2016/4/12. 12 | */ 13 | public class FocusRecyclerView extends RecyclerView { 14 | 15 | /** 16 | * ViewPager右滑 17 | */ 18 | 19 | private int scrollDy = 160; 20 | 21 | 22 | public FocusRecyclerView(Context context) { 23 | super(context); 24 | } 25 | 26 | public FocusRecyclerView(Context context, AttributeSet attrs) { 27 | super(context, attrs); 28 | } 29 | 30 | public FocusRecyclerView(Context context, AttributeSet attrs, int defStyle) { 31 | super(context, attrs, defStyle); 32 | } 33 | 34 | @Override 35 | public View focusSearch(int direction) { 36 | return super.focusSearch(direction); 37 | } 38 | 39 | @Override 40 | public View findFocus() { 41 | LayoutManager lm = getLayoutManager(); 42 | return super.findFocus(); 43 | } 44 | 45 | @Override 46 | public boolean requestFocus(int direction, Rect previouslyFocusedRect) { 47 | return super.requestFocus(direction, previouslyFocusedRect); 48 | } 49 | 50 | @Override 51 | public void requestChildFocus(View child, View focused) { 52 | super.requestChildFocus(child, focused); 53 | } 54 | 55 | @Override 56 | public void smoothScrollToPosition(int position) { 57 | super.smoothScrollToPosition(position); 58 | } 59 | 60 | @Override 61 | public void smoothScrollBy(int dx, int dy) { 62 | if(hasFocus()){ 63 | if(dy>0){ 64 | int mdy = dy + getChildHeight(); 65 | super.smoothScrollBy(dx, mdy); 66 | }else if(dy<0){ 67 | int mdy= dy - getChildHeight(); 68 | super.smoothScrollBy(dx, mdy); 69 | }else { 70 | Log.d("danxx", "FRV dy--->"+dy); 71 | } 72 | } 73 | // super.smoothScrollBy(dx ,dy); 74 | } 75 | 76 | /** 77 | * 初始化的时候第一次请求焦点 78 | * @return 79 | */ 80 | public boolean firstRequestFocus(){ 81 | return false; 82 | } 83 | 84 | private int getChildHeight(){ 85 | return scrollDy; 86 | } 87 | 88 | public void setScrollDy(int height){ 89 | this.scrollDy = height; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/HomeLeftWidget.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.FrameLayout; 6 | 7 | /** 8 | * Created by Danxx on 2016/4/14. 9 | */ 10 | public class HomeLeftWidget extends FrameLayout{ 11 | public HomeLeftWidget(Context context) { 12 | super(context); 13 | } 14 | 15 | public HomeLeftWidget(Context context, AttributeSet attrs) { 16 | super(context, attrs); 17 | } 18 | 19 | public HomeLeftWidget(Context context, AttributeSet attrs, int defStyleAttr) { 20 | super(context, attrs, defStyleAttr); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/SpaceItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | /** 8 | * Created by Danxx on 2016/4/14. 9 | */ 10 | public class SpaceItemDecoration extends RecyclerView.ItemDecoration{ 11 | 12 | private int space; 13 | 14 | public SpaceItemDecoration(int space) { 15 | this.space = space; 16 | } 17 | 18 | @Override 19 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 20 | 21 | outRect.left = space+4; 22 | outRect.right = space+4; 23 | outRect.bottom = space; 24 | 25 | // Add top margin only for the first item to avoid double space between items 26 | // if(parent.getChildAdapterPosition(view) == 0) 27 | outRect.top = space; 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/TitleViewUtil.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.text.format.Time; 4 | 5 | import java.text.DateFormat; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Calendar; 8 | 9 | public class TitleViewUtil { 10 | 11 | public static String getTime() { 12 | String date = getFormattedDate(); 13 | String sTime = date.substring(11, date.length() - 3); 14 | return sTime; 15 | 16 | } 17 | 18 | public static String getDate() { 19 | String date = getFormattedDate(); 20 | String sDate = date.substring(0, 11); 21 | return sDate; 22 | } 23 | 24 | private static String getFormattedDate() { 25 | 26 | Time time = new Time(); 27 | time.setToNow(); 28 | DateFormat.getDateInstance(); 29 | Calendar c = Calendar.getInstance(); 30 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 31 | String formattedDate = df.format(c.getTime()); 32 | return formattedDate; 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/VerticalLabelLayout.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.ScrollView; 6 | 7 | /** 8 | * Created by Danxx on 2016/4/27. 9 | */ 10 | public class VerticalLabelLayout extends ScrollView { 11 | 12 | public VerticalLabelLayout(Context context) { 13 | super(context); 14 | } 15 | 16 | public VerticalLabelLayout(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | } 19 | 20 | public VerticalLabelLayout(Context context, AttributeSet attrs, int defStyleAttr) { 21 | super(context, attrs, defStyleAttr); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/media/IMediaController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Zhang Rui 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.danxx.brisktvlauncher.widget.media; 18 | 19 | import android.view.View; 20 | 21 | public interface IMediaController { 22 | void hide(); 23 | 24 | boolean isShowing(); 25 | 26 | void setAnchorView(View view); 27 | 28 | void setEnabled(boolean enabled); 29 | 30 | void setMediaPlayer(CustomMediaController.MediaPlayerControl player); 31 | 32 | void show(int timeout); 33 | 34 | void show(); 35 | 36 | //---------- 37 | // Extends 38 | //---------- 39 | void showOnce(View view); 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/danxx/brisktvlauncher/widget/media/PolicyCompat.java: -------------------------------------------------------------------------------- 1 | package com.danxx.brisktvlauncher.widget.media; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.view.Window; 6 | 7 | import java.lang.reflect.Constructor; 8 | import java.lang.reflect.Method; 9 | 10 | /** 11 | * 区分版本,反射创建PhoneWindow或者PolicyManager 12 | * danxingxi 13 | */ 14 | public class PolicyCompat { 15 | /* 16 | * Private constants 17 | */ 18 | private static final String PHONE_WINDOW_CLASS_NAME = "com.android.internal.policy.PhoneWindow"; 19 | private static final String POLICY_MANAGER_CLASS_NAME = "com.android.internal.policy.PolicyManager"; 20 | 21 | 22 | private PolicyCompat() { 23 | } 24 | 25 | 26 | /* 27 | * Private methods 28 | */ 29 | private static Window createPhoneWindow(Context context) { 30 | try { 31 | /* Find class */ 32 | Class cls = Class.forName(PHONE_WINDOW_CLASS_NAME); 33 | 34 | /* Get constructor */ 35 | Constructor c = cls.getConstructor(Context.class); 36 | 37 | /* Create instance */ 38 | return (Window)c.newInstance(context); 39 | } 40 | catch (ClassNotFoundException e) { 41 | throw new RuntimeException(PHONE_WINDOW_CLASS_NAME + " could not be loaded", e); 42 | } 43 | catch (Exception e) { 44 | throw new RuntimeException(PHONE_WINDOW_CLASS_NAME + " class could not be instantiated", e); 45 | } 46 | } 47 | 48 | private static Window makeNewWindow(Context context) { 49 | try { 50 | /* Find class */ 51 | Class cls = Class.forName(POLICY_MANAGER_CLASS_NAME); 52 | 53 | /* Find method */ 54 | Method m = cls.getMethod("makeNewWindow", Context.class); 55 | 56 | /* Invoke method */ 57 | return (Window)m.invoke(null, context); 58 | } 59 | catch (ClassNotFoundException e) { 60 | throw new RuntimeException(POLICY_MANAGER_CLASS_NAME + " could not be loaded", e); 61 | } 62 | catch (Exception e) { 63 | throw new RuntimeException(POLICY_MANAGER_CLASS_NAME + ".makeNewWindow could not be invoked", e); 64 | } 65 | } 66 | 67 | 68 | /* 69 | * Public methods 70 | */ 71 | public static Window createWindow(Context context) { 72 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) 73 | return createPhoneWindow(context); 74 | else 75 | return makeNewWindow(context); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/res/anim/activity_down_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/activity_down_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/activity_up_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/activity_up_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/ppwindow_hide.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/ppwindow_show.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/border_highlight.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable-hdpi/border_highlight.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/item_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable-hdpi/item_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/tv_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable-hdpi/tv_background.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_menu_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/bg_menu_shadow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/blur_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/blur_bg.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/checkbox_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/default_focus.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/default_focus.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/delete_btn_focus_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 14 | 15 | 19 | 20 | 21 | 31 | 32 | 33 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/delete_btn_unfocus_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 14 | 15 | 19 | 20 | 21 | 31 | 32 | 33 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/delete_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/delete_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/delete_icon_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/delete_icon_selected.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/dotted_ine.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/item_foucs_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/item_rectangle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/player_bg_gradient_dark.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/seek_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_delete_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_focus_item_home_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/set_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/set_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/shadow7.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/BriskTVLauncher/265753847435804c26ba4f393003680ac2597841/app/src/main/res/drawable/shadow7.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_clean_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_clean_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_delete_flag_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_focus_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_focus_item_home_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 14 | 15 | 19 | 20 | 21 | 31 | 32 | 33 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_popupwindow_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 14 | 15 | 19 | 20 | 21 | 31 | 32 | 33 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_select_flag.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_unfocus_item_home_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 14 | 15 | 16 | 26 | 27 | 28 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_unselect_flag.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_activity_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 25 | 26 | 27 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_focus_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |