Skip to content

Commit

Permalink
省电优化 / Bug 修复
Browse files Browse the repository at this point in the history
  • Loading branch information
ndroi committed Sep 6, 2020
1 parent 87cad4e commit 534462a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Easy163/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "org.ndroi.easy163"
minSdkVersion 24
targetSdkVersion 28
versionCode 14
versionName "1.7.2"
versionCode 15
versionName "1.7.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
17 changes: 1 addition & 16 deletions Easy163/app/src/main/java/org/ndroi/easy163/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public boolean onNavigationItemSelected(MenuItem item)
Builder builder = new Builder(this);
builder.setTitle("使用说明");
builder.setMessage("开启本软件 VPN 服务后即可使用\n" +
"如无法使用请重启音乐软件\n" +
"如遇到设备网络异常请关闭本软件\n" +
"如音乐软件无法联网请重启手机\n" +
"清空音乐软件缓存后请重启本软件\n" +
"更多问题请查阅 Github");
builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
Expand Down Expand Up @@ -129,20 +128,6 @@ public void onClick(DialogInterface dialog, int which)
Cache.clear();
Local.clear();
Toast.makeText(this, "缓存已清除", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_donate)
{
Builder builder = new Builder(this);
builder.setTitle("捐赠支持");
builder.setMessage("暂未开放捐赠\n欢迎 Github 点赞支持");
builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
}
});
builder.show();
} else if (id == R.id.nav_about)
{
Builder builder = new Builder(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ndroi.easy163.utils;

import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.TextView;
import java.text.SimpleDateFormat;
Expand All @@ -16,6 +17,7 @@ public static void log(String info)

public static void setTextView(TextView textView)
{
textView.setMovementMethod(ScrollingMovementMethod.getInstance());
logger = new Logger(textView);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,11 @@ public void run()

try
{
ByteBuffer bufferToNetwork = null;

while (!Thread.interrupted())
{
bufferToNetwork = ByteBufferPool.acquire();
ByteBuffer bufferToNetwork = ByteBufferPool.acquire();
int readBytes = vpnInput.read(bufferToNetwork);

//MainActivity.upByte.addAndGet(readBytes);

if (readBytes > 0)
{
bufferToNetwork.flip();
Expand All @@ -318,7 +314,7 @@ public void run()
{
try
{
Thread.sleep(10);
Thread.sleep(50);
} catch (InterruptedException e)
{
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class ByteBufferPool

public static ByteBuffer acquire()
{
return ByteBuffer.allocate(BUFFER_SIZE);
//return ByteBuffer.allocate(BUFFER_SIZE);
return ByteBuffer.allocateDirect(BUFFER_SIZE);
}
}

3 changes: 2 additions & 1 deletion Easy163/app/src/main/res/layout/app_bar_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion Easy163/app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:gravity="bottom"
android:typeface="monospace"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:clickable="true"
android:id="@+id/log" />

<ToggleButton
Expand Down
3 changes: 0 additions & 3 deletions Easy163/app/src/main/res/menu/activity_main_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<item
android:id="@+id/nav_clear_cache"
android:title="清除缓存" />
<item
android:id="@+id/nav_donate"
android:title="捐赠支持" />
<item
android:id="@+id/nav_about"
android:title="关于" />
Expand Down

0 comments on commit 534462a

Please sign in to comment.