@ -0,0 +1,50 @@ |
||||
package com.fongmi.bear.bean; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
|
||||
import com.fongmi.bear.R; |
||||
import com.fongmi.bear.utils.ResUtil; |
||||
|
||||
public class Func { |
||||
|
||||
private final int resId; |
||||
private int drawable; |
||||
|
||||
public static Func create(int resId) { |
||||
return new Func(resId); |
||||
} |
||||
|
||||
public Func(int resId) { |
||||
this.resId = resId; |
||||
this.setDrawable(); |
||||
} |
||||
|
||||
public int getDrawable() { |
||||
return drawable; |
||||
} |
||||
|
||||
public String getText() { |
||||
return ResUtil.getString(resId); |
||||
} |
||||
|
||||
@SuppressLint("NonConstantResourceId") |
||||
public void setDrawable() { |
||||
switch (resId) { |
||||
case R.string.home_vod: |
||||
this.drawable = R.drawable.ic_vod; |
||||
break; |
||||
case R.string.home_live: |
||||
this.drawable = R.drawable.ic_live; |
||||
break; |
||||
case R.string.home_push: |
||||
this.drawable = R.drawable.ic_push; |
||||
break; |
||||
case R.string.home_search: |
||||
this.drawable = R.drawable.ic_search; |
||||
break; |
||||
case R.string.home_setting: |
||||
this.drawable = R.drawable.ic_setting; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
@ -1,4 +1,4 @@ |
||||
package com.fongmi.bear.ui; |
||||
package com.fongmi.bear.ui.activity; |
||||
|
||||
import android.app.Activity; |
||||
import android.content.res.Configuration; |
||||
@ -1,4 +1,4 @@ |
||||
package com.fongmi.bear.ui; |
||||
package com.fongmi.bear.ui.activity; |
||||
|
||||
import android.app.Activity; |
||||
import android.content.Intent; |
||||
@ -1,4 +1,4 @@ |
||||
package com.fongmi.bear.ui; |
||||
package com.fongmi.bear.ui.activity; |
||||
|
||||
import android.animation.Animator; |
||||
import android.animation.AnimatorListenerAdapter; |
||||
@ -0,0 +1,66 @@ |
||||
package com.fongmi.bear.ui.adapter; |
||||
|
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.fongmi.bear.R; |
||||
import com.fongmi.bear.bean.Func; |
||||
import com.fongmi.bear.databinding.AdapterFuncBinding; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class FuncAdapter extends RecyclerView.Adapter<FuncAdapter.FuncHolder> { |
||||
|
||||
private List<Func> items; |
||||
|
||||
public FuncAdapter() { |
||||
addAll(); |
||||
} |
||||
|
||||
static class FuncHolder extends RecyclerView.ViewHolder implements View.OnClickListener { |
||||
|
||||
private final AdapterFuncBinding binding; |
||||
|
||||
public FuncHolder(@NonNull AdapterFuncBinding binding) { |
||||
super(binding.getRoot()); |
||||
this.binding = binding; |
||||
itemView.setOnClickListener(this); |
||||
} |
||||
|
||||
@Override |
||||
public void onClick(View view) { |
||||
} |
||||
} |
||||
|
||||
public void addAll() { |
||||
items = new ArrayList<>(); |
||||
items.add(Func.create(R.string.home_vod)); |
||||
items.add(Func.create(R.string.home_live)); |
||||
items.add(Func.create(R.string.home_search)); |
||||
items.add(Func.create(R.string.home_push)); |
||||
items.add(Func.create(R.string.home_setting)); |
||||
} |
||||
|
||||
@Override |
||||
public int getItemCount() { |
||||
return items.size(); |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public FuncAdapter.FuncHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
return new FuncHolder(AdapterFuncBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); |
||||
} |
||||
|
||||
@Override |
||||
public void onBindViewHolder(@NonNull FuncAdapter.FuncHolder holder, int position) { |
||||
Func item = items.get(position); |
||||
holder.binding.icon.setImageResource(item.getDrawable()); |
||||
holder.binding.text.setText(item.getText()); |
||||
} |
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
package com.fongmi.bear.utils; |
||||
|
||||
import androidx.annotation.StringRes; |
||||
|
||||
import com.fongmi.bear.App; |
||||
|
||||
public class ResUtil { |
||||
|
||||
public static String getString(@StringRes int resId) { |
||||
return App.get().getString(resId); |
||||
} |
||||
} |
||||
|
After Width: | Height: | Size: 692 B |
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 525 B |
|
After Width: | Height: | Size: 656 B |
|
After Width: | Height: | Size: 689 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 743 B |
|
After Width: | Height: | Size: 920 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
@ -1,4 +1,61 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" /> |
||||
android:layout_height="match_parent"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:orientation="vertical" |
||||
android:padding="16dp"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:text="@string/app_name" |
||||
android:textColor="@color/white" |
||||
android:textSize="24sp" /> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/func" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
tools:itemCount="5" |
||||
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager" |
||||
tools:listitem="@layout/adapter_func" |
||||
tools:orientation="vertical" |
||||
tools:scrollbars="vertical" |
||||
tools:spanCount="5" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
android:text="@string/home_recent" |
||||
android:textColor="@color/white" |
||||
android:textSize="24sp" /> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recent" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" |
||||
android:text="@string/home_update" |
||||
android:textColor="@color/white" |
||||
android:textSize="24sp" /> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/update" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="16dp" /> |
||||
|
||||
</LinearLayout> |
||||
</androidx.core.widget.NestedScrollView> |
||||
@ -0,0 +1,26 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="96dp" |
||||
android:layout_height="96dp" |
||||
android:layout_marginEnd="12dp" |
||||
android:background="@drawable/selector_item" |
||||
android:gravity="center" |
||||
android:orientation="vertical"> |
||||
|
||||
<ImageView |
||||
android:id="@+id/icon" |
||||
android:layout_width="36dp" |
||||
android:layout_height="36dp" |
||||
tools:src="@drawable/ic_vod" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/text" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="4dp" |
||||
android:textColor="@color/white" |
||||
android:textSize="18sp" |
||||
tools:text="點播" /> |
||||
|
||||
</LinearLayout> |
||||
@ -1,9 +1,25 @@ |
||||
<resources> |
||||
|
||||
<!-- App --> |
||||
<string name="app_name">熊爱影视</string> |
||||
|
||||
<!-- Splash --> |
||||
<string name="splash_info">正在载入配置</string> |
||||
|
||||
<!-- Home --> |
||||
<string name="home_vod">点播</string> |
||||
<string name="home_live">直播</string> |
||||
<string name="home_search">搜寻</string> |
||||
<string name="home_push">推送</string> |
||||
<string name="home_setting">设定</string> |
||||
<string name="home_recent">最近观看</string> |
||||
<string name="home_update">更新推荐</string> |
||||
|
||||
<!-- Setting --> |
||||
<string name="setting_url">配置接口</string> |
||||
<string name="setting_history">历史配置</string> |
||||
|
||||
<!-- Dialog --> |
||||
<string name="dialog_positive">确定</string> |
||||
<string name="dialog_negative">取消</string> |
||||
|
||||
|
||||
@ -1,10 +1,26 @@ |
||||
<resources> |
||||
|
||||
<!-- App --> |
||||
<string name="app_name">熊愛影視</string> |
||||
|
||||
<!-- Splash --> |
||||
<string name="splash_info">正在載入配置</string> |
||||
|
||||
<!-- Home --> |
||||
<string name="home_vod">點播</string> |
||||
<string name="home_live">直播</string> |
||||
<string name="home_search">搜尋</string> |
||||
<string name="home_push">推送</string> |
||||
<string name="home_setting">設定</string> |
||||
<string name="home_recent">最近觀看</string> |
||||
<string name="home_update">更新推薦</string> |
||||
|
||||
<!-- Setting --> |
||||
<string name="setting_url">配置接口</string> |
||||
<string name="setting_history">歷史配置</string> |
||||
|
||||
<!-- Dialog --> |
||||
<string name="dialog_positive">確定</string> |
||||
<string name="dialog_negative">取消</string> |
||||
|
||||
|
||||
</resources> |
||||
@ -1,9 +1,25 @@ |
||||
<resources> |
||||
|
||||
<!-- App --> |
||||
<string name="app_name">BearTV</string> |
||||
|
||||
<!-- Splash --> |
||||
<string name="splash_info">Loading config</string> |
||||
|
||||
<!-- Home --> |
||||
<string name="home_vod">Vod</string> |
||||
<string name="home_live">Live</string> |
||||
<string name="home_search">Search</string> |
||||
<string name="home_push">Push</string> |
||||
<string name="home_setting">Setting</string> |
||||
<string name="home_recent">Recent</string> |
||||
<string name="home_update">Recommend</string> |
||||
|
||||
<!-- Setting --> |
||||
<string name="setting_url">Configure</string> |
||||
<string name="setting_history">History</string> |
||||
|
||||
<!-- Dialog --> |
||||
<string name="dialog_positive">OK</string> |
||||
<string name="dialog_negative">Cancel</string> |
||||
|
||||
|
||||