Skip to content

Commit

Permalink
3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbxyyx committed Nov 27, 2024
1 parent a4676d5 commit 769d9e6
Show file tree
Hide file tree
Showing 5 changed files with 400 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
applicationId "com.github.jsbxyyx.xbook"
minSdk 27
targetSdk 33
versionCode 36
versionName "3.6"
versionCode 37
versionName "3.7"
archivesBaseName = "xplay"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.pm.ActivityInfo;
import android.os.Bundle;

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

import com.github.jsbxyyx.xbook.common.Common;
Expand Down Expand Up @@ -54,6 +55,9 @@ protected void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

WebProgress webProgress = findViewById(R.id.progress);
webProgress.setColor("#1AAD19");

try {
webView = findViewById(R.id.wv_html_view);
GeckoSession session = new GeckoSession();
Expand All @@ -76,6 +80,34 @@ protected void onCreate(Bundle savedInstanceState) {
settings.setAllowJavascript(true);
settings.setUserAgentMode(GeckoSessionSettings.USER_AGENT_MODE_MOBILE);

session.setProgressDelegate(new GeckoSession.ProgressDelegate() {
@Override
public void onPageStart(@NonNull GeckoSession session, @NonNull String url) {
GeckoSession.ProgressDelegate.super.onPageStart(session, url);
}

@Override
public void onPageStop(@NonNull GeckoSession session, boolean success) {
GeckoSession.ProgressDelegate.super.onPageStop(session, success);
}

@Override
public void onProgressChange(@NonNull GeckoSession session, int progress) {
GeckoSession.ProgressDelegate.super.onProgressChange(session, progress);
webProgress.setProgress(progress);
}

@Override
public void onSecurityChange(@NonNull GeckoSession session, @NonNull SecurityInformation securityInfo) {
GeckoSession.ProgressDelegate.super.onSecurityChange(session, securityInfo);
}

@Override
public void onSessionStateChange(@NonNull GeckoSession session, @NonNull GeckoSession.SessionState sessionState) {
GeckoSession.ProgressDelegate.super.onSessionStateChange(session, sessionState);
}
});

session.open(runtime);
webView.setSession(session);

Expand All @@ -84,6 +116,7 @@ protected void onCreate(Bundle savedInstanceState) {
});

session.loadUri(url);
webProgress.show();
} catch (Exception e) {
LogUtil.e(getClass().getSimpleName(), "onCreate: %s", LogUtil.getStackTraceString(e));
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/github/jsbxyyx/xbook/HomeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ public void call(JsonNode o, Throwable err) {
double localName = Double.parseDouble(versionName);
double cloudName = Double.parseDouble(update.get("name").asText().trim());
if (cloudName > localName) {
String message = "有新版本啦,前往 我的-设置 进行版本更新";
mActivity.runOnUiThread(() -> {
new AlertDialog.Builder(mActivity)
.setTitle("提示")
.setMessage("有新版本啦,前往 我的-设置 进行版本更新")
.setMessage(message)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Expand Down
Loading

0 comments on commit 769d9e6

Please sign in to comment.