mirror of
https://github.com/sifacaii/VlcJellyfin
synced 2025-06-03 00:58:06 -04:00
优化
This commit is contained in:
parent
c81ac71bc1
commit
72f042c944
@ -16,6 +16,7 @@
|
|||||||
android:roundIcon="@drawable/touchicon144"
|
android:roundIcon="@drawable/touchicon144"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/jellyfin"
|
android:theme="@style/jellyfin"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
@ -3,11 +3,13 @@ package org.sifacai.vlcjellyfin;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -25,7 +27,8 @@ public class PopMenu extends PopupWindow {
|
|||||||
private Context context;
|
private Context context;
|
||||||
private ArrayList<menu> items;
|
private ArrayList<menu> items;
|
||||||
private View attView;
|
private View attView;
|
||||||
private LinearLayout contentView;
|
private ScrollView contentView;
|
||||||
|
private LinearLayout itemContiner;
|
||||||
|
|
||||||
public PopMenu(Context context, View attView) {
|
public PopMenu(Context context, View attView) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -37,9 +40,11 @@ public class PopMenu extends PopupWindow {
|
|||||||
setOutsideTouchable(true);
|
setOutsideTouchable(true);
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
contentView = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.popmenu,null);
|
contentView = (ScrollView) LayoutInflater.from(context).inflate(R.layout.popmenu,null);
|
||||||
setContentView(contentView);
|
setContentView(contentView);
|
||||||
|
itemContiner = contentView.findViewById(R.id.popitemContiner);
|
||||||
this.attView = attView;
|
this.attView = attView;
|
||||||
|
setClippingEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public menu add(int groupid,int id,int orderid,String name){
|
public menu add(int groupid,int id,int orderid,String name){
|
||||||
@ -52,11 +57,14 @@ public class PopMenu extends PopupWindow {
|
|||||||
m.v = v;
|
m.v = v;
|
||||||
((TextView)v).setText(name);
|
((TextView)v).setText(name);
|
||||||
items.add(m);
|
items.add(m);
|
||||||
contentView.addView(v);
|
itemContiner.addView(v);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(){
|
public void show(){
|
||||||
|
if(items.size() > 12){
|
||||||
|
setHeight(500);
|
||||||
|
}
|
||||||
contentView.measure(makeDropDownMeasureSpec(getWidth())
|
contentView.measure(makeDropDownMeasureSpec(getWidth())
|
||||||
,makeDropDownMeasureSpec(getHeight()));
|
,makeDropDownMeasureSpec(getHeight()));
|
||||||
int offx = 0;
|
int offx = 0;
|
||||||
@ -66,8 +74,10 @@ public class PopMenu extends PopupWindow {
|
|||||||
|
|
||||||
public void show(int index){
|
public void show(int index){
|
||||||
show();
|
show();
|
||||||
|
if(index >=0 && index < items.size()) {
|
||||||
items.get(index).v.requestFocus();
|
items.get(index).v.requestFocus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void show(String name){
|
public void show(String name){
|
||||||
show();
|
show();
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="0dp"
|
android:padding="0dp"
|
||||||
android:layout_margin="0dp" >
|
android:layout_margin="0dp">
|
||||||
</LinearLayout>
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/popitemContiner"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="0dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="0dp" />
|
||||||
|
|
||||||
|
</ScrollView>
|
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="jellyfin" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="jellyfin" parent="Theme.Material3.Dark.NoActionBar">
|
||||||
<!-- hide title bar -->
|
<!-- hide title bar -->
|
||||||
<item name="windowNoTitle">true</item>
|
<!-- <item name="windowNoTitle">true</item>-->
|
||||||
<item name="android:background">@null</item>
|
<!-- <item name="android:background">@null</item>-->
|
||||||
<item name="android:windowBackground">@drawable/app_bg</item>
|
<!-- <item name="android:windowBackground">@drawable/app_bg</item>-->
|
||||||
|
|
||||||
<item name="android:textSize">22dp</item>
|
<item name="android:textSize">22dp</item>
|
||||||
<!-- 默认 Button,TextView的文字颜色 -->
|
<!-- 默认 Button,TextView的文字颜色 -->
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<!-- RadioButton checkbox等控件的文字 -->
|
<!-- RadioButton checkbox等控件的文字 -->
|
||||||
<item name="android:textColorPrimaryDisableOnly">#1C71A9</item>
|
<item name="android:textColorPrimaryDisableOnly">#1C71A9</item>
|
||||||
<!-- 应用的主要文字颜色,actionBar的标题文字默认使用该颜色 -->
|
<!-- 应用的主要文字颜色,actionBar的标题文字默认使用该颜色 -->
|
||||||
<item name="android:textColorPrimary">#FFFFFF</item>
|
<item name="android:textColorPrimary">@android:color/white</item>
|
||||||
<!-- 辅助的文字颜色,一般比textColorPrimary的颜色弱一点,用于一些弱化的表示 -->
|
<!-- 辅助的文字颜色,一般比textColorPrimary的颜色弱一点,用于一些弱化的表示 -->
|
||||||
<item name="android:textColorSecondary">#C1C1C1</item>
|
<item name="android:textColorSecondary">#C1C1C1</item>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user