├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── pldroid-player-1.4.0.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── home │ │ └── tiktokdemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── home │ │ │ └── tiktokdemo │ │ │ ├── MainActivity.java │ │ │ ├── RoomFragment.java │ │ │ ├── utils │ │ │ └── Utils.java │ │ │ └── widget │ │ │ └── MarqueeTextView.java │ ├── jniLibs │ │ ├── arm64-v8a │ │ │ └── libpldroidplayer.so │ │ ├── armeabi-v7a │ │ │ └── libpldroidplayer.so │ │ ├── armeabi │ │ │ └── libpldroidplayer.so │ │ └── x86 │ │ │ └── libpldroidplayer.so │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xhdpi │ │ └── bg_room_change.png │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ ├── icon_bottom1.png │ │ ├── icon_bottom2.png │ │ ├── icon_bottom3.png │ │ ├── icon_bottom4.png │ │ ├── icon_bottom5.png │ │ ├── icon_play.png │ │ ├── icon_right1.png │ │ ├── icon_right2.png │ │ ├── icon_right3.png │ │ ├── icon_right4.png │ │ ├── icon_right_avatar1.png │ │ ├── icon_right_avatar2.png │ │ ├── icon_right_avatar3.png │ │ ├── icon_right_avatar_add.png │ │ ├── icon_root_background3.png │ │ ├── icon_search.png │ │ ├── icon_tiktok.png │ │ └── layout_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_room.xml │ │ ├── fragment_room.xml │ │ ├── view_room_container.xml │ │ └── view_room_item.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.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 │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── home │ └── tiktokdemo │ └── ExampleUnitTest.java ├── build.gradle ├── 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/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 37 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TikTokDemo 2 | 3 | 簡介 4 | ================================== 5 | 如果對於 抖音(TikTok)部分介面功能的簡易實現 有興趣的話, 可以參考看看 6 | 7 | 取材自以下資源 8 | -------- 9 | InkeVerticalViewPagerLive 10 | https://github.com/xingstarx/InkeVerticalViewPagerLive 11 | 12 | TikTok-有趣的人都在這裡 13 | https://play.google.com/store/apps/details?id=com.ss.android.ugc.trill 14 | 15 | 預覽 16 | -------- 17 |

18 | 19 | 20 |

