Skip to content
This repository has been archived by the owner on Apr 30, 2023. It is now read-only.

Commit

Permalink
初始化仓库
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonNOV committed Oct 18, 2020
0 parents commit e5a7b38
Show file tree
Hide file tree
Showing 80 changed files with 2,257 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
56 changes: 56 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"

defaultConfig {
applicationId "com.leon.biuvideo"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

// https://mvnrepository.com/artifact/com.alibaba/fastjson
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.74'

//圆形图片库
implementation 'de.hdodenhof:circleimageview:3.1.0'

//加载网络图片
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

//折叠TextView
implementation 'com.ms-square:expandableTextView:0.1.4'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.leon.biuvideo;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.leon.biuvideo", appContext.getPackageName());
}
}
34 changes: 34 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.leon.biuvideo">

<!-- 请求网络权限 -->
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ui.VideoActivity"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar">

</activity>
<activity
android:name=".ui.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
62 changes: 62 additions & 0 deletions app/src/main/java/com/leon/biuvideo/adapters/AnthologyAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.leon.biuvideo.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.leon.biuvideo.R;
import com.leon.biuvideo.beans.view.ViewPage;
import com.leon.biuvideo.utils.WebpSizes;

/**
* video_listView_singleVideoList控件的适配器
*/
public class AnthologyAdapter extends BaseAdapter {
private final Context context;
private final ViewPage viewPage;

public AnthologyAdapter(Context context, ViewPage viewPage) {
this.context = context;
this.viewPage = viewPage;
}

@Override
public int getCount() {
return viewPage.singleVideoInfoList.size();
}

@Override
public Object getItem(int i) {
return viewPage.singleVideoInfoList.get(i);
}

@Override
public long getItemId(int i) {
return 0;
}

@Override
public View getView(int i, View view, ViewGroup viewGroup) {
ViewHolder viewHolder;
if (view == null) {
view = View.inflate(context, R.layout.listview_item, null);
viewHolder = new ViewHolder();
viewHolder.imageView = view.findViewById(R.id.item_imageView_cover);
viewHolder.textView = view.findViewById(R.id.item_textView_title);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
Glide.with(context).load(viewPage.coverUrl + WebpSizes.cover).into(viewHolder.imageView);
viewHolder.textView.setText(viewPage.singleVideoInfoList.get(i).part);
return view;
}

public static class ViewHolder {
ImageView imageView;
TextView textView;
}
}
22 changes: 22 additions & 0 deletions app/src/main/java/com/leon/biuvideo/beans/play/Media.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.leon.biuvideo.beans.play;

import java.io.Serializable;
import java.util.List;

//video和audio通用
public class Media implements Serializable {
public String baseUrl;
public List<String> backupUrl;
public String codecs;

/**
* 获取视频帧数
*/
public int getFrameRate(String framerate) {
String[] split = framerate.split("/");
int temp1 = Integer.parseInt(split[0]);
int temp2 = Integer.parseInt(split[1]);

return temp1 / temp2;
}
}
10 changes: 10 additions & 0 deletions app/src/main/java/com/leon/biuvideo/beans/play/Play.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.leon.biuvideo.beans.play;

import java.io.Serializable;
import java.util.List;

public class Play implements Serializable {
public List<String> accept_description;
public List<Media> videos;
public List<Media> audios;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.leon.biuvideo.beans.view;

import java.io.Serializable;

//单个视频选集信息
public class SingleVideoInfo implements Serializable {
public long cid;
public int page;
public String part;

@Override
public String toString() {
return "SingleVideoInfo{" +
"cid=" + cid +
", page=" + page +
", part='" + part + '\'' +
'}';
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/leon/biuvideo/beans/view/UpInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.leon.biuvideo.beans.view;

import java.io.Serializable;

//up主信息
public class UpInfo implements Serializable {
public long mid;
public String name;
public String faceUrl;

@Override
public String toString() {
return "UpInfo{" +
"mid=" + mid +
", name='" + name + '\'' +
", faceUrl='" + faceUrl + '\'' +
'}';
}
}
27 changes: 27 additions & 0 deletions app/src/main/java/com/leon/biuvideo/beans/view/VideoInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.leon.biuvideo.beans.view;

import java.io.Serializable;

//视频信息
public class VideoInfo implements Serializable {
public int view;
public int danmaku;
public int reply;
public int favorite;
public int like;
public int coin;
public int share;

@Override
public String toString() {
return "VideoInfo{" +
"view=" + view +
", danmaku=" + danmaku +
", reply=" + reply +
", favorite=" + favorite +
", like=" + like +
", coin=" + coin +
", share=" + share +
'}';
}
}
38 changes: 38 additions & 0 deletions app/src/main/java/com/leon/biuvideo/beans/view/ViewPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.leon.biuvideo.beans.view;

import java.io.Serializable;
import java.util.List;

//view接口bean
public class ViewPage implements Serializable {
public String bvid;
public long aid;
public int videos;
public int tid;
public String tname;
public String coverUrl;
public String title;
public long upTime;
public String desc;
public UpInfo upInfo;
public VideoInfo videoInfo;
public List<SingleVideoInfo> singleVideoInfoList;

@Override
public String toString() {
return "ViewPage{" +
"bvid='" + bvid + '\'' +
", aid=" + aid +
", videos=" + videos +
", tid=" + tid +
", tname='" + tname + '\'' +
", coverUrl='" + coverUrl + '\'' +
", title='" + title + '\'' +
", upTime=" + upTime +
", desc='" + desc + '\'' +
", upInfo=" + upInfo +
", videoInfo=" + videoInfo +
", singleVideoInfoList=" + singleVideoInfoList +
'}';
}
}
Loading

0 comments on commit e5a7b38

Please sign in to comment.