[mobile] adjust collect ui

pull/142/head
FongMi 3 years ago
parent 36f967c858
commit 1f499858bd
  1. 4
      app/build.gradle
  2. 2
      app/src/main/java/com/fongmi/android/tv/utils/Utils.java
  3. 6
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/CollectActivity.java
  4. 5
      app/src/mobile/res/layout/activity_collect.xml
  5. 2
      quickjs/src/main/java/com/fongmi/quickjs/Provider.java
  6. 8
      quickjs/src/main/java/com/fongmi/quickjs/utils/Module.java

@ -21,12 +21,12 @@ android {
leanback {
dimension "mode"
versionCode 205
versionName "20230908#2"
versionName "20230908#3"
}
mobile {
dimension "mode"
versionCode 205
versionName "20230908#2"
versionName "20230908#3"
}
java {
dimension "api"

@ -127,7 +127,7 @@ public class Utils {
}
public static int getPendingFlag() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT;
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT;
}
public static int getDigit(String text) {

@ -7,7 +7,6 @@ import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelProvider;
@ -142,12 +141,9 @@ public class CollectActivity extends BaseActivity implements CustomScroller.Call
private void setViewType(int viewType) {
int count = Product.getColumn(this) - 1;
mSearchAdapter.setViewType(viewType, count);
mSearchAdapter.setSize(Product.getSpec(this, ResUtil.dp2px((count + 2) * 16), count + 1));
mSearchAdapter.setSize(Product.getSpec(this, ResUtil.dp2px(128 + (count) * 16), count));
((GridLayoutManager) mBinding.recycler.getLayoutManager()).setSpanCount(mSearchAdapter.isGrid() ? count : 1);
mBinding.view.setImageResource(mSearchAdapter.isGrid() ? R.drawable.ic_action_list : R.drawable.ic_action_grid);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mBinding.collect.getLayoutParams();
params.width = mSearchAdapter.getWidth() + ResUtil.dp2px(24);
mBinding.collect.setLayoutParams(params);
}
private void setViewModel() {

@ -110,7 +110,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/collect"
android:layout_width="wrap_content"
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_marginTop="-8dp"
android:clipChildren="false"
@ -135,7 +135,8 @@
android:paddingEnd="8dp"
android:paddingBottom="8dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2" />
app:spanCount="2"
tools:listitem="@layout/adapter_vod_rect" />
</RelativeLayout>
</LinearLayout>

@ -31,7 +31,7 @@ public class Provider extends ContentProvider {
@Override
public String getModuleScript(String moduleName) {
return Module.get().load(moduleName);
return Module.get().fetch(moduleName);
}
});
}

@ -29,14 +29,14 @@ public class Module {
this.cache = new ConcurrentHashMap<>();
}
public String load(String name) {
public String fetch(String name) {
if (cache.contains(name)) return cache.get(name);
if (name.startsWith("http")) cache.put(name, getModule(name));
if (name.startsWith("assets://")) cache.put(name, Path.asset(name.substring(9)));
if (name.startsWith("http")) cache.put(name, request(name));
if (name.startsWith("assets")) cache.put(name, Path.asset(name.substring(9)));
return cache.get(name);
}
private String getModule(String url) {
private String request(String url) {
try {
Uri uri = Uri.parse(url);
File file = Path.js(uri.getLastPathSegment());

Loading…
Cancel
Save