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

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
670848654 committed Nov 18, 2019
1 parent b076243 commit 8b49023
Show file tree
Hide file tree
Showing 23 changed files with 1,177 additions and 142 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "my.project.sakuraproject"
minSdkVersion 21
targetSdkVersion 29
versionCode 9
versionName "1.8.1"
versionCode 10
versionName "1.8.2"
ndk{abiFilters "armeabi", "armeabi-v7a", "x86"}
resConfigs"zh"
}
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<application
Expand Down Expand Up @@ -51,13 +52,25 @@
android:supportsPictureInPicture="true"
android:theme="@style/AppTheme.FullScreenTheme" />
<activity
android:name=".main.webview.WebActivity"
android:name=".main.webview.normal.NormalWebActivity"
android:configChanges="screenLayout|orientation|screenSize|smallestScreenSize|keyboardHidden|uiMode"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".main.webview.DefaultWebActivity"
android:name=".main.webview.normal.DefaultNormalWebActivity"
android:configChanges="screenLayout|orientation|screenSize|smallestScreenSize|keyboardHidden|uiMode"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".main.webview.x5.DefaultX5WebActivity"
android:configChanges="screenLayout|orientation|screenSize|smallestScreenSize|keyboardHidden|uiMode"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<activity
android:name=".main.webview.x5.X5WebActivity"
android:configChanges="screenLayout|orientation|screenSize|smallestScreenSize|keyboardHidden|uiMode"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ private void initTBS() {
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
if (arg0) showSuccessToastMsg("X5内核加载成功");
else showErrorToastMsg("X5内核加载失败");
// if (arg0) showSuccessToastMsg("X5内核加载成功");
// else showErrorToastMsg("X5内核加载失败");
}

