Skip to content

Commit

Permalink
1.优化文章页反色策略;
Browse files Browse the repository at this point in the history
2.优化文章页图片下载请求的referer策略;
3.优化文章页音频,视频标签的默认属性;
4.优化文章页CSS样式;
5.优化文章页进度保存;
6.优化列表页缩略图下载请求的referer策略;
  • Loading branch information
wizos committed Sep 16, 2018
1 parent 4461d17 commit 4cd5308
Show file tree
Hide file tree
Showing 25 changed files with 434 additions and 403 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ dependencies {
// 【开发工具】
testImplementation 'junit:junit:4.12'
// 内存泄漏检测工具
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
// 日志工具
implementation files('libs/klog.jar')
// implementation files('libs/klog.jar')
implementation 'com.github.zhaokaiqiang.klog:library:1.6.0'
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如:2.3.1
// implementation 'com.tencent.bugly:crashreport:2.6.6.1'
implementation files('libs/bugly_crashreport_upgrade-1.3.5.aar')
Expand Down
Binary file removed app/libs/klog.jar
Binary file not shown.
110 changes: 59 additions & 51 deletions app/src/main/assets/css/normalize.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ html {
word-break: break-all;
}

body {
font-family:Noto Sans,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif !important;
body,div,p {
font-family:Noto Sans,Helvetica Neue,PingFang SC,Microsoft YaHei,Source Han Sans SC,Noto Sans CJK SC,WenQuanYi Micro Hei,sans-serif !important;
font-size: 16px !important;
line-height: 1.6 !important;
margin: 0 auto !important;
-webkit-text-size-adjust: 100%;/* 如果不想让iPhone横坚屏切换的时候调节文字这个 */
}

body > *:first-child {
Expand All @@ -31,56 +29,62 @@ strong,b {
}
/* 图片,视频
=============================================================================*/
/* 隐藏src为空的图片,视频,iframe等 */
*[src=''] {
display: none;
/* 隐藏空图片 */
img[src=''],iframe[src=''] {
display: none !important;
}

img {
max-width: 100% !important;
width: auto !important;
height: auto !important;
margin: 5px 0 !important;
display: flex !important;
text-align: center !important;
align-items: center !important;
justify-content: center !important;
}

/* HTML5 媒体文件跟 img 保持一致 */
audio,video,iframe,embed,pre, canvas{
audio,video,iframe,embed,pre,canvas{
max-width: 100% !important;
width: 100% !important;
height: auto !important;
display: inline-block;
display: inline-block !important;
margin: 5px 0 !important;
}

video,iframe,embed {
background: #E8E8E8;
background-image: repeating-linear-gradient(-30deg, hsla(0,0%,10%,.1),hsla(0,0%,10%,.1) 15px, transparent 0,transparent 30px);
background:repeating-linear-gradient(-50deg,#E8E8E8,#E8E8E8 1em,#d2d2d2 1em,#d2d2d2 2em) !important;
}
/* 如果在div中直接有文字,然后有audio,位置会错位。指定audio的高度可以解决 */

/* HTML5 媒体文件跟 img 保持一致 */
audio {
height: 32px;
height: 32px;
}

input{
width:auto !important;
max-width: 100% !important;
}
/* 取消点击后的橙色框。此处只设置了input、a、div,也可继续添加其他标签。*/
input:focus,a:focus,div:focus{
outline:none;
}


/* BLOCKS
=============================================================================*/

p,section,code,pre,article {
word-wrap: break-word; /* 自动折行 */
word-wrap: break-word !important; /* 自动折行 */
background: transparent !important;
}

p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}

div {
div,p {
max-width: 100% !important;
}

/* HEADERS
=============================================================================*/

h1, h2, h3, h4, h5, h6 {
margin: 10px 0 10px;
padding: 0;
Expand Down Expand Up @@ -117,7 +121,7 @@ h5, h6 {
=============================================================================*/
a {
color: #4183C4;
text-decoration:  underline;
text-decoration:  underline !important;
}

a:hover {
Expand Down Expand Up @@ -241,9 +245,15 @@ table {
border-spacing: 0;
padding: 5px 0;
max-width: 100% !important;
width: 100% !important;
height: auto !important;
}
td,object{
max-width: 100% !important;
height: auto !important;
}
td > pre, td > code {
border: 0 !important;
}

table th {
font-weight: bold;
Expand All @@ -254,29 +264,23 @@ table th, table td {
font-size: 14px !important;
}

/* 对齐是排版最重要的因素, 别让什么都居中 */
/* 对齐是排版最重要的因素, 别让什么都居中 */
caption, th {
text-align: left;
}

}


/* 文章的排版
================================*/
hr {
clear: both;
margin: 8px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 1px dashed #ddd;
padding: 0;
margin: 8px 0 !important;
border: none !important;
border-bottom: 1px dashed #ddd !important;
}

#hr {
margin: 10px 0px;
border-bottom: 1px solid #ddd;
border-bottom: 1px solid #ddd !important;
}

article {
Expand Down Expand Up @@ -306,18 +310,22 @@ article {
opacity: 0.4;
}
#video-button {
background-color:#4183C4;
border: none;
color: white;
padding: 8px 0px;
font-size: 12px;

position: absolute;
bottom: 0;
left: 0;
text-align: center;
height: 32px;
width: 100%;
cursor: pointer;
z-index: 6;
}
background-color:#4183c4;
border: none;
color: white;
padding: 8px 0px;
font-size: 12px;

position: absolute;
bottom: 0;
left: 0;
text-align: center;
height: 32px;
width: 100%;
cursor: pointer;
z-index: 6;
}
#readability-button{
font-size:12px;
margin-top: 10px
}
26 changes: 11 additions & 15 deletions app/src/main/java/me/wizos/loread/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.bumptech.glide.Glide;
import com.lzy.okgo.OkGo;
import com.socks.library.KLog;
import com.squareup.leakcanary.LeakCanary;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.stat.StatConfig;
Expand Down Expand Up @@ -48,16 +49,13 @@ public class App extends Application implements Thread.UncaughtExceptionHandler
* 此处的单例不会造成内存泄露,因为 App 本身就是全局的单例
*/
public static App instance;
public final static String APP_NAME_EN = "loread";
public final static String DB_NAME = "loread_DB";
public final static int Theme_Day = 0;
public final static int Theme_Night = 1;

// 跟使用的 API 有关的 字段
public static long UserID;
public static String StreamId;
public static String StreamTitle;
// public static String StreamState;
public static int StreamStatus;
// 这个只是从 Read 属性的4个类型(Readed, UnRead, UnReading, All), Star 属性的3个类型(Stared, UnStar, All)中,生硬的抽出 UnRead(含UnReading), Stared, All 3个快捷状态,供用户在主页面切换时使用
// 由于根据 StreamId 来获取文章,可从2个属性( Categories[针对Tag], OriginStreamId[针对Feed] )上,共4个变化上(All, Tag, NoTag, Feed)来获取文章。
Expand All @@ -76,7 +74,7 @@ public class App extends Application implements Thread.UncaughtExceptionHandler
public LinkedHashMap<String, Integer> articleProgress = new LinkedHashMap<String, Integer>() {
@Override
protected boolean removeEldestEntry(Map.Entry<String, Integer> eldest) {
return size() > 50;
return size() > 5;
}
};

Expand All @@ -101,14 +99,13 @@ public void onCreate() {
// 虽然他们的内存都维持在一个稳定的消耗水平,但总体看来,Application要比Activity少那么一点。
// 但是采用Application会影响,在 webview 中打开对话框
new WebView(this).destroy();
// articleWebView = new WebViewS(new MutableContextWrapper(this));

AsyncTask.SERIAL_EXECUTOR.execute(new Runnable() {
@Override
public void run() {
// 初始化网络框架
OkGo.getInstance().init(instance);
OkGo.getInstance().getOkHttpClient().dispatcher().setMaxRequestsPerHost(3);
// OkGo.getInstance().getOkHttpClient().dispatcher().setMaxRequestsPerHost(3);
OkGo.getInstance().getOkHttpClient().dispatcher().setMaxRequests(3);
// 初始化网络状态
NetworkUtil.THE_NETWORK = NetworkUtil.getNetWorkState();
Expand Down Expand Up @@ -146,12 +143,11 @@ public void uncaughtException(Thread thread, Throwable ex) {
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
KLog.e("内存清理");
KLog.e("内存onTrimMemory:" + level);
if (level == TRIM_MEMORY_UI_HIDDEN) {
Glide.get(this).clearMemory();
}
Glide.get(this).trimMemory(level);
System.gc();
}

/**
Expand Down Expand Up @@ -191,12 +187,12 @@ private void initLogAndCrash() {


// 内存泄漏检测工具
// private void initLeakCanary() {
// if (LeakCanary.isInAnalyzerProcess(this)) {
// return;
// }
// LeakCanary.install(this);
// }
private void initLeakCanary() {
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
}



Expand Down Expand Up @@ -284,7 +280,7 @@ public DaoSession getDaoSession() {
if (daoSession == null) {
// DaoMaster.OpenHelper helper = new DaoMaster.DevOpenHelper(i(), DB_NAME, null);
// 此处是为了方便升级
SQLiteOpenHelperS helper = new SQLiteOpenHelperS(i(), DB_NAME, null);
SQLiteOpenHelperS helper = new SQLiteOpenHelperS(i(), "loread_DB", null);
daoSession = new DaoMaster(helper.getWritableDb()).newSession();
}
return daoSession;
Expand Down
Loading

0 comments on commit 4cd5308

Please sign in to comment.