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

Commit

Permalink
PreferenceActivity的所有功能已完成
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonNOV committed Nov 20, 2020
1 parent bcabe59 commit 3cd840e
Show file tree
Hide file tree
Showing 33 changed files with 228 additions and 134 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@

## 📘开发日志

### 2020/11/20
- 添加了LICENSE
- 加入了LicenseDialog
- PreferenceActivity的所有功能已完成
- **暂未对反馈信息进行处理**
- 修改了部分icon的大小
- 修改了部分布局代码
- 删除了无用的icon

### 2020/11/19
- 修改了`AboutDialog`的界面代码
- 在PreferenceActivity中加入了`导入外部数据`功能
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putSerializable("article", article);
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

context.startActivity(intent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,6 @@ public String parseHTMLonPhone(String path) {
String html = httpUtils.getData();
Document document = Jsoup.parse(html);

//获取头部份
Elements headContainer = document.getElementsByClass("head-container");
Element first = headContainer.first();

//删除文章基本参数
first.childNode(5).childNode(3).remove();

//删除部分数据
first.childNode(1).remove();
first.childNode(2).remove();
first.childNode(5).remove();

String head = headContainer.first().toString();

//====================================================================

//获取文章主要部分
Elements articleHolder = document.getElementsByClass("article-holder");

Expand Down Expand Up @@ -193,7 +177,7 @@ public String parseHTMLonPhone(String path) {
String body = articleHolder.first().toString();

//合并html
return combineWebPage(head + body);
return combineWebPage(body);
}

/**
Expand All @@ -217,6 +201,7 @@ private String combineWebPage(String content) {

webPage.append(head + css + "</head>" + "<body>");

//添加头部图片
webPage.append("<div class=\"head-container\">\n" +
" <div class=\"banner-img-holder\">\n" +
" <img src=\"" + article.coverUrl + "\">" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.leon.biuvideo.beans.AboutBean;
import com.leon.biuvideo.beans.Favorite;
import com.leon.biuvideo.ui.dialogs.AboutDialog;
import com.leon.biuvideo.ui.dialogs.FeedbackDialog;
import com.leon.biuvideo.ui.dialogs.ImportFollowDialog;
import com.leon.biuvideo.ui.dialogs.LicenseDialog;
import com.leon.biuvideo.ui.dialogs.WaitingDialog;
Expand Down Expand Up @@ -85,6 +86,7 @@ public void onClick(View v) {
//导入指定ID的关注列表
ImportFollowDialog importFollowDialog = new ImportFollowDialog(PreferenceActivity.this);
importFollowDialog.show();

importFollowDialog.setPriorityListener(new ImportFollowDialog.PriorityListener() {
@Override
public void setActivityText(long mid) {
Expand Down Expand Up @@ -175,7 +177,8 @@ public void onCloseClick() {
break;
case R.id.preference_textView_feed_back:
//显示反馈提交界面

FeedbackDialog feedbackDialog = new FeedbackDialog(PreferenceActivity.this);
feedbackDialog.show();
break;
default:
break;
Expand All @@ -196,6 +199,11 @@ private boolean getFollowings(long mid) {
return true;
}

//由于官方的限制关注列表最多只能获取100条
if (total > 100) {
total = 100;
}

//获取数据
int pn = 1;
int currentTotal = 0;
Expand All @@ -204,16 +212,22 @@ private boolean getFollowings(long mid) {
FavoriteDatabaseUtils favoriteDatabaseUtils = (FavoriteDatabaseUtils) sqLiteHelperFactory.getInstance();

while (currentTotal != total) {
List<Favorite> favorites = FollowParseUtils.parseFollow(mid, pn++);
currentTotal += favorites.size();
List<Favorite> favorites = FollowParseUtils.parseFollow(mid, pn);
if (favorites != null) {
currentTotal += favorites.size();

//将数据添加至favorites_up
for (Favorite favorite : favorites) {
boolean insertState = favoriteDatabaseUtils.addFavorite(favorite);
//将数据添加至favorites_up
for (Favorite favorite : favorites) {
boolean insertState = favoriteDatabaseUtils.addFavorite(favorite);

if (!insertState) {
return false;
if (!insertState) {
return false;
}
}

pn++;
} else {
return false;
}
}

Expand Down
54 changes: 54 additions & 0 deletions app/src/main/java/com/leon/biuvideo/ui/dialogs/FeedbackDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.leon.biuvideo.ui.dialogs;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;

import com.leon.biuvideo.R;
import com.leon.biuvideo.utils.Fuck;

public class FeedbackDialog extends AlertDialog {

public FeedbackDialog(@NonNull Context context) {
super(context);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.feed_back_dialog);

initView();
}

private void initView() {
EditText feed_back_editText = findViewById(R.id.feed_back_editText);
Button feed_back_button_submit = findViewById(R.id.feed_back_button_submit);
feed_back_button_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String feedBack = feed_back_editText.getText().toString();
if (!feedBack.equals("")) {
//处理反馈的提交
Fuck.blue(feedBack);
dismiss();
Toast.makeText(getContext(), "感谢您的反馈", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getContext(), "不反馈点儿啥吗?", Toast.LENGTH_SHORT).show();
}
}
});

Window window = this.getWindow();
window.setBackgroundDrawableResource(android.R.color.transparent);
window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
Expand All @@ -12,14 +13,6 @@
import androidx.appcompat.app.AlertDialog;

import com.leon.biuvideo.R;
import com.leon.biuvideo.beans.Favorite;
import com.leon.biuvideo.utils.SQLiteHelper;
import com.leon.biuvideo.utils.dataBaseUtils.FavoriteDatabaseUtils;
import com.leon.biuvideo.utils.dataBaseUtils.SQLiteHelperFactory;
import com.leon.biuvideo.utils.dataBaseUtils.Tables;
import com.leon.biuvideo.utils.parseDataUtils.FollowParseUtils;

import java.util.List;

public class ImportFollowDialog extends AlertDialog implements View.OnClickListener {
private EditText import_follow_editText;
Expand Down Expand Up @@ -49,6 +42,9 @@ private void initView() {
//获取window
Window window = this.getWindow();
window.setBackgroundDrawableResource(android.R.color.transparent);

//点击输入框弹出软键盘
window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import androidx.annotation.NonNull;
Expand All @@ -12,8 +11,6 @@
import com.leon.biuvideo.R;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand All @@ -26,7 +23,7 @@ public LicenseDialog(@NonNull Context context) {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.liscense_dialog);
setContentView(R.layout.license_dialog);

initView();
}
Expand All @@ -44,6 +41,7 @@ public void onClick(View v) {

//获取LICENSE内容
String content = readLicense();
System.out.println(content);
license_dialog_textView.setText(content);
}

Expand All @@ -61,7 +59,7 @@ private String readLicense() {
String temp;
StringBuilder content = new StringBuilder();
while ((temp = bufferedReader.readLine()) != null) {
content.append(temp);
content.append(temp + "\n");
}

bufferedReader.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -62,6 +63,15 @@ public void onClick(View v) {

//添加缩放动画
window.setWindowAnimations(R.style.music_list_dialog);
window.setBackgroundDrawableResource(android.R.color.transparent);

//限制大小
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
int heightPixels = context.getResources().getDisplayMetrics().heightPixels;

WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = (int) (widthPixels * 0.8f);
attributes.height = (int) (heightPixels * 0.8f);
}

@Override
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/res/drawable/dialog.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/dialog_shape_for_about_dialog.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/dialog_shape_for_music_list.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
android:viewportHeight="1024">
<path
android:pathData="M826.16,146.76a50.64,50.64 0,0 1,36.87 15.81,50.72 50.72,0 0,1 14.16,37.62l-10.55,242.63a30.65,30.65 0,0 1,-8.97 20.39l-399.04,399.04a50.86,50.86 0,0 1,-36.2 15,50.86 50.86,0 0,1 -36.2,-15l-224.47,-224.47c-19.96,-19.96 -19.96,-52.44 0,-72.41l399.04,-399.04a30.67,30.67 0,0 1,20.39 -8.97l242.63,-10.55c0.78,-0.04 1.57,-0.05 2.34,-0.05h0.01m-0.01,-71.68c-1.81,0 -3.62,0.04 -5.45,0.12l-242.63,10.55a102.39,102.39 0,0 0,-67.96 29.9l-399.04,399.04c-47.99,47.99 -47.99,125.79 0,173.78l224.47,224.47c24,23.99 55.44,35.99 86.89,35.99s62.89,-12 86.89,-35.99l399.04,-399.04a102.39,102.39 0,0 0,29.9 -67.96l10.55,-242.63c3.05,-70.18 -53.13,-128.22 -122.65,-128.22z"
android:fillColor="#707070"/>
android:fillColor="#353535"/>
<path
android:pathData="M617.25,340.19a66.1,66.1 0,0 1,47.06 19.5c12.57,12.57 19.5,29.29 19.5,47.06s-6.92,34.49 -19.5,47.07a66.14,66.14 0,0 1,-47.06 19.49,66.12 66.12,0 0,1 -47.06,-19.49c-25.95,-25.95 -25.95,-68.18 0,-94.13a66.12,66.12 0,0 1,47.06 -19.5m0,-71.68c-35.38,0 -70.76,13.5 -97.75,40.49 -53.99,53.99 -53.99,141.52 0,195.5a137.81,137.81 0,0 0,97.75 40.49c35.38,0 70.76,-13.5 97.75,-40.49 53.99,-53.99 53.99,-141.52 0,-195.5a137.82,137.82 0,0 0,-97.75 -40.49z"
android:fillColor="#707070"/>
android:fillColor="#353535"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/icon_video_play.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<vector android:height="24dp" android:tint="#707070"
<vector android:height="24dp" android:tint="#353535"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10,16.5l6,-4.5 -6,-4.5v9zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/icon_video_time.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#707070"
android:tint="#353535"
android:viewportWidth="24"
android:viewportHeight="24">
<path
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/icon_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
android:viewportHeight="1024">
<path
android:pathData="M1024,512c0,98.13 -209.07,311.47 -512,311.47 -294.4,0 -512,-209.07 -512,-311.47 0,-102.4 217.6,-311.47 512,-311.47 302.93,0 512,209.07 512,311.47zM512,256c-136.53,0 -247.47,115.2 -247.47,256s110.93,256 247.47,256c136.53,0 247.47,-115.2 247.47,-256S648.53,256 512,256zM512,349.87c-85.33,0 -157.87,72.53 -157.87,162.13 0,89.6 68.27,162.13 157.87,162.13 85.33,0 157.87,-72.53 157.87,-162.13 0,-89.6 -72.53,-162.13 -157.87,-162.13zM512,349.87"
android:fillColor="#707070"/>
android:fillColor="#353535"/>
</vector>
11 changes: 0 additions & 11 deletions app/src/main/res/drawable/navigation_back.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/drawable/play_list_user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
android:viewportHeight="1024">
<path
android:pathData="M656.79,499.92A241.63,241.63 0,0 0,754 306c0,-133.65 -108.35,-242 -242,-242S270,172.35 270,306a241.63,241.63 0,0 0,97.21 193.92C190.84,560.12 64,727.25 64,924a36,36 0,0 0,72 0c0,-207.66 168.34,-376 376,-376s376,168.34 376,376a36,36 0,0 0,72 0c0,-196.75 -126.84,-363.88 -303.21,-424.08zM342,306a170,170 0,1 1,170 170,170 170,0 0,1 -170,-170z"
android:fillColor="#515151"/>
android:fillColor="#353535"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/play_list_video_danmaku.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<vector android:height="24dp" android:viewportHeight="1024"
android:viewportWidth="1024" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#515151" android:pathData="M512,847.88c-28.73,0 -56.73,-2.6 -83.97,-7.1L231.23,960.19 231.23,761.41C128.62,689.36 62.77,578.89 62.77,454.83c0,-217.08 201.13,-393.06 449.23,-393.06 248.08,0 449.23,175.98 449.23,393.06C961.23,671.92 760.08,847.88 512,847.88zM512,117.92c-217.09,0 -393.07,150.85 -393.07,336.91 0,114.17 66.42,214.9 167.76,275.82l-1.77,130.23 132.17,-79.46c30.45,6.5 62.12,10.31 94.91,10.31 217.1,0 393.07,-150.83 393.07,-336.91C905.07,268.77 729.1,117.92 512,117.92zM736.61,510.98c-31.01,0 -56.15,-25.13 -56.15,-56.15 0,-31.01 25.14,-56.15 56.15,-56.15s56.15,25.14 56.15,56.15C792.77,485.85 767.62,510.98 736.61,510.98zM512,510.98c-31.01,0 -56.15,-25.13 -56.15,-56.15 0,-31.01 25.14,-56.15 56.15,-56.15 31.01,0 56.15,25.14 56.15,56.15C568.15,485.85 543.01,510.98 512,510.98zM287.39,510.98c-31.01,0 -56.15,-25.13 -56.15,-56.15 0,-31.01 25.14,-56.15 56.15,-56.15s56.15,25.14 56.15,56.15C343.54,485.85 318.4,510.98 287.39,510.98z"/>
<path android:fillColor="#353535" android:pathData="M512,847.88c-28.73,0 -56.73,-2.6 -83.97,-7.1L231.23,960.19 231.23,761.41C128.62,689.36 62.77,578.89 62.77,454.83c0,-217.08 201.13,-393.06 449.23,-393.06 248.08,0 449.23,175.98 449.23,393.06C961.23,671.92 760.08,847.88 512,847.88zM512,117.92c-217.09,0 -393.07,150.85 -393.07,336.91 0,114.17 66.42,214.9 167.76,275.82l-1.77,130.23 132.17,-79.46c30.45,6.5 62.12,10.31 94.91,10.31 217.1,0 393.07,-150.83 393.07,-336.91C905.07,268.77 729.1,117.92 512,117.92zM736.61,510.98c-31.01,0 -56.15,-25.13 -56.15,-56.15 0,-31.01 25.14,-56.15 56.15,-56.15s56.15,25.14 56.15,56.15C792.77,485.85 767.62,510.98 736.61,510.98zM512,510.98c-31.01,0 -56.15,-25.13 -56.15,-56.15 0,-31.01 25.14,-56.15 56.15,-56.15 31.01,0 56.15,25.14 56.15,56.15C568.15,485.85 543.01,510.98 512,510.98zM287.39,510.98c-31.01,0 -56.15,-25.13 -56.15,-56.15 0,-31.01 25.14,-56.15 56.15,-56.15s56.15,25.14 56.15,56.15C343.54,485.85 318.4,510.98 287.39,510.98z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/shape_feed_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#EDEDED"/>
<corners android:radius="10dp"/>
</shape>
Loading

0 comments on commit 3cd840e

Please sign in to comment.