├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── SrceenShot ├── download.png ├── rendering.gif ├── sina_weibo.jpg ├── st_1.png ├── st_2.png ├── st_3.png ├── st_4.png ├── st_5.png ├── st_6.png ├── st_7.png ├── st_8.png └── st_9.png ├── app ├── .gitignore ├── FunnyClips.apk ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── victor │ │ └── clips │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── fonts │ │ │ └── ZuoAnLianRen.ttf │ ├── java │ │ └── com │ │ │ └── victor │ │ │ └── clips │ │ │ ├── app │ │ │ └── App.kt │ │ │ ├── data │ │ │ ├── AuthorInfo.kt │ │ │ ├── CategoryInfo.kt │ │ │ ├── CategoryReq.kt │ │ │ ├── ConsumptionInfo.kt │ │ │ ├── CoverInfo.kt │ │ │ ├── Direction.kt │ │ │ ├── FollowData.kt │ │ │ ├── FollowHeader.kt │ │ │ ├── FollowInfo.kt │ │ │ ├── FollowItem.kt │ │ │ ├── FollowReq.kt │ │ │ ├── HomeData.kt │ │ │ ├── HomeItemInfo.kt │ │ │ ├── HomeReq.kt │ │ │ ├── IssueInfo.kt │ │ │ ├── Theme.kt │ │ │ └── TrendingReq.kt │ │ │ ├── interfaces │ │ │ ├── ColorUiInterface.kt │ │ │ ├── WindowInsetsHandler.kt │ │ │ └── WindowInsetsHandlingBehavior.kt │ │ │ ├── module │ │ │ ├── DataObservable.kt │ │ │ ├── SchemaModule.kt │ │ │ └── TimeChangeReceiver.kt │ │ │ ├── presenter │ │ │ ├── CategoryDetailPresenterImpl.kt │ │ │ ├── FollowPresenterImpl.kt │ │ │ ├── RankingPresenterImpl.kt │ │ │ ├── RelatedVideoPresenterImpl.kt │ │ │ ├── SearchVideoPresenterImpl.kt │ │ │ └── VideoCategoryPresenterImpl.kt │ │ │ ├── ui │ │ │ ├── AboutActivity.kt │ │ │ ├── BaseActivity.kt │ │ │ ├── CategoryActivity.kt │ │ │ ├── MainActivity.kt │ │ │ ├── SchemaProxyActivity.kt │ │ │ ├── SearchActivity.kt │ │ │ ├── SplashActivity.kt │ │ │ ├── ThemeSettingActivity.kt │ │ │ ├── VideoCategoryActivity.kt │ │ │ ├── VideoDetailActivity.kt │ │ │ ├── WebActivity.kt │ │ │ ├── WelcomeActivity.kt │ │ │ ├── adapter │ │ │ │ ├── AlphaAnimatorAdapter.kt │ │ │ │ ├── AnimatorAdapter.kt │ │ │ │ ├── BaseRecycleAdapter.kt │ │ │ │ ├── CategoryAdapter.kt │ │ │ │ ├── CategoryDetailAdapter.kt │ │ │ │ ├── ColorAdapter.kt │ │ │ │ ├── FollowAdapter.kt │ │ │ │ ├── FollowCellAdapter.kt │ │ │ │ ├── RankingAdapter.kt │ │ │ │ ├── RelatedVideoAdapter.kt │ │ │ │ ├── ScaleInAnimatorAdapter.kt │ │ │ │ ├── SearchVideoAdapter.kt │ │ │ │ ├── SlideInBottomAnimatorAdapter.kt │ │ │ │ ├── SlideInLeftAnimatorAdapter.kt │ │ │ │ ├── SlideInRightAnimatorAdapter.kt │ │ │ │ ├── SwingBottomInAnimationAdapter.kt │ │ │ │ └── VideoCategoryAdapter.kt │ │ │ ├── fragment │ │ │ │ ├── BaseFragment.kt │ │ │ │ ├── FollowFragment.kt │ │ │ │ ├── MonthlyRankingFragment.kt │ │ │ │ ├── TotalRankingFragment.kt │ │ │ │ ├── VideoCategoryFragment.kt │ │ │ │ └── WeeklyRankingFragment.kt │ │ │ ├── holder │ │ │ │ ├── BottomViewHolder.kt │ │ │ │ ├── ContentViewHolder.kt │ │ │ │ ├── FollowCellContentViewHolder.kt │ │ │ │ └── HeaderViewHolder.kt │ │ │ ├── view │ │ │ │ ├── CategoryDetailView.kt │ │ │ │ ├── FollowView.kt │ │ │ │ ├── RankingView.kt │ │ │ │ ├── RelatedVideoView.kt │ │ │ │ ├── SearchVideoView.kt │ │ │ │ └── VideoCategoryView.kt │ │ │ └── widget │ │ │ │ ├── ArcImageView.kt │ │ │ │ ├── ArcView.kt │ │ │ │ ├── CircleBorderImageView.kt │ │ │ │ ├── ColorFloatingActionButton.kt │ │ │ │ ├── ColorMovingTextView.kt │ │ │ │ ├── ColorRelativeLayout.kt │ │ │ │ ├── ColorTextView.kt │ │ │ │ ├── ElasticDragDismissFrameLayout.kt │ │ │ │ ├── FABBehaviour.kt │ │ │ │ ├── GravityDelegate.kt │ │ │ │ ├── GravityPagerSnapHelper.kt │ │ │ │ ├── GravitySnapHelper.kt │ │ │ │ ├── InsetsAppBarLayout.kt │ │ │ │ ├── InsetsCoordinatorLayout.kt │ │ │ │ ├── InsetsToolbar.kt │ │ │ │ ├── LMRecyclerView.kt │ │ │ │ ├── NoTouchViewPager.kt │ │ │ │ ├── PlayLayout.kt │ │ │ │ ├── ProgressWebView.kt │ │ │ │ ├── RoundRectImageView.kt │ │ │ │ ├── VerticalBannerView.kt │ │ │ │ └── parallaximageview │ │ │ │ ├── HorizontalAlphaStyle.kt │ │ │ │ ├── HorizontalMovingStyle.kt │ │ │ │ ├── HorizontalScaleStyle.kt │ │ │ │ ├── ScrollParallaxImageView.kt │ │ │ │ ├── VerticalAlphaStyle.kt │ │ │ │ ├── VerticalMovingStyle.kt │ │ │ │ └── VerticalScaleStyle.kt │ │ │ └── util │ │ │ ├── AnimUtil.kt │ │ │ ├── AppConfig.kt │ │ │ ├── AppUtil.kt │ │ │ ├── BitmapRoundCornerUtil.kt │ │ │ ├── ColorUiUtil.kt │ │ │ ├── ColorUtil.kt │ │ │ ├── ConfigLocal.kt │ │ │ ├── Constant.kt │ │ │ ├── CryptoUtils.kt │ │ │ ├── DataCleanManager.kt │ │ │ ├── DateUtil.kt │ │ │ ├── DensityUtil.kt │ │ │ ├── DeviceUtils.kt │ │ │ ├── HttpUtil.kt │ │ │ ├── ImageUtils.kt │ │ │ ├── ImgBlurUtil.kt │ │ │ ├── Loger.kt │ │ │ ├── ResUtils.kt │ │ │ ├── SharePreferencesUtil.kt │ │ │ ├── SnackbarUtil.kt │ │ │ ├── StatusBarUtil.kt │ │ │ ├── ThemeUtils.kt │ │ │ ├── ThreadUtils.kt │ │ │ ├── ToastUtils.kt │ │ │ ├── ViewAnimator.kt │ │ │ ├── ViewAttributeUtil.kt │ │ │ ├── ViewUtils.kt │ │ │ ├── WebConfig.kt │ │ │ ├── WindowInsetsCompatUtil.kt │ │ │ └── WindowInsetsHelper.kt │ └── res │ │ ├── anim │ │ ├── anim_activity_enter.xml │ │ ├── anim_activity_enter_back.xml │ │ ├── anim_activity_exit.xml │ │ ├── anim_activity_exit_back.xml │ │ ├── anim_bottom_enter.xml │ │ ├── anim_bottom_exit.xml │ │ ├── anim_fragment_enter.xml │ │ ├── anim_fragment_exit.xml │ │ ├── anim_left_enter.xml │ │ ├── anim_left_exit.xml │ │ ├── anim_rv_bottom.xml │ │ ├── anim_top_enter.xml │ │ ├── anim_top_exit.xml │ │ └── anim_welcome.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_color_cell.xml │ │ ├── blue_background.xml │ │ ├── blue_grey_background.xml │ │ ├── brown_background.xml │ │ ├── color_blue_grey_rbtn_selector.xml │ │ ├── color_blue_primary_rbtn_selector.xml │ │ ├── color_brown_primary_rbtn_selector.xml │ │ ├── color_cyan_rbtn_selector.xml │ │ ├── color_deep_orange_rbtn_selector.xml │ │ ├── color_deep_purple_primary_rbtn_selector.xml │ │ ├── color_green_primary_rbtn_selector.xml │ │ ├── color_indigo_rbtn_selector.xml │ │ ├── color_light_green_rbtn_selector.xml │ │ ├── color_lime_rbtn_selector.xml │ │ ├── color_orange_rbtn_selector.xml │ │ ├── color_pink_primary_rbtn_selector.xml │ │ ├── color_purple_primary_rbtn_selector.xml │ │ ├── color_red_primary_rbtn_selector.xml │ │ ├── color_teal_primary_rbtn_selector.xml │ │ ├── cyan_background.xml │ │ ├── deep_orange_background.xml │ │ ├── deep_purple_background.xml │ │ ├── green_background.xml │ │ ├── ic_category.xml │ │ ├── ic_check.xml │ │ ├── ic_close.xml │ │ ├── ic_dolar.xml │ │ ├── ic_favorite.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_play.xml │ │ ├── ic_search.xml │ │ ├── indigo_background.xml │ │ ├── item_switch_button_circle.xml │ │ ├── item_switch_track_circle.xml │ │ ├── light_green_background.xml │ │ ├── lime_background.xml │ │ ├── night_background.xml │ │ ├── orange_background.xml │ │ ├── pb_webview_layer.xml │ │ ├── pink_background.xml │ │ ├── purple_background.xml │ │ ├── red_background.xml │ │ └── teal_background.xml │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_category.xml │ │ ├── activity_main.xml │ │ ├── activity_schema_proxy.xml │ │ ├── activity_search.xml │ │ ├── activity_splash.xml │ │ ├── activity_theme_setting.xml │ │ ├── activity_video_category.xml │ │ ├── activity_video_detail.xml │ │ ├── activity_web.xml │ │ ├── activity_welcome.xml │ │ ├── content_main.xml │ │ ├── fragment_category.xml │ │ ├── fragment_follow.xml │ │ ├── fragment_monthly_ranking.xml │ │ ├── fragment_total_ranking.xml │ │ ├── fragment_video_detail.xml │ │ ├── fragment_weekly_ranking.xml │ │ ├── nav_header_main.xml │ │ ├── recyclerview_foot.xml │ │ ├── rv_category_cell.xml │ │ ├── rv_category_detail_cell.xml │ │ ├── rv_color_cell.xml │ │ ├── rv_follow_cell.xml │ │ ├── rv_follow_item_cell.xml │ │ ├── rv_ranking_cell.xml │ │ ├── rv_related_video_cell.xml │ │ ├── rv_search_video_cell.xml │ │ ├── rv_video_category_cell.xml │ │ ├── rv_video_category_normal_cell.xml │ │ ├── toolbar.xml │ │ └── web_progress_view.xml │ │ ├── menu │ │ ├── activity_main_drawer.xml │ │ ├── menu_main.xml │ │ ├── menu_search.xml │ │ └── menu_web.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_share.png │ │ ├── ic_video_comment.png │ │ ├── ic_video_likes.png │ │ └── ic_video_share.png │ │ ├── mipmap-xxhdpi │ │ ├── beauty1.jpg │ │ ├── beauty10.jpg │ │ ├── beauty2.jpg │ │ ├── beauty3.jpg │ │ ├── beauty4.jpg │ │ ├── beauty5.jpg │ │ ├── beauty6.jpg │ │ ├── beauty7.jpg │ │ ├── beauty8.jpg │ │ ├── beauty9.jpg │ │ ├── default_img.png │ │ ├── ic_about.png │ │ ├── ic_avatar.png │ │ ├── ic_clear.png │ │ ├── ic_copyright.png │ │ ├── ic_exit_fullscreen.png │ │ ├── ic_fullscreen.png │ │ ├── ic_github.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_settings.png │ │ ├── ic_up.png │ │ ├── ic_update.png │ │ ├── img_about_bg.jpg │ │ ├── img_ali.png │ │ ├── img_header.jpg │ │ ├── img_live.png │ │ ├── img_welcome.jpg │ │ ├── img_wx.png │ │ └── projects_bg.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ └── welcome.mp4 │ │ ├── values-v21 │ │ └── styles.xml │ │ └── values │ │ ├── arrays.xml │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── victor │ └── clips │ └── ExampleUnitTest.kt ├── build.gradle ├── docs ├── build.properties ├── upToFir.py ├── update.json └── victor_keystore.jks ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction: 2 | This is a short video application of MaterialDesign design style coding by kotlin. 3 | The video resources are from open source. This application is only for learning and use. 4 | Please do not use it! 5 | 6 | # Rendering: 7 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/rendering.gif) 8 | 9 | # Screenshot: 10 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_1.png) 11 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_2.png) 12 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_3.png) 13 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_4.png) 14 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_5.png) 15 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_6.png) 16 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_7.png) 17 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_8.png) 18 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/st_9.png) 19 | 20 | # Download app 21 | ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/download.png) 22 | 23 | [Download stamp here](https://github.com/Victor2018/FunnyClips/raw/master/app/FunnyClips.apk) 24 | 25 | # Focus on developers: 26 | - Gmail: victor423099@gmail.com 27 | - Sina Weibo 28 | - ![image](https://github.com/Victor2018/FunnyClips/raw/master/SrceenShot/sina_weibo.jpg) 29 | 30 | ## License 31 | 32 | Copyright (c) 2019 Victor 33 | 34 | Licensed under the Apache License, Version 2.0 (the "License"); 35 | you may not use this file except in compliance with the License. 36 | You may obtain a copy of the License at 37 | 38 | http://www.apache.org/licenses/LICENSE-2.0 39 | 40 | Unless required by applicable law or agreed to in writing, software 41 | distributed under the License is distributed on an "AS IS" BASIS, 42 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 43 | See the License for the specific language governing permissions and 44 | limitations under the License. 45 | 46 | 47 | -------------------------------------------------------------------------------- /SrceenShot/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/download.png -------------------------------------------------------------------------------- /SrceenShot/rendering.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/rendering.gif -------------------------------------------------------------------------------- /SrceenShot/sina_weibo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/sina_weibo.jpg -------------------------------------------------------------------------------- /SrceenShot/st_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_1.png -------------------------------------------------------------------------------- /SrceenShot/st_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_2.png -------------------------------------------------------------------------------- /SrceenShot/st_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_3.png -------------------------------------------------------------------------------- /SrceenShot/st_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_4.png -------------------------------------------------------------------------------- /SrceenShot/st_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_5.png -------------------------------------------------------------------------------- /SrceenShot/st_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_6.png -------------------------------------------------------------------------------- /SrceenShot/st_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_7.png -------------------------------------------------------------------------------- /SrceenShot/st_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_8.png -------------------------------------------------------------------------------- /SrceenShot/st_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/SrceenShot/st_9.png -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/FunnyClips.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/FunnyClips.apk -------------------------------------------------------------------------------- /app/src/androidTest/java/com/victor/clips/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.victor.clips", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/assets/fonts/ZuoAnLianRen.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/assets/fonts/ZuoAnLianRen.ttf -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/app/App.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.app 2 | 3 | import android.app.Application 4 | import com.tencent.bugly.crashreport.CrashReport 5 | 6 | /* 7 | * ----------------------------------------------------------------- 8 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 9 | * ----------------------------------------------------------------- 10 | * File: App.kt 11 | * Author: Victor 12 | * Date: 2018/8/16 11:38 13 | * Description: 14 | * ----------------------------------------------------------------- 15 | */ 16 | class App : Application () { 17 | companion object { 18 | private var instance : App ?= null 19 | fun get() = instance!! 20 | } 21 | 22 | override fun onCreate() { 23 | super.onCreate() 24 | instance = this 25 | CrashReport.initCrashReport(getApplicationContext()); 26 | } 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/AuthorInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: AuthorInfo.kt 10 | * Author: Victor 11 | * Date: 2018/8/30 14:24 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class AuthorInfo: Serializable { 16 | var id: Int = 0 17 | var videoNum: Int = 0 18 | var icon: String? = null 19 | var name: String? = null 20 | var description: String? = null 21 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/CategoryInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: CategoryInfo.java 8 | * Author: Victor 9 | * Date: 2019/10/31 11:47 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class CategoryInfo { 14 | var categoryName: String? = null 15 | var categoryImgRes: Int = 0 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/CategoryReq.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: CategoryReq.java 10 | * Author: Victor 11 | * Date: 2019/10/15 14:03 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class CategoryReq:Serializable { 16 | var id: Int = 0 17 | var tagId: Int = 0 18 | var defaultAuthorId: Int = 0 19 | var name: String? = null 20 | var description: String? = null 21 | var bgPicture: String? = null 22 | var headerImage: String? = null 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/ConsumptionInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: ConsumptionInfo.kt 10 | * Author: Victor 11 | * Date: 2018/8/30 14:24 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class ConsumptionInfo: Serializable { 16 | var collectionCount: Int = 0 17 | var shareCount: Int = 0 18 | var replyCount: Int = 0 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/CoverInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: IssueInfo.java 10 | * Author: Victor 11 | * Date: 2018/8/30 14:24 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class CoverInfo: Serializable { 16 | var feed: String? = null 17 | var detail: String? = null 18 | var blurred: String? = null 19 | var homepage: String? = null 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/Direction.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: Direction.java 8 | * Author: Victor 9 | * Date: 2018/9/6 11:04 10 | * Description: Direction sealed class used as enum for defining directions 11 | * ----------------------------------------------------------------- 12 | */ 13 | sealed class Direction { 14 | class LEFT : Direction() 15 | class RIGHT : Direction() 16 | class UP : Direction() 17 | class DOWN : Direction() 18 | class NONE : Direction() 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/FollowData.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: FollowData.java 8 | * Author: Victor 9 | * Date: 2019/11/1 10:02 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class FollowData { 14 | var itemType: String? = null 15 | var itemId: Int = 0 16 | var followed: Boolean = false 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/FollowHeader.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: FollowHeader.java 8 | * Author: Victor 9 | * Date: 2019/11/1 9:59 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class FollowHeader { 14 | var id: Int = 0 15 | var uid: Int = 0 16 | var icon: String? = null 17 | var iconType: String? = null 18 | var title: String? = null 19 | var subTitle: String? = null 20 | var description: String? = null 21 | var actionUrl: String? = null 22 | var adTrack: String? = null 23 | var ifPgc: Boolean = false 24 | var expert: Boolean = false 25 | var ifShowNotificationIcon: Boolean = false 26 | var follow: FollowData? = null 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/FollowInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: FollowInfo.java 8 | * Author: Victor 9 | * Date: 2019/11/1 9:58 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class FollowInfo { 14 | var count: Int = 0 15 | var dataType: String? = null 16 | var adTrack: String? = null 17 | var footer: String? = null 18 | var header: FollowHeader? = null 19 | var itemList: List? = null 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/FollowItem.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: FollowItem.java 8 | * Author: Victor 9 | * Date: 2019/11/1 9:55 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class FollowItem { 14 | var id: Int = 0 15 | var adIndex: Int = 0 16 | var type: String? = null 17 | var tag: String? = null 18 | var data: FollowInfo? = null 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/FollowReq.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: FollowReq.java 10 | * Author: Victor 11 | * Date: 2019/10/15 14:03 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class FollowReq { 16 | var count: Int = 0 17 | var total: Int = 0 18 | var refreshCount: Int = 0 19 | var lastStartId: Int = 0 20 | var nextPageUrl: String? = null 21 | var adExist: Boolean? = false 22 | var updateTime: String? = null 23 | var headerImage: String? = null 24 | 25 | var itemList:List? = null 26 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/HomeData.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: HomeData.kt 10 | * Author: Victor 11 | * Date: 2018/8/30 14:24 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class HomeData: Serializable { 16 | var dataType: String? = null 17 | var id: Int = 0 18 | var title: String? = null 19 | var description: String? = null 20 | var library: String? = null 21 | var resourceType: String? = null 22 | var category: String? = null 23 | var playUrl: String? = null 24 | var duration: Int = 0 25 | var releaseTime: Long = 0 26 | var date: String? = null 27 | var descriptionEditor: String? = null 28 | var consumption: ConsumptionInfo? = null 29 | var author: AuthorInfo? = null 30 | var cover: CoverInfo? = null 31 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/HomeItemInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | import java.io.Serializable 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: HomeItemInfo.kt 10 | * Author: Victor 11 | * Date: 2018/8/30 14:24 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class HomeItemInfo: Serializable { 16 | var type: String? = null 17 | var id: Int = 0 18 | var adIndex: Int = 0 19 | var data: HomeData? = null 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/HomeReq.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: HomeReq.java 8 | * Author: Victor 9 | * Date: 2018/8/30 14:23 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class HomeReq { 14 | var nextPageUrl: String? = null 15 | var newestIssueType: String? = null 16 | var nextPublishTime: Long = 0 17 | var issueList: List? = null 18 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/IssueInfo.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: IssueInfo.java 8 | * Author: Victor 9 | * Date: 2018/8/30 14:24 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class IssueInfo { 14 | var releaseTime: Long = 0 15 | var date: Long = 0 16 | var publishTime: Long = 0 17 | var count: Int = 0 18 | var type: String? = null 19 | var itemList: List? = null 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/Theme.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: Theme.java 8 | * Author: Victor 9 | * Date: 2019/10/24 16:32 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | enum class Theme { 14 | Blue, 15 | Red, 16 | Brown, 17 | Purple, 18 | Teal, 19 | Green, 20 | Pink, 21 | Orange, 22 | DeepPurple, 23 | Indigo, 24 | Cyan, 25 | LightGreen, 26 | Lime, 27 | DeepOrange, 28 | BlueGrey, 29 | Night 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/data/TrendingReq.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.data 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: TrendingReq.java 8 | * Author: Victor 9 | * Date: 2018/8/30 14:23 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class TrendingReq { 14 | var nextPageUrl: String? = null 15 | var itemList: List? = null 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/interfaces/ColorUiInterface.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.interfaces 2 | 3 | import android.content.res.Resources 4 | import android.content.res.Resources.Theme 5 | import android.view.View 6 | 7 | 8 | /* 9 | * ----------------------------------------------------------------- 10 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 11 | * ----------------------------------------------------------------- 12 | * File: ColorUiInterface.java 13 | * Author: Victor 14 | * Date: 2019/10/14 16:08 15 | * Description: 16 | * ----------------------------------------------------------------- 17 | */ 18 | interface ColorUiInterface { 19 | fun getView(): View 20 | 21 | fun setTheme(themeId: Resources.Theme) 22 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/interfaces/WindowInsetsHandler.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.interfaces 2 | 3 | import android.graphics.Rect 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: WindowInsetsHandler.java 10 | * Author: Victor 11 | * Date: 2019/10/14 16:09 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | interface WindowInsetsHandler { 16 | fun onApplyWindowInsets(insets: Rect): Boolean 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/interfaces/WindowInsetsHandlingBehavior.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.interfaces 2 | 3 | import android.graphics.Rect 4 | import android.support.design.widget.CoordinatorLayout 5 | import android.view.View 6 | 7 | /* 8 | * ----------------------------------------------------------------- 9 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 10 | * ----------------------------------------------------------------- 11 | * File: WindowInsetsHandlingBehavior.java 12 | * Author: Victor 13 | * Date: 2019/10/14 16:24 14 | * Description: 15 | * ----------------------------------------------------------------- 16 | */ 17 | interface WindowInsetsHandlingBehavior { 18 | fun onApplyWindowInsets(layout: CoordinatorLayout, child: View, insets: Rect): Boolean 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/module/DataObservable.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.module 2 | 3 | import java.util.* 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: DataObservable.java 10 | * Author: Victor 11 | * Date: 2018/8/30 15:34 12 | * Description: 13 | * 观察者模式 14 | * 定义对象间一种一对多的依赖关系,使得当每一个对象改变状态,则所有依赖于它的对象都会得到通知并自动更新。 15 | * 观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。 16 | * 这个主题对象在状态上发生变化时,会通知所有观察者对象,使它们能够自动更新自己。 17 | * ----------------------------------------------------------------- 18 | */ 19 | class DataObservable : Observable() { 20 | private val TAG = "DataObservable" 21 | private object Holder { val instance = DataObservable()} 22 | private var data: Any? = null 23 | 24 | companion object { 25 | val instance: DataObservable by lazy { DataObservable.Holder.instance } 26 | } 27 | fun setData(data: Any) { 28 | this.data = data 29 | setChanged() 30 | //只有在setChanged()被调用后notifyObservers()才会去调用update(),否则什么都不干 31 | notifyObservers(data) 32 | } 33 | 34 | fun getData(): Any? { 35 | return data 36 | } 37 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/module/TimeChangeReceiver.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.module 2 | 3 | import android.content.BroadcastReceiver 4 | import android.content.Context 5 | import android.content.Intent 6 | import android.os.Message 7 | import com.victor.clips.util.Constant 8 | import com.victor.clips.util.Loger 9 | import org.victor.funny.util.ToastUtils 10 | import org.victor.khttp.library.util.MainHandler 11 | import java.text.SimpleDateFormat 12 | import java.util.* 13 | 14 | /* 15 | * ----------------------------------------------------------------- 16 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 17 | * ----------------------------------------------------------------- 18 | * File: TimeChangeReceiver 19 | * Author: Victor 20 | * Date: 2019/12/20 14:17 21 | * Description: 22 | * ----------------------------------------------------------------- 23 | */ 24 | 25 | class TimeChangeReceiver: BroadcastReceiver() { 26 | var TAG = "TimeChangeReceiver" 27 | override fun onReceive(context: Context?, intent: Intent?) { 28 | when(intent?.action) { 29 | Intent.ACTION_TIME_TICK -> { 30 | var isDayLight = isTimeDayLight(System.currentTimeMillis()) 31 | Loger.e(TAG,"isDayLight = " + isDayLight) 32 | var msg = MainHandler.get().obtainMessage(Constant.Msg.TIME_CHANGE) 33 | msg.arg1 = if (isDayLight) 1 else 0 34 | MainHandler.get().sendMessage(msg); 35 | } 36 | } 37 | } 38 | 39 | /* 40 | * 是否是白天 41 | */ 42 | fun isTimeDayLight(currentTime: Long): Boolean { 43 | val nowDate = Date(currentTime) 44 | val simpleDate = SimpleDateFormat("HH:MM", Locale.CHINA) 45 | val nowTime = simpleDate.format(nowDate) 46 | val startTime = simpleDate.format(simpleDate.parse("7:00")) 47 | val endTime = simpleDate.format(simpleDate.parse("22:00")) 48 | if (nowTime in startTime..endTime) { 49 | return true 50 | } 51 | return false 52 | 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/presenter/CategoryDetailPresenterImpl.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.presenter 2 | 3 | import com.victor.clips.data.TrendingReq 4 | import com.victor.clips.ui.view.CategoryDetailView 5 | import org.victor.khttp.library.annotation.HttpParms 6 | import org.victor.khttp.library.data.Request 7 | import org.victor.khttp.library.inject.HttpInject 8 | import org.victor.khttp.library.presenter.impl.BasePresenterImpl 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: CategoryDetailPresenterImpl.kt 15 | * Author: Victor 16 | * Date: 2018/8/24 13:49 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class CategoryDetailPresenterImpl(var categoryDetailView: CategoryDetailView?): BasePresenterImpl() { 21 | var TAG = "CategoryDetailPresenterImpl" 22 | /*Presenter作为中间层,持有View和Model的引用*/ 23 | override fun onComplete(data: Any?, msg: String) { 24 | categoryDetailView?.OnCategoryDetail(data,msg) 25 | } 26 | 27 | override fun detachView() { 28 | categoryDetailView = null 29 | } 30 | 31 | @HttpParms (method = Request.GET,responseCls = TrendingReq::class) 32 | override fun sendRequest(url: String, header: HashMap?, parms: String?) { 33 | HttpInject.inject(this); 34 | super.sendRequest(url, header, parms) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/presenter/FollowPresenterImpl.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.presenter 2 | 3 | import com.victor.clips.data.FollowReq 4 | import com.victor.clips.ui.view.FollowView 5 | import org.victor.khttp.library.annotation.HttpParms 6 | import org.victor.khttp.library.data.Request 7 | import org.victor.khttp.library.inject.HttpInject 8 | import org.victor.khttp.library.presenter.impl.BasePresenterImpl 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: FollowPresenterImpl.kt 15 | * Author: Victor 16 | * Date: 2018/8/24 13:49 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class FollowPresenterImpl(var followView: FollowView?): BasePresenterImpl() { 21 | var TAG = "FollowPresenterImpl" 22 | /*Presenter作为中间层,持有View和Model的引用*/ 23 | override fun onComplete(data: Any?, msg: String) { 24 | followView?.OnFollow(data,msg) 25 | } 26 | 27 | override fun detachView() { 28 | followView = null 29 | } 30 | 31 | @HttpParms (method = Request.GET,responseCls = FollowReq::class) 32 | override fun sendRequest(url: String, header: HashMap?, parms: String?) { 33 | HttpInject.inject(this); 34 | super.sendRequest(url, header, parms) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/presenter/RankingPresenterImpl.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.presenter 2 | 3 | import com.victor.clips.data.TrendingReq 4 | import com.victor.clips.ui.view.RankingView 5 | import org.victor.khttp.library.annotation.HttpParms 6 | import org.victor.khttp.library.data.Request 7 | import org.victor.khttp.library.inject.HttpInject 8 | import org.victor.khttp.library.presenter.impl.BasePresenterImpl 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: RankingPresenterImpl Author: Victor 15 | * Date: 2018/8/24 13:49 16 | * Description: 17 | * ----------------------------------------------------------------- 18 | */ 19 | class RankingPresenterImpl(var rankingView: RankingView?): BasePresenterImpl() { 20 | var TAG = "RankingPresenterImpl" 21 | /*Presenter作为中间层,持有View和Model的引用*/ 22 | override fun onComplete(data: Any?, msg: String) { 23 | rankingView?.OnRanking(data,msg) 24 | } 25 | 26 | override fun detachView() { 27 | rankingView = null 28 | } 29 | 30 | @HttpParms (method = Request.GET,responseCls = TrendingReq::class) 31 | override fun sendRequest(url: String, header: HashMap?, parms: String?) { 32 | HttpInject.inject(this); 33 | super.sendRequest(url, header, parms) 34 | } 35 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/presenter/RelatedVideoPresenterImpl.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.presenter 2 | 3 | import com.victor.clips.data.TrendingReq 4 | import com.victor.clips.ui.view.RelatedVideoView 5 | import org.victor.khttp.library.annotation.HttpParms 6 | import org.victor.khttp.library.data.Request 7 | import org.victor.khttp.library.inject.HttpInject 8 | import org.victor.khttp.library.presenter.impl.BasePresenterImpl 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: RelatedVideoPresenterImpl.kt 15 | * Author: Victor 16 | * Date: 2018/8/24 13:49 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class RelatedVideoPresenterImpl(var relatedVideoView: RelatedVideoView?): BasePresenterImpl() { 21 | var TAG = "RelatedVideoPresenterImpl" 22 | /*Presenter作为中间层,持有View和Model的引用*/ 23 | override fun onComplete(data: Any?, msg: String) { 24 | relatedVideoView?.OnRelatedVideo(data,msg) 25 | } 26 | 27 | override fun detachView() { 28 | relatedVideoView = null 29 | } 30 | 31 | @HttpParms (method = Request.GET,responseCls = TrendingReq::class) 32 | override fun sendRequest(url: String, header: HashMap?, parms: String?) { 33 | HttpInject.inject(this); 34 | super.sendRequest(url, header, parms) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/presenter/SearchVideoPresenterImpl.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.presenter 2 | 3 | import com.victor.clips.data.TrendingReq 4 | import com.victor.clips.ui.view.SearchVideoView 5 | import org.victor.khttp.library.annotation.HttpParms 6 | import org.victor.khttp.library.data.Request 7 | import org.victor.khttp.library.inject.HttpInject 8 | import org.victor.khttp.library.presenter.impl.BasePresenterImpl 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: SearchVideoPresenterImplrImpl.kt 15 | * Author: Victor 16 | * Date: 2018/8/24 13:49 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class SearchVideoPresenterImpl(var searchVideoView: SearchVideoView?): BasePresenterImpl() { 21 | var TAG = "SearchVideoPresenterImpl" 22 | /*Presenter作为中间层,持有View和Model的引用*/ 23 | override fun onComplete(data: Any?, msg: String) { 24 | searchVideoView?.OnSearchVideo(data,msg) 25 | } 26 | 27 | override fun detachView() { 28 | searchVideoView = null 29 | } 30 | 31 | @HttpParms (method = Request.GET,responseCls = TrendingReq::class) 32 | override fun sendRequest(url: String, header: HashMap?, parms: String?) { 33 | HttpInject.inject(this); 34 | super.sendRequest(url, header, parms) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/presenter/VideoCategoryPresenterImpl.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.presenter 2 | 3 | import com.victor.clips.data.CategoryReq 4 | import com.victor.clips.ui.view.VideoCategoryView 5 | import org.victor.khttp.library.annotation.HttpParms 6 | import org.victor.khttp.library.data.Request 7 | import org.victor.khttp.library.inject.HttpInject 8 | import org.victor.khttp.library.presenter.impl.BasePresenterImpl 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: VideoCategoryPresenterImplrImpl.kt 15 | * Author: Victor 16 | * Date: 2018/8/24 13:49 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class VideoCategoryPresenterImpl(var categoryView: VideoCategoryView?): BasePresenterImpl() { 21 | var TAG = "VideoCategoryPresenterImpl" 22 | /*Presenter作为中间层,持有View和Model的引用*/ 23 | override fun onComplete(data: Any?, msg: String) { 24 | categoryView?.OnVideoCategory(data,msg) 25 | } 26 | 27 | override fun detachView() { 28 | categoryView = null 29 | } 30 | 31 | @HttpParms (method = Request.GET,responseCls = CategoryReq::class) 32 | override fun sendRequest(url: String, header: HashMap?, parms: String?) { 33 | HttpInject.inject(this); 34 | super.sendRequest(url, header, parms) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/SchemaProxyActivity.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.os.Bundle 6 | import android.support.v7.app.AppCompatActivity 7 | import com.victor.clips.R 8 | import com.victor.clips.module.SchemaModule 9 | 10 | class SchemaProxyActivity : AppCompatActivity() { 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_schema_proxy) 15 | 16 | val temp = intent.data 17 | dispatchScheme(temp) 18 | } 19 | 20 | override fun onNewIntent(intent: Intent?) { 21 | super.onNewIntent(intent) 22 | dispatchScheme(intent?.data) 23 | } 24 | 25 | private fun dispatchScheme(data: Uri?) { 26 | SchemaModule.dispatchSchema(this, data) 27 | finish() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui 2 | 3 | import android.Manifest 4 | import android.media.MediaPlayer 5 | import android.os.Bundle 6 | import com.victor.clips.R 7 | import com.victor.clips.util.ConfigLocal 8 | import android.net.Uri 9 | import com.victor.clips.util.Loger 10 | import kotlinx.android.synthetic.main.activity_splash.* 11 | import permission.victor.com.library.OnPermissionCallback 12 | import android.support.v7.app.AlertDialog 13 | import permission.victor.com.library.PermissionHelper 14 | import java.util.* 15 | import android.content.DialogInterface 16 | 17 | 18 | class SplashActivity : BaseActivity(), MediaPlayer.OnCompletionListener { 19 | 20 | override fun onCompletion(mp: MediaPlayer?) { 21 | toWelcome() 22 | } 23 | 24 | override fun getLayoutResource(): Int { 25 | return R.layout.activity_splash 26 | } 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | initialize() 31 | initData() 32 | } 33 | 34 | fun initialize () { 35 | mVvPlay.setOnCompletionListener(this); 36 | } 37 | 38 | fun initData () { 39 | var need = ConfigLocal.needPlayWelcomeVideoGuide(this,"") 40 | if (need) { 41 | ConfigLocal.updateWelcomeVideoPlayGuide(this, "", false) 42 | val uri = Uri.parse("android.resource://" + packageName + "/" + R.raw.welcome) 43 | mVvPlay.setVideoURI(uri) 44 | mVvPlay.start() 45 | return 46 | } 47 | toWelcome() 48 | } 49 | 50 | fun toWelcome () { 51 | WelcomeActivity.intentStart(this) 52 | finish() 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/WelcomeActivity.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui 2 | 3 | import android.content.Intent 4 | import android.graphics.Typeface 5 | import android.os.Bundle 6 | import android.os.Message 7 | import android.support.v7.app.AppCompatActivity 8 | import android.view.Menu 9 | import android.view.MenuItem 10 | import com.victor.clips.R 11 | import com.victor.clips.util.Constant.Msg.Companion.ENTER_HAPPY_COAST 12 | import org.victor.khttp.library.util.MainHandler 13 | import android.view.animation.AnimationUtils 14 | import com.victor.clips.util.AppUtil 15 | import com.victor.clips.util.Constant 16 | import kotlinx.android.synthetic.main.activity_welcome.* 17 | 18 | 19 | class WelcomeActivity : BaseActivity(),MainHandler.OnMainHandlerImpl { 20 | val delayMillis: Long = 1000; 21 | 22 | var fontStyle: Typeface? = null 23 | 24 | override fun handleMainMessage(message: Message?) { 25 | when (message?.what) { 26 | ENTER_HAPPY_COAST -> { 27 | MainActivity.intentStart(this) 28 | finish() 29 | } 30 | } 31 | } 32 | 33 | companion object { 34 | fun intentStart (activity: AppCompatActivity) { 35 | activity.startActivity(Intent(activity, WelcomeActivity::class.java)) 36 | } 37 | } 38 | 39 | override fun getLayoutResource(): Int { 40 | return R.layout.activity_welcome 41 | } 42 | 43 | override fun onCreate(savedInstanceState: Bundle?) { 44 | super.onCreate(savedInstanceState) 45 | initialize() 46 | } 47 | 48 | fun initialize () { 49 | MainHandler.get().register(this) 50 | 51 | fontStyle = Typeface.createFromAsset(assets, "fonts/ZuoAnLianRen.ttf"); 52 | mTvAppName.typeface = fontStyle 53 | mTvVersion.typeface = fontStyle 54 | 55 | mTvAppName.setText(AppUtil.getAppName(this)) 56 | mTvVersion.setText(getString(R.string.current_version) + AppUtil.getAppVersionName(this)) 57 | val animation = AnimationUtils.loadAnimation(this, R.anim.anim_welcome) 58 | mClWelcome.startAnimation(animation) 59 | MainHandler.get().sendEmptyMessageDelayed(ENTER_HAPPY_COAST,delayMillis) 60 | } 61 | 62 | override fun onDestroy() { 63 | super.onDestroy() 64 | MainHandler.get().unregister(this) 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/AlphaAnimatorAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.animation.Animator 4 | import android.animation.ObjectAnimator 5 | import android.support.v7.widget.RecyclerView 6 | import android.view.View 7 | 8 | 9 | /* 10 | * ----------------------------------------------------------------- 11 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 12 | * ----------------------------------------------------------------- 13 | * File: AlphaAnimatorAdapter.java 14 | * Author: Victor 15 | * Date: 2019/11/11 16:38 16 | * Description: 17 | * ----------------------------------------------------------------- 18 | */ 19 | class AlphaAnimatorAdapter 20 | (var adapter: RecyclerView.Adapter, var recyclerView: RecyclerView): AnimatorAdapter(adapter,recyclerView) { 21 | private val ALPHA = "alpha" 22 | 23 | override fun getAnimators(view: View): Array { 24 | return arrayOf(ObjectAnimator.ofFloat(view, ALPHA, 0f, 1f)); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/ColorAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.content.Context 4 | import android.support.v7.widget.RecyclerView 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.AdapterView 8 | import com.victor.clips.R 9 | import com.victor.clips.ui.holder.ContentViewHolder 10 | import kotlinx.android.synthetic.main.rv_color_cell.view.* 11 | 12 | 13 | /* 14 | * ----------------------------------------------------------------- 15 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 16 | * ----------------------------------------------------------------- 17 | * File: ColorAdapter.java 18 | * Author: Victor 19 | * Date: 2018/9/28 14:52 20 | * Description: 21 | * ----------------------------------------------------------------- 22 | */ 23 | class ColorAdapter(context: Context, listener: AdapterView.OnItemClickListener): BaseRecycleAdapter(context,listener) { 24 | var currentPosition = -1 25 | override fun onCreateHeadVHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder? { 26 | return null 27 | } 28 | 29 | override fun onBindHeadVHolder(viewHolder: RecyclerView.ViewHolder, data: Int, position: Int) { 30 | } 31 | 32 | override fun onCreateContentVHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { 33 | return ContentViewHolder(mLayoutInflater!!.inflate(R.layout.rv_color_cell, parent, false)) 34 | } 35 | 36 | override fun onBindContentVHolder(viewHolder: RecyclerView.ViewHolder, data: Int, position: Int) { 37 | val contentViewHolder = viewHolder as ContentViewHolder 38 | 39 | contentViewHolder.itemView.mCvColor.setCardBackgroundColor(data) 40 | if (currentPosition == position) { 41 | contentViewHolder.itemView.mViewFocus.visibility = View.VISIBLE 42 | } else { 43 | contentViewHolder.itemView.mViewFocus.visibility = View.GONE 44 | } 45 | contentViewHolder.setOnItemClickListener(mOnItemClickListener) 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/ScaleInAnimatorAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.animation.Animator 4 | import android.animation.ObjectAnimator 5 | import android.support.v7.widget.RecyclerView 6 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 7 | import android.view.View 8 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 9 | import android.view.View.SCALE_Y 10 | import android.view.View.SCALE_X 11 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 12 | 13 | 14 | 15 | 16 | 17 | 18 | /* 19 | * ----------------------------------------------------------------- 20 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 21 | * ----------------------------------------------------------------- 22 | * File: ScaleInAnimatorAdapter.java 23 | * Author: Victor 24 | * Date: 2019/11/11 16:38 25 | * Description: 26 | * ----------------------------------------------------------------- 27 | */ 28 | class ScaleInAnimatorAdapter 29 | (var adapter: RecyclerView.Adapter, var recyclerView: RecyclerView): AnimatorAdapter(adapter,recyclerView) { 30 | 31 | private val DEFAULT_SCALE_FROM = 0.6f 32 | 33 | private val SCALE_X = "scaleX" 34 | private val SCALE_Y = "scaleY" 35 | 36 | private val mScaleFrom: Float = 0f 37 | 38 | override fun getAnimators(view: View): Array { 39 | val scaleX = ObjectAnimator.ofFloat(view, SCALE_X, mScaleFrom, 1f) 40 | val scaleY = ObjectAnimator.ofFloat(view, SCALE_Y, mScaleFrom, 1f) 41 | return arrayOf(scaleX,scaleY) 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/SlideInBottomAnimatorAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.animation.Animator 4 | import android.animation.ObjectAnimator 5 | import android.support.v7.widget.RecyclerView 6 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 7 | import android.view.View 8 | 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: SlideInBottomAnimatorAdapter.java 15 | * Author: Victor 16 | * Date: 2019/11/11 16:38 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class SlideInBottomAnimatorAdapter 21 | (var adapter: RecyclerView.Adapter, var recyclerView: RecyclerView): AnimatorAdapter(adapter,recyclerView) { 22 | private val TRANSLATION_Y = "translationY" 23 | 24 | override fun getAnimators(view: View): Array { 25 | var anim = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, (mRecyclerView.measuredHeight shr 1).toFloat(), 0f) 26 | return arrayOf(anim) 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/SlideInLeftAnimatorAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.animation.Animator 4 | import android.animation.ObjectAnimator 5 | import android.support.v7.widget.RecyclerView 6 | import android.view.View 7 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 8 | import android.view.View.TRANSLATION_Y 9 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 10 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | /* 19 | * ----------------------------------------------------------------- 20 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 21 | * ----------------------------------------------------------------- 22 | * File: SlideInLeftAnimatorAdapter.java 23 | * Author: Victor 24 | * Date: 2019/11/11 16:08 25 | * Description: 26 | * ----------------------------------------------------------------- 27 | */ 28 | class SlideInLeftAnimatorAdapter 29 | (var adapter: RecyclerView.Adapter, var recyclerView: RecyclerView): AnimatorAdapter(adapter,recyclerView) { 30 | private val TRANSLATION_X = "translationX" 31 | 32 | override fun getAnimators(view: View): Array { 33 | var anim = ObjectAnimator.ofFloat(view, TRANSLATION_X, 0f - mRecyclerView.layoutManager!!.getWidth(), 0f) 34 | return arrayOf(anim) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/SlideInRightAnimatorAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.animation.Animator 4 | import android.animation.ObjectAnimator 5 | import android.support.v7.widget.RecyclerView 6 | import android.view.View 7 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 8 | import android.view.View.TRANSLATION_Y 9 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 10 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 11 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | /* 22 | * ----------------------------------------------------------------- 23 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 24 | * ----------------------------------------------------------------- 25 | * File: SlideInLeftAnimatorAdapter.java 26 | * Author: Victor 27 | * Date: 2019/11/11 16:08 28 | * Description: 29 | * ----------------------------------------------------------------- 30 | */ 31 | class SlideInRightAnimatorAdapter 32 | (var adapter: RecyclerView.Adapter, var recyclerView: RecyclerView): AnimatorAdapter(adapter,recyclerView) { 33 | private val TRANSLATION_X = "translationX" 34 | 35 | override fun getAnimators(view: View): Array { 36 | var anim = ObjectAnimator.ofFloat(view, TRANSLATION_X, mRecyclerView.layoutManager!!.getWidth().toFloat(), 0f) 37 | return arrayOf(anim) 38 | } 39 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/adapter/SwingBottomInAnimationAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.adapter 2 | 3 | import android.animation.Animator 4 | import android.animation.ObjectAnimator 5 | import android.support.v7.widget.RecyclerView 6 | import android.view.View 7 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 8 | import android.view.View.TRANSLATION_Y 9 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 10 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 11 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 12 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 13 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | /* 28 | * ----------------------------------------------------------------- 29 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 30 | * ----------------------------------------------------------------- 31 | * File: SwingBottomInAnimationAdapter.java 32 | * Author: Victor 33 | * Date: 2019/11/11 16:08 34 | * Description: 35 | * ----------------------------------------------------------------- 36 | */ 37 | class SwingBottomInAnimationAdapter 38 | (var adapter: RecyclerView.Adapter, var recyclerView: RecyclerView): AnimatorAdapter(adapter,recyclerView) { 39 | private val TRANSLATION_Y = "translationY" 40 | 41 | override fun getAnimators(view: View): Array { 42 | val mOriginalY = mRecyclerView.layoutManager!!.getDecoratedTop(view).toFloat() 43 | val mDeltaY = mRecyclerView.height - mOriginalY 44 | var anim = ObjectAnimator.ofFloat(view, TRANSLATION_Y, mDeltaY.toFloat(), 0f) 45 | return arrayOf(anim) 46 | } 47 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/holder/BottomViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.holder 2 | 3 | import android.support.v7.widget.RecyclerView 4 | import android.view.View 5 | import android.widget.LinearLayout 6 | import android.widget.ProgressBar 7 | import android.widget.TextView 8 | import com.victor.clips.R 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: BottomViewHolder.java 15 | * Author: Victor 16 | * Date: 2018/8/30 17:31 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class BottomViewHolder : RecyclerView.ViewHolder { 21 | var progressBar: ProgressBar? = null 22 | var mTvTitle: TextView? = null 23 | var mLayoutEnd: LinearLayout? = null 24 | 25 | 26 | constructor(itemView: View) : super(itemView) { 27 | progressBar = itemView.findViewById(R.id.progressBar) 28 | mTvTitle = itemView.findViewById(R.id.tv_title) 29 | mLayoutEnd = itemView.findViewById(R.id.ll_end) 30 | } 31 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/holder/ContentViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.holder 2 | 3 | import android.support.v7.widget.RecyclerView 4 | import android.view.View 5 | import android.widget.AdapterView 6 | 7 | /* 8 | * ----------------------------------------------------------------- 9 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 10 | * ----------------------------------------------------------------- 11 | * File: ContentViewHolder.java 12 | * Author: Victor 13 | * Date: 2018/9/4 9:06 14 | * Description: 15 | * ----------------------------------------------------------------- 16 | */ 17 | open class ContentViewHolder: RecyclerView.ViewHolder,View.OnClickListener,View.OnLongClickListener { 18 | var mOnItemClickListener: AdapterView.OnItemClickListener? = null 19 | 20 | fun setOnItemClickListener(listener: AdapterView.OnItemClickListener?) { 21 | mOnItemClickListener = listener 22 | } 23 | 24 | constructor(itemView: View) : super(itemView) { 25 | itemView.setOnClickListener(this) 26 | itemView.setOnLongClickListener(this) 27 | } 28 | 29 | override fun onClick(view: View) { 30 | mOnItemClickListener?.onItemClick(null, view, getAdapterPosition(), 0) 31 | } 32 | 33 | override fun onLongClick(v: View): Boolean { 34 | mOnItemClickListener?.onItemClick(null, v, getAdapterPosition(), -1) 35 | return false 36 | } 37 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/holder/FollowCellContentViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.holder 2 | 3 | import android.view.View 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: FollowCellContentViewHolder.java 10 | * Author: Victor 11 | * Date: 2018/9/4 9:10 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class FollowCellContentViewHolder(itemView: View,var parentPosition: Int) : ContentViewHolder(itemView) { 16 | 17 | override fun onClick(view: View) { 18 | mOnItemClickListener!!.onItemClick(null, view, getAdapterPosition(), parentPosition.toLong()) 19 | } 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/holder/HeaderViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.holder 2 | 3 | import android.support.v7.widget.RecyclerView 4 | import android.view.View 5 | 6 | /* 7 | * ----------------------------------------------------------------- 8 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 9 | * ----------------------------------------------------------------- 10 | * File: HeaderViewHolder.java 11 | * Author: Victor 12 | * Date: 2018/8/30 17:46 13 | * Description: 14 | * ----------------------------------------------------------------- 15 | */ 16 | class HeaderViewHolder(itemView: View): RecyclerView.ViewHolder(itemView) { 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/view/CategoryDetailView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.view 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: CategoryDetailView.kt 8 | * Author: Victor 9 | * Date: 2018/8/24 13:51 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | interface CategoryDetailView { 14 | fun OnCategoryDetail (data: Any?,msg: String) 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/view/FollowView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.view 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: FollowView.kt 8 | * Author: Victor 9 | * Date: 2018/8/24 13:51 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | interface FollowView { 14 | fun OnFollow (data: Any?,msg: String) 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/view/RankingView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.view 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: RankingView.ktew.kt 8 | * Author: Victor 9 | * Date: 2018/8/24 13:51 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | interface RankingView { 14 | fun OnRanking (data: Any?,msg: String) 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/view/RelatedVideoView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.view 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: RelatedVideoView.kt 8 | * Author: Victor 9 | * Date: 2018/8/24 13:51 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | interface RelatedVideoView { 14 | fun OnRelatedVideo (data: Any?,msg: String) 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/view/SearchVideoView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.view 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: SearchVideoView.ktew.kt 8 | * Author: Victor 9 | * Date: 2018/8/24 13:51 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | interface SearchVideoView { 14 | fun OnSearchVideo (data: Any?,msg: String) 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/view/VideoCategoryView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.view 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: VideoCategoryView.ktew.kt 8 | * Author: Victor 9 | * Date: 2018/8/24 13:51 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | interface VideoCategoryView { 14 | fun OnVideoCategory (data: Any?,msg: String) 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/ArcImageView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.graphics.Canvas 5 | import android.graphics.Path 6 | import android.util.AttributeSet 7 | import android.widget.ImageView 8 | import com.victor.clips.R 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: ArcImageView.java 15 | * Author: Victor 16 | * Date: 2019/10/30 17:42 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class ArcImageView: ImageView { 21 | val TAG = "ArcImageView" 22 | var mArcHeight: Int = 100 23 | 24 | constructor(context: Context) : this(context,null) 25 | 26 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs,0) 27 | 28 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 29 | initAttr(context,attrs) 30 | } 31 | 32 | fun initAttr (context: Context,attrs: AttributeSet?) { 33 | var typedArray = context.obtainStyledAttributes(attrs, R.styleable.ArcImageView); 34 | mArcHeight = typedArray.getDimensionPixelSize(R.styleable.ArcImageView_arcHeight, 0); 35 | } 36 | 37 | override fun onDraw(canvas: Canvas?) { 38 | var path = Path(); 39 | path.moveTo(0f, 0f); 40 | path.lineTo(0f, height.toFloat()); 41 | path.quadTo(getWidth() / 2f, getHeight() - 2f * mArcHeight, width.toFloat(), height.toFloat()); 42 | path.lineTo(width.toFloat(), 0f); 43 | path.close(); 44 | canvas?.clipPath(path); 45 | super.onDraw(canvas) 46 | } 47 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/ColorFloatingActionButton.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.support.design.widget.FloatingActionButton 6 | import android.util.AttributeSet 7 | import android.view.View 8 | import com.victor.clips.interfaces.ColorUiInterface 9 | import com.victor.clips.util.ViewAttributeUtil 10 | 11 | /* 12 | * ----------------------------------------------------------------- 13 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 14 | * ----------------------------------------------------------------- 15 | * File: ColorFloatingActionButton.java 16 | * Author: Victor 17 | * Date: 2019/10/14 16:28 18 | * Description: 19 | * ----------------------------------------------------------------- 20 | */ 21 | class ColorFloatingActionButton: FloatingActionButton,ColorUiInterface { 22 | private var attr_background = -1 23 | 24 | constructor(context: Context) : this(context,null) 25 | 26 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs,0) 27 | 28 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 29 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 30 | } 31 | 32 | override fun getView(): View { 33 | return this 34 | } 35 | 36 | override fun setTheme(themeId: Resources.Theme) { 37 | if (attr_background != -1) { 38 | ViewAttributeUtil.applyBackgroundTintColor(this, themeId, attr_background); 39 | } 40 | } 41 | 42 | 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/ColorMovingTextView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.widget.TextView 6 | import com.victor.clips.interfaces.ColorUiInterface 7 | import com.victor.clips.util.ViewAttributeUtil 8 | import android.util.AttributeSet 9 | import android.view.View 10 | 11 | 12 | /* 13 | * ----------------------------------------------------------------- 14 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 15 | * ----------------------------------------------------------------- 16 | * File: ColorMovingTextView.java 17 | * Author: Victor 18 | * Date: 2019/10/24 14:35 19 | * Description: 20 | * ----------------------------------------------------------------- 21 | */ 22 | class ColorMovingTextView: TextView,ColorUiInterface { 23 | private var attr_drawable = -1 24 | private val attr_textAppearance = -1 25 | private var attr_textColor = -1 26 | private var attr_textLinkColor = -1 27 | 28 | constructor(context: Context) : this(context,null) 29 | 30 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs,0) 31 | 32 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 33 | this.attr_drawable = ViewAttributeUtil.getBackgroundAttibute(attrs) 34 | this.attr_textColor = ViewAttributeUtil.getTextColorAttribute(attrs) 35 | this.attr_textLinkColor = ViewAttributeUtil.getTextLinkColorAttribute(attrs) 36 | } 37 | 38 | override fun isFocused(): Boolean { 39 | return true 40 | } 41 | 42 | override fun getView(): View { 43 | return this 44 | } 45 | 46 | override fun setTheme(themeId: Resources.Theme) { 47 | if (attr_drawable != -1) { 48 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_drawable) 49 | } 50 | if (attr_textColor != -1) { 51 | ViewAttributeUtil.applyTextColor(this, themeId, attr_textColor) 52 | } 53 | if (attr_textLinkColor != -1) { 54 | ViewAttributeUtil.applyTextLinkColor(this, themeId, attr_textLinkColor) 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/ColorRelativeLayout.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.util.AttributeSet 6 | import android.view.View 7 | import android.widget.RelativeLayout 8 | import com.victor.clips.interfaces.ColorUiInterface 9 | import com.victor.clips.util.ViewAttributeUtil 10 | 11 | /* 12 | * ----------------------------------------------------------------- 13 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 14 | * ----------------------------------------------------------------- 15 | * File: ColorRelativeLayout.java 16 | * Author: Victor 17 | * Date: 2019/10/14 16:32 18 | * Description: 19 | * ----------------------------------------------------------------- 20 | */ 21 | class ColorRelativeLayout: RelativeLayout,ColorUiInterface { 22 | 23 | private var attr_background = -1 24 | 25 | constructor(context: Context) : this(context,null) 26 | 27 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs,0) 28 | 29 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 30 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 31 | } 32 | 33 | override fun getView(): View { 34 | return this 35 | } 36 | 37 | override fun setTheme(themeId: Resources.Theme) { 38 | if (attr_background != -1) { 39 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_background); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/ColorTextView.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.util.AttributeSet 6 | import android.widget.TextView 7 | import com.victor.clips.interfaces.ColorUiInterface 8 | import com.victor.clips.util.ViewAttributeUtil 9 | import android.util.Log 10 | import android.view.View 11 | 12 | 13 | /* 14 | * ----------------------------------------------------------------- 15 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 16 | * ----------------------------------------------------------------- 17 | * File: ColorTextView.java 18 | * Author: Victor 19 | * Date: 2019/10/15 17:41 20 | * Description: 21 | * ----------------------------------------------------------------- 22 | */ 23 | class ColorTextView: TextView,ColorUiInterface { 24 | private var attr_drawable = -1 25 | private var attr_textAppearance = -1 26 | private var attr_textColor = -1 27 | private var attr_textLinkColor = -1 28 | 29 | constructor(context: Context) : this(context,null) 30 | 31 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs,0) 32 | 33 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 34 | this.attr_drawable = ViewAttributeUtil.getBackgroundAttibute(attrs); 35 | this.attr_textColor = ViewAttributeUtil.getTextColorAttribute(attrs); 36 | this.attr_textLinkColor = ViewAttributeUtil.getTextLinkColorAttribute(attrs); 37 | } 38 | 39 | override fun getView(): View { 40 | return this 41 | } 42 | 43 | override fun setTheme(themeId: Resources.Theme) { 44 | Log.d("COLOR", "id = $id") 45 | if (attr_drawable !== -1) { 46 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_drawable) 47 | } 48 | if (attr_textColor !== -1) { 49 | ViewAttributeUtil.applyTextColor(this, themeId, attr_textColor) 50 | } 51 | if (attr_textLinkColor !== -1) { 52 | ViewAttributeUtil.applyTextLinkColor(this, themeId, attr_textLinkColor) 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/FABBehaviour.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.support.design.widget.CoordinatorLayout 5 | import android.support.design.widget.FloatingActionButton 6 | import android.support.v4.view.ViewCompat 7 | import android.util.AttributeSet 8 | import android.view.View 9 | import android.view.ViewPropertyAnimator 10 | import android.view.animation.LinearInterpolator 11 | /* 12 | * ----------------------------------------------------------------- 13 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 14 | * ----------------------------------------------------------------- 15 | * File: FABBehaviour.java 16 | * Author: Victor 17 | * Date: 2019/11/8 10:05 18 | * Description: 19 | * ----------------------------------------------------------------- 20 | */ 21 | class FABBehaviour(context: Context, attrs: AttributeSet) : FloatingActionButton.Behavior() { 22 | 23 | override fun onNestedScroll(coordinatorLayout: CoordinatorLayout, child: FloatingActionButton, target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, type: Int) { 24 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type) 25 | //child -> Floating Action Button 26 | val translation: ViewPropertyAnimator? = when { 27 | dyConsumed > 0 -> { 28 | val layoutParams = child.layoutParams as CoordinatorLayout.LayoutParams 29 | val fab_bottomMargin = layoutParams.bottomMargin 30 | child.animate().translationY((child.height + fab_bottomMargin * 2).toFloat()) 31 | } 32 | dyConsumed < 0 -> child.animate().translationY(0f) 33 | else -> null 34 | } 35 | translation?.multiplyDuration()?.setInterpolator(LinearInterpolator())?.start() 36 | } 37 | 38 | override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: FloatingActionButton, directTargetChild: View, target: View, nestedScrollAxes: Int, type: Int): Boolean { 39 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL 40 | } 41 | } 42 | 43 | private fun ViewPropertyAnimator.multiplyDuration(): ViewPropertyAnimator { 44 | return setDuration(duration) 45 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/GravitySnapHelper.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.support.v7.widget.LinearSnapHelper 4 | import android.support.v7.widget.RecyclerView 5 | import android.view.View 6 | 7 | /* 8 | * ----------------------------------------------------------------- 9 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 10 | * ----------------------------------------------------------------- 11 | * File: GravitySnapHelper.java 12 | * Author: Victor 13 | * Date: 2018/9/4 10:43 14 | * Description: 15 | * ----------------------------------------------------------------- 16 | */ 17 | class GravitySnapHelper: LinearSnapHelper() { 18 | 19 | private lateinit var delegate: GravityDelegate 20 | 21 | @Throws(IllegalStateException::class) 22 | override fun attachToRecyclerView(recyclerView: RecyclerView?) { 23 | delegate.attachToRecyclerView(recyclerView) 24 | super.attachToRecyclerView(recyclerView) 25 | } 26 | 27 | override fun calculateDistanceToFinalSnap(layoutManager: RecyclerView.LayoutManager, 28 | targetView: View): IntArray? { 29 | return delegate.calculateDistanceToFinalSnap(layoutManager, targetView) 30 | } 31 | 32 | override fun findSnapView(layoutManager: RecyclerView.LayoutManager): View? { 33 | return delegate.findSnapView(layoutManager) 34 | } 35 | 36 | /** 37 | * Enable snapping of the last item that's snappable. 38 | * The default value is false, because you can't see the last item completely 39 | * if this is enabled. 40 | * 41 | * @param snap true if you want to enable snapping of the last snappable item 42 | */ 43 | fun enableLastItemSnap(snap: Boolean) { 44 | delegate.enableLastItemSnap(snap) 45 | } 46 | 47 | interface SnapListener { 48 | fun onSnap(position: Int) 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/InsetsAppBarLayout.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.graphics.Rect 6 | import android.support.design.widget.AppBarLayout 7 | import android.util.AttributeSet 8 | import android.view.View 9 | import com.victor.clips.interfaces.ColorUiInterface 10 | import com.victor.clips.interfaces.WindowInsetsHandler 11 | import com.victor.clips.util.ViewAttributeUtil 12 | import android.support.design.widget.CoordinatorLayout 13 | import com.victor.clips.interfaces.WindowInsetsHandlingBehavior 14 | import com.victor.clips.util.WindowInsetsHelper 15 | 16 | 17 | /* 18 | * ----------------------------------------------------------------- 19 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 20 | * ----------------------------------------------------------------- 21 | * File: InsetsAppBarLayout.java 22 | * Author: Victor 23 | * Date: 2019/10/14 16:16 24 | * Description: 25 | * ----------------------------------------------------------------- 26 | */ 27 | class InsetsAppBarLayout: AppBarLayout, WindowInsetsHandler, ColorUiInterface { 28 | private var attr_background = -1 29 | constructor(context: Context) : this(context,null) 30 | 31 | constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { 32 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs); 33 | } 34 | 35 | override fun onApplyWindowInsets(insets: Rect): Boolean { 36 | return WindowInsetsHelper.dispatchApplyWindowInsets(this, insets) 37 | } 38 | 39 | override fun getView(): View { 40 | return this 41 | } 42 | 43 | override fun setTheme(themeId: Resources.Theme) { 44 | if (attr_background != -1) { 45 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_background); 46 | } 47 | } 48 | 49 | class Behavior : AppBarLayout.Behavior, WindowInsetsHandlingBehavior { 50 | 51 | constructor() {} 52 | 53 | constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {} 54 | 55 | override fun onApplyWindowInsets(layout: CoordinatorLayout, child: View, insets: Rect): Boolean { 56 | return WindowInsetsHelper.onApplyWindowInsets(child, insets) 57 | } 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/InsetsToolbar.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.content.res.Resources 5 | import android.graphics.Rect 6 | import android.util.AttributeSet 7 | import android.view.View 8 | import com.victor.clips.interfaces.ColorUiInterface 9 | import com.victor.clips.interfaces.WindowInsetsHandler 10 | import android.support.v4.view.ViewCompat 11 | import android.support.v7.widget.Toolbar 12 | import com.victor.clips.R 13 | import com.victor.clips.util.ViewAttributeUtil 14 | 15 | 16 | /* 17 | * ----------------------------------------------------------------- 18 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 19 | * ----------------------------------------------------------------- 20 | * File: InsetsToolbar.java 21 | * Author: Victor 22 | * Date: 2019/10/14 16:06 23 | * Description: 24 | * ----------------------------------------------------------------- 25 | */ 26 | class InsetsToolbar: Toolbar, WindowInsetsHandler, ColorUiInterface { 27 | private var attr_background = -1 28 | 29 | constructor(context: Context) : this(context,null) 30 | 31 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, R.attr.toolbarStyle) 32 | 33 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { 34 | this.attr_background = ViewAttributeUtil.getBackgroundAttibute(attrs) 35 | ViewCompat.setOnApplyWindowInsetsListener(this) { v, insets -> 36 | val l = insets.systemWindowInsetLeft 37 | val t = insets.systemWindowInsetTop 38 | val r = insets.systemWindowInsetRight 39 | setPadding(l, t, r, 0) 40 | insets.consumeSystemWindowInsets() 41 | } 42 | 43 | } 44 | 45 | override fun onApplyWindowInsets(insets: Rect): Boolean { 46 | setPadding(insets.left, insets.top, insets.right, 0); 47 | return true 48 | } 49 | 50 | override fun getView(): View { 51 | return this 52 | } 53 | 54 | override fun setTheme(themeId: Resources.Theme) { 55 | if (attr_background != -1) { 56 | ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_background); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/NoTouchViewPager.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.support.v4.view.ViewPager 6 | import android.util.AttributeSet 7 | import android.view.MotionEvent 8 | 9 | /* 10 | * ----------------------------------------------------------------- 11 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 12 | * ----------------------------------------------------------------- 13 | * File: NoTouchViewPager.kt 14 | * Author: Victor 15 | * Date: 2018/8/30 15:05 16 | * Description: 不能滑动的ViewPager 17 | * ----------------------------------------------------------------- 18 | */ 19 | class NoTouchViewPager(context: Context, attrs: AttributeSet) : ViewPager(context, attrs) { 20 | @SuppressLint("ClickableViewAccessibility") 21 | override fun onTouchEvent(event: MotionEvent) = false 22 | 23 | override fun onInterceptTouchEvent(event: MotionEvent) = false 24 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/PlayLayout.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget 2 | 3 | import android.content.Context 4 | import android.util.AttributeSet 5 | import android.view.MotionEvent 6 | import android.widget.FrameLayout 7 | 8 | /* 9 | * ----------------------------------------------------------------- 10 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 11 | * ----------------------------------------------------------------- 12 | * File: PlayLayout.java 13 | * Author: Victor 14 | * Date: 2019/10/22 17:15 15 | * Description: 16 | * ----------------------------------------------------------------- 17 | */ 18 | class PlayLayout: FrameLayout { 19 | private var mLastX: Int = 0 20 | private var mLastY: Int = 0 21 | var mOnPlayViewTouchListener: OnPlayViewTouchListener? = null; 22 | 23 | constructor(context: Context) : this(context,null) 24 | 25 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs,0) 26 | 27 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) 28 | 29 | override fun onTouchEvent(event: MotionEvent?): Boolean { 30 | var x = event?.getX()?.toInt() 31 | var y = event?.getY()?.toInt() 32 | mOnPlayViewTouchListener?.OnPlayViewTouch(event?.getAction()) 33 | when (event?.getAction()) { 34 | MotionEvent.ACTION_DOWN -> { 35 | mLastX = x!! 36 | mLastY = y!! 37 | } 38 | MotionEvent.ACTION_MOVE -> { 39 | var offsetX = x!! - mLastX 40 | var offsetY = y!! - mLastY 41 | 42 | layout(left + offsetX, 43 | (top + offsetY), 44 | (right + offsetX), 45 | (bottom + offsetY)) 46 | } 47 | MotionEvent.ACTION_CANCEL -> { 48 | 49 | } 50 | MotionEvent.ACTION_UP -> { 51 | 52 | } 53 | } 54 | return true 55 | } 56 | 57 | public interface OnPlayViewTouchListener{ 58 | fun OnPlayViewTouch(action: Int?) 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/parallaximageview/HorizontalAlphaStyle.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget.parallaximageview 2 | 3 | import android.graphics.Canvas 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: HorizontalAlphaStyle.java 10 | * Author: Victor 11 | * Date: 2019/11/8 14:52 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class HorizontalAlphaStyle: ScrollParallaxImageView.ParallaxStyle { 16 | private var finalAlpha = 0.3f 17 | 18 | 19 | fun HorizontalAlphaStyle() { 20 | } 21 | 22 | fun HorizontalAlphaStyle(finalAlpha: Float) { 23 | if (finalAlpha < 0 || finalAlpha > 1.0f) { 24 | throw IllegalArgumentException("the alpha must between 0 and 1.") 25 | } 26 | this.finalAlpha = finalAlpha 27 | } 28 | 29 | fun setFinalAlpha(alpha: Float) { 30 | finalAlpha = alpha 31 | } 32 | 33 | override fun transform(view: ScrollParallaxImageView, canvas: Canvas, x: Int, y: Int) { 34 | // view's width 35 | val vWidth = view.width - view.paddingLeft - view.paddingRight 36 | // device's width 37 | val dWidth = view.resources.displayMetrics.widthPixels 38 | 39 | if (vWidth >= dWidth) { 40 | // Do nothing if imageView's width is bigger than device's width. 41 | return 42 | } 43 | 44 | val alpha: Float 45 | val pivot = (dWidth - vWidth) / 2 46 | if (x <= pivot) { 47 | alpha = 2f * (1 - finalAlpha) * (x + vWidth).toFloat() / (dWidth + vWidth) + finalAlpha 48 | } else { 49 | alpha = 2f * (1 - finalAlpha) * (dWidth - x).toFloat() / (dWidth + vWidth) + finalAlpha 50 | } 51 | view.alpha = alpha 52 | } 53 | 54 | override fun onAttachedToImageView(view: ScrollParallaxImageView) { 55 | 56 | } 57 | 58 | override fun onDetachedFromImageView(view: ScrollParallaxImageView) { 59 | 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/parallaximageview/HorizontalMovingStyle.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget.parallaximageview 2 | 3 | import android.graphics.Canvas 4 | import android.widget.ImageView 5 | 6 | /* 7 | * ----------------------------------------------------------------- 8 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 9 | * ----------------------------------------------------------------- 10 | * File: HorizontalMovingStyle.java 11 | * Author: Victor 12 | * Date: 2019/11/8 14:56 13 | * Description: 14 | * ----------------------------------------------------------------- 15 | */ 16 | class HorizontalMovingStyle: ScrollParallaxImageView.ParallaxStyle { 17 | 18 | override fun onAttachedToImageView(view: ScrollParallaxImageView) { 19 | // only supports CENTER_CROP 20 | view.scaleType = ImageView.ScaleType.CENTER_CROP 21 | } 22 | 23 | override fun onDetachedFromImageView(view: ScrollParallaxImageView) { 24 | 25 | } 26 | 27 | override fun transform(view: ScrollParallaxImageView, canvas: Canvas, x: Int, y: Int) { 28 | var x = x 29 | if (view.scaleType !== ImageView.ScaleType.CENTER_CROP) { 30 | return 31 | } 32 | 33 | // image's width and height 34 | val iWidth = view.drawable.intrinsicWidth 35 | val iHeight = view.drawable.intrinsicHeight 36 | if (iWidth <= 0 || iHeight <= 0) { 37 | return 38 | } 39 | 40 | // view's width and height 41 | val vWidth = view.width - view.paddingLeft - view.paddingRight 42 | val vHeight = view.height - view.paddingTop - view.paddingBottom 43 | 44 | // device's width 45 | val dWidth = view.resources.displayMetrics.widthPixels 46 | 47 | if (iWidth * vHeight > iHeight * vWidth) { 48 | // avoid over scroll 49 | if (x < -vWidth) { 50 | x = -vWidth 51 | } else if (x > dWidth) { 52 | x = dWidth 53 | } 54 | 55 | val imgScale = vHeight.toFloat() / iHeight.toFloat() 56 | val max_dx = Math.abs((iWidth * imgScale - vWidth) * 0.5f) 57 | val translateX = -(2f * max_dx * x.toFloat() + max_dx * (vWidth - dWidth)) / (vWidth + dWidth) 58 | canvas.translate(translateX, 0f) 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/parallaximageview/HorizontalScaleStyle.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget.parallaximageview 2 | 3 | import android.graphics.Canvas 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: HorizontalScaleStyle.java 10 | * Author: Victor 11 | * Date: 2019/11/8 14:57 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class HorizontalScaleStyle: ScrollParallaxImageView.ParallaxStyle { 16 | private var finalScaleRatio = 0.7f 17 | 18 | fun HorizontalScaleStyle() { 19 | 20 | } 21 | 22 | fun HorizontalScaleStyle(finalScaleRatio: Float) { 23 | this.finalScaleRatio = finalScaleRatio 24 | } 25 | 26 | fun setFinalScaleRatio(scale: Float) { 27 | finalScaleRatio = scale 28 | } 29 | 30 | override fun transform(view: ScrollParallaxImageView, canvas: Canvas, x: Int, y: Int) { 31 | // view's width and height 32 | val vWidth = view.width - view.paddingLeft - view.paddingRight 33 | val vHeight = view.height - view.paddingTop - view.paddingBottom 34 | // device's width 35 | val dWidth = view.resources.displayMetrics.widthPixels 36 | 37 | if (vWidth >= dWidth) { 38 | // Do nothing if imageView's width is bigger than device's width. 39 | return 40 | } 41 | 42 | val scale: Float 43 | val pivot = (dWidth - vWidth) / 2 44 | if (x <= pivot) { 45 | scale = 2f * (1 - finalScaleRatio) * (x + vWidth).toFloat() / (dWidth + vWidth) + finalScaleRatio 46 | } else { 47 | scale = 2f * (1 - finalScaleRatio) * (dWidth - x).toFloat() / (dWidth + vWidth) + finalScaleRatio 48 | } 49 | 50 | canvas.scale(scale, scale, (vWidth / 2).toFloat(), (vHeight / 2).toFloat()) 51 | } 52 | 53 | override fun onAttachedToImageView(view: ScrollParallaxImageView) { 54 | 55 | } 56 | 57 | override fun onDetachedFromImageView(view: ScrollParallaxImageView) { 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/parallaximageview/VerticalAlphaStyle.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget.parallaximageview 2 | 3 | import android.graphics.Canvas 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: VerticalAlphaStyle.java 10 | * Author: Victor 11 | * Date: 2019/11/8 14:59 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class VerticalAlphaStyle: ScrollParallaxImageView.ParallaxStyle { 16 | private var finalAlpha = 0.3f 17 | 18 | fun VerticalAlphaStyle() { 19 | 20 | } 21 | 22 | fun VerticalAlphaStyle(finalAlpha: Float) { 23 | if (finalAlpha < 0 || finalAlpha > 1.0f) { 24 | throw IllegalArgumentException("the alpha must between 0 and 1.") 25 | } 26 | this.finalAlpha = finalAlpha 27 | } 28 | 29 | fun setFinalAlpha(alpha: Float) { 30 | finalAlpha = alpha 31 | } 32 | 33 | override fun transform(view: ScrollParallaxImageView, canvas: Canvas, x: Int, y: Int) { 34 | // view's height 35 | val vHeight = view.height - view.paddingTop - view.paddingBottom 36 | // device's height 37 | val dHeight = view.resources.displayMetrics.heightPixels 38 | 39 | if (vHeight >= dHeight) { 40 | // Do nothing if imageView's height is bigger than device's height. 41 | return 42 | } 43 | 44 | val alpha: Float 45 | val pivot = (dHeight - vHeight) / 2 46 | if (y <= pivot) { 47 | alpha = 2f * (1 - finalAlpha) * (y + vHeight).toFloat() / (dHeight + vHeight) + finalAlpha 48 | } else { 49 | alpha = 2f * (1 - finalAlpha) * (dHeight - y).toFloat() / (dHeight + vHeight) + finalAlpha 50 | } 51 | view.alpha = alpha 52 | } 53 | 54 | override fun onAttachedToImageView(view: ScrollParallaxImageView) { 55 | 56 | } 57 | 58 | override fun onDetachedFromImageView(view: ScrollParallaxImageView) { 59 | 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/parallaximageview/VerticalMovingStyle.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget.parallaximageview 2 | 3 | import android.graphics.Canvas 4 | import android.widget.ImageView 5 | 6 | /* 7 | * ----------------------------------------------------------------- 8 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 9 | * ----------------------------------------------------------------- 10 | * File: VerticalMovingStyle.java 11 | * Author: Victor 12 | * Date: 2019/11/8 15:00 13 | * Description: 14 | * ----------------------------------------------------------------- 15 | */ 16 | class VerticalMovingStyle: ScrollParallaxImageView.ParallaxStyle { 17 | 18 | override fun onAttachedToImageView(view: ScrollParallaxImageView) { 19 | // only supports CENTER_CROP 20 | view.scaleType = ImageView.ScaleType.CENTER_CROP 21 | } 22 | 23 | override fun onDetachedFromImageView(view: ScrollParallaxImageView) { 24 | 25 | } 26 | 27 | override fun transform(view: ScrollParallaxImageView, canvas: Canvas, x: Int, y: Int) { 28 | var y = y 29 | if (view.scaleType !== ImageView.ScaleType.CENTER_CROP) { 30 | return 31 | } 32 | 33 | // image's width and height 34 | val iWidth = view.drawable.intrinsicWidth 35 | val iHeight = view.drawable.intrinsicHeight 36 | if (iWidth <= 0 || iHeight <= 0) { 37 | return 38 | } 39 | 40 | // view's width and height 41 | val vWidth = view.width - view.paddingLeft - view.paddingRight 42 | val vHeight = view.height - view.paddingTop - view.paddingBottom 43 | 44 | // device's height 45 | val dHeight = view.resources.displayMetrics.heightPixels 46 | 47 | if (iWidth * vHeight < iHeight * vWidth) { 48 | // avoid over scroll 49 | if (y < -vHeight) { 50 | y = -vHeight 51 | } else if (y > dHeight) { 52 | y = dHeight 53 | } 54 | 55 | val imgScale = vWidth.toFloat() / iWidth.toFloat() 56 | val max_dy = Math.abs((iHeight * imgScale - vHeight) * 0.5f) 57 | val translateY = -(2f * max_dy * y.toFloat() + max_dy * (vHeight - dHeight)) / (vHeight + dHeight) 58 | canvas.translate(0f, translateY) 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/ui/widget/parallaximageview/VerticalScaleStyle.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.ui.widget.parallaximageview 2 | 3 | import android.graphics.Canvas 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: VerticalScaleStyle.java 10 | * Author: Victor 11 | * Date: 2019/11/8 15:00 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class VerticalScaleStyle: ScrollParallaxImageView.ParallaxStyle { 16 | private var finalScaleRatio = 0.7f 17 | 18 | fun VerticalScaleStyle() { 19 | 20 | } 21 | 22 | fun VerticalScaleStyle(finalScaleRatio: Float) { 23 | this.finalScaleRatio = finalScaleRatio 24 | } 25 | 26 | fun setFinalScaleRatio(scale: Float) { 27 | finalScaleRatio = scale 28 | } 29 | 30 | override fun transform(view: ScrollParallaxImageView, canvas: Canvas, x: Int, y: Int) { 31 | // view's width and height 32 | val vWidth = view.width - view.paddingLeft - view.paddingRight 33 | val vHeight = view.height - view.paddingTop - view.paddingBottom 34 | // device's height 35 | val dHeight = view.resources.displayMetrics.heightPixels 36 | 37 | if (vHeight >= dHeight) { 38 | // Do nothing if imageView's height is bigger than device's height. 39 | return 40 | } 41 | 42 | val scale: Float 43 | val pivot = (dHeight - vHeight) / 2 44 | if (y <= pivot) { 45 | scale = 2f * (1 - finalScaleRatio) * (y + vHeight).toFloat() / (dHeight + vHeight) + finalScaleRatio 46 | } else { 47 | scale = 2f * (1 - finalScaleRatio) * (dHeight - y).toFloat() / (dHeight + vHeight) + finalScaleRatio 48 | } 49 | 50 | canvas.scale(scale, scale, (vWidth / 2).toFloat(), (vHeight / 2).toFloat()) 51 | } 52 | 53 | override fun onAttachedToImageView(view: ScrollParallaxImageView) { 54 | 55 | } 56 | 57 | override fun onDetachedFromImageView(view: ScrollParallaxImageView) { 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/AppConfig.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import com.victor.clips.BuildConfig 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: AppConfig.java 10 | * Author: Victor 11 | * Date: 2018/9/4 10:22 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class AppConfig { 16 | companion object { 17 | /** 18 | * 开发者模式 19 | */ 20 | const val MODEL_DEBUG = BuildConfig.MODEL_DEBUG 21 | /** 22 | * 线上模式 23 | */ 24 | const val MODEL_ONLINE = BuildConfig.MODEL_ONLINE 25 | 26 | /** 27 | * 编译版本 28 | */ 29 | const val BUILD_CODE = BuildConfig.BUILD_CODE 30 | } 31 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/ColorUtil.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.support.annotation.ColorInt 4 | import android.support.annotation.FloatRange 5 | import com.victor.clips.R 6 | import com.victor.clips.app.App 7 | import java.util.* 8 | 9 | /* 10 | * ----------------------------------------------------------------- 11 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 12 | * ----------------------------------------------------------------- 13 | * File: ColorUtil.java 14 | * Author: Victor 15 | * Date: 2018/9/4 9:40 16 | * Description: 17 | * ----------------------------------------------------------------- 18 | */ 19 | class ColorUtil { 20 | companion object { 21 | fun getDefaultRandomColor(): Int { 22 | val colors = intArrayOf( 23 | App.get().getResources().getColor(R.color.color_E6FCFC), 24 | App.get().getResources().getColor(R.color.color_E6FBFD), 25 | App.get().getResources().getColor(R.color.color_E5FAFE), 26 | App.get().getResources().getColor(R.color.color_E5F9FE)) 27 | val random = Random() 28 | return colors[random.nextInt(colors.size)] 29 | } 30 | 31 | /** 32 | * Set the alpha component of `color` to be `alpha`. 33 | */ 34 | fun modifyAlpha(@ColorInt color: Int, alpha: Int): Int { 35 | return color and 0x00ffffff or (alpha shl 24) 36 | } 37 | 38 | /** 39 | * Set the alpha component of `color` to be `alpha`. 40 | */ 41 | fun modifyAlpha(@ColorInt color: Int, alpha: Float): Int { 42 | return modifyAlpha(color, (255f * alpha).toInt()) 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/ConfigLocal.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.content.Context 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: ConfigLocal.java 10 | * Author: Victor 11 | * Date: 2019/11/8 11:15 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class ConfigLocal { 16 | companion object { 17 | private val WELCOME_VIDEO_PLAY_GUIDE = "WELCOME_VIDEO_PLAY_GUIDE" 18 | private val DAY_NIGHT_GUIDE = "DAY_NIGHT_GUIDE" 19 | 20 | /** 21 | * 是否需要播放开场欢迎视频 22 | * @param context 23 | * @param userId 24 | * @return 25 | */ 26 | fun needPlayWelcomeVideoGuide (context: Context, userId: String): Boolean { 27 | return SharePreferencesUtil.getBoolean(context, WELCOME_VIDEO_PLAY_GUIDE + ":" + userId, true) 28 | } 29 | fun updateWelcomeVideoPlayGuide (context: Context, userId: String,enable: Boolean) { 30 | return SharePreferencesUtil.putBoolean(context, WELCOME_VIDEO_PLAY_GUIDE + ":" + userId, enable) 31 | } 32 | /** 33 | * 是否需要显示昼夜模式 34 | * @param context 35 | * @param userId 36 | * @return 37 | */ 38 | fun needShowDayNightThemeGuide (context: Context, userId: String): Boolean { 39 | return SharePreferencesUtil.getBoolean(context, DAY_NIGHT_GUIDE + ":" + userId, false) 40 | } 41 | fun updateDayNightThemeGuide (context: Context, userId: String,enable: Boolean) { 42 | return SharePreferencesUtil.putBoolean(context, DAY_NIGHT_GUIDE + ":" + userId, enable) 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/Constant.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | /* 4 | * ----------------------------------------------------------------- 5 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 6 | * ----------------------------------------------------------------- 7 | * File: Constant.kt 8 | * Author: Victor 9 | * Date: 2018/8/17 13:47 10 | * Description: 11 | * ----------------------------------------------------------------- 12 | */ 13 | class Constant { 14 | companion object { 15 | const val HEADER_HIDE_ANIM_DURATION = 300 16 | const val BG_COLOR_MAX = 255f 17 | const val BG_COLOR_MIN = 232f 18 | const val INTENT_DATA_KEY = "INTENT_DATA_KEY" 19 | const val INTENT_ACTION_KEY = "INTENT_ACTION_KEY" 20 | const val CATEGORY_POSITION_KEY = "CATEGORY_POSITION_KEY" 21 | const val MA_DATA = "madata" 22 | const val SHARE_TYPE = "text/plain"; 23 | const val MAIL_TO = "mailto:%s"; 24 | 25 | } 26 | 27 | class Msg { 28 | companion object { 29 | const val ENTER_HAPPY_COAST = 0x1001 30 | const val TIME_CHANGE = 0x1002 31 | } 32 | } 33 | class Action { 34 | companion object { 35 | const val CATEGORY = 0x2001 36 | const val WEEKLY_RANKING = 0x2002 37 | const val MONTHLY_RANKING = 0x2003 38 | const val TOTAL_RANKING = 0x2004 39 | const val FOLLOW = 0x1005 40 | } 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/DateUtil.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import java.util.* 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: DateUtil.java 10 | * Author: Victor 11 | * Date: 2018/10/25 11:40 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | class DateUtil { 16 | companion object { 17 | /** 18 | * 将毫秒数格式化为"##:##"的时间 19 | * 20 | * @param milliseconds 毫秒数 21 | * @return ##:## 22 | */ 23 | fun formatPlayTime(milliseconds: Long): String { 24 | val totalSeconds = milliseconds / 1000 25 | val seconds = totalSeconds % 60 26 | val minutes = totalSeconds / 60 % 60 27 | val hours = totalSeconds / 3600 28 | val stringBuilder = StringBuilder() 29 | val mFormatter = Formatter(stringBuilder, Locale.getDefault()) 30 | return if (hours > 0) { 31 | mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString() 32 | } else { 33 | mFormatter.format("%02d:%02d", minutes, seconds).toString() 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/DensityUtil.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.view.WindowManager 6 | 7 | /* 8 | * ----------------------------------------------------------------- 9 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 10 | * ----------------------------------------------------------------- 11 | * File: DensityUtil.java 12 | * Author: Victor 13 | * Date: 2018/9/28 14:32 14 | * Description: 15 | * ----------------------------------------------------------------- 16 | */ 17 | class DensityUtil { 18 | companion object { 19 | /** 20 | * 获取屏幕的高度 21 | * @param context 22 | * @return 23 | */ 24 | fun getScreenHeight(context: Context): Int { 25 | val manager = context 26 | .getSystemService(Context.WINDOW_SERVICE) as WindowManager 27 | val display = manager.defaultDisplay 28 | return display.height 29 | } 30 | 31 | fun getScreenHeight(activity: Activity): Int { 32 | return activity.windowManager.defaultDisplay.height 33 | } 34 | 35 | fun getScreenWidth(activity: Activity): Int { 36 | return activity.windowManager.defaultDisplay.width 37 | } 38 | 39 | /** 40 | * 根据手机的分辨率 dp 的单位 转成 px(像素) 41 | */ 42 | fun dip2px(context: Context, dpValue: Float): Int { 43 | val scale = context.resources.displayMetrics.density 44 | return (dpValue * scale + 0.5f).toInt() 45 | } 46 | 47 | /** 48 | * 根据手机的分辨率 px(像素) 的单位 转成 dp 49 | */ 50 | fun px2dip(context: Context, pxValue: Float): Int { 51 | val scale = context.resources.displayMetrics.density 52 | return (pxValue / scale + 0.5f).toInt() 53 | } 54 | 55 | fun sp2px(context: Context, spValue: Float): Int { 56 | val fontScale = context.resources.displayMetrics.scaledDensity 57 | return (spValue * fontScale + 0.5f).toInt() 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/Loger.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.util.Log 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: Loger.java 10 | * Author: Victor 11 | * Date: 2019/11/5 16:25 12 | * Description: 日志打印工具 13 | * ----------------------------------------------------------------- 14 | */ 15 | class Loger { 16 | companion object { 17 | fun d(TAG: String, msg: Any) { 18 | if (AppConfig.MODEL_DEBUG) { 19 | Log.d(TAG, msg.toString()) 20 | } 21 | } 22 | 23 | fun e(TAG: String, msg: Any) { 24 | if (AppConfig.MODEL_DEBUG) { 25 | Log.e(TAG, msg.toString()) 26 | } 27 | } 28 | 29 | fun i(TAG: String, msg: Any) { 30 | if (AppConfig.MODEL_DEBUG) { 31 | Log.i(TAG, msg.toString()) 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/ThreadUtils.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.os.Handler 4 | import android.os.Looper 5 | 6 | /* 7 | * ----------------------------------------------------------------- 8 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 9 | * ----------------------------------------------------------------- 10 | * File: ThreadUtils.java 11 | * Author: Victor 12 | * Date: 2018/9/28 14:27 13 | * Description: 14 | * ----------------------------------------------------------------- 15 | */ 16 | class ThreadUtils { 17 | companion object { 18 | fun runOnUiThread(r: Runnable) { 19 | if (isMainThread()) { 20 | r.run() 21 | } else { 22 | LazyHolder.sUiThreadHandler.post(r) 23 | } 24 | } 25 | 26 | fun runOnUiThread(r: Runnable, delay: Long) { 27 | LazyHolder.sUiThreadHandler.postDelayed(r, delay) 28 | } 29 | 30 | fun removeCallbacks(r: Runnable) { 31 | LazyHolder.sUiThreadHandler.removeCallbacks(r) 32 | } 33 | 34 | private fun isMainThread(): Boolean { 35 | return Looper.getMainLooper() == Looper.myLooper() 36 | } 37 | 38 | private object LazyHolder { 39 | val sUiThreadHandler = Handler(Looper.getMainLooper()) 40 | } 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/ViewUtils.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.content.Context 4 | 5 | /* 6 | * ----------------------------------------------------------------- 7 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 8 | * ----------------------------------------------------------------- 9 | * File: ViewUtils 10 | * Author: Victor 11 | * Date: 2019/11/22 11:54 12 | * Description: 13 | * ----------------------------------------------------------------- 14 | */ 15 | 16 | class ViewUtils { 17 | companion object { 18 | /** 19 | * Determine if the navigation bar will be on the bottom of the screen, based on logic in 20 | * PhoneWindowManager. 21 | */ 22 | fun isNavBarOnBottom(context: Context): Boolean { 23 | val res = context.resources 24 | val cfg = context.resources.configuration 25 | val dm = res.displayMetrics 26 | val canMove = dm.widthPixels != dm.heightPixels && cfg.smallestScreenWidthDp < 600 27 | return !canMove || dm.widthPixels < dm.heightPixels 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/WindowInsetsCompatUtil.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.view.Gravity 4 | import android.support.v4.view.WindowInsetsCompat 5 | import android.annotation.SuppressLint 6 | 7 | 8 | 9 | /* 10 | * ----------------------------------------------------------------- 11 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 12 | * ----------------------------------------------------------------- 13 | * File: WindowInsetsCompatUtil.java 14 | * Author: Victor 15 | * Date: 2019/10/14 16:25 16 | * Description: 17 | * ----------------------------------------------------------------- 18 | */ 19 | class WindowInsetsCompatUtil { 20 | companion object { 21 | fun copy(source: WindowInsetsCompat): WindowInsetsCompat { 22 | return copyExcluded(source, Gravity.NO_GRAVITY) 23 | } 24 | 25 | @SuppressLint("RtlHardcoded") 26 | fun copyExcluded(source: WindowInsetsCompat, gravity: Int): WindowInsetsCompat { 27 | val l = if (gravity and Gravity.LEFT == Gravity.LEFT) 0 else source.systemWindowInsetLeft 28 | val t = if (gravity and Gravity.TOP == Gravity.TOP) 0 else source.systemWindowInsetTop 29 | val r = if (gravity and Gravity.RIGHT == Gravity.RIGHT) 0 else source.systemWindowInsetRight 30 | val b = if (gravity and Gravity.BOTTOM == Gravity.BOTTOM) 0 else source.systemWindowInsetBottom 31 | return source.replaceSystemWindowInsets(l, t, r, b) 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/victor/clips/util/WindowInsetsHelper.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips.util 2 | 3 | import android.graphics.Rect 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import com.victor.clips.interfaces.WindowInsetsHandler 7 | 8 | 9 | 10 | /* 11 | * ----------------------------------------------------------------- 12 | * Copyright (C) 2018-2028, by Victor, All rights reserved. 13 | * ----------------------------------------------------------------- 14 | * File: WindowInsetsHelper.java 15 | * Author: Victor 16 | * Date: 2019/10/14 16:20 17 | * Description: 18 | * ----------------------------------------------------------------- 19 | */ 20 | class WindowInsetsHelper { 21 | companion object { 22 | fun onApplyWindowInsets(view: View, insets: Rect): Boolean { 23 | return view is WindowInsetsHandler && (view as WindowInsetsHandler).onApplyWindowInsets(insets) 24 | } 25 | 26 | fun dispatchApplyWindowInsets(parent: ViewGroup, insets: Rect): Boolean { 27 | val count = parent.childCount 28 | 29 | for (i in 0 until count) { 30 | if (onApplyWindowInsets(parent.getChildAt(i), insets)) { 31 | return true 32 | } 33 | } 34 | 35 | return false 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_activity_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_activity_enter_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_activity_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_activity_exit_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 17 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_bottom_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_bottom_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_fragment_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_fragment_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 17 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_left_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_left_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_rv_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_top_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_top_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_color_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/blue_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/blue_grey_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/brown_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_blue_grey_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_blue_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_brown_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_cyan_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_deep_orange_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_deep_purple_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_green_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_indigo_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_light_green_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_lime_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_orange_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_pink_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_purple_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_red_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/color_teal_primary_rbtn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 13 | 14 | 17 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cyan_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/deep_orange_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/deep_purple_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/green_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_category.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_check.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_close.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dolar.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_play.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/indigo_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/item_switch_button_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/item_switch_track_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/light_green_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/lime_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/night_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/orange_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/pb_webview_layer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/pink_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/purple_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/red_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/teal_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_schema_proxy.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 19 | 20 | 26 | 27 | 33 | 34 | 35 | 36 | 37 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_web.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 19 | 20 | 28 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 20 | 24 | 33 | 34 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 15 | 21 | 25 | 26 | 27 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_category.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_follow.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_monthly_ranking.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_total_ranking.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_weekly_ranking.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_header_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 18 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_category_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 25 | 26 | 38 | 39 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_category_detail_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 19 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_color_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_follow_item_cell.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | 26 | 27 | 28 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_ranking_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 19 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_search_video_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 19 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_video_category_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 20 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/rv_video_category_normal_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 20 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/web_progress_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 15 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/menu/activity_main_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 12 | 16 | 17 | 18 | 19 | 20 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 11 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_web.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 15 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xhdpi/ic_share.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_video_comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xhdpi/ic_video_comment.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_video_likes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xhdpi/ic_video_likes.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_video_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xhdpi/ic_video_share.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty1.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty10.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty4.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty5.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty6.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty7.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty8.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/beauty9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/beauty9.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/default_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/default_img.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_about.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_avatar.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_clear.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_copyright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_copyright.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_exit_fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_exit_fullscreen.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_fullscreen.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_github.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_up.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/ic_update.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/img_about_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/img_about_bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/img_ali.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/img_ali.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/img_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/img_header.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/img_live.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/img_live.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/img_welcome.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/img_welcome.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/img_wx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/img_wx.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/projects_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxhdpi/projects_bg.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/raw/welcome.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/app/src/main/res/raw/welcome.mp4 -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Category 5 | Weekly ranking 6 | Monthly ranking 7 | Total ranking 8 | Follow 9 | 10 | 11 | 12 | @mipmap/beauty1 13 | @mipmap/beauty2 14 | @mipmap/beauty3 15 | @mipmap/beauty4 16 | @mipmap/beauty5 17 | @mipmap/beauty6 18 | @mipmap/beauty7 19 | @mipmap/beauty8 20 | @mipmap/beauty9 21 | @mipmap/beauty10 22 | 23 | 24 | 25 | @color/colorBluePrimary 26 | @color/colorRedPrimary 27 | @color/colorBrownPrimary 28 | @color/colorGreenPrimary 29 | @color/colorPurplePrimary 30 | @color/colorTealPrimary 31 | @color/colorPinkPrimary 32 | @color/colorDeepPurplePrimary 33 | @color/colorOrangePrimary 34 | @color/colorIndigoPrimary 35 | @color/colorLightGreenPrimary 36 | @color/colorDeepOrangePrimary 37 | @color/colorLimePrimary 38 | @color/colorBlueGreyPrimary 39 | @color/colorCyanPrimary 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 5dp 4 | -20dp 5 | 20dp 6 | 20dp 7 | 10dp 8 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/victor/clips/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.victor.clips 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.2.51' 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.1.4' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | maven { url "https://jitpack.io" } 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /docs/build.properties: -------------------------------------------------------------------------------- 1 | #*******************# 2 | #此处存放版本配置文件 3 | #可以本地修改或者提交 4 | #*******************# 5 | #正式版本号 6 | VERSION_CODE=10 7 | #正式版本名称 8 | VERSION_NAME=1.1.0 9 | #测试版本号 10 | BUILD_CODE=10 11 | #编译apk文件名称 12 | BUILD_NAME=FunnyClips 13 | #线上环境API接口 14 | MODEL_ONLINE=true 15 | #调试模式输出信息 16 | MODEL_DEBUG=false 17 | #上传apk到https://fir.im/apps api_token 18 | FIR_API_TOKEN=5826c9a4bc7c9a766e9145b8c4f91201 19 | #fir 上传 url地址 20 | FIR_UPLOAD_URL=http://api.fir.im/apps 21 | #是否上传到fir 22 | UPLOAD_TO_FIR=true 23 | #上传至fir渠道名称[main,overseas] 24 | UPLOAD_CHANNEL=main 25 | # bugly app id 26 | BUGLY_APPID=4f27ce3d04 -------------------------------------------------------------------------------- /docs/upToFir.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | # encoding = utf-8 3 | import requests 4 | import sys 5 | 6 | 7 | def upToFir(): 8 | # 打印传递过来的参数数组长度,便于校验 9 | print len(sys.argv) 10 | upUrl = sys.argv[1] 11 | appName = sys.argv[2].decode("gbk").encode("utf-8") 12 | bundleId = sys.argv[3] 13 | verName = sys.argv[4] 14 | apiToken = sys.argv[5] 15 | iconPath = sys.argv[6] 16 | apkPath = sys.argv[7] 17 | buildNumber = sys.argv[8] 18 | changeLog = sys.argv[9].decode("gbk").encode("utf-8") 19 | queryData = {'type': 'android', 'bundle_id': bundleId, 'api_token': apiToken} 20 | iconDict = {} 21 | binaryDict = {} 22 | # 获取上传信息 23 | try: 24 | response = requests.post(url=upUrl, data=queryData) 25 | json = response.json() 26 | iconDict = (json["cert"]["icon"]) 27 | binaryDict = (json["cert"]["binary"]) 28 | except Exception as e: 29 | print('query:' + e) 30 | 31 | # 上传apk 32 | try: 33 | file = {'file': open(apkPath, 'rb')} 34 | param = {"key": binaryDict['key'], 35 | 'token': binaryDict['token'], 36 | "x:name": appName, 37 | "x:version": verName, 38 | "x:build": buildNumber, 39 | "x:changelog": changeLog} 40 | req = requests.post(url=binaryDict['upload_url'], files=file, data=param, verify=False) 41 | print 'success_apk:' + req.content 42 | except Exception as e: 43 | print'error_apk:' + e 44 | 45 | # 上传logo 46 | try: 47 | file = {'file': open(iconPath, 'rb')} 48 | param = {"key": iconDict['key'], 49 | 'token': iconDict['token']} 50 | req = requests.post(url=iconDict['upload_url'], files=file, data=param, verify=False) 51 | print 'success_icon:' + req.content 52 | except Exception as e: 53 | print'error_icon:' + e 54 | 55 | 56 | if __name__ == '__main__': 57 | upToFir() 58 | -------------------------------------------------------------------------------- /docs/update.json: -------------------------------------------------------------------------------- 1 | {"app_name":"FunnyClips","version_name":"1.0.9","version_code":9,"update_content":"1,Day and night mode automatically switches according to time","url":"https://github.com/Victor2018/FunnyClips/raw/master/app/FunnyClips.apk"} -------------------------------------------------------------------------------- /docs/victor_keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/docs/victor_keystore.jks -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Victor2018/FunnyClips/ebd31401c63ec5641e69427bd25e41c60f0fa9fd/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Nov 13 14:50:30 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------