pull/144/head
于俊 1 year ago
parent 499bf107a3
commit 51621d80fb
  1. 20
      app/build.gradle
  2. BIN
      app/libs/pyramid.aar
  3. 2
      app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
  4. 29
      app/src/main/java/com/github/tvbox/osc/ui/dialog/SelectDialog.java
  5. 2
      gradle.properties
  6. 9
      pyramid/build.gradle
  7. 7
      pyramid/consumer-rules.pro
  8. 9
      pyramid/proguard-rules.pro

@ -41,6 +41,7 @@ android {
minifyEnabled false
ndk {
//noinspection ChromeOsAbiSupport
abiFilters 'armeabi-v7a'
}
}
@ -48,6 +49,7 @@ android {
minifyEnabled true
ndk {
//noinspection ChromeOsAbiSupport
abiFilters 'armeabi-v7a'
}
}
@ -79,13 +81,10 @@ android {
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
api fileTree(dir: "libs", include: ["*.jar"])
api fileTree(dir: "libs", include: ["*.jar","*.aar"])
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'com.google.zxing:core:3.3.0'
@ -93,8 +92,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation files('libs/thunder.jar')
implementation files('libs/commons-lang3-3.12.0.jar')
// implementation files('libs/thunder.jar')
// implementation files('libs/commons-lang3-3.12.0.jar')
implementation 'com.squareup.okhttp3:okhttp:3.12.11'
@ -117,9 +116,7 @@ dependencies {
implementation project(":quickjs")
pythonImplementation project(":pyramid")
// implementation('org.xwalk:xwalk_shared_library:23.53.589.4') {
// exclude group: 'com.android.support'
// }
implementation 'com.lzy.net:okgo:3.0.4'
// implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
implementation 'com.owen:tv-recyclerview:3.0.0'
@ -129,9 +126,6 @@ dependencies {
implementation 'com.github.hedzr:android-file-chooser:v1.2.0-final'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
// implementation(name:'pyramid',ext:'aar')
// pythonImplementation(name:'pyramid', ext:'aar')
implementation(name:'xwalk_shared_library-23.53.589.4',ext:'aar')
//http3
implementation ('com.google.net.cronet:cronet-okhttp:0.1.0')
// implementation 'com.google.android.gms:play-services-cronet:18.0.1'

Binary file not shown.

@ -651,7 +651,7 @@ public class HomeActivity extends BaseActivity {
List<SourceBean> sites = ApiConfig.get().getSwitchSourceBeanList();
if (sites.isEmpty()) return;
int select = sites.indexOf(ApiConfig.get().getHomeSourceBean());
if (select < 0) select = 0;
if (select < 0 || select >= sites.size()) select = 0;
if (mSiteSwitchDialog == null) {
mSiteSwitchDialog = new SelectDialog<>(HomeActivity.this);
TvRecyclerView tvRecyclerView = mSiteSwitchDialog.findViewById(R.id.list);

@ -41,29 +41,22 @@ public class SelectDialog<T> extends BaseDialog {
public void setAdapter(SelectDialogAdapter.SelectDialogInterface<T> sourceBeanSelectDialogInterface,
DiffUtil.ItemCallback<T> sourceBeanItemCallback,
List<T> data, int select) {
final int selectIdx = select;
SelectDialogAdapter<T> adapter = new SelectDialogAdapter<>(sourceBeanSelectDialogInterface, sourceBeanItemCallback);
adapter.setData(data, select);
TvRecyclerView tvRecyclerView = findViewById(R.id.list);
tvRecyclerView.setAdapter(adapter);
tvRecyclerView.post(() -> {
RecyclerView.LayoutManager layoutManager = tvRecyclerView.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
int spanCount = gridLayoutManager.getNumColumns();
int rowIndex = select / spanCount;
int firstVisibleRow = gridLayoutManager.getFirstVisiblePosition() / spanCount;
int lastVisibleRow = gridLayoutManager.getLastVisiblePosition() / spanCount;
// 平滑滚动并调整位置
if (rowIndex < firstVisibleRow || rowIndex > lastVisibleRow) {
int offset = tvRecyclerView.getHeight() / 3;
gridLayoutManager.scrollToPositionWithOffset(select, offset);
tvRecyclerView.setSelectedPosition(select);
if (select<10){
tvRecyclerView.setSelection(select);
}
tvRecyclerView.post(new Runnable() {
@Override
public void run() {
if (selectIdx >= 10) {
tvRecyclerView.smoothScrollToPosition(selectIdx);
tvRecyclerView.setSelectionWithSmooth(selectIdx);
}
// tvRecyclerView.postDelayed(() -> tvRecyclerView.smoothScrollToPosition(select), 200);
} else if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
int offset = tvRecyclerView.getHeight() / 3;
linearLayoutManager.scrollToPositionWithOffset(select, offset);
// tvRecyclerView.postDelayed(() -> tvRecyclerView.smoothScrollToPosition(select), 200);
}
});
}

@ -17,4 +17,4 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
IsDebug=true
#org.gradle.jvmargs=-Xmx2048m --add-opens java.base/java.io=ALL-UNNAMED
org.gradle.jvmargs=-Xmx2048m --add-opens java.base/java.io=ALL-UNNAMED

@ -9,13 +9,11 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
consumerProguardFiles "consumer-rules.pro"
ndk {
//abiFilters 'arm64-v8a'
abiFilters "armeabi-v7a"
}
python {
// version "3.8"
buildPython("D:/Programs/Python/Python38/python.exe")
pip {
install "lxml"
@ -31,6 +29,11 @@ android {
}
buildTypes {
all {
ndk {
abiFilters 'armeabi-v7a'
}
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@ -49,7 +52,7 @@ android {
python.srcDirs = ["src/python"]
}
}
buildToolsVersion '30.0.2'
// buildToolsVersion '30.0.2'
}
dependencies {

@ -1,8 +1 @@
-dontwarn okhttp3.**
-keep class okhttp3.**{*;}
# Python支持
-keep public class com.undcover.freedom.pyramid.** { *; }
-dontwarn com.undcover.freedom.pyramid.**
-keep public class com.chaquo.python.** { *; }
-dontwarn com.chaquo.python.**

@ -19,12 +19,3 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#okhttp
-dontwarn okhttp3.**
-keep class okhttp3.**{*;}
# Python支持
-keep public class com.undcover.freedom.pyramid.** { *; }
-dontwarn com.undcover.freedom.pyramid.**
-keep public class com.chaquo.python.** { *; }
-dontwarn com.chaquo.python.**

Loading…
Cancel
Save