mirror of
https://github.com/sifacaii/VlcJellyfin
synced 2025-05-26 06:20:20 -04:00
添加检索
This commit is contained in:
parent
58f1c7d0f1
commit
02ea0ee07a
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@ -10,6 +10,7 @@
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/activity_detail.xml" value="0.14583333333333334" />
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/activity_search.xml" value="0.14583333333333334" />
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/activity_vlc_player.xml" value="0.286231884057971" />
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/dialog_login.xml" value="0.14479166666666668" />
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/item_h.xml" value="0.16770833333333332" />
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/item_v.xml" value="0.14583333333333334" />
|
||||
<entry key="..\:/code/VlcJellyfin/app/src/main/res/layout/popmenu.xml" value="0.14479166666666668" />
|
||||
|
@ -1,26 +1,23 @@
|
||||
package org.sifacai.vlcjellyfin;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
@ -112,22 +109,22 @@ public class MainActivity extends BaseActivity {
|
||||
private void addRowTvRecyclerView(String title, JsonArray data, boolean horizon) {
|
||||
Log.d(TAG, "addRowTvRecyclerView: " + data.toString());
|
||||
JRecyclerView tvRecyclerView = (JRecyclerView) LayoutInflater.from(this)
|
||||
.inflate(R.layout.home_horizon_tvrecycler,null);
|
||||
((V7LinearLayoutManager)tvRecyclerView.getLayoutManager()).setOrientation(V7LinearLayoutManager.HORIZONTAL);
|
||||
.inflate(R.layout.home_horizon_tvrecycler, null);
|
||||
((V7LinearLayoutManager) tvRecyclerView.getLayoutManager()).setOrientation(V7LinearLayoutManager.HORIZONTAL);
|
||||
|
||||
JAdapter jAdapter = new JAdapter(data, horizon);
|
||||
jAdapter.setOnItemClickListener(new JAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onClick(JsonObject jo) {
|
||||
String type = Utils.getJsonString(jo,"Type").getAsString();
|
||||
String type = Utils.getJsonString(jo, "Type").getAsString();
|
||||
String itemId = jo.get("Id").getAsString();
|
||||
Intent intent = null;
|
||||
if(type.equals("Folder") || type.equals("CollectionFolder")){
|
||||
intent = new Intent(mActivity,CollectionActivity.class);
|
||||
}else{
|
||||
intent = new Intent(mActivity,DetailActivity.class);
|
||||
if (type.equals("Folder") || type.equals("CollectionFolder")) {
|
||||
intent = new Intent(mActivity, CollectionActivity.class);
|
||||
} else {
|
||||
intent = new Intent(mActivity, DetailActivity.class);
|
||||
}
|
||||
intent.putExtra("itemId",itemId);
|
||||
intent.putExtra("itemId", itemId);
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -186,8 +183,8 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
LinearLayout ll = new LinearLayout(builder.getContext());
|
||||
ll.setOrientation(LinearLayout.VERTICAL);
|
||||
int pd = Utils.getPixelsFromDp(mActivity,mActivity.getResources().getDimensionPixelSize(R.dimen.padding_border));
|
||||
ll.setPadding(pd,pd,pd,pd);
|
||||
int pd = Utils.getPixelsFromDp(mActivity, mActivity.getResources().getDimensionPixelSize(R.dimen.padding_border));
|
||||
ll.setPadding(pd, pd, pd, pd);
|
||||
EditText urlInput = new EditText(ll.getContext());
|
||||
urlInput.setHint("服务器地址");
|
||||
urlInput.setText(Utils.config.getJellyfinUrl());
|
||||
@ -197,6 +194,9 @@ public class MainActivity extends BaseActivity {
|
||||
EditText pwInput = new EditText(ll.getContext());
|
||||
pwInput.setHint("密码");
|
||||
pwInput.setText(Utils.config.getPassWord());
|
||||
CheckBox saveCheckBox = new CheckBox(ll.getContext());
|
||||
saveCheckBox.setText("保存用户");
|
||||
saveCheckBox.setBackground(this.getResources().getDrawable(R.drawable.shape_user_focus));
|
||||
Button commitBtn = new Button(ll.getContext());
|
||||
commitBtn.setText("确定");
|
||||
commitBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@ -213,8 +213,10 @@ public class MainActivity extends BaseActivity {
|
||||
showLoadingDialog("正在验证用户名密码……");
|
||||
Utils.config.setJellyfinUrl(url);
|
||||
if (authenticateByName(un, pw)) {
|
||||
Utils.config.setUserName(un);
|
||||
Utils.config.setPassWord(pw);
|
||||
if(saveCheckBox.isChecked()) {
|
||||
Utils.config.setUserName(un);
|
||||
Utils.config.setPassWord(pw);
|
||||
}
|
||||
dialog.dismiss();
|
||||
initData(); //刷新首页
|
||||
} else {
|
||||
@ -240,6 +242,7 @@ public class MainActivity extends BaseActivity {
|
||||
ll.addView(urlInput);
|
||||
ll.addView(unInput);
|
||||
ll.addView(pwInput);
|
||||
ll.addView(saveCheckBox);
|
||||
ll.addView(commitBtn);
|
||||
ll.addView(canelBtn);
|
||||
dialog.setView(ll);
|
||||
@ -262,7 +265,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (valid) {
|
||||
String publicUrl = url + "/system/info/public";
|
||||
String publicInfo = Utils.okhttpSend(publicUrl);
|
||||
JsonObject serverInfo = Utils.JsonToObj(publicInfo,JsonObject.class);
|
||||
JsonObject serverInfo = Utils.JsonToObj(publicInfo, JsonObject.class);
|
||||
if (serverInfo != null) {
|
||||
String ServerId = serverInfo.get("Id").getAsString();
|
||||
if (ServerId == null || ServerId.length() == 0) {
|
||||
@ -287,9 +290,9 @@ public class MainActivity extends BaseActivity {
|
||||
String reqjson = "{\"Username\":\"" + username + "\",\"Pw\":\"" + password + "\"}";
|
||||
String userinfo = Utils.okhttpSend(url, reqjson);
|
||||
Log.d(TAG, "authenticateByName: userinf:" + userinfo);
|
||||
JsonObject userObj = Utils.JsonToObj(userinfo,JsonObject.class);
|
||||
JsonObject userObj = Utils.JsonToObj(userinfo, JsonObject.class);
|
||||
if (userObj != null) {
|
||||
String userId = Utils.getJsonString(userObj,"User").getAsJsonObject().get("Id").getAsString();
|
||||
String userId = Utils.getJsonString(userObj, "User").getAsJsonObject().get("Id").getAsString();
|
||||
String Token = userObj.get("AccessToken").getAsString();
|
||||
if (Token != null) {
|
||||
Utils.UserId = userId;
|
||||
@ -310,6 +313,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private long exitTime = 0;
|
||||
|
||||
public void exit() {
|
||||
if ((System.currentTimeMillis() - exitTime) > 2000) {
|
||||
Toast.makeText(getApplicationContext(), "再按一次退出程序",
|
||||
|
@ -6,11 +6,16 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="1200dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="@dimen/padding_border"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TTTTT" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/searchTermEdit"
|
||||
android:layout_width="600dp"
|
||||
@ -27,6 +32,11 @@
|
||||
android:src="@drawable/ic_outline_search_48"
|
||||
android:background="@drawable/shape_user_focus"
|
||||
android:layout_marginLeft="@dimen/button_margin_left" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TTTTT" />
|
||||
</LinearLayout>
|
||||
|
||||
<org.sifacai.vlcjellyfin.JRecyclerView
|
||||
|
62
app/src/main/res/layout/dialog_login.xml
Normal file
62
app/src/main/res/layout/dialog_login.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/padding_border" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dialog_login_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="服务器地址"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dialog_login_un"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="用户名"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/dialog_login_pw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:hint="密码"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/dialog_login_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusedByDefault="true"
|
||||
android:background="@drawable/shape_user_focus"
|
||||
android:text="保存用户" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_login_submit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/shape_user_focus"
|
||||
android:text="确定"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_login_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:focusable="true"
|
||||
android:background="@drawable/shape_user_focus"
|
||||
android:text="取消"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -10,9 +10,9 @@
|
||||
<!-- 默认 Button,TextView的文字颜色 -->
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<!-- 默认 EditView 输入框字体的颜色 -->
|
||||
<item name="android:editTextColor">#E6E6FA</item>
|
||||
<!-- <item name="android:editTextColor">#E6E6FA</item>-->
|
||||
<!-- RadioButton checkbox等控件的文字 -->
|
||||
<item name="android:textColorPrimaryDisableOnly">#1C71A9</item>
|
||||
<!-- <item name="android:textColorPrimaryDisableOnly">#1C71A9</item>-->
|
||||
<!-- 应用的主要文字颜色,actionBar的标题文字默认使用该颜色 -->
|
||||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
<!-- 辅助的文字颜色,一般比textColorPrimary的颜色弱一点,用于一些弱化的表示 -->
|
||||
|
Loading…
Reference in New Issue
Block a user