21 | 22 | 備註 23 | -------- 24 | 圖片資源僅供學習交流之用, 請勿用於商業用途, 如有侵權請聯繫刪除, 謝謝 25 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.home.tiktokdemo" 7 | minSdkVersion 23 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | 24 | // 如果使用太新的版本, 有可能會出現下面所示的錯誤 25 | // Error: Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat 26 | implementation 'com.android.support:appcompat-v7:25.0.1' 27 | 28 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 29 | testImplementation 'junit:junit:4.12' 30 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 31 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 32 | 33 | implementation 'com.qiniu:happy-dns:0.2.+' 34 | implementation 'com.qiniu.pili:pili-android-qos:0.8.+' 35 | implementation 'com.github.castorflex.verticalviewpager:library:19.0.1' 36 | implementation 'io.reactivex:rxandroid:0.25.0' 37 | 38 | // circleimageview 39 | implementation 'de.hdodenhof:circleimageview:2.2.0' 40 | 41 | // rotatinganimation 42 | implementation 'theanilpaudel:rotatinganimation:1.0.0' 43 | } 44 | -------------------------------------------------------------------------------- /app/libs/pldroid-player-1.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/libs/pldroid-player-1.4.0.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/home/tiktokdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.home.tiktokdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.home.tiktokdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | 20 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/home/tiktokdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.home.tiktokdemo; 2 | 3 | import android.graphics.Bitmap; 4 | import android.media.MediaMetadataRetriever; 5 | import android.os.Bundle; 6 | import android.os.Handler; 7 | import android.os.Looper; 8 | import android.os.Message; 9 | import android.support.v4.app.FragmentManager; 10 | import android.support.v4.view.ViewPager; 11 | import android.support.v7.app.AppCompatActivity; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.view.ViewGroup; 15 | import android.view.WindowManager; 16 | import android.widget.FrameLayout; 17 | import android.widget.ImageView; 18 | import android.widget.RelativeLayout; 19 | import android.widget.Toast; 20 | 21 | import com.home.tiktokdemo.utils.Utils; 22 | import com.pili.pldroid.player.AVOptions; 23 | import com.pili.pldroid.player.PLMediaPlayer; 24 | import com.pili.pldroid.player.widget.PLVideoTextureView; 25 | import com.pili.pldroid.player.widget.PLVideoView; 26 | 27 | import java.util.ArrayList; 28 | import java.util.HashMap; 29 | 30 | import fr.castorflex.android.verticalviewpager.VerticalViewPager; 31 | import rx.Subscription; 32 | import rx.subscriptions.Subscriptions; 33 | 34 | public class MainActivity extends AppCompatActivity 35 | implements PLMediaPlayer.OnPreparedListener, PLMediaPlayer.OnCompletionListener, 36 | View.OnClickListener { 37 | 38 | private static final int MESSAGE_ID_RECONNECTING = 0x01; 39 | private boolean mIsActivityPaused = true; 40 | private PLVideoTextureView mVideoView; 41 | private Toast mToast = null; 42 | private String mVideoPath = null; 43 | protected Handler mHandler = new Handler(Looper.getMainLooper()) { 44 | @Override 45 | public void handleMessage(Message msg) { 46 | if (msg.what != MESSAGE_ID_RECONNECTING) { 47 | return; 48 | } 49 | if (mIsActivityPaused || !Utils.isLiveStreamingAvailable()) { 50 | finish(); 51 | return; 52 | } 53 | if (!Utils.isNetworkAvailable(MainActivity.this)) { 54 | sendReconnectMessage(); 55 | return; 56 | } 57 | mVideoView.setVideoPath(mVideoPath); 58 | mVideoView.start(); 59 | } 60 | }; 61 | private VerticalViewPager mViewPager; 62 | private RelativeLayout mRoomContainer; 63 | private PagerAdapter mPagerAdapter; 64 | private int mCurrentItem; 65 | private int isLiveStreaming = 1; 66 | private AVOptions options; 67 | private FrameLayout mFragmentContainer; 68 | private ArrayList mVideoUrls = new ArrayList<>(); 69 | private Subscription mSubscription = Subscriptions.empty(); 70 | private FragmentManager mFragmentManager; 71 | private int mRoomId = -1; 72 | private RoomFragment mRoomFragment; 73 | private boolean mInit = false; 74 | private boolean isFirst = true; 75 | private MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); 76 | private ImageView searchImageView; 77 | private View separationLineView1, separationLineView2, separationLineView3, separationLineView4; 78 | private String[] authorName, authorContent, songName; 79 | private int[] authorAvatar; 80 | 81 | @Override 82 | protected void onCreate(Bundle savedInstanceState) { 83 | super.onCreate(savedInstanceState); 84 | fullScreenDisplayAndStatusBarIsNotHidden(); 85 | setContentView(R.layout.activity_room); 86 | 87 | initializationData(); 88 | initializationView(); 89 | initAVOptions(); 90 | generateUrls(); 91 | mFragmentManager = getSupportFragmentManager(); 92 | mPagerAdapter = new PagerAdapter(); 93 | initializationPLVideoTextureView(); 94 | initializationVerticalViewPager(); 95 | initializationRoomFragment(); 96 | searchImageView.setOnClickListener(this); 97 | } 98 | 99 | private void initializationData() { 100 | authorName = new String[]{ 101 | "\u0040小海鷗", "\u0040小貓頭鷹", "\u0040大兔子",}; 102 | authorContent = new String[]{ 103 | "#深海 #飛翔", "#洞穴 #肥兔", "#草原 #蝴蝶",}; 104 | songName = new String[]{ 105 | "原聲 - 小海鷗 - 小海鷗 原聲 - 小海鷗 - 小海鷗 原聲 - 小海鷗 - 小海鷗", 106 | "原聲 - 小貓頭鷹 - 小貓頭鷹 原聲 - 小貓頭鷹 - 小貓頭鷹 原聲 - 小貓頭鷹 - 小貓頭鷹", 107 | "原聲 - 大兔子 - 大兔子 原聲 - 大兔子 - 大兔子 原聲 - 大兔子 - 大兔子",}; 108 | authorAvatar = new int[]{R.drawable.icon_right_avatar1, R.drawable.icon_right_avatar2, R.drawable.icon_right_avatar3}; 109 | } 110 | 111 | private void initializationRoomFragment() { 112 | mRoomFragment = RoomFragment.newInstance(); 113 | mRoomFragment.setOnItemClickListener(new RoomFragment.OnVideoControlListener() { 114 | 115 | /** 開始播放, 並隱藏按鈕 */ 116 | @Override 117 | public void onStart(ImageView imageView) { 118 | mVideoView.start(); 119 | imageView.setVisibility(View.INVISIBLE); 120 | } 121 | 122 | /** 開始播放與暫停播放, 並顯示與隱藏按鈕 */ 123 | @Override 124 | public void onPause(ImageView imageView) { 125 | if (mVideoView.isPlaying()) { 126 | mVideoView.pause(); 127 | imageView.setVisibility(View.VISIBLE); 128 | } else { 129 | mVideoView.start(); 130 | imageView.setVisibility(View.INVISIBLE); 131 | } 132 | } 133 | }); 134 | } 135 | 136 | private void initializationVerticalViewPager() { 137 | 138 | /** 上下翻頁時, 同步更新mCurrentItem */ 139 | mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { 140 | @Override 141 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { 142 | mCurrentItem = position; 143 | } 144 | }); 145 | 146 | mViewPager.setPageTransformer(false, new ViewPager.PageTransformer() { 147 | @Override 148 | public void transformPage(View page, float position) { 149 | ViewGroup viewGroup = (ViewGroup) page; 150 | 151 | if ((position < 0 && viewGroup.getId() != mCurrentItem)) { 152 | View roomContainer = viewGroup.findViewById(R.id.room_container); 153 | if (roomContainer != null && roomContainer.getParent() != null && roomContainer.getParent() instanceof ViewGroup) { 154 | ((ViewGroup) (roomContainer.getParent())).removeView(roomContainer); 155 | } 156 | } 157 | 158 | /** 满足此种条件, 表明需要加载直播视频以及聊天室 */ 159 | if (viewGroup.getId() == mCurrentItem && position == 0 && mCurrentItem != mRoomId) { 160 | changeSeparationLineColor(); 161 | if (mRoomContainer.getParent() != null && mRoomContainer.getParent() instanceof ViewGroup) { 162 | ((ViewGroup) (mRoomContainer.getParent())).removeView(mRoomContainer); 163 | } 164 | loadVideoAndChatRoom(viewGroup, mCurrentItem); 165 | } 166 | } 167 | }); 168 | 169 | mViewPager.setAdapter(mPagerAdapter); 170 | } 171 | 172 | private void initializationPLVideoTextureView() { 173 | mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_PAVED_PARENT); // 設定視訊預覽模式 174 | mVideoView.setAVOptions(options); 175 | } 176 | 177 | /** 178 | * Android全屏显示时, 状态栏显示在最顶层, 不隐藏 179 | */ 180 | private void fullScreenDisplayAndStatusBarIsNotHidden() { 181 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); 182 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 183 | } 184 | 185 | private void initializationView() { 186 | mViewPager = (VerticalViewPager) findViewById(R.id.view_pager); 187 | mRoomContainer = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.view_room_container, null); 188 | mFragmentContainer = (FrameLayout) mRoomContainer.findViewById(R.id.fragment_container); 189 | mVideoView = (PLVideoTextureView) mRoomContainer.findViewById(R.id.texture_view); 190 | separationLineView1 = findViewById(R.id.separationLineView1); 191 | separationLineView2 = findViewById(R.id.separationLineView2); 192 | separationLineView3 = findViewById(R.id.separationLineView3); 193 | separationLineView4 = findViewById(R.id.separationLineView4); 194 | searchImageView = (ImageView) findViewById(R.id.searchImageView); 195 | } 196 | 197 | /** 198 | * 初始化播放片源網址 199 | */ 200 | private void generateUrls() { 201 | mVideoUrls.add("http://vjs.zencdn.net/v/oceans.mp4"); 202 | mVideoUrls.add("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); 203 | mVideoUrls.add("http://www.w3school.com.cn/example/html5/mov_bbb.mp4"); 204 | } 205 | 206 | private void initAVOptions() { 207 | options = new AVOptions(); 208 | 209 | /** the unit of timeout is ms */ 210 | options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000); 211 | options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000); 212 | 213 | /** Some optimization with buffering mechanism when be set to 1 */ 214 | options.setInteger(AVOptions.KEY_LIVE_STREAMING, isLiveStreaming); 215 | options.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1); 216 | 217 | /** 1 -> hw codec enable, 0 -> disable [recommended] */ 218 | int codec = 0; 219 | options.setInteger(AVOptions.KEY_MEDIACODEC, codec); 220 | 221 | /**whether start play automatically after prepared, default value is 1 */ 222 | options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0); 223 | } 224 | 225 | /** 226 | * @param viewGroup 227 | * @param currentItem 228 | */ 229 | private void loadVideoAndChatRoom(ViewGroup viewGroup, int currentItem) { 230 | 231 | /** 聊天室的fragment只加载一次, 以后复用 */ 232 | if (!mInit) { 233 | mFragmentManager.beginTransaction().add(mFragmentContainer.getId(), mRoomFragment).commitAllowingStateLoss(); 234 | mInit = true; 235 | } 236 | 237 | loadVideo(currentItem); 238 | viewGroup.addView(mRoomContainer); 239 | mRoomId = currentItem; 240 | 241 | /** 切換影片時, 如果有顯示播放按鈕 就把它隱藏 */ 242 | if (isFirst == true) { 243 | new Handler().postDelayed(new Runnable() { 244 | @Override 245 | public void run() { 246 | mRoomFragment.invisibleImageView(); 247 | isFirst = false; 248 | } 249 | }, 50); 250 | } else { 251 | mRoomFragment.invisibleImageView(); 252 | } 253 | } 254 | 255 | private void loadVideo(int position) { 256 | mVideoView.setOnCompletionListener(this); 257 | mVideoView.setOnPreparedListener(this); 258 | mVideoView.stopPlayback(); 259 | mVideoView.setVideoPath(mVideoUrls.get(position)); 260 | mVideoView.start(); 261 | } 262 | 263 | @Override 264 | protected void onPause() { 265 | super.onPause(); 266 | mToast = null; 267 | mVideoView.pause(); 268 | mIsActivityPaused = true; 269 | mRoomFragment.invisibleImageView(); 270 | } 271 | 272 | @Override 273 | protected void onResume() { 274 | super.onResume(); 275 | mIsActivityPaused = false; 276 | mVideoView.start(); 277 | } 278 | 279 | @Override 280 | protected void onDestroy() { 281 | super.onDestroy(); 282 | mVideoView.stopPlayback(); 283 | mSubscription.unsubscribe(); 284 | } 285 | 286 | private void showToastTips(final String tips) { 287 | runOnUiThread(new Runnable() { 288 | @Override 289 | public void run() { 290 | if (mToast != null) { 291 | mToast.cancel(); 292 | } 293 | mToast = Toast.makeText(MainActivity.this, tips, Toast.LENGTH_SHORT); 294 | mToast.show(); 295 | } 296 | }); 297 | } 298 | 299 | private void sendReconnectMessage() { 300 | showToastTips("正在重连..."); 301 | mHandler.removeCallbacksAndMessages(null); 302 | mHandler.sendMessageDelayed(mHandler.obtainMessage(MESSAGE_ID_RECONNECTING), 500); 303 | } 304 | 305 | /** 306 | * 當影片播放完, 自動重新播放 307 | */ 308 | @Override 309 | public void onCompletion(PLMediaPlayer plMediaPlayer) { 310 | new Handler().postDelayed(new Runnable() { 311 | @Override 312 | public void run() { 313 | loadVideo(mCurrentItem); 314 | } 315 | }, 100); 316 | } 317 | 318 | /** 319 | * 當影片加載完成時, 刷新旋轉的動畫 320 | */ 321 | @Override 322 | public void onPrepared(PLMediaPlayer plMediaPlayer) { 323 | mRoomFragment.rotateView(); 324 | mRoomFragment.setAuthorAvatar(authorAvatar[mCurrentItem]); 325 | mRoomFragment.setAuthorAvatar2(authorAvatar[mCurrentItem]); 326 | mRoomFragment.setAuthorName(authorName[mCurrentItem]); 327 | mRoomFragment.setAuthorContent(authorContent[mCurrentItem]); 328 | mRoomFragment.setSongName(songName[mCurrentItem]); 329 | } 330 | 331 | @Override 332 | public void onClick(View view) { 333 | switch (view.getId()) { 334 | case R.id.searchImageView: 335 | Toast.makeText(this, "Click searchImageView", Toast.LENGTH_SHORT).show(); 336 | changeSeparationLineColor(); 337 | break; 338 | } 339 | } 340 | 341 | class PagerAdapter extends android.support.v4.view.PagerAdapter { 342 | 343 | @Override 344 | public int getCount() { 345 | return mVideoUrls.size(); 346 | } 347 | 348 | @Override 349 | public boolean isViewFromObject(View view, Object object) { 350 | return view == object; 351 | } 352 | 353 | @Override 354 | public Object instantiateItem(ViewGroup container, int position) { 355 | View view = LayoutInflater.from(container.getContext()).inflate(R.layout.view_room_item, null); 356 | mediaMetadataRetriever = new MediaMetadataRetriever(); 357 | mediaMetadataRetriever.setDataSource(mVideoUrls.get(position), new HashMap()); 358 | Bitmap bitmap = mediaMetadataRetriever.getFrameAtTime((long) (1000), MediaMetadataRetriever.OPTION_PREVIOUS_SYNC); 359 | ImageView previewImageView = view.findViewById(R.id.previewImageView); 360 | previewImageView.setImageBitmap(bitmap); 361 | view.setId(position); 362 | container.addView(view); 363 | return view; 364 | } 365 | 366 | @Override 367 | public void destroyItem(ViewGroup container, int position, Object object) { 368 | container.removeView(container.findViewById(position)); 369 | } 370 | } 371 | 372 | /** 373 | * 分隔線的顏色動畫 374 | */ 375 | public void changeSeparationLineColor() { 376 | separationLineView1.setBackgroundColor(getColor(R.color.colorSLineChange)); 377 | separationLineView2.setBackgroundColor(getColor(R.color.colorSLineChange)); 378 | new Handler().postDelayed(new Runnable() { 379 | public void run() { 380 | separationLineView3.setBackgroundColor(getColor(R.color.colorSLineChange)); 381 | separationLineView4.setBackgroundColor(getColor(R.color.colorSLineChange)); 382 | } 383 | }, 100); 384 | new Handler().postDelayed(new Runnable() { 385 | public void run() { 386 | separationLineView1.setBackgroundColor(getColor(R.color.colorSLineDeneral)); 387 | separationLineView2.setBackgroundColor(getColor(R.color.colorSLineDeneral)); 388 | separationLineView3.setBackgroundColor(getColor(R.color.colorSLineDeneral)); 389 | separationLineView4.setBackgroundColor(getColor(R.color.colorSLineDeneral)); 390 | } 391 | }, 200); 392 | } 393 | } -------------------------------------------------------------------------------- /app/src/main/java/com/home/tiktokdemo/RoomFragment.java: -------------------------------------------------------------------------------- 1 | package com.home.tiktokdemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.FrameLayout; 10 | import android.widget.ImageView; 11 | import android.widget.RelativeLayout; 12 | import android.widget.TextView; 13 | 14 | import com.home.tiktokdemo.widget.MarqueeTextView; 15 | 16 | import de.hdodenhof.circleimageview.CircleImageView; 17 | 18 | /** 19 | * Created by xiongxingxing on 16/12/3. 20 | */ 21 | 22 | public class RoomFragment extends Fragment implements View.OnClickListener { 23 | 24 | private TextView authorNameTextView, authorContentTextView; 25 | private MarqueeTextView songNameMTextView; 26 | private FrameLayout rotateFrameLayout; 27 | private RelativeLayout room_view; 28 | private ImageView playImageView; 29 | private OnVideoControlListener onVideoControlListener; 30 | private CircleImageView avatarCircleImageView, avatarCircleImageView2; 31 | 32 | public static RoomFragment newInstance() { 33 | Bundle args = new Bundle(); 34 | RoomFragment fragment = new RoomFragment(); 35 | fragment.setArguments(args); 36 | return fragment; 37 | } 38 | 39 | @Nullable 40 | @Override 41 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 42 | View view = inflater.inflate(R.layout.fragment_room, container, false); 43 | return view; 44 | } 45 | 46 | @Override 47 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 48 | initializationView(view); 49 | } 50 | 51 | private void initializationView(View view) { 52 | room_view = view.findViewById(R.id.room_view); 53 | room_view.setOnClickListener(this); 54 | playImageView = view.findViewById(R.id.playImageView); 55 | playImageView.setAlpha(70); 56 | playImageView.setVisibility(View.INVISIBLE); 57 | playImageView.setOnClickListener(this); 58 | rotateFrameLayout = view.findViewById(R.id.rotateFrameLayout); 59 | avatarCircleImageView = view.findViewById(R.id.avatarCircleImageView); 60 | authorNameTextView = view.findViewById(R.id.authorNameTextView); 61 | authorContentTextView = view.findViewById(R.id.authorContentTextView); 62 | songNameMTextView = view.findViewById(R.id.songNameMTextView); 63 | avatarCircleImageView2 = view.findViewById(R.id.avatarCircleImageView2); 64 | } 65 | 66 | @Override 67 | public void onClick(View view) { 68 | switch (view.getId()) { 69 | case R.id.room_view: 70 | onVideoControlListener.onPause(playImageView); 71 | break; 72 | case R.id.playImageView: 73 | onVideoControlListener.onStart(playImageView); 74 | break; 75 | } 76 | } 77 | 78 | public interface OnVideoControlListener { 79 | void onStart(ImageView imageView); 80 | 81 | void onPause(ImageView imageView); 82 | } 83 | 84 | public void setOnItemClickListener(OnVideoControlListener onVideoControlListener) { 85 | this.onVideoControlListener = onVideoControlListener; 86 | } 87 | 88 | /** 89 | * 隱藏播放按鈕 90 | */ 91 | public void invisibleImageView() { 92 | if (playImageView != null) { 93 | playImageView.setVisibility(View.INVISIBLE); 94 | } 95 | } 96 | 97 | /** 98 | * 將圖片呈現轉360度的動畫效果 99 | */ 100 | public void rotateView() { 101 | if (rotateFrameLayout != null) { 102 | rotateFrameLayout.setRotation(0); 103 | rotateFrameLayout.animate() 104 | .rotationBy(36000) 105 | .setDuration(100000) 106 | .start(); 107 | } 108 | } 109 | 110 | public void setAuthorName(String string) { 111 | authorNameTextView.setText(string); 112 | } 113 | 114 | public void setAuthorContent(String string) { 115 | authorContentTextView.setText(string); 116 | } 117 | 118 | public void setSongName(String string) { 119 | songNameMTextView.setText(string); 120 | } 121 | 122 | public void setAuthorAvatar(int id) { 123 | avatarCircleImageView.setImageResource(id); 124 | } 125 | 126 | public void setAuthorAvatar2(int id) { 127 | avatarCircleImageView2.setImageResource(id); 128 | } 129 | } 130 | 131 | -------------------------------------------------------------------------------- /app/src/main/java/com/home/tiktokdemo/utils/Utils.java: -------------------------------------------------------------------------------- 1 | package com.home.tiktokdemo.utils; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | public class Utils { 8 | 9 | public static boolean isNetworkAvailable(Context context) { 10 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 11 | NetworkInfo netInfo = cm.getActiveNetworkInfo(); 12 | return netInfo != null && netInfo.isConnectedOrConnecting(); 13 | } 14 | 15 | /** 16 | * Is the live streaming still available 17 | * @return is the live streaming is available 18 | */ 19 | public static boolean isLiveStreamingAvailable() { 20 | // Todo: Please ask your app server, is the live streaming still available 21 | return true; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/home/tiktokdemo/widget/MarqueeTextView.java: -------------------------------------------------------------------------------- 1 | package com.home.tiktokdemo.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | public class MarqueeTextView extends android.support.v7.widget.AppCompatTextView { 7 | 8 | public MarqueeTextView(Context context, AttributeSet attrs, int defStyle) { 9 | super(context, attrs, defStyle); 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public MarqueeTextView(Context context, AttributeSet attrs) { 14 | super(context, attrs); 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | public MarqueeTextView(Context context) { 19 | super(context); 20 | // TODO Auto-generated constructor stub 21 | } 22 | 23 | @Override 24 | public boolean isFocused() { 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libpldroidplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/jniLibs/arm64-v8a/libpldroidplayer.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libpldroidplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/jniLibs/armeabi-v7a/libpldroidplayer.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libpldroidplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/jniLibs/armeabi/libpldroidplayer.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86/libpldroidplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/jniLibs/x86/libpldroidplayer.so -------------------------------------------------------------------------------- /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-xhdpi/bg_room_change.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable-xhdpi/bg_room_change.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 16 | 21 | 26 | 31 | 36 | 41 | 46 | 51 | 56 | 61 | 66 | 71 | 76 | 81 | 86 | 91 | 96 | 101 | 106 | 111 | 116 | 121 | 126 | 131 | 136 | 141 | 146 | 151 | 156 | 161 | 166 | 171 | 172 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_bottom1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_bottom1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_bottom2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_bottom2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_bottom3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_bottom3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_bottom4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_bottom4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_bottom5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_bottom5.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right4.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right_avatar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right_avatar1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right_avatar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right_avatar2.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right_avatar3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right_avatar3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_right_avatar_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_right_avatar_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_root_background3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_root_background3.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_tiktok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/drawable/icon_tiktok.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/layout_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 11 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_room.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 19 | 23 | 24 | 25 | 29 | 30 | 31 | 36 | 37 | 44 | 45 | 49 | 50 | 57 | 58 | 64 | 65 | 72 | 73 | 77 | 78 | 82 | 83 | 84 | 88 | 89 | 90 | 91 | 92 | 97 | 98 | 103 | 104 | 110 | 111 | 117 | 118 | 124 | 125 | 131 | 132 | 137 | 138 | 139 | 140 | 146 | 147 | 152 | 153 | 157 | 158 | 162 | 163 | 167 | 168 | 172 | 173 | 177 | 178 | 182 | 183 | 187 | 188 | 193 | 194 | 195 | 196 | 197 | 202 | 203 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_room.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 20 | 21 | 22 | 27 | 28 | 29 | 35 | 36 | 37 | 46 | 47 | 56 | 57 | 64 | 65 | 69 | 70 | 81 | 82 | 83 | 84 | 85 | 91 | 92 | 97 | 98 | 106 | 107 | 113 | 114 | 115 | 121 | 122 | 130 | 131 | 136 | 137 | 145 | 146 | 151 | 152 | 160 | 161 | 167 | 168 | 172 | 173 | 182 | 183 | 184 | 185 | 186 | 192 | 193 | 194 | 201 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_room_container.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_room_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #50ffffff 8 | #ffffff 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TikTokDemo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/home/tiktokdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.home.tiktokdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.1.3' 11 | 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://dl.bintray.com/theanilpaudel/android/' } 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /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/tenSunFree/TikTokDemo/85ad89006818d6f1507a94ca3912c15f449a7ff9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 25 17:28:25 CST 2018 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-4.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------