@Override
public void onCoreInitFinished() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void showUpdateLogs() {

public List createUpdateLogList() {
List logsList = new ArrayList();
logsList.add(new LogBean("版本:1.8.2","默认禁用X5内核,X5内核更新后会导致应用闪退(Android 10),你可以在自定义设置中打开,若发生闪退则关闭该选项"));
logsList.add(new LogBean("版本:1.8.1","修复某些设备导航栏的显示问题"));
logsList.add(new LogBean("版本:1.8","修复一些Bugs\n修正部分界面布局\n适配沉浸式导航栏《仅支持原生导航栏,第三方魔改UI无效》(Test)"));
logsList.add(new LogBean("版本:1.7","修复一些Bugs\n修正部分界面布局\n新增亮色主题(Test)"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.tencent.smtt.sdk.TbsVideo;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import my.project.sakuraproject.R;
Expand All @@ -37,6 +40,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
if (!getRunningActivityName().equals("StartActivity") && !getRunningActivityName().equals("HomeActivity")) overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
initBeforeView();
setContentView(setLayoutRes());
if (TbsVideo.canUseTbsPlayer(this)) SharedPreferencesUtils.setParam(getApplicationContext(),"loadX5",false);
if (Utils.checkHasNavigationBar(this)) {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
Expand Down Expand Up @@ -156,8 +160,10 @@ public void setStatusBarColor() {
if (!getRunningActivityName().equals("HomeActivity") &&
!getRunningActivityName().equals("DescActivity") &&
!getRunningActivityName().equals("PlayerActivity") &&
!getRunningActivityName().equals("DefaultWebActivity") &&
!getRunningActivityName().equals("WebActivity")) {
!getRunningActivityName().equals("DefaultX5WebActivity") &&
!getRunningActivityName().equals("X5WebActivity") &&
!getRunningActivityName().equals("DefaultNormalWebActivity") &&
!getRunningActivityName().equals("NormalWebActivity")) {
if (gtSdk23()) {
StatusBarUtil.setColorForSwipeBack(this, getColor(R.color.colorPrimary), 0);
if (!(Boolean) SharedPreferencesUtils.getParam(this, "darkTheme", false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
import my.project.sakuraproject.main.base.BaseActivity;
import my.project.sakuraproject.main.video.VideoContract;
import my.project.sakuraproject.main.video.VideoPresenter;
import my.project.sakuraproject.main.webview.DefaultWebActivity;
import my.project.sakuraproject.main.webview.normal.DefaultNormalWebActivity;
import my.project.sakuraproject.main.webview.x5.DefaultX5WebActivity;
import my.project.sakuraproject.util.SharedPreferencesUtils;
import my.project.sakuraproject.util.StatusBarUtil;
import my.project.sakuraproject.util.SwipeBackLayoutUtil;
Expand Down Expand Up @@ -243,11 +244,17 @@ private void playAnime(String animeUrl) {
}
} else {
Sakura.getInstance().showToastMsg(Utils.getString(R.string.should_be_used_web));
startActivity(new Intent(DescActivity.this, DefaultWebActivity.class).putExtra("url", animeUrl));
if (Utils.loadX5())
startActivity(new Intent(DescActivity.this, DefaultX5WebActivity.class).putExtra("url", animeUrl));
else
startActivity(new Intent(DescActivity.this, DefaultNormalWebActivity.class).putExtra("url", animeUrl));
}
} else {
Sakura.getInstance().showToastMsg(Utils.getString(R.string.maybe_can_not_play));
startActivity(new Intent(DescActivity.this, DefaultWebActivity.class).putExtra("url",String.format(Api.PARSE_API, animeUrl)));
if (Utils.loadX5())
startActivity(new Intent(DescActivity.this, DefaultX5WebActivity.class).putExtra("url",String.format(Api.PARSE_API, animeUrl)));
else
startActivity(new Intent(DescActivity.this, DefaultNormalWebActivity.class).putExtra("url",String.format(Api.PARSE_API, animeUrl)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
import my.project.sakuraproject.main.base.Presenter;
import my.project.sakuraproject.main.video.VideoContract;
import my.project.sakuraproject.main.video.VideoPresenter;
import my.project.sakuraproject.main.webview.DefaultWebActivity;
import my.project.sakuraproject.main.webview.normal.DefaultNormalWebActivity;
import my.project.sakuraproject.main.webview.x5.DefaultX5WebActivity;
import my.project.sakuraproject.util.SharedPreferencesUtils;
import my.project.sakuraproject.util.StatusBarUtil;
import my.project.sakuraproject.util.Utils;
Expand Down Expand Up @@ -218,12 +219,18 @@ private void playAnime(String animeUrl) {
}
}else {
Sakura.getInstance().showToastMsg(Utils.getString(R.string.should_be_used_web));
startActivity(new Intent(PlayerActivity.this, DefaultWebActivity.class).putExtra("url", url));
if (Utils.loadX5())
startActivity(new Intent(PlayerActivity.this, DefaultX5WebActivity.class).putExtra("url", url));
else
startActivity(new Intent(PlayerActivity.this, DefaultNormalWebActivity.class).putExtra("url", url));
this.finish();
}
} else {
Sakura.getInstance().showToastMsg(Utils.getString(R.string.maybe_can_not_play));
startActivity(new Intent(PlayerActivity.this, DefaultWebActivity.class).putExtra("url",String.format(Api.PARSE_API, url)));
if (Utils.loadX5())
startActivity(new Intent(PlayerActivity.this, DefaultX5WebActivity.class).putExtra("url",String.format(Api.PARSE_API, url)));
else
startActivity(new Intent(PlayerActivity.this, DefaultNormalWebActivity.class).putExtra("url",String.format(Api.PARSE_API, url)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.widget.TextView;

import com.r0adkll.slidr.Slidr;
import com.tencent.smtt.sdk.TbsVideo;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
Expand All @@ -37,10 +38,13 @@ public class SettingActivity extends BaseActivity {
TextView player_default;
@BindView(R.id.api)
TextView api;
@BindView(R.id.x5_state)
TextView x5_state;
@BindView(R.id.footer)
LinearLayout footer;
private String url;
private String[] playerItems = Utils.getArray(R.array.player);
private String [] x5Items = {"启用","禁用"};

@Override
protected Presenter createPresenter() {
Expand Down Expand Up @@ -92,10 +96,12 @@ public void getUserCustomSet() {
player_default.setText(playerItems[1]);
break;
}
if (Utils.loadX5()) x5_state.setText(x5Items[0]);
else x5_state.setText(x5Items[1]);
domain_default.setText(Sakura.DOMAIN);
}

@OnClick({R.id.set_domain, R.id.set_player, R.id.set_api_source})
@OnClick({R.id.set_domain, R.id.set_player, R.id.set_api_source,R.id.set_x5})
public void onClick(RelativeLayout layout) {
switch (layout.getId()) {
case R.id.set_domain:
Expand All @@ -107,6 +113,9 @@ public void onClick(RelativeLayout layout) {
case R.id.set_api_source:
startActivity(new Intent(this, ApiActivity.class));
break;
case R.id.set_x5:
setX5State();
break;
}
}

Expand Down Expand Up @@ -163,21 +172,41 @@ public void onNothingSelected(AdapterView<?> parent) {
public void setDefaultPlayer() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(Utils.getString(R.string.select_player));
builder.setSingleChoiceItems(playerItems, (Integer) SharedPreferencesUtils.getParam(getApplicationContext(), "player", 0), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
SharedPreferencesUtils.setParam(getApplicationContext(), "player", 0);
player_default.setText(playerItems[0]);
break;
case 1:
SharedPreferencesUtils.setParam(getApplicationContext(), "player", 1);
player_default.setText(playerItems[1]);
break;
}
dialog.dismiss();
builder.setSingleChoiceItems(playerItems, (Integer) SharedPreferencesUtils.getParam(getApplicationContext(), "player", 0), (dialog, which) -> {
switch (which) {
case 0:
SharedPreferencesUtils.setParam(getApplicationContext(), "player", 0);
player_default.setText(playerItems[0]);
break;
case 1:
SharedPreferencesUtils.setParam(getApplicationContext(), "player", 1);
player_default.setText(playerItems[1]);
break;
}
dialog.dismiss();
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}

public void setX5State() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("请选择");
builder.setSingleChoiceItems(x5Items, Utils.loadX5() ? 0 : 1, (dialog, which) -> {
switch (which){
case 0:
if (TbsVideo.canUseTbsPlayer(SettingActivity.this)) {
SharedPreferencesUtils.setParam(getApplicationContext(),"loadX5",true);
x5_state.setText(x5Items[0]);
}else
application.showErrorToastMsg("X5内核未能加载成功,无法启用");
break;
case 1:
SharedPreferencesUtils.setParam(getApplicationContext(),"loadX5",false);
x5_state.setText(x5Items[1]);
break;
}
dialog.dismiss();
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
Expand Down
Loading

0 comments on commit 8b49023

Please sign in to comment.