集成完直播后提交代码
2
LiveCommon/live_commonui/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/release
|
||||
41
LiveCommon/live_commonui/build.gradle
Normal file
@@ -0,0 +1,41 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdkVersion
|
||||
buildToolsVersion androidBuildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion androidMinSdkVersion
|
||||
targetSdkVersion androidTargetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
viewBinding {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation externalAndroidDesign
|
||||
|
||||
api project(':LiveCommon:live_commonutils')
|
||||
|
||||
def isInteractive = project.hasProperty("sdk_type") && "AliVCSDK_InteractiveLive".equalsIgnoreCase(sdk_type)
|
||||
api isInteractive ? externalLivePusherInteractive : externalLivePusher
|
||||
}
|
||||
0
LiveCommon/live_commonui/consumer-rules.pro
Normal file
5
LiveCommon/live_commonui/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.alivc.live.commonui">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.alivc.live.commonui.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
|
||||
public class AUILiveActionBar extends RelativeLayout {
|
||||
|
||||
private ImageView mLeftImageView;
|
||||
private ImageView mRightImageView;
|
||||
private TextView mTitleView;
|
||||
|
||||
public AUILiveActionBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AUILiveActionBar(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public AUILiveActionBar(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
LayoutInflater.from(context).inflate(R.layout.aui_live_actionbar_layout, this, true);
|
||||
mLeftImageView = findViewById(R.id.aui_player_actionbar_left_image);
|
||||
mRightImageView = findViewById(R.id.aui_player_actionbar_right_image);
|
||||
mTitleView = findViewById(R.id.aui_player_actionbar_title);
|
||||
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.av_actionbar);
|
||||
if (ta == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isShowTitle = ta.getBoolean(R.styleable.av_actionbar_showTitle, false);
|
||||
mTitleView.setVisibility(isShowTitle ? VISIBLE : GONE);
|
||||
String title = ta.getString(R.styleable.av_actionbar_title);
|
||||
mTitleView.setText(title);
|
||||
|
||||
boolean isShowLeftImage = ta.getBoolean(R.styleable.av_actionbar_showLeftView, false);
|
||||
mLeftImageView.setVisibility(isShowLeftImage ? VISIBLE : GONE);
|
||||
int leftBackground = ta.getResourceId(R.styleable.av_actionbar_leftImageBackground, 0);
|
||||
if (leftBackground != 0) {
|
||||
mLeftImageView.setBackgroundResource(leftBackground);
|
||||
}
|
||||
int leftImage = ta.getResourceId(R.styleable.av_actionbar_leftImageSrc, 0);
|
||||
if (leftImage != 0) {
|
||||
mLeftImageView.setImageResource(leftImage);
|
||||
}
|
||||
|
||||
|
||||
boolean isShowRightImage = ta.getBoolean(R.styleable.av_actionbar_showRightView, false);
|
||||
mRightImageView.setVisibility(isShowRightImage ? VISIBLE : GONE);
|
||||
int rightBackground = ta.getResourceId(R.styleable.av_actionbar_rightImageBackground, 0);
|
||||
if (rightBackground != 0) {
|
||||
mRightImageView.setBackgroundResource(rightBackground);
|
||||
}
|
||||
int rightImage = ta.getResourceId(R.styleable.av_actionbar_rightImageSrc, 0);
|
||||
if (rightImage != 0) {
|
||||
mRightImageView.setImageResource(rightImage);
|
||||
}
|
||||
}
|
||||
|
||||
public void showLeftView() {
|
||||
mLeftImageView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public void hideLeftView() {
|
||||
mLeftImageView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
public void showRightView() {
|
||||
mRightImageView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public void hideRightView() {
|
||||
mRightImageView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
public void showTitleView() {
|
||||
mTitleView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public void hideTitleView() {
|
||||
mTitleView.setVisibility(GONE);
|
||||
}
|
||||
|
||||
public ImageView getLeftImageView() {
|
||||
return mLeftImageView;
|
||||
}
|
||||
|
||||
public ImageView getRightImageView() {
|
||||
return mRightImageView;
|
||||
}
|
||||
|
||||
public TextView getTitleView() {
|
||||
return mTitleView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.alivc.live.commonui.activity;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.commonui.utils.StatusBarUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AUILiveBaseListActivity extends AppCompatActivity {
|
||||
|
||||
private AUILiveActionBar mAUILiveActionBar;
|
||||
private RecyclerView mRecyclerView;
|
||||
private AVListAdapter mAVListAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
getDelegate().setLocalNightMode(specifiedThemeMode());
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.translucent(this, Color.TRANSPARENT);
|
||||
setContentView(R.layout.aui_live_activity_list_layout);
|
||||
initBaseView();
|
||||
initBaseData();
|
||||
}
|
||||
|
||||
private void initBaseView() {
|
||||
mAUILiveActionBar = findViewById(R.id.aui_player_base_title);
|
||||
mRecyclerView = findViewById(R.id.aui_player_base_main_recyclerView);
|
||||
mAVListAdapter = new AVListAdapter(this);
|
||||
mRecyclerView.setAdapter(mAVListAdapter);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mAUILiveActionBar.getLeftImageView().setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initBaseData() {
|
||||
mAUILiveActionBar.getTitleView().setText(getTitleResId());
|
||||
if (showBackBtn()) {
|
||||
mAUILiveActionBar.showLeftView();
|
||||
} else {
|
||||
mAUILiveActionBar.hideLeftView();
|
||||
}
|
||||
mAVListAdapter.setData(createListData());
|
||||
}
|
||||
|
||||
protected int specifiedThemeMode() {
|
||||
return AppCompatDelegate.MODE_NIGHT_NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标题的resourceID, 不要直接使用文本,要适配多语言
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract int getTitleResId();
|
||||
|
||||
/**
|
||||
* 是否显示返回按钮
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean showBackBtn();
|
||||
|
||||
public abstract List<ListModel> createListData();
|
||||
|
||||
public abstract void onListItemClick(ListModel model);
|
||||
|
||||
public static class ListModel {
|
||||
public int index;
|
||||
public int drawableResId;
|
||||
public String title;
|
||||
public String desc;
|
||||
|
||||
public ListModel(int index, int drawableResId, String title, String desc) {
|
||||
this.index = index;
|
||||
this.drawableResId = drawableResId;
|
||||
this.title = title;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
|
||||
private static class AVListAdapter extends RecyclerView.Adapter<AVListHolder> {
|
||||
|
||||
private List<ListModel> mData = new ArrayList<>();
|
||||
private WeakReference<AUILiveBaseListActivity> mAVBaseListActivityRef;
|
||||
|
||||
public AVListAdapter(AUILiveBaseListActivity activity) {
|
||||
mAVBaseListActivityRef = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
public void setData(List<ListModel> data) {
|
||||
mData.clear();
|
||||
mData.addAll(data);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AVListHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.aui_live_base_list_item, parent, false);
|
||||
AVListHolder avListHolder = new AVListHolder(itemView);
|
||||
avListHolder.mImageView = itemView.findViewById(R.id.av_list_item_image);
|
||||
avListHolder.mTitle = itemView.findViewById(R.id.av_list_item_title);
|
||||
avListHolder.mDesc = itemView.findViewById(R.id.av_list_item_desc);
|
||||
return avListHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AVListHolder holder, int position) {
|
||||
ListModel listModel = mData.get(position);
|
||||
if (listModel == null) {
|
||||
return;
|
||||
}
|
||||
holder.mImageView.setImageResource(listModel.drawableResId);
|
||||
holder.mTitle.setText(listModel.title);
|
||||
if (!TextUtils.isEmpty(listModel.desc)) {
|
||||
holder.mDesc.setText(listModel.desc);
|
||||
holder.mDesc.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.mDesc.setVisibility(View.GONE);
|
||||
}
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
if (mAVBaseListActivityRef.get() != null) {
|
||||
mAVBaseListActivityRef.get().onListItemClick(mData.get(position));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mData.size();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AVListHolder extends RecyclerView.ViewHolder {
|
||||
ImageView mImageView;
|
||||
TextView mTitle;
|
||||
TextView mDesc;
|
||||
|
||||
public AVListHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.alivc.live.commonui.avdialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationSet;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
|
||||
|
||||
public class AUILiveDialog extends Dialog {
|
||||
private final static int ANIMATION_DURATION = 200;
|
||||
private View mContentView;
|
||||
private boolean mIsAnimating = false;
|
||||
|
||||
public AUILiveDialog(@NonNull Context context) {
|
||||
super(context, R.style.AUILiveDialog);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().getDecorView().setPadding(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@NonNull View view) {
|
||||
mContentView = view;
|
||||
super.setContentView(view);
|
||||
}
|
||||
|
||||
|
||||
public void setLayoutBySreenMode() {
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.CENTER;
|
||||
|
||||
// int screenWidth = DensityUtil.getDisplayMetrics(getContext()).widthPixels;
|
||||
// int screenHeight = DensityUtil.getDisplayMetrics(getContext()).heightPixels;
|
||||
// params.width = Math.min(screenWidth, screenHeight);
|
||||
getWindow().setAttributes(params);
|
||||
setCanceledOnTouchOutside(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* ChoiceItemBottomDialog从下往上升起的动画动画
|
||||
*/
|
||||
private void animateUp() {
|
||||
if (mContentView != null) {
|
||||
return;
|
||||
}
|
||||
TranslateAnimation translateAnimation = new TranslateAnimation(
|
||||
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
|
||||
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f);
|
||||
AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
|
||||
AnimationSet animationSet = new AnimationSet(true);
|
||||
animationSet.addAnimation(translateAnimation);
|
||||
animationSet.addAnimation(alphaAnimation);
|
||||
animationSet.setInterpolator(new DecelerateInterpolator());
|
||||
animationSet.setDuration(ANIMATION_DURATION);
|
||||
animationSet.setFillAfter(true);
|
||||
mContentView.startAnimation(animationSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* ChoiceItemBottomDialog从下往上升起的动画动画
|
||||
*/
|
||||
private void animateDown() {
|
||||
if (mContentView == null) {
|
||||
return;
|
||||
}
|
||||
TranslateAnimation translate = new TranslateAnimation(
|
||||
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
|
||||
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f
|
||||
);
|
||||
AlphaAnimation alpha = new AlphaAnimation(1, 0);
|
||||
AnimationSet set = new AnimationSet(true);
|
||||
set.addAnimation(translate);
|
||||
set.addAnimation(alpha);
|
||||
set.setInterpolator(new DecelerateInterpolator());
|
||||
set.setDuration(ANIMATION_DURATION);
|
||||
set.setFillAfter(true);
|
||||
set.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
mIsAnimating = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
mIsAnimating = false;
|
||||
mContentView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
AUILiveDialog.super.dismiss();
|
||||
} catch (Exception e) {
|
||||
Log.w("Test", "dismiss error\n" + Log.getStackTraceString(e));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
|
||||
}
|
||||
});
|
||||
mContentView.startAnimation(set);
|
||||
}
|
||||
|
||||
private void fullScreenImmersive(View view) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
view.setSystemUiVisibility(uiOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
setLayoutBySreenMode();
|
||||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
|
||||
super.show();
|
||||
fullScreenImmersive(getWindow().getDecorView());
|
||||
this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
|
||||
animateUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.alivc.live.commonui.avdialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
|
||||
public abstract class AVLiveBaseBottomSheetDialog extends AVLiveBaseDialog {
|
||||
private ViewGroup mBottomSheetContainer;
|
||||
private boolean mAnimateToCancel = false;
|
||||
private boolean mAnimateToDismiss = false;
|
||||
private BottomSheetBehavior<ViewGroup> mBottomSheetBehavior;
|
||||
|
||||
public AVLiveBaseBottomSheetDialog(Context context) {
|
||||
super(context,R.style.Live_BottomSheetDialog);
|
||||
}
|
||||
|
||||
public AVLiveBaseBottomSheetDialog(Context context, int theme) {
|
||||
super(context, theme);
|
||||
}
|
||||
|
||||
protected AVLiveBaseBottomSheetDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
|
||||
super(context, cancelable, cancelListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(Context context) {
|
||||
super.initView(context);
|
||||
View container = getLayoutInflater().inflate(R.layout.av_live_base_dialog_bottom_sheet, null);
|
||||
mBottomSheetContainer = container.findViewById(R.id.bottom_sheet_container);
|
||||
View contentView = getContentView();
|
||||
ViewGroup.LayoutParams contentParams = getContentLayoutParams();
|
||||
if (contentView != null && contentParams != null) {
|
||||
mBottomSheetContainer.addView(contentView, contentParams);
|
||||
}
|
||||
mBottomSheetBehavior = new BottomSheetBehavior<>();
|
||||
mBottomSheetBehavior.setHideable(true);
|
||||
mBottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
|
||||
@Override
|
||||
public void onStateChanged(@NonNull View bottomSheet, int newState) {
|
||||
if (newState == BottomSheetBehavior.STATE_HIDDEN) {
|
||||
if (mAnimateToCancel) {
|
||||
cancel();
|
||||
} else if (mAnimateToDismiss) {
|
||||
dismiss();
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||
|
||||
}
|
||||
});
|
||||
mBottomSheetBehavior.setPeekHeight(0);
|
||||
mBottomSheetBehavior.setSkipCollapsed(true);
|
||||
((CoordinatorLayout.LayoutParams) mBottomSheetContainer.getLayoutParams()).setBehavior(mBottomSheetBehavior);
|
||||
container.findViewById(R.id.touch_outside).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_SETTLING) {
|
||||
return;
|
||||
}
|
||||
if (mBottomSheetBehavior.isHideable() && isShowing()) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBottomSheetContainer.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
setContentView(container, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelable(boolean flag) {
|
||||
super.setCancelable(flag);
|
||||
mBottomSheetBehavior.setHideable(flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
ViewCompat.requestApplyInsets(mBottomSheetContainer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
|
||||
mAnimateToCancel = false;
|
||||
super.cancel();
|
||||
} else {
|
||||
mAnimateToCancel = true;
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN){
|
||||
mAnimateToDismiss = false;
|
||||
super.dismiss();
|
||||
}else {
|
||||
mAnimateToDismiss = true;
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
|
||||
setToExpandWhenShow();
|
||||
}
|
||||
mAnimateToCancel = false;
|
||||
mAnimateToDismiss = false;
|
||||
}
|
||||
|
||||
private void setToExpandWhenShow() {
|
||||
mBottomSheetContainer.postOnAnimation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected abstract View getContentView();
|
||||
|
||||
protected abstract ViewGroup.LayoutParams getContentLayoutParams();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.alivc.live.commonui.avdialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.appcompat.app.AppCompatDialog;
|
||||
|
||||
public class AVLiveBaseDialog extends AppCompatDialog {
|
||||
public AVLiveBaseDialog(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public AVLiveBaseDialog(Context context, int theme) {
|
||||
super(context, theme);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
protected AVLiveBaseDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
|
||||
super(context, cancelable, cancelListener);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public void initView(Context context) {
|
||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
Context context = getContext();
|
||||
if (context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
if (activity.isDestroyed() || activity.isFinishing()) {
|
||||
return;
|
||||
}
|
||||
super.dismiss();
|
||||
} else {
|
||||
try {
|
||||
super.dismiss();
|
||||
} catch (Throwable ignore) {
|
||||
super.dismiss();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.alivc.live.commonui.bean;
|
||||
|
||||
public class MusicInfo {
|
||||
private String mMusicName;
|
||||
private String mPlayTime;
|
||||
private String mTotalTime;
|
||||
private String mPath;
|
||||
|
||||
public MusicInfo() {
|
||||
|
||||
}
|
||||
|
||||
public MusicInfo(String musicName, String playTime, String totalTime, String path) {
|
||||
mPlayTime = playTime;
|
||||
mTotalTime = totalTime;
|
||||
mMusicName = musicName;
|
||||
mPath = path;
|
||||
}
|
||||
|
||||
public String getPlayTime() {
|
||||
return mPlayTime;
|
||||
}
|
||||
|
||||
public void setPlayTime(String playTime) {
|
||||
mPlayTime = playTime;
|
||||
}
|
||||
|
||||
public String getTotalTime() {
|
||||
return mTotalTime;
|
||||
}
|
||||
|
||||
public void setTotalTime(String totalTime) {
|
||||
mTotalTime = totalTime;
|
||||
}
|
||||
|
||||
public String getMusicName() {
|
||||
return mMusicName;
|
||||
}
|
||||
|
||||
public void setMusicName(String musicName) {
|
||||
mMusicName = musicName;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return mPath;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
mPath = path;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.alivc.live.commonui.configview;
|
||||
|
||||
public class LivePushProgressStep {
|
||||
public static final int PROGRESS_0 = 0;
|
||||
public static final int PROGRESS_16 = 16;
|
||||
public static final int PROGRESS_20 = 20;
|
||||
public static final int PROGRESS_33 = 33;
|
||||
public static final int PROGRESS_40 = 40;
|
||||
public static final int PROGRESS_50 = 50;
|
||||
public static final int PROGRESS_60 = 60;
|
||||
public static final int PROGRESS_66 = 66;
|
||||
public static final int PROGRESS_75 = 75;
|
||||
public static final int PROGRESS_80 = 80;
|
||||
public static final int PROGRESS_90 = 90;
|
||||
public static final int PROGRESS_100 = 100;
|
||||
|
||||
public static final int PROGRESS_AUDIO_160 = 20;
|
||||
public static final int PROGRESS_AUDIO_320 = 40;
|
||||
public static final int PROGRESS_AUDIO_441 = 60;
|
||||
public static final int PROGRESS_AUDIO_480 = 80;
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package com.alivc.live.commonui.configview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.pusher.AlivcResolutionEnum;
|
||||
|
||||
public class LivePushResolutionView extends LinearLayout {
|
||||
|
||||
private SeekBar mResolution;
|
||||
private TextView mResolutionText;
|
||||
private LinearLayout mCustomResolutionRootView;
|
||||
private AlivcResolutionEnum mDefinition = AlivcResolutionEnum.RESOLUTION_720P;
|
||||
private OnResolutionChangedListener mOnResolutionChangedListener;
|
||||
private EditText mWidth;
|
||||
private EditText mHeight;
|
||||
|
||||
public LivePushResolutionView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public LivePushResolutionView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, -1);
|
||||
}
|
||||
|
||||
public LivePushResolutionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.push_resolution_view_layout, this, true);
|
||||
mResolution = inflate.findViewById(R.id.resolution_seekbar);
|
||||
mResolutionText = inflate.findViewById(R.id.resolution_text);
|
||||
mWidth = inflate.findViewById(R.id.et_width);
|
||||
mHeight = inflate.findViewById(R.id.et_height);
|
||||
mCustomResolutionRootView = inflate.findViewById(R.id.custom_resolution_root);
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
mResolution.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean b) {
|
||||
if (progress <= LivePushProgressStep.PROGRESS_0) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_180P;
|
||||
mResolutionText.setText(R.string.setting_resolution_180P);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_0 && progress <= LivePushProgressStep.PROGRESS_16) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_240P;
|
||||
mResolutionText.setText(R.string.setting_resolution_240P);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_16 && progress <= LivePushProgressStep.PROGRESS_33) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_360P;
|
||||
mResolutionText.setText(R.string.setting_resolution_360P);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_33 && progress <= LivePushProgressStep.PROGRESS_50) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_480P;
|
||||
mResolutionText.setText(R.string.setting_resolution_480P);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_50 && progress <= LivePushProgressStep.PROGRESS_66) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_540P;
|
||||
mResolutionText.setText(R.string.setting_resolution_540P);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_66 && progress <= LivePushProgressStep.PROGRESS_75) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_720P;
|
||||
mResolutionText.setText(R.string.setting_resolution_720P);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_75 && progress <= LivePushProgressStep.PROGRESS_90) {
|
||||
mCustomResolutionRootView.setVisibility(View.GONE);
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_1080P;
|
||||
mResolutionText.setText(R.string.setting_resolution_1080P);
|
||||
} else {
|
||||
mDefinition = AlivcResolutionEnum.RESOLUTION_SELF_DEFINE;
|
||||
mResolutionText.setText(R.string.setting_resolution_self_define);
|
||||
mCustomResolutionRootView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (mOnResolutionChangedListener != null) {
|
||||
mOnResolutionChangedListener.onResolutionChanged(mDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress();
|
||||
if (progress <= LivePushProgressStep.PROGRESS_0) {
|
||||
seekBar.setProgress(0);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_0 && progress <= LivePushProgressStep.PROGRESS_16) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_16);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_16 && progress <= LivePushProgressStep.PROGRESS_33) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_33);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_33 && progress <= LivePushProgressStep.PROGRESS_50) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_50);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_50 && progress <= LivePushProgressStep.PROGRESS_66) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_66);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_66 && progress <= LivePushProgressStep.PROGRESS_75) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_75);
|
||||
} else if (progress > LivePushProgressStep.PROGRESS_75 && progress <= LivePushProgressStep.PROGRESS_90) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_90);
|
||||
} else {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setResolution(AlivcResolutionEnum resolution) {
|
||||
if (resolution == AlivcResolutionEnum.RESOLUTION_180P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_0);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_180P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_240P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_16);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_240P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_360P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_33);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_360P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_480P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_50);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_480P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_540P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_66);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_540P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_720P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_75);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_720P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_1080P) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_90);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_1080P));
|
||||
} else if (resolution == AlivcResolutionEnum.RESOLUTION_SELF_DEFINE) {
|
||||
mResolution.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
mResolutionText.setText(getResources().getString(R.string.setting_resolution_self_define));
|
||||
int resolutionWidth = AlivcResolutionEnum.getResolutionWidth(resolution, null);
|
||||
int resolutionHeight = AlivcResolutionEnum.getResolutionHeight(resolution, null);
|
||||
mWidth.setText(String.valueOf(resolutionWidth));
|
||||
mHeight.setText(String.valueOf(resolutionHeight));
|
||||
}
|
||||
}
|
||||
|
||||
public int getSelfDefineWidth() {
|
||||
return Integer.parseInt(mWidth.getText().toString());
|
||||
}
|
||||
|
||||
public int getSelfDefineHeight() {
|
||||
return Integer.parseInt(mHeight.getText().toString());
|
||||
}
|
||||
|
||||
public void setOnResolutionChangedListener(OnResolutionChangedListener listener) {
|
||||
this.mOnResolutionChangedListener = listener;
|
||||
}
|
||||
|
||||
public interface OnResolutionChangedListener {
|
||||
void onResolutionChanged(AlivcResolutionEnum resolutionEnum);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1220 @@
|
||||
package com.alivc.live.commonui.configview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.alivc.live.annotations.AlivcLiveCameraCaptureOutputPreference;
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.commonutils.TextFormatUtil;
|
||||
import com.alivc.live.pusher.AlivcAudioAACProfileEnum;
|
||||
import com.alivc.live.pusher.AlivcAudioChannelEnum;
|
||||
import com.alivc.live.pusher.AlivcAudioSampleRateEnum;
|
||||
import com.alivc.live.pusher.AlivcAudioSceneModeEnum;
|
||||
import com.alivc.live.pusher.AlivcEncodeModeEnum;
|
||||
import com.alivc.live.pusher.AlivcEncodeType;
|
||||
import com.alivc.live.pusher.AlivcFpsEnum;
|
||||
import com.alivc.live.pusher.AlivcLivePushCameraTypeEnum;
|
||||
import com.alivc.live.pusher.AlivcLivePushConfig;
|
||||
import com.alivc.live.pusher.AlivcLivePushConstants;
|
||||
import com.alivc.live.pusher.AlivcPreviewDisplayMode;
|
||||
import com.alivc.live.pusher.AlivcPreviewOrientationEnum;
|
||||
import com.alivc.live.pusher.AlivcQualityModeEnum;
|
||||
import com.alivc.live.pusher.AlivcResolutionEnum;
|
||||
import com.alivc.live.pusher.AlivcVideoEncodeGopEnum;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LivePushSettingView extends LinearLayout {
|
||||
|
||||
private com.alivc.live.commonui.databinding.PushSettingViewLayoutBinding mViewBinding;
|
||||
private PushConfigDialogImpl mPushConfigDialog = new PushConfigDialogImpl();
|
||||
|
||||
//码率控制
|
||||
private final MutableLiveData<Boolean> mBitrateControlLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> bitrateControl = mBitrateControlLiveData;
|
||||
|
||||
//可变分辨率
|
||||
private final MutableLiveData<Boolean> mVariableResolutionLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> variableResolution = mVariableResolutionLiveData;
|
||||
|
||||
//分辨率
|
||||
private final MutableLiveData<AlivcResolutionEnum> mResolutionLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcResolutionEnum> resolution = mResolutionLiveData;
|
||||
|
||||
//最小帧率
|
||||
private final MutableLiveData<AlivcFpsEnum> mMinFpsLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcFpsEnum> minFps = mMinFpsLiveData;
|
||||
|
||||
//音频采样率
|
||||
private final MutableLiveData<AlivcAudioSampleRateEnum> mAudioSampleRateLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcAudioSampleRateEnum> audioSampleRate = mAudioSampleRateLiveData;
|
||||
|
||||
//GOP
|
||||
private final MutableLiveData<AlivcVideoEncodeGopEnum> mGopLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcVideoEncodeGopEnum> gop = mGopLiveData;
|
||||
|
||||
//FPS
|
||||
private final MutableLiveData<AlivcFpsEnum> mFpsLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcFpsEnum> fps = mFpsLiveData;
|
||||
|
||||
//视频硬编码
|
||||
private final MutableLiveData<Boolean> mVideoHardwareDecodeLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> videoHardwareDecode = mVideoHardwareDecodeLiveData;
|
||||
//音频硬编码
|
||||
private final MutableLiveData<Boolean> mAudioHardwareDecodeLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> audioHardwareDecode = mAudioHardwareDecodeLiveData;
|
||||
|
||||
//推流镜像
|
||||
private final MutableLiveData<Boolean> mPushMirrorLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> pushMirror = mPushMirrorLiveData;
|
||||
|
||||
//预览镜像
|
||||
private final MutableLiveData<Boolean> mPreviewMirrorLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> previewMirror = mPreviewMirrorLiveData;
|
||||
|
||||
//前置摄像头
|
||||
private final MutableLiveData<Boolean> mEnableFrontCamera = new MutableLiveData<>();
|
||||
public LiveData<Boolean> enableFrontCamera = mEnableFrontCamera;
|
||||
|
||||
//美颜
|
||||
private final MutableLiveData<Boolean> mEnableBeauty = new MutableLiveData<>();
|
||||
public LiveData<Boolean> enableBeauty = mEnableBeauty;
|
||||
|
||||
//暂停图片
|
||||
private final MutableLiveData<Boolean> mPauseImageLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> pauseImage = mPauseImageLiveData;
|
||||
|
||||
//网络差图片
|
||||
private final MutableLiveData<Boolean> mNetWorkImageLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> netWorkImage = mNetWorkImageLiveData;
|
||||
|
||||
//自动对焦
|
||||
private final MutableLiveData<Boolean> mAutoFocusLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> autoFocus = mAutoFocusLiveData;
|
||||
|
||||
//异步接口
|
||||
private final MutableLiveData<Boolean> mAsyncLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> async = mAsyncLiveData;
|
||||
|
||||
//音乐模式
|
||||
private final MutableLiveData<Boolean> mMusicModeLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> musicMode = mMusicModeLiveData;
|
||||
|
||||
//外部音视频
|
||||
private final MutableLiveData<Boolean> mExternLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> extern = mExternLiveData;
|
||||
|
||||
//本地日志
|
||||
private final MutableLiveData<Boolean> mLocalLogLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> localLog = mLocalLogLiveData;
|
||||
|
||||
//仅视频
|
||||
private final MutableLiveData<Boolean> mVideoOnlyLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> videoOnly = mVideoOnlyLiveData;
|
||||
|
||||
//仅音频
|
||||
private final MutableLiveData<Boolean> mAudioOnlyLiveData = new MutableLiveData<>();
|
||||
public LiveData<Boolean> audioOnly = mAudioOnlyLiveData;
|
||||
|
||||
//预览显示模式
|
||||
private final MutableLiveData<AlivcPreviewDisplayMode> mPreviewDisplayModeLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcPreviewDisplayMode> previewDisplayMode = mPreviewDisplayModeLiveData;
|
||||
|
||||
//摄像头采集偏好
|
||||
private final MutableLiveData<AlivcLiveCameraCaptureOutputPreference> mCameraCaptureOutputPreferenceLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcLiveCameraCaptureOutputPreference> cameraCaptureOutputPreference = mCameraCaptureOutputPreferenceLiveData;
|
||||
|
||||
//声道
|
||||
private final MutableLiveData<AlivcAudioChannelEnum> mAudioChannelLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcAudioChannelEnum> audioChannel = mAudioChannelLiveData;
|
||||
|
||||
//音频编码
|
||||
private final MutableLiveData<AlivcAudioAACProfileEnum> mAudioProfileLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcAudioAACProfileEnum> audioProfile = mAudioProfileLiveData;
|
||||
|
||||
//音频编码
|
||||
private final MutableLiveData<AlivcEncodeType> mVideoEncodeTypeLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcEncodeType> videoEncodeType = mVideoEncodeTypeLiveData;
|
||||
|
||||
//B-Frame
|
||||
private final MutableLiveData<Integer> mBFrameLiveData = new MutableLiveData<>();
|
||||
public LiveData<Integer> bFrame = mBFrameLiveData;
|
||||
|
||||
// 视频目标码率
|
||||
private final MutableLiveData<Integer> mTargetVideoBitrate = new MutableLiveData<>();
|
||||
public LiveData<Integer> targetVideoBitrate = mTargetVideoBitrate;
|
||||
|
||||
// 视频最小码率
|
||||
private final MutableLiveData<Integer> mMinVideoBitrate = new MutableLiveData<>();
|
||||
public LiveData<Integer> minVideoBitrate = mMinVideoBitrate;
|
||||
|
||||
// 视频初始码率
|
||||
private final MutableLiveData<Integer> mInitialVideoBitrate = new MutableLiveData<>();
|
||||
public LiveData<Integer> initialVideoBitrate = mInitialVideoBitrate;
|
||||
|
||||
// 音频码率
|
||||
private final MutableLiveData<Integer> mAudioBitrate = new MutableLiveData<>();
|
||||
public LiveData<Integer> audioBitrate = mAudioBitrate;
|
||||
|
||||
//暂停图片路径
|
||||
private final MutableLiveData<String> mPauseImgPathLiveData = new MutableLiveData<>();
|
||||
public LiveData<String> pauseImagePath = mPauseImgPathLiveData;
|
||||
|
||||
//网络差图片路径
|
||||
private final MutableLiveData<String> mNetWorkImgPathLiveData = new MutableLiveData<>();
|
||||
public LiveData<String> netWorkImagePath = mNetWorkImgPathLiveData;
|
||||
|
||||
//屏幕方向
|
||||
private final MutableLiveData<AlivcPreviewOrientationEnum> mPreviewOrientationLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcPreviewOrientationEnum> previewOrientation = mPreviewOrientationLiveData;
|
||||
|
||||
//视频质量
|
||||
private final MutableLiveData<AlivcQualityModeEnum> mQualityModeLiveData = new MutableLiveData<>();
|
||||
public LiveData<AlivcQualityModeEnum> qualityMode = mQualityModeLiveData;
|
||||
|
||||
//水印 Dialog
|
||||
private final MutableLiveData<Boolean> mShowWaterMarkDialog = new MutableLiveData<>();
|
||||
public LiveData<Boolean> showWaterMark = mShowWaterMarkDialog;
|
||||
|
||||
private AlivcQualityModeEnum mCurrentQualityMode = AlivcQualityModeEnum.QM_RESOLUTION_FIRST;
|
||||
private AlivcResolutionEnum mCurrentResolution = AlivcResolutionEnum.RESOLUTION_540P;
|
||||
|
||||
private int mPushModeDefaultIndex = 0;
|
||||
private int mDisplayModeDefaultIndex = 0;
|
||||
private int mCameraCaptureOutputPreferenceDefaultIndex = 2;
|
||||
private int mAudioChannelDefaultIndex = 1;
|
||||
private int mAudioProfileDefaultIndex = 0;
|
||||
private int mQualityModeDefaultIndex = 0;
|
||||
private int mVideoEncoderTypeDefaultIndex = 0;
|
||||
private int mBFrameDefaultIndex = 0;
|
||||
private int mPreviewOrientationDefaultIndex = 0;
|
||||
|
||||
public LivePushSettingView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public LivePushSettingView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, -1);
|
||||
}
|
||||
|
||||
public LivePushSettingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
mViewBinding = com.alivc.live.commonui.databinding.PushSettingViewLayoutBinding.inflate(LayoutInflater.from(context), this, true);
|
||||
initData();
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setHint(String.valueOf(AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate()));
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
mTargetVideoBitrate.setValue(TextFormatUtil.convertString2Int(String.valueOf(s)));
|
||||
}
|
||||
});
|
||||
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setHint(String.valueOf(AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate()));
|
||||
mViewBinding.pushArgsSetting.minRateEdit.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
mMinVideoBitrate.setValue(TextFormatUtil.convertString2Int(String.valueOf(s)));
|
||||
}
|
||||
});
|
||||
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setHint(String.valueOf(AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate()));
|
||||
mViewBinding.pushArgsSetting.initRateEdit.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
mInitialVideoBitrate.setValue(TextFormatUtil.convertString2Int(String.valueOf(s)));
|
||||
}
|
||||
});
|
||||
turnOnBitRateFps(false);
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
//切换分辨率
|
||||
mViewBinding.pushArgsSetting.resolutionView.setOnResolutionChangedListener(resolutionEnum -> {
|
||||
mCurrentResolution = resolutionEnum;
|
||||
mResolutionLiveData.setValue(resolutionEnum);
|
||||
if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_180P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_180P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_180P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_180P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_240P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_240P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_240P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_240P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_360P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_360P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_360P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_360P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_480P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_480P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_480P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_480P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_540P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_540P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_540P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_720P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_720P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_720P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_720P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else if (resolutionEnum == AlivcResolutionEnum.RESOLUTION_1080P) {
|
||||
if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_RESOLUTION_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_1080P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_1080P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_1080P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else if (mCurrentQualityMode.equals(AlivcQualityModeEnum.QM_FLUENCY_FIRST)) {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_1080P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_1080P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_1080P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
} else {
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.BITRATE_1080P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_1080P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_1080P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate());
|
||||
}
|
||||
} else {
|
||||
//自定义
|
||||
changeVideoBitrateWithResolution(AlivcLivePushConstants.DEFAULT_VALUE_INT_TARGET_BITRATE,
|
||||
AlivcLivePushConstants.DEFAULT_VALUE_INT_MIN_BITRATE,
|
||||
AlivcLivePushConstants.DEFAULT_VALUE_INT_INIT_BITRATE);
|
||||
}
|
||||
});
|
||||
//最小帧率
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (progress <= LivePushProgressStep.PROGRESS_0) {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_8);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_8.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_16) {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_10);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_10.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_33) {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_12);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_12.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_50) {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_15);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_15.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_66) {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_20);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_20.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_80) {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_25);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_25.getFps()));
|
||||
} else {
|
||||
mMinFpsLiveData.setValue(AlivcFpsEnum.FPS_30);
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(AlivcFpsEnum.FPS_30.getFps()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
});
|
||||
|
||||
//fps
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (progress <= LivePushProgressStep.PROGRESS_0) {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_8);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_8.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_16) {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_10);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_10.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_33) {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_12);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_12.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_50) {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_15);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_15.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_66) {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_20);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_20.getFps()));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_80) {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_25);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_25.getFps()));
|
||||
} else {
|
||||
mFpsLiveData.setValue(AlivcFpsEnum.FPS_30);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_30.getFps()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress();
|
||||
if (progress <= LivePushProgressStep.PROGRESS_0) {
|
||||
seekBar.setProgress(0);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_16) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_16);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_33) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_33);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_50) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_50);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_66) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_66);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_80) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_80);
|
||||
} else {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//音频采样率
|
||||
mViewBinding.pushArgsSetting.audioRateSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (progress <= LivePushProgressStep.PROGRESS_AUDIO_160) {
|
||||
mAudioSampleRateLiveData.setValue(AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_16000);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getContext().getString(R.string.setting_audio_160));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_AUDIO_320) {
|
||||
mAudioSampleRateLiveData.setValue(AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_32000);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getContext().getString(R.string.setting_audio_320));
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_AUDIO_441) {
|
||||
mAudioSampleRateLiveData.setValue(AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_44100);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getContext().getString(R.string.setting_audio_441));
|
||||
} else {
|
||||
mAudioSampleRateLiveData.setValue(AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_48000);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getContext().getString(R.string.setting_audio_480));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress();
|
||||
if (progress <= LivePushProgressStep.PROGRESS_AUDIO_160) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_160);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_AUDIO_320) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_320);
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_AUDIO_441) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_441);
|
||||
} else {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_480);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//GOP
|
||||
mViewBinding.pushArgsSetting.gopSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (progress <= LivePushProgressStep.PROGRESS_20) {
|
||||
mGopLiveData.setValue(AlivcVideoEncodeGopEnum.GOP_ONE);
|
||||
mViewBinding.pushArgsSetting.gopText.setText("1/s");
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_40) {
|
||||
mGopLiveData.setValue(AlivcVideoEncodeGopEnum.GOP_TWO);
|
||||
mViewBinding.pushArgsSetting.gopText.setText("2/s");
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_60) {
|
||||
mGopLiveData.setValue(AlivcVideoEncodeGopEnum.GOP_THREE);
|
||||
mViewBinding.pushArgsSetting.gopText.setText("3/s");
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_80) {
|
||||
mGopLiveData.setValue(AlivcVideoEncodeGopEnum.GOP_FOUR);
|
||||
mViewBinding.pushArgsSetting.gopText.setText("4/s");
|
||||
} else if (progress <= LivePushProgressStep.PROGRESS_100) {
|
||||
mGopLiveData.setValue(AlivcVideoEncodeGopEnum.GOP_FIVE);
|
||||
mViewBinding.pushArgsSetting.gopText.setText("5/s");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
int progress = seekBar.getProgress();
|
||||
if (progress <= 20) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_20);
|
||||
} else if (progress <= 40) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_40);
|
||||
} else if (progress <= 60) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_60);
|
||||
} else if (progress <= 80) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_80);
|
||||
} else if (progress <= 100) {
|
||||
seekBar.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//码率控制
|
||||
mViewBinding.pushArgsSetting.bitrateControl.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mBitrateControlLiveData.setValue(isChecked);
|
||||
});
|
||||
//可变分辨率
|
||||
mViewBinding.pushArgsSetting.variableResolution.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mVariableResolutionLiveData.setValue(isChecked);
|
||||
});
|
||||
//高级设置
|
||||
mViewBinding.pushArgsSetting.advanceConfig.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mViewBinding.pushArgsSetting.advanceLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
||||
});
|
||||
//显示模式
|
||||
mViewBinding.pushArgsSetting.qualityModes.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushArgsSetting.qualityModes, mQualityListener, mQualityModeDefaultIndex);
|
||||
});
|
||||
//音频编码
|
||||
mViewBinding.pushArgsSetting.audioProfiles.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushArgsSetting.audioProfiles, mAudioProfilesListener, mAudioProfileDefaultIndex);
|
||||
});
|
||||
//声道
|
||||
mViewBinding.pushArgsSetting.audioChannel.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushArgsSetting.audioChannel, mAudioChannelListener, mAudioChannelDefaultIndex);
|
||||
});
|
||||
//视频编码
|
||||
mViewBinding.pushArgsSetting.videoEncoderType.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushArgsSetting.videoEncoderType, mEncoderTypeListener, mVideoEncoderTypeDefaultIndex);
|
||||
});
|
||||
//B帧
|
||||
mViewBinding.pushArgsSetting.bFrameNum.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushArgsSetting.bFrameNum, mFrameNumListener, mBFrameDefaultIndex);
|
||||
});
|
||||
//视频硬编码
|
||||
mViewBinding.pushArgsSetting.hardSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mVideoHardwareDecodeLiveData.setValue(isChecked);
|
||||
});
|
||||
//音频硬编码
|
||||
mViewBinding.pushArgsSetting.audioHardenc.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mAudioHardwareDecodeLiveData.setValue(isChecked);
|
||||
});
|
||||
|
||||
//推流方向
|
||||
mViewBinding.pushFunctionSetting.mainOrientation.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushFunctionSetting.mainOrientation, mOrientationListener, mPreviewOrientationDefaultIndex);
|
||||
});
|
||||
//显示模式
|
||||
mViewBinding.pushFunctionSetting.settingDisplayMode.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushFunctionSetting.settingDisplayMode, mDisplayModeListener, mDisplayModeDefaultIndex);
|
||||
});
|
||||
//摄像头采集偏好
|
||||
mViewBinding.pushFunctionSetting.settingCameraCaptureOutputPreference.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushFunctionSetting.settingCameraCaptureOutputPreference, mCameraCaptureOutputPreferenceListener, mCameraCaptureOutputPreferenceDefaultIndex);
|
||||
});
|
||||
//水印
|
||||
mViewBinding.pushFunctionSetting.watermarkSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mViewBinding.pushFunctionSetting.waterPosition.setClickable(isChecked);
|
||||
mViewBinding.pushFunctionSetting.waterPosition.setTextColor(isChecked ? getResources().getColor(R.color.colourful_text_strong) : getResources().getColor(R.color.text_ultraweak));
|
||||
});
|
||||
//水印位置
|
||||
mViewBinding.pushFunctionSetting.waterPosition.setOnClickListener(view -> {
|
||||
mShowWaterMarkDialog.setValue(mViewBinding.pushFunctionSetting.watermarkSwitch.isChecked());
|
||||
});
|
||||
//推流镜像
|
||||
mViewBinding.pushFunctionSetting.pushMirrorSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mPushMirrorLiveData.setValue(isChecked);
|
||||
});
|
||||
//预览镜像
|
||||
mViewBinding.pushFunctionSetting.previewMirrorSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mPreviewMirrorLiveData.setValue(isChecked);
|
||||
});
|
||||
//摄像头
|
||||
mViewBinding.pushFunctionSetting.cameraSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mEnableFrontCamera.setValue(isChecked);
|
||||
});
|
||||
//自动对焦
|
||||
mViewBinding.pushFunctionSetting.autofocusSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mAutoFocusLiveData.setValue(isChecked);
|
||||
});
|
||||
//美颜
|
||||
mViewBinding.pushFunctionSetting.beautyOnSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mEnableBeauty.setValue(isChecked);
|
||||
});
|
||||
//暂停推图片
|
||||
mViewBinding.pushFunctionSetting.pauseImage.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mPauseImageLiveData.setValue(isChecked);
|
||||
});
|
||||
//网络差图片
|
||||
mViewBinding.pushFunctionSetting.networkImage.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mNetWorkImageLiveData.setValue(isChecked);
|
||||
});
|
||||
//推流模式
|
||||
mViewBinding.pushFunctionSetting.pushMode.setOnClickListener(view -> {
|
||||
mPushConfigDialog.showConfigDialog(mViewBinding.pushFunctionSetting.pushMode, mPushModeListener, mPushModeDefaultIndex);
|
||||
});
|
||||
//有效时长,鉴权 key
|
||||
//异步接口
|
||||
mViewBinding.pushFunctionSetting.asyncSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mAsyncLiveData.setValue(isChecked);
|
||||
});
|
||||
//音乐模式
|
||||
mViewBinding.pushFunctionSetting.musicModeSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mMusicModeLiveData.setValue(isChecked);
|
||||
});
|
||||
//外部音视频
|
||||
mViewBinding.pushFunctionSetting.externVideo.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mExternLiveData.setValue(isChecked);
|
||||
// 当前外部音视频的资源是720P,因此推流分辨率对应调整为720P
|
||||
mViewBinding.pushArgsSetting.resolutionView.setResolution(AlivcResolutionEnum.RESOLUTION_720P);
|
||||
});
|
||||
//本地日志
|
||||
mViewBinding.pushFunctionSetting.logSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> {
|
||||
mLocalLogLiveData.setValue(isChecked);
|
||||
});
|
||||
}
|
||||
|
||||
public void showArgsContent(boolean isShow) {
|
||||
mViewBinding.pushArgsSetting.getRoot().setVisibility(isShow ? View.VISIBLE : View.GONE);
|
||||
mViewBinding.pushFunctionSetting.getRoot().setVisibility(isShow ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mQualityListener = new PushConfigBottomSheetLive.OnPushConfigSelectorListener() {
|
||||
@Override
|
||||
public void confirm(String tips, int i) {
|
||||
mViewBinding.pushArgsSetting.qualityModes.setText(tips);
|
||||
if (AlivcQualityModeEnum.QM_CUSTOM.equals(mCurrentQualityMode)) {
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setText("");
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setText("");
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setText("");
|
||||
mViewBinding.pushArgsSetting.audioBitrate.setText("");
|
||||
}
|
||||
if (i == 0) {
|
||||
mCurrentQualityMode = AlivcQualityModeEnum.QM_RESOLUTION_FIRST;
|
||||
mQualityModeLiveData.setValue(AlivcQualityModeEnum.QM_RESOLUTION_FIRST);
|
||||
if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_180P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_180P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_240P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_240P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_360P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_360P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_480P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_480P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_540P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_720P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_720P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_RESOLUTION_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
}
|
||||
turnOnBitRateFps(false);
|
||||
} else if (i == 1) {
|
||||
mCurrentQualityMode = AlivcQualityModeEnum.QM_FLUENCY_FIRST;
|
||||
mQualityModeLiveData.setValue(AlivcQualityModeEnum.QM_FLUENCY_FIRST);
|
||||
if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_180P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_180P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_240P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_240P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_360P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_360P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_480P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_480P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_540P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_540P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_720P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_720P_FLUENCY_FIRST.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_FLUENCY_FIRST.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P_FLUENCY_FIRST.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
}
|
||||
turnOnBitRateFps(false);
|
||||
} else if (i == 2) {
|
||||
mCurrentQualityMode = AlivcQualityModeEnum.QM_CUSTOM;
|
||||
mQualityModeLiveData.setValue(AlivcQualityModeEnum.QM_CUSTOM);
|
||||
if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_180P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_180P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_180P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_240P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_240P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_240P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_360P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_360P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_360P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_480P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_480P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_480P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_540P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_540P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_540P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
} else if (mCurrentResolution.equals(AlivcResolutionEnum.RESOLUTION_720P)) {
|
||||
changeVideoBitrateWithResolution(
|
||||
AlivcLivePushConstants.BITRATE_720P.DEFAULT_VALUE_INT_TARGET_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P.DEFAULT_VALUE_INT_MIN_BITRATE.getBitrate(),
|
||||
AlivcLivePushConstants.BITRATE_720P.DEFAULT_VALUE_INT_INIT_BITRATE.getBitrate()
|
||||
);
|
||||
}
|
||||
turnOnBitRateFps(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mAudioProfilesListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mAudioProfileLiveData.setValue(AlivcAudioAACProfileEnum.AAC_LC);
|
||||
} else if (index == 1) {
|
||||
mAudioProfileLiveData.setValue(AlivcAudioAACProfileEnum.HE_AAC);
|
||||
} else if (index == 2) {
|
||||
mAudioProfileLiveData.setValue(AlivcAudioAACProfileEnum.HE_AAC_v2);
|
||||
} else if (index == 3) {
|
||||
mAudioProfileLiveData.setValue(AlivcAudioAACProfileEnum.AAC_LD);
|
||||
}
|
||||
};
|
||||
|
||||
private void turnOnBitRateFps(boolean on) {
|
||||
if (!on) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(83);
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(AlivcFpsEnum.FPS_25.getFps()));
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setFocusable(false);
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setFocusable(false);
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setFocusable(false);
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setFocusable(false);
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setFocusableInTouchMode(false);
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setFocusableInTouchMode(false);
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setFocusableInTouchMode(false);
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setFocusableInTouchMode(false);
|
||||
} else {
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setFocusable(true);
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setFocusable(true);
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setFocusable(true);
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setFocusableInTouchMode(true);
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setFocusableInTouchMode(true);
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setFocusableInTouchMode(true);
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.requestFocus();
|
||||
mViewBinding.pushArgsSetting.initRateEdit.requestFocus();
|
||||
mViewBinding.pushArgsSetting.minRateEdit.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
private void changeVideoBitrateWithResolution(int targetBitrate, int minBitrate, int initBitrate) {
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setHint(String.valueOf(targetBitrate));
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setHint(String.valueOf(minBitrate));
|
||||
mViewBinding.pushArgsSetting.initRateEdit.setHint(String.valueOf(initBitrate));
|
||||
|
||||
mTargetVideoBitrate.setValue(targetBitrate);
|
||||
mMinVideoBitrate.setValue(minBitrate);
|
||||
mInitialVideoBitrate.setValue(initBitrate);
|
||||
}
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mAudioChannelListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mAudioChannelLiveData.setValue(AlivcAudioChannelEnum.AUDIO_CHANNEL_ONE);
|
||||
} else if (index == 1) {
|
||||
mAudioChannelLiveData.setValue(AlivcAudioChannelEnum.AUDIO_CHANNEL_TWO);
|
||||
}
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mEncoderTypeListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mVideoEncodeTypeLiveData.setValue(AlivcEncodeType.Encode_TYPE_H264);
|
||||
} else if (index == 1) {
|
||||
mVideoEncodeTypeLiveData.setValue(AlivcEncodeType.Encode_TYPE_H265);
|
||||
}
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mFrameNumListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mBFrameLiveData.setValue(0);
|
||||
} else if (index == 1) {
|
||||
mBFrameLiveData.setValue(1);
|
||||
} else if (index == 2) {
|
||||
mBFrameLiveData.setValue(3);
|
||||
}
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mOrientationListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mPreviewOrientationLiveData.setValue(AlivcPreviewOrientationEnum.ORIENTATION_PORTRAIT);
|
||||
} else if (index == 1) {
|
||||
mPreviewOrientationLiveData.setValue(AlivcPreviewOrientationEnum.ORIENTATION_LANDSCAPE_HOME_LEFT);
|
||||
} else if (index == 2) {
|
||||
mPreviewOrientationLiveData.setValue(AlivcPreviewOrientationEnum.ORIENTATION_LANDSCAPE_HOME_RIGHT);
|
||||
}
|
||||
mPauseImgPathLiveData.setValue(getContext().getFilesDir().getPath() + File.separator + "alivc_resource/background_push.png");
|
||||
mNetWorkImgPathLiveData.setValue(getContext().getFilesDir().getPath() + File.separator + "alivc_resource/poor_network.png");
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mDisplayModeListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mPreviewDisplayModeLiveData.setValue(AlivcPreviewDisplayMode.ALIVC_LIVE_PUSHER_PREVIEW_SCALE_FILL);
|
||||
} else if (index == 1) {
|
||||
mPreviewDisplayModeLiveData.setValue(AlivcPreviewDisplayMode.ALIVC_LIVE_PUSHER_PREVIEW_ASPECT_FIT);
|
||||
} else if (index == 2) {
|
||||
mPreviewDisplayModeLiveData.setValue(AlivcPreviewDisplayMode.ALIVC_LIVE_PUSHER_PREVIEW_ASPECT_FILL);
|
||||
}
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mCameraCaptureOutputPreferenceListener = (data, index) -> {
|
||||
if (index == 0) {
|
||||
mCameraCaptureOutputPreferenceLiveData.setValue(AlivcLiveCameraCaptureOutputPreference.AUTO);
|
||||
} else if (index == 1) {
|
||||
mCameraCaptureOutputPreferenceLiveData.setValue(AlivcLiveCameraCaptureOutputPreference.PERFORMANCE);
|
||||
} else if (index == 2) {
|
||||
mCameraCaptureOutputPreferenceLiveData.setValue(AlivcLiveCameraCaptureOutputPreference.PREVIEW);
|
||||
}
|
||||
};
|
||||
|
||||
private final PushConfigBottomSheetLive.OnPushConfigSelectorListener mPushModeListener = (data, index) -> {
|
||||
boolean mAudioOnlyPush = (index == 1);
|
||||
boolean mVideoOnlyPush = (index == 2);
|
||||
mAudioOnlyLiveData.setValue(mAudioOnlyPush);
|
||||
mVideoOnlyLiveData.setValue(mVideoOnlyPush);
|
||||
};
|
||||
|
||||
public String getInitVideoBitrate() {
|
||||
String initVideoBitrate = mViewBinding.pushArgsSetting.initRateEdit.getText().toString();
|
||||
if (TextUtils.isEmpty(initVideoBitrate)) {
|
||||
return mViewBinding.pushArgsSetting.initRateEdit.getHint().toString();
|
||||
}
|
||||
return initVideoBitrate;
|
||||
}
|
||||
|
||||
public String getAudioBitrate() {
|
||||
String audioBitrate = mViewBinding.pushArgsSetting.audioBitrate.getText().toString();
|
||||
if (TextUtils.isEmpty(audioBitrate)) {
|
||||
return mViewBinding.pushArgsSetting.audioBitrate.getHint().toString();
|
||||
}
|
||||
return audioBitrate;
|
||||
}
|
||||
|
||||
public String getMinVideoBitrate() {
|
||||
String minVideoBitrate = mViewBinding.pushArgsSetting.minRateEdit.getText().toString();
|
||||
if (TextUtils.isEmpty(minVideoBitrate)) {
|
||||
return mViewBinding.pushArgsSetting.minRateEdit.getHint().toString();
|
||||
}
|
||||
return minVideoBitrate;
|
||||
}
|
||||
|
||||
public String getMinVideoBitrateOnlyEditText() {
|
||||
return mViewBinding.pushArgsSetting.minRateEdit.getText().toString();
|
||||
}
|
||||
|
||||
public String getMinVideoBitrateOnlyHint() {
|
||||
return mViewBinding.pushArgsSetting.minRateEdit.getHint().toString();
|
||||
}
|
||||
|
||||
public void setTargetVideoBitrateText(String bitrate) {
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setText(bitrate);
|
||||
}
|
||||
|
||||
public void setMinVideoBitrateText(String bitrate) {
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setText(bitrate);
|
||||
}
|
||||
|
||||
public String getTargetVideoBitrate() {
|
||||
String targetVideoBitrate = mViewBinding.pushArgsSetting.targetRateEdit.getText().toString();
|
||||
if (TextUtils.isEmpty(targetVideoBitrate)) {
|
||||
return mViewBinding.pushArgsSetting.targetRateEdit.getHint().toString();
|
||||
}
|
||||
return targetVideoBitrate;
|
||||
}
|
||||
|
||||
public String getTargetVideoBitrateOnlyEditText() {
|
||||
return mViewBinding.pushArgsSetting.targetRateEdit.getText().toString();
|
||||
}
|
||||
|
||||
public String getTargetVideoBitrateOnlyHint() {
|
||||
return mViewBinding.pushArgsSetting.targetRateEdit.getHint().toString();
|
||||
}
|
||||
|
||||
public int getRetryCount() {
|
||||
String retryCount = mViewBinding.pushFunctionSetting.retryCount.getText().toString();
|
||||
if (TextUtils.isEmpty(retryCount)) {
|
||||
return AlivcLivePushConstants.DEFAULT_VALUE_INT_AUDIO_RETRY_COUNT;
|
||||
}
|
||||
return Integer.parseInt(retryCount);
|
||||
}
|
||||
|
||||
public int getRetryInterval() {
|
||||
String retryInterval = mViewBinding.pushFunctionSetting.retryInterval.getText().toString();
|
||||
if (TextUtils.isEmpty(retryInterval)) {
|
||||
return AlivcLivePushConstants.DEFAULT_VALUE_INT_RETRY_INTERVAL;
|
||||
}
|
||||
return Integer.parseInt(retryInterval);
|
||||
}
|
||||
|
||||
public String getAuthTime() {
|
||||
return mViewBinding.pushFunctionSetting.authTime.getText().toString();
|
||||
}
|
||||
|
||||
public String getPrivacyKey() {
|
||||
return mViewBinding.pushFunctionSetting.privacyKey.getText().toString();
|
||||
}
|
||||
|
||||
public void externDownloadError() {
|
||||
mViewBinding.pushFunctionSetting.externVideo.setChecked(false);
|
||||
}
|
||||
|
||||
public boolean enableWaterMark() {
|
||||
return mViewBinding.pushFunctionSetting.watermarkSwitch.isChecked();
|
||||
}
|
||||
|
||||
public void setPushMirror(boolean isChecked) {
|
||||
mViewBinding.pushFunctionSetting.pushMirrorSwitch.setChecked(isChecked);
|
||||
}
|
||||
|
||||
public void setPreviewMirror(boolean isChecked) {
|
||||
mViewBinding.pushFunctionSetting.previewMirrorSwitch.setChecked(isChecked);
|
||||
}
|
||||
|
||||
public void setAutoFocus(boolean isChecked) {
|
||||
mViewBinding.pushFunctionSetting.autofocusSwitch.setChecked(isChecked);
|
||||
}
|
||||
|
||||
public void setBeautyOn(boolean isChecked) {
|
||||
mViewBinding.pushFunctionSetting.beautyOnSwitch.setChecked(isChecked);
|
||||
}
|
||||
|
||||
public boolean enableBeauty() {
|
||||
return mViewBinding.pushFunctionSetting.beautyOnSwitch.isChecked();
|
||||
}
|
||||
|
||||
public int getSelfDefineResolutionWidth() {
|
||||
return mViewBinding.pushArgsSetting.resolutionView.getSelfDefineWidth();
|
||||
}
|
||||
|
||||
public int getSelfDefineResolutionHeight() {
|
||||
return mViewBinding.pushArgsSetting.resolutionView.getSelfDefineHeight();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
mPushConfigDialog.destroy();
|
||||
}
|
||||
|
||||
public void setDefaultConfig(AlivcLivePushConfig alivcLivePushConfig, boolean isEnableBeauty, boolean isEnableLocalLog, boolean isEnableWaterMark) {
|
||||
mViewBinding.pushArgsSetting.bitrateControl.setChecked(alivcLivePushConfig.isEnableBitrateControl());
|
||||
mViewBinding.pushArgsSetting.targetRateEdit.setText(String.valueOf(alivcLivePushConfig.getTargetVideoBitrate()));
|
||||
mViewBinding.pushArgsSetting.minRateEdit.setText(String.valueOf(alivcLivePushConfig.getMinVideoBitrate()));
|
||||
mViewBinding.pushArgsSetting.variableResolution.setChecked(alivcLivePushConfig.isEnableAutoResolution());
|
||||
AlivcResolutionEnum configResolution = alivcLivePushConfig.getResolution();
|
||||
mViewBinding.pushArgsSetting.resolutionView.setResolution(configResolution);
|
||||
int audioChannels = alivcLivePushConfig.getAudioChannels();
|
||||
if (audioChannels == AlivcAudioChannelEnum.AUDIO_CHANNEL_ONE.getChannelCount()) {
|
||||
mAudioChannelDefaultIndex = 0;
|
||||
mViewBinding.pushArgsSetting.audioChannel.setText(getResources().getString(R.string.single_track));
|
||||
} else if ((audioChannels == AlivcAudioChannelEnum.AUDIO_CHANNEL_TWO.getChannelCount())) {
|
||||
mAudioChannelDefaultIndex = 1;
|
||||
mViewBinding.pushArgsSetting.audioChannel.setText(getResources().getString(R.string.dual_track));
|
||||
}
|
||||
AlivcAudioAACProfileEnum configAudioProfile = alivcLivePushConfig.getAudioProfile();
|
||||
if (configAudioProfile == AlivcAudioAACProfileEnum.AAC_LC) {
|
||||
mAudioProfileDefaultIndex = 0;
|
||||
mViewBinding.pushArgsSetting.audioProfiles.setText(getResources().getString(R.string.setting_audio_aac_lc));
|
||||
} else if (configAudioProfile == AlivcAudioAACProfileEnum.HE_AAC) {
|
||||
mAudioProfileDefaultIndex = 1;
|
||||
mViewBinding.pushArgsSetting.audioProfiles.setText(getResources().getString(R.string.setting_audio_aac_he));
|
||||
} else if (configAudioProfile == AlivcAudioAACProfileEnum.HE_AAC_v2) {
|
||||
mAudioProfileDefaultIndex = 2;
|
||||
mViewBinding.pushArgsSetting.audioProfiles.setText(getResources().getString(R.string.setting_audio_aac_hev2));
|
||||
} else if (configAudioProfile == AlivcAudioAACProfileEnum.AAC_LD) {
|
||||
mAudioProfileDefaultIndex = 3;
|
||||
mViewBinding.pushArgsSetting.audioProfiles.setText(getResources().getString(R.string.setting_audio_aac_ld));
|
||||
}
|
||||
mViewBinding.pushArgsSetting.minFpsText.setText(String.valueOf(alivcLivePushConfig.getMinFps()));
|
||||
int configMinFps = alivcLivePushConfig.getMinFps();
|
||||
if (configMinFps == AlivcFpsEnum.FPS_8.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_0);
|
||||
} else if (configMinFps == AlivcFpsEnum.FPS_10.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_16);
|
||||
} else if (configMinFps == AlivcFpsEnum.FPS_12.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_33);
|
||||
} else if (configMinFps == AlivcFpsEnum.FPS_15.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_50);
|
||||
} else if (configMinFps == AlivcFpsEnum.FPS_20.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_66);
|
||||
} else if (configMinFps == AlivcFpsEnum.FPS_25.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_80);
|
||||
} else if (configMinFps == AlivcFpsEnum.FPS_30.getFps()) {
|
||||
mViewBinding.pushArgsSetting.minFpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
}
|
||||
AlivcAudioSampleRateEnum configAudioSampleRate = alivcLivePushConfig.getAudioSampleRate();
|
||||
if (configAudioSampleRate == AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_16000) {
|
||||
mViewBinding.pushArgsSetting.audioRateSeekbar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_160);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getResources().getString(R.string.setting_audio_160));
|
||||
} else if (configAudioSampleRate == AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_32000) {
|
||||
mViewBinding.pushArgsSetting.audioRateSeekbar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_320);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getResources().getString(R.string.setting_audio_320));
|
||||
} else if (configAudioSampleRate == AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_44100) {
|
||||
mViewBinding.pushArgsSetting.audioRateSeekbar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_441);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getResources().getString(R.string.setting_audio_441));
|
||||
} else if (configAudioSampleRate == AlivcAudioSampleRateEnum.AUDIO_SAMPLE_RATE_48000) {
|
||||
mViewBinding.pushArgsSetting.audioRateSeekbar.setProgress(LivePushProgressStep.PROGRESS_AUDIO_480);
|
||||
mViewBinding.pushArgsSetting.audioRateText.setText(getResources().getString(R.string.setting_audio_480));
|
||||
}
|
||||
mViewBinding.pushArgsSetting.gopText.setText(String.format(Locale.getDefault(), "%d/s", alivcLivePushConfig.getVideoEncodeGop()));
|
||||
int videoEncodeGop = alivcLivePushConfig.getVideoEncodeGop();
|
||||
if (videoEncodeGop == AlivcVideoEncodeGopEnum.GOP_ONE.getGop()) {
|
||||
mViewBinding.pushArgsSetting.gopSeekbar.setProgress(LivePushProgressStep.PROGRESS_20);
|
||||
} else if (videoEncodeGop == AlivcVideoEncodeGopEnum.GOP_TWO.getGop()) {
|
||||
mViewBinding.pushArgsSetting.gopSeekbar.setProgress(LivePushProgressStep.PROGRESS_40);
|
||||
} else if (videoEncodeGop == AlivcVideoEncodeGopEnum.GOP_THREE.getGop()) {
|
||||
mViewBinding.pushArgsSetting.gopSeekbar.setProgress(LivePushProgressStep.PROGRESS_60);
|
||||
} else if (videoEncodeGop == AlivcVideoEncodeGopEnum.GOP_FOUR.getGop()) {
|
||||
mViewBinding.pushArgsSetting.gopSeekbar.setProgress(LivePushProgressStep.PROGRESS_80);
|
||||
} else if (videoEncodeGop == AlivcVideoEncodeGopEnum.GOP_FIVE.getGop()) {
|
||||
mViewBinding.pushArgsSetting.gopSeekbar.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
}
|
||||
mViewBinding.pushArgsSetting.fpsText.setText(String.valueOf(alivcLivePushConfig.getFps()));
|
||||
int configFps = alivcLivePushConfig.getFps();
|
||||
if (configFps == AlivcFpsEnum.FPS_8.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_0);
|
||||
} else if (configFps == AlivcFpsEnum.FPS_10.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_16);
|
||||
} else if (configFps == AlivcFpsEnum.FPS_12.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_33);
|
||||
} else if (configFps == AlivcFpsEnum.FPS_15.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_50);
|
||||
} else if (configFps == AlivcFpsEnum.FPS_20.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_66);
|
||||
} else if (configFps == AlivcFpsEnum.FPS_25.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_80);
|
||||
} else if (configFps == AlivcFpsEnum.FPS_30.getFps()) {
|
||||
mViewBinding.pushArgsSetting.fpsSeekbar.setProgress(LivePushProgressStep.PROGRESS_100);
|
||||
}
|
||||
AlivcQualityModeEnum configQualityMode = alivcLivePushConfig.getQualityMode();
|
||||
if (configQualityMode == AlivcQualityModeEnum.QM_RESOLUTION_FIRST) {
|
||||
mQualityModeDefaultIndex = 0;
|
||||
mViewBinding.pushArgsSetting.qualityModes.setText(getResources().getString(R.string.quality_resolution_first));
|
||||
} else if (configQualityMode == AlivcQualityModeEnum.QM_FLUENCY_FIRST) {
|
||||
mQualityModeDefaultIndex = 1;
|
||||
mViewBinding.pushArgsSetting.qualityModes.setText(getResources().getString(R.string.quality_fluency_first));
|
||||
} else if (configQualityMode == AlivcQualityModeEnum.QM_CUSTOM) {
|
||||
mQualityModeDefaultIndex = 2;
|
||||
mViewBinding.pushArgsSetting.qualityModes.setText(getResources().getString(R.string.quality_custom));
|
||||
}
|
||||
AlivcEncodeType configVideoEncodeType = alivcLivePushConfig.getVideoEncodeType();
|
||||
if (configVideoEncodeType == AlivcEncodeType.Encode_TYPE_H264) {
|
||||
mVideoEncoderTypeDefaultIndex = 0;
|
||||
mViewBinding.pushArgsSetting.videoEncoderType.setText(getResources().getString(R.string.h264));
|
||||
} else if (configVideoEncodeType == AlivcEncodeType.Encode_TYPE_H265) {
|
||||
mVideoEncoderTypeDefaultIndex = 1;
|
||||
mViewBinding.pushArgsSetting.videoEncoderType.setText(getResources().getString(R.string.h265));
|
||||
}
|
||||
int bFrames = alivcLivePushConfig.getBFrames();
|
||||
if (bFrames == 0) {
|
||||
mBFrameDefaultIndex = 0;
|
||||
mViewBinding.pushArgsSetting.bFrameNum.setText("0");
|
||||
} else if (bFrames == 1) {
|
||||
mBFrameDefaultIndex = 1;
|
||||
mViewBinding.pushArgsSetting.bFrameNum.setText("1");
|
||||
} else if (bFrames == 3) {
|
||||
mBFrameDefaultIndex = 2;
|
||||
mViewBinding.pushArgsSetting.bFrameNum.setText("3");
|
||||
}
|
||||
mViewBinding.pushArgsSetting.hardSwitch.setChecked(alivcLivePushConfig.getVideoEncodeMode() == AlivcEncodeModeEnum.Encode_MODE_HARD);
|
||||
mViewBinding.pushArgsSetting.audioHardenc.setChecked(alivcLivePushConfig.getAudioEncodeMode() == AlivcEncodeModeEnum.Encode_MODE_HARD);
|
||||
|
||||
mViewBinding.pushFunctionSetting.beautyOnSwitch.setChecked(isEnableBeauty);
|
||||
mViewBinding.pushFunctionSetting.logSwitch.setChecked(isEnableLocalLog);
|
||||
mViewBinding.pushFunctionSetting.watermarkSwitch.setChecked(isEnableWaterMark);
|
||||
mViewBinding.pushFunctionSetting.pushMirrorSwitch.setChecked(alivcLivePushConfig.isPushMirror());
|
||||
mViewBinding.pushFunctionSetting.previewMirrorSwitch.setChecked(alivcLivePushConfig.isPreviewMirror());
|
||||
mViewBinding.pushFunctionSetting.cameraSwitch.setChecked(alivcLivePushConfig.getCameraType() == AlivcLivePushCameraTypeEnum.CAMERA_TYPE_FRONT.getCameraId());
|
||||
mViewBinding.pushFunctionSetting.autofocusSwitch.setChecked(alivcLivePushConfig.isAutoFocus());
|
||||
mViewBinding.pushFunctionSetting.pauseImage.setChecked(!TextUtils.isEmpty(alivcLivePushConfig.getPausePushImage()));
|
||||
mViewBinding.pushFunctionSetting.networkImage.setChecked(!TextUtils.isEmpty(alivcLivePushConfig.getNetworkPoorPushImage()));
|
||||
mViewBinding.pushFunctionSetting.musicModeSwitch.setChecked(alivcLivePushConfig.getAudioSceneMode() == AlivcAudioSceneModeEnum.AUDIO_SCENE_MUSIC_MODE);
|
||||
mViewBinding.pushFunctionSetting.externVideo.setChecked(alivcLivePushConfig.isExternMainStream());
|
||||
|
||||
boolean configAudioOnly = alivcLivePushConfig.isAudioOnly();
|
||||
boolean configVideoOnly = alivcLivePushConfig.isVideoOnly();
|
||||
if (configAudioOnly && configVideoOnly) {
|
||||
mPushModeDefaultIndex = 0;
|
||||
mViewBinding.pushFunctionSetting.pushMode.setText(getResources().getString(R.string.video_push_streaming));
|
||||
} else {
|
||||
if (configAudioOnly) {
|
||||
mPushModeDefaultIndex = 1;
|
||||
mViewBinding.pushFunctionSetting.pushMode.setText(getResources().getString(R.string.audio_only_push_streaming));
|
||||
} else {
|
||||
mPushModeDefaultIndex = 2;
|
||||
mViewBinding.pushFunctionSetting.pushMode.setText(getResources().getString(R.string.video_only_push_streaming));
|
||||
}
|
||||
}
|
||||
|
||||
AlivcPreviewDisplayMode configPreviewDisplayMode = alivcLivePushConfig.getPreviewDisplayMode();
|
||||
if (configPreviewDisplayMode == AlivcPreviewDisplayMode.ALIVC_LIVE_PUSHER_PREVIEW_SCALE_FILL) {
|
||||
mDisplayModeDefaultIndex = 0;
|
||||
mViewBinding.pushFunctionSetting.settingDisplayMode.setText(getResources().getString(R.string.display_mode_full));
|
||||
} else if (configPreviewDisplayMode == AlivcPreviewDisplayMode.ALIVC_LIVE_PUSHER_PREVIEW_ASPECT_FIT) {
|
||||
mDisplayModeDefaultIndex = 1;
|
||||
mViewBinding.pushFunctionSetting.settingDisplayMode.setText(getResources().getString(R.string.display_mode_fit));
|
||||
} else if (configPreviewDisplayMode == AlivcPreviewDisplayMode.ALIVC_LIVE_PUSHER_PREVIEW_ASPECT_FILL) {
|
||||
mDisplayModeDefaultIndex = 2;
|
||||
mViewBinding.pushFunctionSetting.settingDisplayMode.setText(getResources().getString(R.string.display_mode_cut));
|
||||
}
|
||||
|
||||
int configPreviewOrientation = alivcLivePushConfig.getPreviewOrientation();
|
||||
if (configPreviewOrientation == AlivcPreviewOrientationEnum.ORIENTATION_PORTRAIT.getOrientation()) {
|
||||
mPreviewOrientationDefaultIndex = 0;
|
||||
mViewBinding.pushFunctionSetting.mainOrientation.setText(getResources().getString(R.string.portrait));
|
||||
} else if (configPreviewOrientation == AlivcPreviewOrientationEnum.ORIENTATION_LANDSCAPE_HOME_LEFT.getOrientation()) {
|
||||
mPreviewOrientationDefaultIndex = 1;
|
||||
mViewBinding.pushFunctionSetting.mainOrientation.setText(getResources().getString(R.string.homeLeft));
|
||||
} else if (configPreviewOrientation == AlivcPreviewOrientationEnum.ORIENTATION_LANDSCAPE_HOME_RIGHT.getOrientation()) {
|
||||
mPreviewOrientationDefaultIndex = 2;
|
||||
mViewBinding.pushFunctionSetting.mainOrientation.setText(getResources().getString(R.string.homeRight));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
package com.alivc.live.commonui.configview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.widget.Scroller;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OptionSelectorView extends View implements Runnable {
|
||||
private static final String TAG = "OptionSelectorView";
|
||||
private final float DEFAULT_FRICTION = 0.02f;
|
||||
private final int DEFAULT_ITEM_HEIGHT = (int) dip2px(39);
|
||||
private final int DEFAULT_DIVIDER_COLOR = Color.parseColor("#3A3D48");
|
||||
private final int DEFAULT_VISIBLE_ITEM_NUM = 6;
|
||||
private final float mHalfShowHeight = DEFAULT_VISIBLE_ITEM_NUM * DEFAULT_ITEM_HEIGHT / 2.0f;
|
||||
private final int DEFAULT_START_ITEM_COLOR = Color.parseColor("#FCFCFD");
|
||||
private final int DEFAULT_END_TEXT_COLOR = Color.parseColor("#747A8C");
|
||||
private final float mMaxTextSize = sp2px(21);
|
||||
private final float mMinTextSize = sp2px(13);
|
||||
|
||||
private List<String> mData;
|
||||
private int mMinimumVelocity;
|
||||
private int mMaximumVelocity;
|
||||
private long mClickTimeout;
|
||||
private VelocityTracker mVelocityTracker;
|
||||
private Scroller mScroller;
|
||||
private int mMinScrollY;
|
||||
private int mMaxScrollY;
|
||||
private int mScrollOffsetY;
|
||||
private boolean mIsDragging = false;
|
||||
private boolean mIsFlingScroll = false;
|
||||
private float mTouchY;
|
||||
private long mTouchDownTime;
|
||||
private int mCurrentScrollPosition;
|
||||
private int mSelectedItemPosition = 0;
|
||||
private OnItemSelectedListener mOnItemSelectedListener;
|
||||
private Rect mContentRect;
|
||||
protected Rect mPanelRect;
|
||||
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
public OptionSelectorView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public OptionSelectorView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public OptionSelectorView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
|
||||
private void initView(Context context) {
|
||||
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
|
||||
mMinimumVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
|
||||
mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
|
||||
mClickTimeout = ViewConfiguration.getTapTimeout();
|
||||
mContentRect = new Rect(0, 0, 0, 0);
|
||||
mPanelRect = new Rect(0, 0, 0, 0);
|
||||
mScroller = new Scroller(context);
|
||||
mScroller.setFriction(DEFAULT_FRICTION);
|
||||
mMinScrollY = 0;
|
||||
}
|
||||
|
||||
public void setData(List<String> data, int selectPosition) {
|
||||
mScroller.forceFinished(true);
|
||||
mData = data;
|
||||
mCurrentScrollPosition = mSelectedItemPosition = selectPosition;
|
||||
mScrollOffsetY = DEFAULT_ITEM_HEIGHT * selectPosition;
|
||||
mMaxScrollY = (mData.size() - 1) * DEFAULT_ITEM_HEIGHT;
|
||||
invalidateAndCheckItemChange();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
reSetRect();
|
||||
}
|
||||
|
||||
private void reSetRect() {
|
||||
mContentRect.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(), getHeight() - getPaddingBottom());
|
||||
mPanelRect.set(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
initVelocityTracker(event);
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (getParent() != null) {
|
||||
getParent().requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
if (!mScroller.isFinished()) {
|
||||
mScroller.forceFinished(true);
|
||||
}
|
||||
mIsDragging = true;
|
||||
mTouchY = event.getY();
|
||||
mTouchDownTime = System.currentTimeMillis();
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
float currentY = event.getY();
|
||||
float dy = currentY - mTouchY;
|
||||
if (Math.abs(dy) < 1) {
|
||||
break;
|
||||
}
|
||||
scroll((int) -dy);
|
||||
mTouchY = currentY;
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
mIsDragging = false;
|
||||
mVelocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||
float velocityY = mVelocityTracker.getYVelocity();
|
||||
if (Math.abs(velocityY) > mMinimumVelocity) {
|
||||
mScroller.forceFinished(true);
|
||||
mIsFlingScroll = true;
|
||||
mScroller.fling(0, mScrollOffsetY, 0, (int) -velocityY, 0, 0,
|
||||
mMinScrollY, mMaxScrollY);
|
||||
fixBounceEffect();
|
||||
} else {
|
||||
//点击位置和中心点的y轴距离
|
||||
int clickOffset = 0;
|
||||
if (System.currentTimeMillis() - mTouchDownTime <= mClickTimeout) {
|
||||
clickOffset = (int) (event.getY() - getHeight() / 2);
|
||||
}
|
||||
int scrollDistance = clickOffset + calculateDistanceNeedToScroll((mScrollOffsetY + clickOffset) % DEFAULT_ITEM_HEIGHT);
|
||||
|
||||
if (scrollDistance <= 0) {
|
||||
scrollDistance = Math.max(scrollDistance, -mScrollOffsetY);
|
||||
} else {
|
||||
scrollDistance = Math.min(scrollDistance, mMaxScrollY - mScrollOffsetY);
|
||||
}
|
||||
mScroller.startScroll(0, mScrollOffsetY, 0, scrollDistance);
|
||||
|
||||
}
|
||||
invalidateAndCheckItemChange();
|
||||
ViewCompat.postOnAnimation(this, this);
|
||||
recycleVelocityTracker();
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
recycleVelocityTracker();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//停止滚动后更新状态
|
||||
if (mScroller.isFinished() && !mIsDragging && !mIsFlingScroll) {
|
||||
int currentItemPosition = getCurrentPosition();
|
||||
if (currentItemPosition == mSelectedItemPosition) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentScrollPosition = mSelectedItemPosition = currentItemPosition;
|
||||
|
||||
//选中监听回调
|
||||
if (mOnItemSelectedListener != null && mData != null && mData.size() > mSelectedItemPosition) {
|
||||
mOnItemSelectedListener.onItemSelected(mData.get(mSelectedItemPosition), mSelectedItemPosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (mScroller.computeScrollOffset()) {
|
||||
mScrollOffsetY = mScroller.getCurrY();
|
||||
invalidateAndCheckItemChange();
|
||||
ViewCompat.postOnAnimation(this, this);
|
||||
} else if (mIsFlingScroll) {
|
||||
//快速滚动后调整选中位置到中心
|
||||
mIsFlingScroll = false;
|
||||
mScroller.startScroll(0, mScrollOffsetY, 0, calculateDistanceNeedToScroll(mScrollOffsetY % DEFAULT_ITEM_HEIGHT));
|
||||
invalidateAndCheckItemChange();
|
||||
ViewCompat.postOnAnimation(this, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (mContentRect.width() == 0) {
|
||||
reSetRect();
|
||||
}
|
||||
drawDivider(canvas);
|
||||
//已滚动item数
|
||||
int scrolledItem;
|
||||
//没有滚动完的item偏移值
|
||||
int scrolledOffset;
|
||||
scrolledItem = mScrollOffsetY / DEFAULT_ITEM_HEIGHT;
|
||||
scrolledOffset = mScrollOffsetY % DEFAULT_ITEM_HEIGHT;
|
||||
|
||||
int half = (DEFAULT_VISIBLE_ITEM_NUM + 1) / 2;
|
||||
//绘制的第一个选项下标
|
||||
int firstItemIndex = scrolledItem - half + (mScrollOffsetY > 0 ? 1 : 0);
|
||||
//绘制的最后一个选项下标
|
||||
int lastItemIndex = scrolledItem + half;
|
||||
|
||||
for (int i = firstItemIndex; i <= lastItemIndex; i++) {
|
||||
drawItem(canvas, i, scrolledOffset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void drawItem(Canvas canvas, int index, int scrolledOffset) {
|
||||
String text = getTextByIndex(index);
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
//item 与中间项的偏移
|
||||
int item2CenterOffsetY;
|
||||
item2CenterOffsetY = (index - mScrollOffsetY / DEFAULT_ITEM_HEIGHT) * DEFAULT_ITEM_HEIGHT - scrolledOffset;
|
||||
float textSize = mMaxTextSize - ((mMaxTextSize - mMinTextSize) / mHalfShowHeight * Math.abs(item2CenterOffsetY));
|
||||
mPaint.setTextSize((float) Math.floor(textSize));
|
||||
int textColor = evaluate(Math.abs(item2CenterOffsetY) * 1.0f / mHalfShowHeight, DEFAULT_START_ITEM_COLOR, DEFAULT_END_TEXT_COLOR);
|
||||
mPaint.setColor(textColor);
|
||||
int textHeightHalf = (int) ((mPaint.getFontMetrics().descent + mPaint.getFontMetrics().ascent) / 2);
|
||||
|
||||
mPaint.setTextAlign(Paint.Align.CENTER);
|
||||
canvas.clipRect(mContentRect);
|
||||
canvas.drawText(text, mContentRect.centerX(), mContentRect.centerY() + item2CenterOffsetY - textHeightHalf, mPaint);
|
||||
}
|
||||
|
||||
|
||||
private void drawDivider(Canvas canvas) {
|
||||
//没有设置分割线颜色时跳过绘制
|
||||
if (DEFAULT_DIVIDER_COLOR == Color.TRANSPARENT) {
|
||||
return;
|
||||
}
|
||||
mPaint.setColor(DEFAULT_DIVIDER_COLOR);
|
||||
mPaint.setStrokeWidth(1);
|
||||
canvas.drawLine(mContentRect.left, mContentRect.centerY() - (DEFAULT_ITEM_HEIGHT >> 1), mContentRect.right, mContentRect.centerY() - (DEFAULT_ITEM_HEIGHT >> 1), mPaint);
|
||||
canvas.drawLine(mContentRect.left, mContentRect.centerY() + (DEFAULT_ITEM_HEIGHT >> 1), mContentRect.right, mContentRect.centerY() + (DEFAULT_ITEM_HEIGHT >> 1), mPaint);
|
||||
}
|
||||
|
||||
public int evaluate(float fraction, int startValue, int endValue) {
|
||||
float startA = ((startValue >> 24) & 0xff) / 255.0f;
|
||||
float startR = ((startValue >> 16) & 0xff) / 255.0f;
|
||||
float startG = ((startValue >> 8) & 0xff) / 255.0f;
|
||||
float startB = (startValue & 0xff) / 255.0f;
|
||||
|
||||
float endA = ((endValue >> 24) & 0xff) / 255.0f;
|
||||
float endR = ((endValue >> 16) & 0xff) / 255.0f;
|
||||
float endG = ((endValue >> 8) & 0xff) / 255.0f;
|
||||
float endB = (endValue & 0xff) / 255.0f;
|
||||
|
||||
// convert from sRGB to linear
|
||||
startR = (float) Math.pow(startR, 2.2);
|
||||
startG = (float) Math.pow(startG, 2.2);
|
||||
startB = (float) Math.pow(startB, 2.2);
|
||||
|
||||
endR = (float) Math.pow(endR, 2.2);
|
||||
endG = (float) Math.pow(endG, 2.2);
|
||||
endB = (float) Math.pow(endB, 2.2);
|
||||
|
||||
// compute the interpolated color in linear space
|
||||
float a = startA + fraction * (endA - startA);
|
||||
float r = startR + fraction * (endR - startR);
|
||||
float g = startG + fraction * (endG - startG);
|
||||
float b = startB + fraction * (endB - startB);
|
||||
|
||||
// convert back to sRGB in the [0..255] range
|
||||
a = a * 255.0f;
|
||||
r = (float) Math.pow(r, 1.0 / 2.2) * 255.0f;
|
||||
g = (float) Math.pow(g, 1.0 / 2.2) * 255.0f;
|
||||
b = (float) Math.pow(b, 1.0 / 2.2) * 255.0f;
|
||||
|
||||
return Math.round(a) << 24 | Math.round(r) << 16 | Math.round(g) << 8 | Math.round(b);
|
||||
}
|
||||
|
||||
private String getTextByIndex(int index) {
|
||||
|
||||
|
||||
if (mData != null && index >= 0 && index < mData.size()) {
|
||||
return mData.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void initVelocityTracker(MotionEvent event) {
|
||||
if (mVelocityTracker == null) {
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
}
|
||||
mVelocityTracker.addMovement(event);
|
||||
}
|
||||
|
||||
private void recycleVelocityTracker() {
|
||||
if (mVelocityTracker != null) {
|
||||
mVelocityTracker.recycle();
|
||||
mVelocityTracker = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void scroll(int distance) {
|
||||
mScrollOffsetY += distance;
|
||||
mScrollOffsetY = Math.min(mMaxScrollY, Math.max(mMinScrollY, mScrollOffsetY));
|
||||
invalidateAndCheckItemChange();
|
||||
}
|
||||
|
||||
private void invalidateAndCheckItemChange() {
|
||||
invalidate();
|
||||
int currentPosition = getCurrentPosition();
|
||||
if (mCurrentScrollPosition != currentPosition) {
|
||||
mCurrentScrollPosition = currentPosition;
|
||||
}
|
||||
}
|
||||
|
||||
private int getCurrentPosition() {
|
||||
int itemPosition;
|
||||
if (mScrollOffsetY < 0) {
|
||||
itemPosition = (mScrollOffsetY - DEFAULT_ITEM_HEIGHT / 2) / DEFAULT_ITEM_HEIGHT;
|
||||
} else {
|
||||
itemPosition = (mScrollOffsetY + DEFAULT_ITEM_HEIGHT / 2) / DEFAULT_ITEM_HEIGHT;
|
||||
}
|
||||
int currentPosition = itemPosition % mData.size();
|
||||
if (currentPosition < 0) {
|
||||
currentPosition += mData.size();
|
||||
}
|
||||
|
||||
return currentPosition;
|
||||
}
|
||||
|
||||
private int calculateDistanceNeedToScroll(int offset) {
|
||||
//超过item高度一半,需要滚动一个item
|
||||
if (Math.abs(offset) > DEFAULT_ITEM_HEIGHT / 2) {
|
||||
if (mScrollOffsetY < 0) {
|
||||
return -DEFAULT_ITEM_HEIGHT - offset;
|
||||
} else {
|
||||
return DEFAULT_ITEM_HEIGHT - offset;
|
||||
}
|
||||
}
|
||||
//当前item回到中心距离
|
||||
else {
|
||||
return -offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void fixBounceEffect() {
|
||||
//修正快速滑动最后停止位置,没有回弹效果
|
||||
int stopOffset = mScroller.getFinalY();
|
||||
int itemScrollOffset = Math.abs(stopOffset % DEFAULT_ITEM_HEIGHT);
|
||||
|
||||
//如果滚动偏移超过半个item高度,停止位置加一item高度
|
||||
if (itemScrollOffset > DEFAULT_ITEM_HEIGHT >> 1) {
|
||||
if (stopOffset < 0) {
|
||||
stopOffset = stopOffset / DEFAULT_ITEM_HEIGHT * DEFAULT_ITEM_HEIGHT - DEFAULT_ITEM_HEIGHT;
|
||||
} else {
|
||||
stopOffset = stopOffset / DEFAULT_ITEM_HEIGHT * DEFAULT_ITEM_HEIGHT + DEFAULT_ITEM_HEIGHT;
|
||||
}
|
||||
} else {
|
||||
stopOffset = stopOffset / DEFAULT_ITEM_HEIGHT * DEFAULT_ITEM_HEIGHT;
|
||||
|
||||
}
|
||||
mScroller.setFinalY(stopOffset);
|
||||
}
|
||||
|
||||
private void draw3DItemText(Canvas canvas, String text, int item2CenterOffsetY, int textHeightHalf) {
|
||||
canvas.save();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) {
|
||||
mOnItemSelectedListener = onItemSelectedListener;
|
||||
}
|
||||
|
||||
public interface OnItemSelectedListener {
|
||||
void onItemSelected(String data, int position);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dp宽度转像素值
|
||||
*/
|
||||
public float dip2px(float dpValue) {
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, Resources.getSystem().getDisplayMetrics());
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字大小转像素值
|
||||
*/
|
||||
public float sp2px(float spValue) {
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, Resources.getSystem().getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.alivc.live.commonui.configview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.commonui.avdialog.AVLiveBaseBottomSheetDialog;
|
||||
import com.alivc.live.commonutils.DensityUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PushConfigBottomSheetLive extends AVLiveBaseBottomSheetDialog {
|
||||
private OptionSelectorView mOptionSelectorView;
|
||||
private int mSelectIndex;
|
||||
private String mTips;
|
||||
|
||||
public PushConfigBottomSheetLive(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public PushConfigBottomSheetLive(Context context, int theme) {
|
||||
super(context, theme);
|
||||
}
|
||||
|
||||
protected PushConfigBottomSheetLive(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
|
||||
super(context, cancelable, cancelListener);
|
||||
}
|
||||
|
||||
public void setData(List<String> data, int defaultPosition) {
|
||||
mSelectIndex = defaultPosition;
|
||||
mTips = data.get(defaultPosition);
|
||||
mOptionSelectorView.setData(data, defaultPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getContentView() {
|
||||
View rootView = getLayoutInflater().inflate(R.layout.push_config_dialog, null, false);
|
||||
mOptionSelectorView = rootView.findViewById(R.id.optionSelectorView);
|
||||
mOptionSelectorView.setOnItemSelectedListener(new OptionSelectorView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(String data, int position) {
|
||||
mSelectIndex = position;
|
||||
mTips = data;
|
||||
}
|
||||
});
|
||||
rootView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
rootView.findViewById(R.id.confirm_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnPushConfigSelectorListener != null) {
|
||||
mOnPushConfigSelectorListener.confirm(mTips, mSelectIndex);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewGroup.LayoutParams getContentLayoutParams() {
|
||||
return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DensityUtil.dip2px(getContext(), 304));
|
||||
}
|
||||
|
||||
private OnPushConfigSelectorListener mOnPushConfigSelectorListener;
|
||||
|
||||
public void setOnPushConfigSelectorListener(OnPushConfigSelectorListener onPushConfigSelectorListener) {
|
||||
mOnPushConfigSelectorListener = onPushConfigSelectorListener;
|
||||
}
|
||||
|
||||
public interface OnPushConfigSelectorListener {
|
||||
void confirm(String data, int index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.alivc.live.commonui.configview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class PushConfigDialogImpl {
|
||||
private PushConfigBottomSheetLive mDialog;
|
||||
|
||||
@Nullable
|
||||
private List<String> getTips(Context context, int id) {
|
||||
if (id == R.id.quality_modes) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.quality_resolution_first),
|
||||
context.getResources().getString(R.string.quality_fluency_first),
|
||||
context.getResources().getString(R.string.quality_custom));
|
||||
} else if (id == R.id.audio_channel) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.single_track), context.getResources().getString(R.string.dual_track));
|
||||
} else if (id == R.id.audio_profiles) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.setting_audio_aac_lc),
|
||||
context.getResources().getString(R.string.setting_audio_aac_he),
|
||||
context.getResources().getString(R.string.setting_audio_aac_hev2),
|
||||
context.getResources().getString(R.string.setting_audio_aac_ld));
|
||||
} else if (id == R.id.video_encoder_type) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.h264),
|
||||
context.getResources().getString(R.string.h265));
|
||||
} else if (id == R.id.b_frame_num) {
|
||||
return Arrays.asList("0", "1", "3");
|
||||
} else if (id == R.id.main_orientation) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.portrait), context.getResources().getString(R.string.homeLeft), context.getResources().getString(R.string.homeRight));
|
||||
} else if (id == R.id.setting_display_mode) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.display_mode_full), context.getResources().getString(R.string.display_mode_fit), context.getResources().getString(R.string.display_mode_cut));
|
||||
} else if (id == R.id.push_mode) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.video_push_streaming), context.getResources().getString(R.string.audio_only_push_streaming), context.getResources().getString(R.string.video_only_push_streaming));
|
||||
} else if (id == R.id.setting_camera_capture_output_preference) {
|
||||
return Arrays.asList(context.getResources().getString(R.string.camera_capture_output_preference_auto), context.getResources().getString(R.string.camera_capture_output_preference_performance), context.getResources().getString(R.string.camera_capture_output_preference_preview));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void showConfigDialog(View view, PushConfigBottomSheetLive.OnPushConfigSelectorListener configSelectorListener, int defaultPosition) {
|
||||
int selectPosition = defaultPosition;
|
||||
List<String> tips = getTips(view.getContext(), view.getId());
|
||||
if (tips == null || defaultPosition >= tips.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mDialog == null) {
|
||||
mDialog = new PushConfigBottomSheetLive(view.getContext(), R.style.Live_BottomSheetDialog);
|
||||
}
|
||||
Object lastIndex = view.getTag();
|
||||
if (lastIndex instanceof Integer) {
|
||||
selectPosition = (int) lastIndex;
|
||||
}
|
||||
mDialog.setData(tips, selectPosition);
|
||||
mDialog.setOnPushConfigSelectorListener(new PushConfigBottomSheetLive.OnPushConfigSelectorListener() {
|
||||
@Override
|
||||
public void confirm(String data, int index) {
|
||||
view.setTag(index);
|
||||
if (view instanceof TextView) {
|
||||
((TextView) view).setText(data);
|
||||
}
|
||||
if (configSelectorListener != null) {
|
||||
configSelectorListener.confirm(data, index);
|
||||
}
|
||||
}
|
||||
});
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if (mDialog != null && mDialog.isShowing()) {
|
||||
mDialog.dismiss();
|
||||
mDialog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
package com.alivc.live.commonui.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextUtils.TruncateAt;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.commonutils.DensityUtil;
|
||||
import com.alivc.live.commonutils.TextFormatUtil;
|
||||
|
||||
public class CommonDialog extends Dialog {
|
||||
private TextView titleText;
|
||||
private TextView tipContent;
|
||||
private LinearLayout contentLayout;
|
||||
private FrameLayout contentContainer2;
|
||||
private ScrollView contentContainer;
|
||||
private FrameLayout expandContainer;
|
||||
private View btnTopLine;
|
||||
private TextView cancelButton;
|
||||
private View btnLine;
|
||||
private TextView confirmButton;
|
||||
private int buttonCount;
|
||||
|
||||
public CommonDialog(@NonNull Context context) {
|
||||
this(context, R.style.DialogStyle);
|
||||
}
|
||||
|
||||
public CommonDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
this.initView();
|
||||
}
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Window window = this.getWindow();
|
||||
window.setGravity(17);
|
||||
LayoutParams params = window.getAttributes();
|
||||
params.width = -1;
|
||||
params.height = -2;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if (!this.isShowing()) {
|
||||
if (this.buttonCount == 0) {
|
||||
this.btnLine.setVisibility(View.GONE);
|
||||
this.btnTopLine.setVisibility(View.GONE);
|
||||
this.setDialogCancelable(true);
|
||||
} else if (this.buttonCount == 1) {
|
||||
this.btnLine.setVisibility(View.GONE);
|
||||
this.btnTopLine.setVisibility(View.VISIBLE);
|
||||
} else if (this.buttonCount == 2) {
|
||||
this.btnLine.setVisibility(View.VISIBLE);
|
||||
this.btnTopLine.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
super.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
if (this.isShowing()) {
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
View tipDialogView = this.getLayoutInflater().inflate(R.layout.common_dialog, null);
|
||||
this.titleText = (TextView) tipDialogView.findViewById(R.id.dialog_title);
|
||||
this.contentLayout = (LinearLayout) tipDialogView.findViewById(R.id.dialog_content_layout);
|
||||
this.contentContainer2 = (FrameLayout) tipDialogView.findViewById(R.id.dialog_content_container2);
|
||||
this.contentContainer = (ScrollView) tipDialogView.findViewById(R.id.dialog_content_container);
|
||||
this.tipContent = (TextView) tipDialogView.findViewById(R.id.dialog_tip_content);
|
||||
this.expandContainer = (FrameLayout) tipDialogView.findViewById(R.id.dialog_expand_content_container);
|
||||
this.btnTopLine = tipDialogView.findViewById(R.id.dialog_btn_top_line);
|
||||
this.cancelButton = (TextView) tipDialogView.findViewById(R.id.dialog_cancel_btn);
|
||||
this.btnLine = tipDialogView.findViewById(R.id.dialog_btn_line);
|
||||
this.confirmButton = (TextView) tipDialogView.findViewById(R.id.dialog_confirm_btn);
|
||||
View bottomSpace = tipDialogView.findViewById(R.id.dialog_bottom_space);
|
||||
int space = (int) ((double) DensityUtil.getDisplayMetrics(this.getContext()).heightPixels * 0.05D);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, space);
|
||||
bottomSpace.setLayoutParams(params);
|
||||
this.setContentView(tipDialogView);
|
||||
}
|
||||
|
||||
public CommonDialog setDialogCancelable(boolean cancelable) {
|
||||
this.setCancelable(cancelable);
|
||||
this.setCanceledOnTouchOutside(cancelable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogTitle(int title) {
|
||||
CharSequence titleStr = title == 0 ? "" : TextFormatUtil.getTextFormat(this.getContext(), title);
|
||||
return this.setDialogTitle(titleStr);
|
||||
}
|
||||
|
||||
public CommonDialog setDialogTitle(CharSequence title) {
|
||||
if (this.titleText != null && !TextUtils.isEmpty(title)) {
|
||||
this.titleText.setText(title);
|
||||
this.titleText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogTitleGravity(int gravity) {
|
||||
if (this.titleText != null) {
|
||||
this.titleText.setGravity(gravity);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogTitleMaxLines(int lines) {
|
||||
if (this.titleText != null && lines > 0) {
|
||||
this.setDialogTitleLinesNoLimit();
|
||||
this.titleText.setMaxLines(lines);
|
||||
this.titleText.setEllipsize(TruncateAt.END);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogTitleLinesNoLimit() {
|
||||
if (this.titleText != null) {
|
||||
this.titleText.setSingleLine(false);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogContentGravity(int gravity) {
|
||||
if (this.tipContent != null) {
|
||||
this.tipContent.setGravity(gravity);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogContent(int tip) {
|
||||
CharSequence tipStr = tip == 0 ? "" : TextFormatUtil.getTextFormat(this.getContext(), tip);
|
||||
return this.setDialogContent(tipStr);
|
||||
}
|
||||
|
||||
public CommonDialog setDialogContent(CharSequence tip) {
|
||||
if (this.tipContent != null && !TextUtils.isEmpty(tip)) {
|
||||
this.tipContent.setText(tip);
|
||||
this.contentLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogContentView(View contentView) {
|
||||
if (this.contentContainer != null && contentView != null) {
|
||||
this.contentContainer.removeAllViews();
|
||||
this.contentContainer.addView(contentView);
|
||||
this.contentLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setDialogContentView2(View contentView) {
|
||||
if (this.contentContainer2 != null && contentView != null) {
|
||||
this.contentContainer2.removeAllViews();
|
||||
this.contentContainer2.addView(contentView);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setExpandView(View expandView) {
|
||||
if (this.expandContainer != null && expandView != null) {
|
||||
this.expandContainer.removeAllViews();
|
||||
this.expandContainer.addView(expandView);
|
||||
this.expandContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setCancelButton(int cancel, OnClickListener listener) {
|
||||
return this.setCancelButton(cancel, 0, listener);
|
||||
}
|
||||
|
||||
public CommonDialog setCancelButton(int cancel, int color, OnClickListener listener) {
|
||||
CharSequence cancelStr = cancel == 0 ? "" : TextFormatUtil.getTextFormat(this.getContext(), cancel);
|
||||
return this.setCancelButton(cancelStr, color, listener);
|
||||
}
|
||||
|
||||
public CommonDialog setCancelButton(CharSequence cancel, OnClickListener listener) {
|
||||
this.setCancelButton(cancel, 0, listener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setCancelButton(CharSequence cancel, int color, final OnClickListener listener) {
|
||||
if (this.cancelButton != null && !TextUtils.isEmpty(cancel)) {
|
||||
this.cancelButton.setText(cancel);
|
||||
if (color != 0) {
|
||||
this.cancelButton.setTextColor(color);
|
||||
}
|
||||
|
||||
this.cancelButton.setVisibility(View.VISIBLE);
|
||||
++this.buttonCount;
|
||||
if (this.cancelButton != null) {
|
||||
this.cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
CommonDialog.this.dismiss();
|
||||
if (listener != null) {
|
||||
listener.onClick(CommonDialog.this, -2);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setConfirmButton(int confirm, OnClickListener listener) {
|
||||
return this.setConfirmButton(confirm, 0, listener);
|
||||
}
|
||||
|
||||
public CommonDialog setConfirmButton(int confirm, int color, OnClickListener listener) {
|
||||
CharSequence confirmStr = confirm == 0 ? "" : TextFormatUtil.getTextFormat(this.getContext(), confirm);
|
||||
return this.setConfirmButton(confirmStr, color, listener);
|
||||
}
|
||||
|
||||
public CommonDialog setConfirmButton(CharSequence confirm, OnClickListener listener) {
|
||||
this.setConfirmButton(confirm, 0, listener);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonDialog setConfirmButton(CharSequence confirm, int color, final OnClickListener listener) {
|
||||
if (this.confirmButton != null && !TextUtils.isEmpty(confirm)) {
|
||||
this.confirmButton.setText(confirm);
|
||||
if (color != 0) {
|
||||
this.confirmButton.setTextColor(color);
|
||||
}
|
||||
|
||||
this.confirmButton.setVisibility(View.VISIBLE);
|
||||
++this.buttonCount;
|
||||
this.confirmButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
CommonDialog.this.dismiss();
|
||||
if (listener != null) {
|
||||
listener.onClick(CommonDialog.this, -1);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.alivc.live.commonui.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.commonutils.DensityUtil;
|
||||
|
||||
/**
|
||||
* 设置最大高度的Layout
|
||||
*/
|
||||
public class MaxHeightLayout extends LinearLayout {
|
||||
|
||||
private float mMaxRatio = 0.75f;
|
||||
private float mMaxHeight;
|
||||
private float mMinHeight;
|
||||
|
||||
public MaxHeightLayout(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public MaxHeightLayout(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initAtts(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public MaxHeightLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initAtts(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
private void initAtts(Context context, AttributeSet attrs) {
|
||||
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.mMaxRatio);
|
||||
if (attributes != null) {
|
||||
mMaxRatio = attributes.getFloat(R.styleable.mMaxRatio_linear_max_ratio, 0.75f);
|
||||
attributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mMaxHeight = mMaxRatio * DensityUtil.getDisplayMetrics(getContext()).heightPixels;
|
||||
mMinHeight = DensityUtil.dip2px(getContext(), 125);
|
||||
mMaxHeight = mMaxHeight < mMinHeight ? mMinHeight : mMaxHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
if (heightMode == MeasureSpec.EXACTLY) {
|
||||
heightSize = heightSize <= mMaxHeight ? heightSize : (int) mMaxHeight;
|
||||
}
|
||||
|
||||
if (heightMode == MeasureSpec.UNSPECIFIED) {
|
||||
heightSize = heightSize <= mMaxHeight ? heightSize : (int) mMaxHeight;
|
||||
}
|
||||
|
||||
if (heightMode == MeasureSpec.AT_MOST) {
|
||||
heightSize = heightSize <= mMaxHeight ? heightSize : (int) mMaxHeight;
|
||||
}
|
||||
int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
|
||||
super.onMeasure(widthMeasureSpec, maxHeightMeasureSpec);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.alivc.live.commonui.messageview;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 自动追加滚动消息视图适配器
|
||||
*/
|
||||
public class AutoScrollMessagesAdapter extends RecyclerView.Adapter<AutoScrollMessagesAdapter.RecyclerViewHolder> {
|
||||
private @NonNull
|
||||
ArrayList<String> msgList = new ArrayList<String>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
View view = layoutInflater.inflate(R.layout.layout_callback_message, parent, false);
|
||||
return new RecyclerViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerViewHolder holder, int position) {
|
||||
holder.applyTextMsg(msgList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return msgList.size();
|
||||
}
|
||||
|
||||
public void applyDataMessage(String msg) {
|
||||
msgList.add(msg);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
static class RecyclerViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView mTextView;
|
||||
|
||||
RecyclerViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mTextView = itemView.findViewById(R.id.text_msg);
|
||||
}
|
||||
|
||||
public void applyTextMsg(String msg) {
|
||||
if (mTextView != null) {
|
||||
mTextView.setText(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.alivc.live.commonui.messageview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* 自动追加滚动消息视图
|
||||
*/
|
||||
public class AutoScrollMessagesView extends RecyclerView {
|
||||
private final AutoScrollMessagesAdapter mAdapter = new AutoScrollMessagesAdapter();
|
||||
|
||||
public AutoScrollMessagesView(@NonNull Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public AutoScrollMessagesView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public AutoScrollMessagesView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
setLayoutManager(linearLayoutManager);
|
||||
setAdapter(mAdapter);
|
||||
|
||||
setDrawingCacheEnabled(true);
|
||||
setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
|
||||
}
|
||||
|
||||
public void appendMessage(String msg) {
|
||||
mAdapter.applyDataMessage(msg);
|
||||
smoothScrollToPosition(mAdapter.getItemCount());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.alivc.live.commonui.seiview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class LivePusherSEIView extends LinearLayout {
|
||||
private static final int DEFAULT_PAYLOAD_TYPE = 5;
|
||||
private static final String DEFAULT_SEI_MESSAGE = "010203=-./,_adcd-&^%$~@";
|
||||
|
||||
private EditText mPayloadEditText;
|
||||
private EditText mSeiEditText;
|
||||
private Button mSendSEIButton;
|
||||
|
||||
private SendSeiViewListener mListener;
|
||||
|
||||
public LivePusherSEIView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public LivePusherSEIView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public LivePusherSEIView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
View inflateView = LayoutInflater.from(context).inflate(R.layout.push_sei_view_layout, this, true);
|
||||
|
||||
mPayloadEditText = inflateView.findViewById(R.id.et_sei_payload_type);
|
||||
mPayloadEditText.setText(String.valueOf(DEFAULT_PAYLOAD_TYPE));
|
||||
|
||||
mSeiEditText = inflateView.findViewById(R.id.et_sei);
|
||||
mSeiEditText.setText(DEFAULT_SEI_MESSAGE);
|
||||
|
||||
mSendSEIButton = inflateView.findViewById(R.id.btn_send_sei);
|
||||
mSendSEIButton.setOnClickListener(view -> {
|
||||
if (mListener != null) {
|
||||
// 如果输入框为空,默认输出指定的json格式以供测试
|
||||
String text = mSeiEditText.getText().toString();
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
text = DEFAULT_SEI_MESSAGE;
|
||||
}
|
||||
|
||||
// 如果输入框为空,默认payload type=5以供测试
|
||||
String payloadEdit = mPayloadEditText.getText().toString();
|
||||
int payload = DEFAULT_PAYLOAD_TYPE;
|
||||
Pattern pattern = Pattern.compile("[0-9]*");
|
||||
if (pattern.matcher(payloadEdit).matches()) {
|
||||
payload = Integer.parseInt(payloadEdit);
|
||||
}
|
||||
|
||||
mListener.onSendSeiClick(payload, text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface SendSeiViewListener {
|
||||
void onSendSeiClick(int payload, String text);
|
||||
}
|
||||
|
||||
public void setSendSeiViewListener(SendSeiViewListener mListener) {
|
||||
this.mListener = mListener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.alivc.live.commonutils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DensityUtil {
|
||||
private static final String TAG = DensityUtil.class.getSimpleName();
|
||||
/**
|
||||
* dp、sp 转换为 px 的工具类
|
||||
*
|
||||
* @author fxsky 2012.11.12
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 将px值转换为dip或dp值,保证尺寸大小不变
|
||||
*
|
||||
* @param pxValue
|
||||
* @param scale (DisplayMetrics类中属性density)
|
||||
* @return
|
||||
*/
|
||||
public static int px2dip(Context context, float pxValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (pxValue / scale + 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将dip或dp值转换为px值,保证尺寸大小不变
|
||||
*
|
||||
* @param dipValue
|
||||
* @param scale (DisplayMetrics类中属性density)
|
||||
* @return
|
||||
*/
|
||||
public static int dip2px(Context context, float dipValue) {
|
||||
if (context == null || context.getResources() == null)
|
||||
return 1;
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dipValue * scale + 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将px值转换为sp值,保证文字大小不变
|
||||
*
|
||||
* @param pxValue
|
||||
* @param fontScale (DisplayMetrics类中属性scaledDensity)
|
||||
* @return
|
||||
*/
|
||||
public static int px2sp(Context context, float pxValue) {
|
||||
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
|
||||
return (int) (pxValue / fontScale + 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将sp值转换为px值,保证文字大小不变
|
||||
*
|
||||
* @param spValue
|
||||
* @param fontScale (DisplayMetrics类中属性scaledDensity)
|
||||
* @return
|
||||
*/
|
||||
public static int sp2px(Context context, float spValue) {
|
||||
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
|
||||
return (int) (spValue * fontScale + 0.5f);
|
||||
}
|
||||
|
||||
private static DisplayMetrics sDisplayMetrics;
|
||||
private static int sStatusBarHeight = -1;
|
||||
|
||||
public static DisplayMetrics getDisplayMetrics(Context context) {
|
||||
if (sDisplayMetrics == null) {
|
||||
sDisplayMetrics = context.getResources().getDisplayMetrics();
|
||||
}
|
||||
return sDisplayMetrics;
|
||||
}
|
||||
|
||||
public static int getStatusBarHeight(Context context) {
|
||||
if (sStatusBarHeight == -1) {
|
||||
try {
|
||||
Class<?> c = Class.forName("com.android.internal.R$dimen");
|
||||
Object o = c.newInstance();
|
||||
Field field = c.getField("status_bar_height");
|
||||
int x = (Integer) field.get(o);
|
||||
sStatusBarHeight = context.getResources().getDimensionPixelSize(x);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
} catch (InstantiationException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
} catch (NoSuchFieldException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
return sStatusBarHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取view的宽度
|
||||
*/
|
||||
public static int getViewWidth(View view) {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
|
||||
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
|
||||
return view.getMeasuredWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取view的高度
|
||||
*/
|
||||
public static int getViewHeight(View view) {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
|
||||
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
|
||||
return view.getMeasuredHeight();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取适配后的高度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getScaleHeight(Context context, int srcHeight) {
|
||||
double realHeight = getScreenRealHeight(context);
|
||||
if (realHeight <= 0) {
|
||||
return srcHeight;
|
||||
}
|
||||
|
||||
if (realHeight >= 37) {// [37, +∞)
|
||||
srcHeight = (int) (srcHeight * 0.9 * 0.9 * 0.9);
|
||||
} else if (realHeight >= 33) {// [33, 37)
|
||||
srcHeight = (int) (srcHeight * 0.9 * 0.9);
|
||||
} else if (realHeight >= 27) {// [27, 33)
|
||||
srcHeight = (int) (srcHeight * 0.9);
|
||||
}
|
||||
// [0, 27]
|
||||
return srcHeight;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前手机屏幕的尺寸(单位:像素)
|
||||
*/
|
||||
public static double getScreenRealHeight(Context context) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
|
||||
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Point point = new Point();
|
||||
manager.getDefaultDisplay().getRealSize(point);
|
||||
DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
// dm.ydpi是屏幕y方向的真实密度值
|
||||
return new BigDecimal(Math.pow(point.y / dm.ydpi, 2)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("DensityUtil", e.getMessage());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前手机屏幕的尺寸(单位:像素)
|
||||
*/
|
||||
public static double getScreenSize(Context context) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
|
||||
WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Point point = new Point();
|
||||
manager.getDefaultDisplay().getRealSize(point);
|
||||
DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
// dm.xdpi是屏幕x方向的真实密度值
|
||||
double x = Math.pow(point.x / dm.xdpi, 2);
|
||||
// dm.ydpi是屏幕y方向的真实密度值
|
||||
double y = Math.pow(point.y / dm.ydpi, 2);
|
||||
return new BigDecimal(Math.sqrt(x + y)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("DensityUtil", e.getMessage());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.alivc.live.commonui.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
public class StatusBarUtil {
|
||||
/**
|
||||
* 沉浸式状态栏。
|
||||
* 支持 4.4 以上版本的 MIUI 和 Flyme,以及 5.0 以上版本的其他 Android。
|
||||
*
|
||||
* @param activity 需要被设置沉浸式状态栏的 Activity。
|
||||
*/
|
||||
public static void translucent(Activity activity, @ColorInt int colorOn5x) {
|
||||
try {
|
||||
Window window = activity.getWindow();
|
||||
translucent(window, colorOn5x);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TargetApi(19)
|
||||
private static void translucent(Window window, @ColorInt int colorOn5x) {
|
||||
if (isNotchOfficialSupport()) {
|
||||
handleDisplayCutoutMode(window);
|
||||
}
|
||||
int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
|
||||
systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
window.getDecorView().setSystemUiVisibility(systemUiVisibility);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// android 6以后可以改状态栏字体颜色,因此可以自行设置为透明
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@TargetApi(28)
|
||||
private static void handleDisplayCutoutMode(final Window window) {
|
||||
View decorView = window.getDecorView();
|
||||
if (decorView != null) {
|
||||
if (ViewCompat.isAttachedToWindow(decorView)) {
|
||||
realHandleDisplayCutoutMode(window, decorView);
|
||||
} else {
|
||||
decorView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(View v) {
|
||||
v.removeOnAttachStateChangeListener(this);
|
||||
realHandleDisplayCutoutMode(window, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(28)
|
||||
private static void realHandleDisplayCutoutMode(Window window, View decorView) {
|
||||
if (decorView.getRootWindowInsets() != null &&
|
||||
decorView.getRootWindowInsets().getDisplayCutout() != null) {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.layoutInDisplayCutoutMode = WindowManager.LayoutParams
|
||||
.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNotchOfficialSupport(){
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.alivc.live.commonui.widgets;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
|
||||
public class AVLiveLoadingDialog extends Dialog {
|
||||
private Context context;
|
||||
private ImageView mIconView;
|
||||
private TextView mTipView;
|
||||
private CharSequence mTipMsg;
|
||||
|
||||
public AVLiveLoadingDialog(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View view = inflater.inflate(R.layout.av_live_loading_dialog_layout, null, false);
|
||||
mIconView = view.findViewById(R.id.av_loading_dialog_icon);
|
||||
mTipView = view.findViewById(R.id.av_loading_dialog_tip);
|
||||
if (mTipMsg != null) {
|
||||
mTipView.setVisibility(View.VISIBLE);
|
||||
mTipView.setText(mTipMsg);
|
||||
} else {
|
||||
mTipView.setVisibility(View.GONE);
|
||||
}
|
||||
setContentView(view);
|
||||
|
||||
Window dialogWindow = getWindow();
|
||||
dialogWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
dialogWindow.setBackgroundDrawableResource(android.R.color.transparent);
|
||||
|
||||
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
|
||||
lp.alpha = 1.0f;
|
||||
lp.dimAmount = 0.0f;
|
||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
|
||||
lp.verticalMargin = 0.3f;
|
||||
dialogWindow.setAttributes(lp);
|
||||
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
startAnimation();
|
||||
}
|
||||
|
||||
private void startAnimation() {
|
||||
if (mIconView == null || mIconView.getAnimation() != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f, RotateAnimation.RELATIVE_TO_SELF,
|
||||
0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
|
||||
//设置动画持续时长
|
||||
rotateAnimation.setDuration(1000);
|
||||
rotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
//设置动画的重复模式:反转REVERSE和重新开始RESTART
|
||||
rotateAnimation.setRepeatMode(ScaleAnimation.RESTART);
|
||||
//设置动画播放次数
|
||||
rotateAnimation.setRepeatCount(ScaleAnimation.INFINITE);
|
||||
|
||||
//开始动画
|
||||
mIconView.startAnimation(rotateAnimation);
|
||||
}
|
||||
|
||||
private void stopAnimation() {
|
||||
if (mIconView == null || mIconView.getAnimation() == null) {
|
||||
return;
|
||||
}
|
||||
mIconView.clearAnimation();
|
||||
}
|
||||
|
||||
public AVLiveLoadingDialog tip(CharSequence tip) {
|
||||
mTipMsg = tip;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
stopAnimation();
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.alivc.live.commonui.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* @author keria
|
||||
* @date 2024/5/23
|
||||
* @brief 带文字的按钮开关
|
||||
*/
|
||||
public class LivePushTextSwitch extends LinearLayout {
|
||||
|
||||
private TextView textView;
|
||||
private Switch switchView;
|
||||
|
||||
/**
|
||||
* 定义回调接口,用于监听 Switch 状态变化
|
||||
*/
|
||||
public interface OnSwitchToggleListener {
|
||||
void onSwitchToggled(boolean isChecked);
|
||||
}
|
||||
|
||||
private OnSwitchToggleListener onSwitchToggleListener;
|
||||
|
||||
public LivePushTextSwitch(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public LivePushTextSwitch(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public LivePushTextSwitch(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
// 设置横向布局
|
||||
setOrientation(HORIZONTAL);
|
||||
setGravity(Gravity.CENTER_VERTICAL);
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(Color.WHITE);
|
||||
textView.setLines(1);
|
||||
textView.setTextSize(12);
|
||||
textView.setPadding(0, 0, 12, 0);
|
||||
|
||||
switchView = new Switch(context);
|
||||
switchView.setChecked(false);
|
||||
|
||||
// 设置 TextView 的布局参数,使其宽度包裹内容并且靠左对齐
|
||||
LayoutParams textViewLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
textViewLayoutParams.gravity = Gravity.START | Gravity.CENTER_VERTICAL;
|
||||
|
||||
// 设置 Switch 的布局参数,使其宽度包裹内容并且靠右对齐
|
||||
LayoutParams switchLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
switchLayoutParams.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
|
||||
|
||||
textView.setLayoutParams(textViewLayoutParams);
|
||||
switchView.setLayoutParams(switchLayoutParams);
|
||||
|
||||
// 将 TextView 和 Switch 添加到布局中
|
||||
addView(textView);
|
||||
addView(switchView);
|
||||
|
||||
// 设置 Switch 的监听事件
|
||||
switchView.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (onSwitchToggleListener != null) {
|
||||
onSwitchToggleListener.onSwitchToggled(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
setPadding(0, 3, 3, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于设置 TextView 的文本
|
||||
*/
|
||||
public void setTextViewText(String text) {
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于设置 Switch 的初始状态
|
||||
*/
|
||||
public void setSwitchChecked(boolean checked) {
|
||||
switchView.setChecked(checked);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于设置回调监听器
|
||||
*/
|
||||
public void setOnSwitchToggleListener(OnSwitchToggleListener listener) {
|
||||
this.onSwitchToggleListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.alivc.live.commonui.widgets;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.alivc.live.commonui.R;
|
||||
import com.alivc.live.commonutils.FileUtil;
|
||||
import com.alivc.live.pusher.WaterMarkInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PushWaterMarkDialog extends DialogFragment {
|
||||
|
||||
private Switch mSwitch;
|
||||
private EditText mX;
|
||||
private EditText mY;
|
||||
private EditText mW;
|
||||
private Switch mSwitch1;
|
||||
private EditText mX1;
|
||||
private EditText mY1;
|
||||
private EditText mW1;
|
||||
private Switch mSwitch2;
|
||||
private EditText mX2;
|
||||
private EditText mY2;
|
||||
private EditText mW2;
|
||||
private ArrayList<WaterMarkInfo> mWaterMarkInfos;
|
||||
private WaterMarkInfo mWaterMarkInfo = new WaterMarkInfo();
|
||||
private WaterMarkInfo mWaterMarkInfo1 = new WaterMarkInfo();
|
||||
private WaterMarkInfo mWaterMarkInfo2 = new WaterMarkInfo();
|
||||
private boolean mWater = false;
|
||||
private boolean mWater1 = false;
|
||||
private boolean mWater2 = false;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getDialog().getWindow().getAttributes().windowAnimations = R.style.dialog_animation;
|
||||
getDialog().setCanceledOnTouchOutside(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
View view = inflater.inflate(R.layout.push_watermark, container);
|
||||
mX = (EditText) view.findViewById(R.id.x);
|
||||
mY = (EditText) view.findViewById(R.id.y);
|
||||
mW = (EditText) view.findViewById(R.id.w);
|
||||
mX1 = (EditText) view.findViewById(R.id.x1);
|
||||
mY1 = (EditText) view.findViewById(R.id.y1);
|
||||
mW1 = (EditText) view.findViewById(R.id.w1);
|
||||
mX2 = (EditText) view.findViewById(R.id.x2);
|
||||
mY2 = (EditText) view.findViewById(R.id.y2);
|
||||
mW2 = (EditText) view.findViewById(R.id.w2);
|
||||
mSwitch = (Switch) view.findViewById(R.id.watermark);
|
||||
mSwitch1 = (Switch) view.findViewById(R.id.watermark1);
|
||||
mSwitch2 = (Switch) view.findViewById(R.id.watermark2);
|
||||
mSwitch.setOnCheckedChangeListener(onCheckedChangeListener);
|
||||
mSwitch1.setOnCheckedChangeListener(onCheckedChangeListener);
|
||||
mSwitch2.setOnCheckedChangeListener(onCheckedChangeListener);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
getDialog().getWindow().setGravity(Gravity.BOTTOM);
|
||||
super.onResume();
|
||||
|
||||
DisplayMetrics dpMetrics = new DisplayMetrics();
|
||||
getActivity().getWindow().getWindowManager().getDefaultDisplay().getMetrics(dpMetrics);
|
||||
WindowManager.LayoutParams p = getDialog().getWindow().getAttributes();
|
||||
|
||||
p.width = dpMetrics.widthPixels;
|
||||
p.height = dpMetrics.heightPixels * 2 / 3;
|
||||
getDialog().getWindow().setAttributes(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
if (mWaterMarkInfos == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
if (!mX.getText().toString().isEmpty() && !mY.getText().toString().isEmpty() && !mW.getText().toString().isEmpty()) {
|
||||
mWaterMarkInfo.mWaterMarkCoordX = Float.valueOf(mX.getText().toString());
|
||||
mWaterMarkInfo.mWaterMarkCoordY = Float.valueOf(mY.getText().toString());
|
||||
mWaterMarkInfo.mWaterMarkWidth = Float.valueOf(mW.getText().toString());
|
||||
mWaterMarkInfo.mWaterMarkPath = FileUtil.combinePaths(FileUtil.getInternalFilesFolder(getContext()), "alivc_resource/watermark.png");
|
||||
mWater = true;
|
||||
}
|
||||
|
||||
if (!mX1.getText().toString().isEmpty() && !mY1.getText().toString().isEmpty() && !mW1.getText().toString().isEmpty()) {
|
||||
mWaterMarkInfo1.mWaterMarkCoordX = Float.valueOf(mX1.getText().toString());
|
||||
mWaterMarkInfo1.mWaterMarkCoordY = Float.valueOf(mY1.getText().toString());
|
||||
mWaterMarkInfo1.mWaterMarkWidth = Float.valueOf(mW1.getText().toString());
|
||||
mWaterMarkInfo1.mWaterMarkPath = FileUtil.combinePaths(FileUtil.getInternalFilesFolder(getContext()), "alivc_resource/watermark.png");
|
||||
mWater1 = true;
|
||||
}
|
||||
|
||||
if (!mX2.getText().toString().isEmpty() && !mY2.getText().toString().isEmpty() && !mW2.getText().toString().isEmpty()) {
|
||||
mWaterMarkInfo2.mWaterMarkCoordX = Float.valueOf(mX2.getText().toString());
|
||||
mWaterMarkInfo2.mWaterMarkCoordY = Float.valueOf(mY2.getText().toString());
|
||||
mWaterMarkInfo2.mWaterMarkWidth = Float.valueOf(mW2.getText().toString());
|
||||
mWaterMarkInfo2.mWaterMarkPath = FileUtil.combinePaths(FileUtil.getInternalFilesFolder(getContext()), "alivc_resource/watermark.png");
|
||||
mWater2 = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (mWaterMarkInfos.size() > 0) {
|
||||
mWaterMarkInfos.clear();
|
||||
}
|
||||
|
||||
if (mWater) {
|
||||
mWaterMarkInfos.add(mWaterMarkInfo);
|
||||
}
|
||||
if (mWater1) {
|
||||
mWaterMarkInfos.add(mWaterMarkInfo1);
|
||||
}
|
||||
if (mWater2) {
|
||||
mWaterMarkInfos.add(mWaterMarkInfo2);
|
||||
}
|
||||
}
|
||||
|
||||
public void setWaterMarkInfo(ArrayList<WaterMarkInfo> waterMarkInfos) {
|
||||
this.mWaterMarkInfos = waterMarkInfos;
|
||||
}
|
||||
|
||||
private final CompoundButton.OnCheckedChangeListener onCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
int id = compoundButton.getId();
|
||||
if (id == R.id.watermark) {
|
||||
mWater = b;
|
||||
} else if (id == R.id.watermark1) {
|
||||
mWater1 = b;
|
||||
} else if (id == R.id.watermark2) {
|
||||
mWater2 = b;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.alivc.live.commonui.widgets;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author keria
|
||||
* @date 2024/7/9
|
||||
* @brief 可缩放的FrameLayout
|
||||
* @note 备注:该FrameLayout容器仅用于API测试,测试在不同FrameLayout切换策略下的表现及性能
|
||||
* @note 如果您对接直播连麦,可直接使用FrameLayout容器作为预览和拉流的渲染窗口
|
||||
*/
|
||||
public class ResizableFrameLayout extends FrameLayout {
|
||||
private static final int ANIMATION_DURATION = 200;
|
||||
|
||||
private int originalWidth;
|
||||
private int originalHeight;
|
||||
private boolean isResized = false;
|
||||
|
||||
private static final ResizeStrategy[] strategies = new ResizeStrategy[]{new HalveStrategy(), new EqualStrategy()};
|
||||
private ResizeStrategy currentStrategy;
|
||||
private final Random random = new Random();
|
||||
|
||||
public ResizableFrameLayout(Context context) {
|
||||
super(context);
|
||||
|
||||
initializeDefaultStrategy();
|
||||
}
|
||||
|
||||
public ResizableFrameLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
initializeDefaultStrategy();
|
||||
}
|
||||
|
||||
public ResizableFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
initializeDefaultStrategy();
|
||||
}
|
||||
|
||||
private void initializeDefaultStrategy() {
|
||||
currentStrategy = new HalveStrategy(); // 默认为缩放策略
|
||||
}
|
||||
|
||||
public void resize() {
|
||||
useRandomStrategy();
|
||||
toggleSize();
|
||||
}
|
||||
|
||||
public void resize(ResizeStrategy strategy) {
|
||||
setResizeStrategy(strategy);
|
||||
toggleSize();
|
||||
}
|
||||
|
||||
private void toggleSize() {
|
||||
// 保存原始宽高
|
||||
if (originalWidth == 0 || originalHeight == 0) {
|
||||
originalWidth = getWidth();
|
||||
originalHeight = getHeight();
|
||||
}
|
||||
|
||||
// 根据策略计算目标宽高
|
||||
int targetWidth = isResized ? originalWidth : currentStrategy.getTargetWidth(originalWidth, originalHeight);
|
||||
int targetHeight = isResized ? originalHeight : currentStrategy.getTargetHeight(originalWidth, originalHeight);
|
||||
|
||||
// 创建动画
|
||||
animateResize(targetWidth, targetHeight);
|
||||
|
||||
// 切换标志位
|
||||
isResized = !isResized;
|
||||
}
|
||||
|
||||
private void animateResize(int targetWidth, int targetHeight) {
|
||||
ValueAnimator widthAnimator = ValueAnimator.ofInt(getWidth(), targetWidth);
|
||||
ValueAnimator heightAnimator = ValueAnimator.ofInt(getHeight(), targetHeight);
|
||||
|
||||
widthAnimator.addUpdateListener(animation -> {
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
layoutParams.width = (int) animation.getAnimatedValue();
|
||||
setLayoutParams(layoutParams);
|
||||
});
|
||||
|
||||
heightAnimator.addUpdateListener(animation -> {
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
layoutParams.height = (int) animation.getAnimatedValue();
|
||||
setLayoutParams(layoutParams);
|
||||
});
|
||||
|
||||
widthAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
heightAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
widthAnimator.setDuration(ANIMATION_DURATION);
|
||||
heightAnimator.setDuration(ANIMATION_DURATION);
|
||||
|
||||
widthAnimator.start();
|
||||
heightAnimator.start();
|
||||
}
|
||||
|
||||
public void setResizeStrategy(ResizeStrategy strategy) {
|
||||
this.currentStrategy = strategy;
|
||||
}
|
||||
|
||||
public void useRandomStrategy() {
|
||||
int randomIndex = random.nextInt(strategies.length);
|
||||
setResizeStrategy(strategies[randomIndex]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩放策略(宽高除以2策略)
|
||||
*/
|
||||
public static class HalveStrategy implements ResizeStrategy {
|
||||
@Override
|
||||
public int getTargetWidth(int originalWidth, int originalHeight) {
|
||||
return originalWidth / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTargetHeight(int originalWidth, int originalHeight) {
|
||||
return originalHeight / 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 正方形策略(宽高相等)
|
||||
*/
|
||||
public static class EqualStrategy implements ResizeStrategy {
|
||||
@Override
|
||||
public int getTargetWidth(int originalWidth, int originalHeight) {
|
||||
return Math.min(originalWidth, originalHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTargetHeight(int originalWidth, int originalHeight) {
|
||||
return Math.min(originalWidth, originalHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ResizeStrategy {
|
||||
int getTargetWidth(int originalWidth, int originalHeight);
|
||||
|
||||
int getTargetHeight(int originalWidth, int originalHeight);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:fillAfter="true"
|
||||
android:fromXDelta="0.0"
|
||||
android:fromYDelta="0.0"
|
||||
android:toXDelta="0.0"
|
||||
android:toYDelta="100.0%p" />
|
||||
</set>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="256"
|
||||
android:fillAfter="true"
|
||||
android:fromXDelta="0.0"
|
||||
android:fromYDelta="100.0%"
|
||||
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
|
||||
android:toXDelta="0.0"
|
||||
android:toYDelta="0.0" />
|
||||
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 678 B |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 357 B |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_selected="true" android:drawable="@drawable/beauty_on"/>
|
||||
<item android:state_selected="false" android:drawable="@drawable/beauty_on"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<corners android:radius="2dp" />
|
||||
|
||||
<solid android:color="#1C1D22" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="12dp" />
|
||||
<solid android:color="@color/bg_weak" />
|
||||
<stroke android:width="1dp" android:color="#3A3D48" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="12dp" />
|
||||
<solid android:color="#23262F" />
|
||||
<stroke android:width="1dp" android:color="#3A3D48" />
|
||||
</shape>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/live_list_item_bg" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/live_list_item_bg" android:state_hovered="true"/>
|
||||
<item android:drawable="@drawable/live_list_item_bg" android:state_selected="true"/>
|
||||
<item android:drawable="@drawable/live_list_item_fg" />
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="8dp" />
|
||||
<solid android:color="#1C1D22" />
|
||||
</shape>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<!-- 背景 gradient是渐变,corners定义的是圆角 -->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="#3A3D48" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 进度条 -->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
|
||||
<solid android:color="#4DCFE1" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 背景 gradient是渐变,corners定义的是圆角 -->
|
||||
<item
|
||||
android:id="@android:id/background"
|
||||
android:gravity="center_vertical|fill_horizontal">
|
||||
<shape>
|
||||
<size android:height="2dp" />
|
||||
<solid android:color="#3A3D48" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 进度条 -->
|
||||
<item
|
||||
android:id="@android:id/progress"
|
||||
android:gravity="center_vertical|fill_horizontal">
|
||||
<clip>
|
||||
<shape>
|
||||
<size android:height="2dp" />
|
||||
<solid android:color="#4DCFE1" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="24dp"/>
|
||||
<solid android:color="@color/colourful_ic_strong"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/darker_gray"/>
|
||||
<solid android:color="@android:color/white" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
6
LiveCommon/live_commonui/src/main/res/drawable/thumb.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 按钮的选择器,可以设置按钮在不同状态下的时候,按钮不同的颜色 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_checked="true" android:drawable="@drawable/thumb_on" />
|
||||
<item android:drawable="@drawable/thumb_off" />
|
||||
</selector>
|
||||
10
LiveCommon/live_commonui/src/main/res/drawable/thumb_off.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<size android:height="26dp" android:width="26dp"/>
|
||||
<corners android:radius="13dp"/>
|
||||
<solid android:color="@color/transparent"/>
|
||||
<stroke android:width="2dp"
|
||||
android:color="@color/des_txt_color"/>
|
||||
</shape>
|
||||
14
LiveCommon/live_commonui/src/main/res/drawable/thumb_on.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<!-- 高度40 -->
|
||||
<size
|
||||
android:width="26dp"
|
||||
android:height="26dp" />
|
||||
<!-- 圆角弧度 20 -->
|
||||
<corners android:radius="13dp" />
|
||||
<solid android:color="@color/transparent" />
|
||||
<stroke android:width="2dp"
|
||||
android:color="@color/text_true_color"/>
|
||||
</shape>
|
||||
7
LiveCommon/live_commonui/src/main/res/drawable/track.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 底层下滑条的样式选择器,可控制Switch在不同状态下,底下下滑条的颜色 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:state_checked="true" android:drawable="@drawable/track_on" />
|
||||
<item android:drawable="@drawable/track_off" />
|
||||
|
||||
</selector>
|
||||
13
LiveCommon/live_commonui/src/main/res/drawable/track_off.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<!-- 高度30 此处设置宽度无效-->
|
||||
<size android:height="26dp"/>
|
||||
<!-- 圆角弧度 15 -->
|
||||
<corners android:radius="13dp"/>
|
||||
<!-- 变化率 定义从左到右的颜色不变 -->
|
||||
<solid android:color="@color/des_txt_color"/>
|
||||
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
|
||||
<size android:height="26dp"
|
||||
android:width="50dp"/>
|
||||
<corners android:radius="13dp" />
|
||||
<solid android:height="26dp" android:color="@color/text_true_color" />
|
||||
</shape>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/aui_player_actionbar_left_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/aui_player_actionbar_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textFontWeight="500"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/aui_player_actionbar_right_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#1C1D22"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.alivc.live.commonui.activity.AUILiveActionBar
|
||||
android:id="@+id/aui_player_base_title"
|
||||
style="@style/LiveBaseActionBar_Style"
|
||||
tools:leftImageSrc="@drawable/ic_live_action_bar_back"
|
||||
tools:rightImageSrc="@drawable/ic_live_actionbar_more"
|
||||
tools:showLeftView="false"
|
||||
tools:showRightView="false"
|
||||
tools:showTitle="true" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/aui_player_base_main_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/live_list_item_selector">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/av_list_item_image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_toRightOf="@+id/av_list_item_image"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/av_list_item_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineHeight="24dp"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textFontWeight="500"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/av_list_item_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
android:ellipsize="end"
|
||||
android:lineHeight="18dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="#B2B7C4"
|
||||
android:textFontWeight="500"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/av_list_item_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/coordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<View
|
||||
android:id="@+id/touch_outside"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:importantForAccessibility="no"
|
||||
android:soundEffectsEnabled="false"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/bottom_sheet_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/bottom_sheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|top" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#00000000">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/live_loading_dialog_bg"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/av_loading_dialog_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/av_live_loading_dialog_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/av_loading_dialog_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:ellipsize="middle"
|
||||
android:gravity="center"
|
||||
android:maxWidth="198dp"
|
||||
android:maxLines="2"
|
||||
android:minWidth="112dp"
|
||||
android:textColor="@color/text_strong"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
158
LiveCommon/live_commonui/src/main/res/layout/common_dialog.xml
Normal file
@@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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:orientation="vertical"
|
||||
tools:background="#80000000">
|
||||
|
||||
<com.alivc.live.commonui.dialog.MaxHeightLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/live_dialog_bg"
|
||||
android:minHeight="125dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone"
|
||||
tools:text="18dp大标题"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_content_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dialog_content_container2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/dialog_content_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none">
|
||||
|
||||
<!-- 解决内部滑动问题 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_tip_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="14sp"
|
||||
tools:text="14dp提示内容" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dialog_expand_content_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/dialog_btn_top_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="#3A3D48"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_cancel_btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:text="取消"
|
||||
android:textColor="#4DCFE1"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dialog_btn_line"
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="52dp"
|
||||
android:background="#3A3D48"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_confirm_btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:singleLine="true"
|
||||
android:text="确定"
|
||||
android:textColor="#4DCFE1"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 解决弹窗中心点与屏幕高度45%的位置重合 -->
|
||||
<View
|
||||
android:id="@+id/dialog_bottom_space"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp" />
|
||||
</com.alivc.live.commonui.dialog.MaxHeightLayout>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/color_text_white"
|
||||
android:textSize="12dp" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,804 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/resolution_label"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<com.alivc.live.commonui.configview.LivePushResolutionView
|
||||
android:id="@+id/resolution_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/bitrate_control"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/bitrate_control"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="true"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/variable_resolution"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/variable_resolution"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/view_height_size_45"
|
||||
android:text="@string/resolution_label_desc"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/advance_config"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/advance_config"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/advance_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/push_mode"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quality_modes"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/quality_resolution_first"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_height="1px"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<TextView
|
||||
android:background="#141416"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:minHeight="@dimen/view_height_size_45"
|
||||
android:text="@string/video_label_desc"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/target_bitrate"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/target_rate_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="28dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/target_rate_value"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:maxLength="9"
|
||||
android:paddingLeft="10dp"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/kb_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="/kbps"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="11sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/min_bitrate"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/min_rate_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="28dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/min_rate_value"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:maxLength="9"
|
||||
android:paddingLeft="10dp"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/min_kb_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="/kbps"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="11sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/initial_bitrate"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/init_rate_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="28dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/initial_bit_value"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:maxLength="9"
|
||||
android:paddingLeft="10dp"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/initial_kb_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="/kbps"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="11sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/audio_bitrate"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/audio_bitrate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="28dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/audio_bitrate_value"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:maxLength="9"
|
||||
android:paddingLeft="10dp"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/audio_kb_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="/kbps"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/min_fps"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/min_fps_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:maxHeight="5dp"
|
||||
android:minHeight="5dp"
|
||||
android:progress="0"
|
||||
android:theme="@style/Push_SeekBar_Style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/min_fps_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="8"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="/fps"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/captrue_fps"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/fps_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:maxHeight="5dp"
|
||||
android:minHeight="5dp"
|
||||
android:progress="80"
|
||||
android:theme="@style/Push_SeekBar_Style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fps_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/init_fps"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="/fps"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/audio_sampling_rate"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/audio_rate_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:maxHeight="5dp"
|
||||
android:minHeight="5dp"
|
||||
android:progress="80"
|
||||
android:theme="@style/Push_SeekBar_Style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/audio_rate_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="@string/setting_audio_480"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/GOP"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/gop_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:maxHeight="5dp"
|
||||
android:minHeight="5dp"
|
||||
android:progress="40"
|
||||
android:theme="@style/Push_SeekBar_Style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gop_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="2/s"
|
||||
android:textColor="#E6E7EC"
|
||||
android:textSize="11sp" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/audio_profile"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/audio_profiles"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center_vertical|end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/setting_audio_aac_lc"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/sound_track"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/audio_channel"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center_vertical|end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/dual_track"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/video_encoder"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_encoder_type"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|end"
|
||||
android:layout_gravity="end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/h264"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/b_frames"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/b_frame_num"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|end"
|
||||
android:layout_gravity="end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="0"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/hardware_encode"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/hard_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="true"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/audio_hardware_encode"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/audio_hardenc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="304dp"
|
||||
android:background="#1C1D22"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
android:gravity="center"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:text="@string/pull_cancel"
|
||||
android:textSize="15sp"
|
||||
android:textColor="#4DCFE1"
|
||||
android:layout_width="62dp"
|
||||
android:layout_height="39dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/confirm_button"
|
||||
android:gravity="center"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:text="@string/btn_confirm"
|
||||
android:textSize="15sp"
|
||||
android:textColor="#4DCFE1"
|
||||
android:layout_width="62dp"
|
||||
android:layout_height="39dp"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/div"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:background="#3A3D48"
|
||||
android:layout_height="1px"/>
|
||||
|
||||
<com.alivc.live.commonui.configview.OptionSelectorView
|
||||
android:id="@+id/optionSelectorView"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/div"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,838 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#141416"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/push_orientation"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/main_orientation"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center_vertical|end"
|
||||
android:maxLines="1"
|
||||
android:layout_marginEnd="23dp"
|
||||
android:text="@string/portrait"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/landscape_model"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setting_display_mode"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center_vertical|end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/display_mode_cut"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/auto_reconnect"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:paddingStart="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/reconnect_duration"
|
||||
android:textColor="#FCFCFD"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/retry_interval"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end|center_vertical"
|
||||
android:background="@null"
|
||||
android:hint="@string/input_desc"
|
||||
android:inputType="number"
|
||||
android:maxLength="9"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="/ms"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:paddingStart="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/reconnect_times"
|
||||
android:textColor="#FCFCFD"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/retry_count"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end|center_vertical"
|
||||
android:background="@null"
|
||||
android:hint="@string/input_desc"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/second_rate"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/watermark"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/watermark_open"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/watermark_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/watermark_setting"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/water_position"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="@string/watermark_setting"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="14sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/mirror_desc"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/setting_push_mirror"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/push_mirror_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/setting_pre_mirror"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/preview_mirror_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/camera_setting"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/front_camera"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/camera_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="true"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/auto_focus"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/autofocus_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/camera_capture_output_preference"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setting_camera_capture_output_preference"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center_vertical|end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/camera_capture_output_preference_preview"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/beauty_setting"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/beauty_enable"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/beautyOn_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/image_push"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/pause_image"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/pause_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="true"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/network_image"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/network_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="true"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/push_mode"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/push_mode"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center_vertical|end"
|
||||
android:paddingEnd="23dp"
|
||||
android:text="@string/video_push_streaming"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_live_arrow_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/url_auth"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/auth_text"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/auth_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end|center_vertical"
|
||||
android:background="@null"
|
||||
android:hint="@string/input_desc"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="/ms"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/privacy_text"
|
||||
android:textColor="#FCFCFD"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/privacy_key"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end|center_vertical"
|
||||
android:background="@null"
|
||||
android:hint="@string/input_desc"
|
||||
android:inputType="number"
|
||||
android:textColor="#747A8C"
|
||||
android:textColorHint="#747A8C"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="39dp"
|
||||
android:background="#141416"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@string/other_func"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_24px" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/asynchronous_interface"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/async_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/music_mode"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/music_mode_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/extern_stream_main"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/extern_video"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="#3A3D48" />
|
||||
|
||||
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_log"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="100dp"
|
||||
android:text="@string/local_log"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_30px" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/log_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:checked="false"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?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">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/view_height_size_45"
|
||||
android:paddingEnd="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/resolution_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:maxHeight="5dp"
|
||||
android:minHeight="5dp"
|
||||
android:progress="66"
|
||||
android:theme="@style/Push_SeekBar_Style" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/resolution_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:text="@string/setting_resolution_540P"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="12sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/custom_resolution_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textColor="#FCFCFD"
|
||||
android:text="@string/resolution_width"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_width"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLength="10"
|
||||
android:maxLines="1"
|
||||
android:text="0"
|
||||
android:textColor="#FCFCFD"
|
||||
android:inputType="number"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="#FCFCFD"
|
||||
android:text="@string/resolution_height"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_height"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLength="10"
|
||||
android:maxLines="1"
|
||||
android:text="0"
|
||||
android:textColor="#FCFCFD"
|
||||
android:inputType="number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/tv_sei_payload" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_sei_payload_type"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_text_white"
|
||||
android:textSize="@dimen/font_size_32px" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/tv_sei_message" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_sei"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/color_text_white"
|
||||
android:textSize="@dimen/font_size_32px" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_send_sei"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:background="@drawable/shape_pysh_btn_bg"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/sei_send_custom_message_tv"
|
||||
android:textColor="#FCFCFD"
|
||||
android:textSize="@dimen/font_size_24px"
|
||||
android:textStyle="normal" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
android:id="@+id/push_args_setting"
|
||||
layout="@layout/push_args_setting_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/push_function_setting"
|
||||
layout="@layout/push_function_setting_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
412
LiveCommon/live_commonui/src/main/res/layout/push_watermark.xml
Normal file
@@ -0,0 +1,412 @@
|
||||
<?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:background="@color/darker_gray"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/watermark_setting"
|
||||
android:textColor="#747A8C"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
<Switch
|
||||
android:id="@+id/watermark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track"
|
||||
android:checked="true"
|
||||
android:visibility="gone"/>
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="X"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/x"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.1"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Y"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/y"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.2"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="W"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/w"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.1"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="@android:color/black" />
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
<Switch
|
||||
android:id="@+id/watermark1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track"
|
||||
android:checked="true"
|
||||
android:visibility="gone"/>
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="X"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/x1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.1"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Y"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/y1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.3"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="W"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/w1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.1"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="@android:color/black" />
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
<Switch
|
||||
android:id="@+id/watermark2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:thumb="@drawable/thumb"
|
||||
android:track="@drawable/track"
|
||||
android:checked="true"
|
||||
android:visibility="gone"/>
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="X"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/x2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.1"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Y"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/y2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.5"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="W"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/w2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_rect_gray"
|
||||
android:hint="0.1"
|
||||
android:paddingLeft="10dp"
|
||||
android:inputType="numberDecimal"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/font_size_28px" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="%"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
116
LiveCommon/live_commonui/src/main/res/values-en/strings.xml
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="system_error">System error:</string>
|
||||
<string name="sdk_error">SDK error:</string>
|
||||
<string name="connect_fail">Connection failed</string>
|
||||
<string name="view_string_hint_push_url">Enter the ingest URL.</string>
|
||||
<string name="url_empty">Please enter url</string>
|
||||
<string name="btn_confirm">Confirm</string>
|
||||
<string name="pull_cancel">Cancel</string>
|
||||
<string name="stop_button">Stop pushing</string>
|
||||
<string name="start_push">Start pushing</string>
|
||||
<string name="resolution_label">Resolution</string>
|
||||
<string name="setting_resolution_180P">180P</string>
|
||||
<string name="setting_resolution_240P">240P</string>
|
||||
<string name="setting_resolution_360P">360P</string>
|
||||
<string name="setting_resolution_480P">480P</string>
|
||||
<string name="setting_resolution_540P">540P</string>
|
||||
<string name="setting_resolution_720P">720P</string>
|
||||
<string name="setting_resolution_1080P">1080P</string>
|
||||
<string name="setting_resolution_self_define">Self Define</string>
|
||||
<string name="bitrate_control">Bitrate Control</string>
|
||||
<string name="variable_resolution">Variable Resolution</string>
|
||||
<string name="resolution_width">width:</string>
|
||||
<string name="resolution_height">height:</string>
|
||||
<string name="resolution_label_desc">To enable the system to automatically switch to the most suitable resolution, you must enable adaptive bitrate streaming. For more information, see the API reference.</string>
|
||||
<string name="advance_config">Advanced Settings</string>
|
||||
<string name="display_mode">DisplayMode</string>
|
||||
<string name="display_mode_full">scaleToFill</string>
|
||||
<string name="display_mode_fit">aspectFit</string>
|
||||
<string name="display_mode_cut">aspectFill</string>
|
||||
<string name="quality_resolution_first">High quality priority</string>
|
||||
<string name="quality_fluency_first">fluency priority</string>
|
||||
<string name="video_label_desc">You can adjust the video bitrate and frame rate only in custom mode.</string>
|
||||
<string name="quality_custom">custom</string>
|
||||
<string name="target_bitrate">Target bitrate</string>
|
||||
<string name="target_rate_value">1200</string>
|
||||
<string name="min_bitrate">Min bitrate</string>
|
||||
<string name="min_rate_value">300</string>
|
||||
<string name="initial_bitrate">Initial bitrate</string>
|
||||
<string name="audio_bitrate">Audio bitrate</string>
|
||||
<string name="initial_bit_value">1000</string>
|
||||
<string name="audio_bitrate_value">64</string>
|
||||
<string name="min_fps">Min fps</string>
|
||||
<string name="captrue_fps">Captrue fps</string>
|
||||
<string name="init_fps">20</string>
|
||||
<string name="audio_sampling_rate">Audio sampling rate</string>
|
||||
<string name="setting_audio_480">48KHz</string>
|
||||
<string name="setting_audio_441">44.1KHz</string>
|
||||
<string name="setting_audio_320">32KHz</string>
|
||||
<string name="setting_audio_160">16KHz</string>
|
||||
<string name="GOP">Gop</string>
|
||||
<string name="audio_profile">Audio profile</string>
|
||||
<string name="sound_track">Sound track</string>
|
||||
<string name="video_encoder">Video Encoder</string>
|
||||
<string name="b_frames">B Frames</string>
|
||||
<string name="hardware_encode">Hardware encoder</string>
|
||||
<string name="audio_hardware_encode">Audio Hardware encoder</string>
|
||||
<string name="setting_audio_aac_lc">LC</string>
|
||||
<string name="setting_audio_aac_he">HE-AAC</string>
|
||||
<string name="setting_audio_aac_hev2">HEv2-AAC</string>
|
||||
<string name="setting_audio_aac_ld">AAC-LD</string>
|
||||
<string name="single_track">Single track</string>
|
||||
<string name="dual_track">Dual track</string>
|
||||
<string name="h264">H264</string>
|
||||
<string name="h265">H265</string>
|
||||
<string name="portrait">Portrait</string>
|
||||
<string name="homeLeft">HomeLeft</string>
|
||||
<string name="homeRight">HomeRight</string>
|
||||
<string name="video_push_streaming">Default</string>
|
||||
<string name="audio_only_push_streaming">Audio only</string>
|
||||
<string name="video_only_push_streaming">Video only</string>
|
||||
<string name="push_orientation">Ingest To</string>
|
||||
<string name="landscape_model">Orientation</string>
|
||||
<string name="auto_reconnect">Auto Reconnection</string>
|
||||
<string name="reconnect_duration">Reconnection duration</string>
|
||||
<string name="input_desc">Enter</string>
|
||||
<string name="reconnect_times">Reconnection times</string>
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="watermark_open">Watermark</string>
|
||||
<string name="watermark_setting">Setting</string>
|
||||
<string name="mirror_desc">Mirroring</string>
|
||||
<string name="setting_pre_mirror">Preview mirror</string>
|
||||
<string name="setting_push_mirror">Push mirror</string>
|
||||
<string name="camera_setting">Camera Control</string>
|
||||
<string name="front_camera">Front camera</string>
|
||||
<string name="auto_focus">Auto focus</string>
|
||||
<string name="camera_capture_output_preference">Camera Capture Output Preference</string>
|
||||
<string name="camera_capture_output_preference_auto">Auto</string>
|
||||
<string name="camera_capture_output_preference_performance">Performance</string>
|
||||
<string name="camera_capture_output_preference_preview">Preview</string>
|
||||
<string name="beauty_setting">Retouching Switch</string>
|
||||
<string name="beauty_enable">Beauty</string>
|
||||
<string name="image_push">Ingest Standby Stream</string>
|
||||
<string name="pause_image">Pause Image</string>
|
||||
<string name="network_image">NetworkPoor Image</string>
|
||||
<string name="push_mode">Push Mode</string>
|
||||
<string name="url_auth">Url Auth Setting</string>
|
||||
<string name="auth_text">Auth Time</string>
|
||||
<string name="privacy_text">Privacy Key</string>
|
||||
<string name="other_func">Other Features</string>
|
||||
<string name="asynchronous_interface">Asynchronous interface</string>
|
||||
<string name="music_mode">Music Mode</string>
|
||||
<string name="extern_stream_main">Main Extern Stream</string>
|
||||
<string name="local_log">Local log</string>
|
||||
|
||||
<string name="push_args">Stream Ingest Parameters</string>
|
||||
<string name="stream_pusher_tip">Stream Ingest Features</string>
|
||||
|
||||
<string name="tv_sei_message">message</string>
|
||||
<string name="tv_sei_payload">payload</string>
|
||||
|
||||
<string name="local_record_tv">Local Record</string>
|
||||
<string name="manual_create_egl_context_tv">Manual Create EGLContext</string>
|
||||
<string name="sei_send_custom_message_tv">Send Custom Message</string>
|
||||
|
||||
</resources>
|
||||
128
LiveCommon/live_commonui/src/main/res/values-zh-rCN/strings.xml
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="system_error">系统错误:</string>
|
||||
<string name="sdk_error">SDK错误:</string>
|
||||
<string name="connect_fail">连接失败</string>
|
||||
|
||||
<string name="view_string_hint_push_url">请输入推流url</string>
|
||||
<string name="url_empty">请输入推流地址</string>
|
||||
|
||||
<string name="btn_confirm">确认</string>
|
||||
<string name="pull_cancel">取消</string>
|
||||
<string name="stop_button">停止推流</string>
|
||||
<string name="start_push">开始推流</string>
|
||||
|
||||
|
||||
<string name="resolution_label">分辨率</string>
|
||||
<string name="setting_resolution_180P">180P</string>
|
||||
<string name="setting_resolution_240P">240P</string>
|
||||
<string name="setting_resolution_360P">360P</string>
|
||||
<string name="setting_resolution_480P">480P</string>
|
||||
<string name="setting_resolution_540P">540P</string>
|
||||
<string name="setting_resolution_720P">720P</string>
|
||||
<string name="setting_resolution_1080P">1080P</string>
|
||||
<string name="setting_resolution_self_define">自定义</string>
|
||||
|
||||
<string name="bitrate_control">码率自适应</string>
|
||||
<string name="resolution_width">宽:</string>
|
||||
<string name="resolution_height">高:</string>
|
||||
<string name="variable_resolution">可变分辨率</string>
|
||||
<string name="resolution_label_desc">分辨率自适应需开启码率自适应,详细请参考api文档</string>
|
||||
<string name="advance_config">高级设置</string>
|
||||
<string name="display_mode">显示模式</string>
|
||||
<string name="display_mode_full">拉伸</string>
|
||||
<string name="display_mode_fit">适合</string>
|
||||
<string name="display_mode_cut">剪裁</string>
|
||||
<string name="quality_resolution_first">清晰度优先</string>
|
||||
<string name="quality_fluency_first">流畅度优先</string>
|
||||
<string name="video_label_desc">视频码率和帧率仅在自定义模式下可以调整</string>
|
||||
<string name="quality_custom">自定义</string>
|
||||
<string name="target_bitrate">视频目标码率</string>
|
||||
<string name="target_rate_value">1200</string>
|
||||
<string name="min_bitrate">视频最小码率</string>
|
||||
<string name="min_rate_value">300</string>
|
||||
<string name="initial_bitrate">视频初始码率</string>
|
||||
<string name="initial_bit_value">1000</string>
|
||||
<string name="audio_bitrate">音频码率</string>
|
||||
<string name="audio_bitrate_value">64</string>
|
||||
<string name="min_fps">最小帧率</string>
|
||||
<string name="captrue_fps">采集帧率</string>
|
||||
<string name="init_fps">20</string>
|
||||
<string name="audio_sampling_rate">音频采样率</string>
|
||||
<string name="setting_audio_480">48KHz</string>
|
||||
<string name="setting_audio_441">44.1KHz</string>
|
||||
<string name="setting_audio_320">32KHz</string>
|
||||
<string name="setting_audio_160">16KHz</string>
|
||||
<string name="GOP">关键帧间隔</string>
|
||||
<string name="audio_profile">音频编码</string>
|
||||
<string name="sound_track">声道</string>
|
||||
<string name="video_encoder">视频编码器</string>
|
||||
<string name="b_frames">B帧个数</string>
|
||||
<string name="hardware_encode">视频硬编码</string>
|
||||
<string name="audio_hardware_encode">音频硬编码</string>
|
||||
<string name="setting_audio_aac_lc">LC</string>
|
||||
<string name="setting_audio_aac_he">HE-AAC</string>
|
||||
<string name="setting_audio_aac_hev2">HEv2-AAC</string>
|
||||
<string name="setting_audio_aac_ld">AAC-LD</string>
|
||||
<string name="single_track">单声道</string>
|
||||
<string name="dual_track">双声道</string>
|
||||
<string name="h264">H264</string>
|
||||
<string name="h265">H265</string>
|
||||
<string name="portrait">Portrait</string>
|
||||
<string name="homeLeft">HomeLeft</string>
|
||||
<string name="homeRight">HomeRight</string>
|
||||
<string name="video_push_streaming">音视频</string>
|
||||
<string name="audio_only_push_streaming">纯音频</string>
|
||||
<string name="video_only_push_streaming">纯视频</string>
|
||||
|
||||
|
||||
<string name="push_orientation">推流方向</string>
|
||||
<string name="landscape_model">显示模式</string>
|
||||
<string name="auto_reconnect">自动重连</string>
|
||||
<string name="reconnect_duration">重连时长</string>
|
||||
<string name="input_desc">请输入</string>
|
||||
<string name="reconnect_times">重连次数</string>
|
||||
<string name="watermark">水印</string>
|
||||
<string name="watermark_open">开启水印</string>
|
||||
<string name="watermark_setting">水印位置</string>
|
||||
<string name="mirror_desc">镜像</string>
|
||||
<string name="setting_pre_mirror">预览镜像</string>
|
||||
<string name="setting_push_mirror">推流镜像</string>
|
||||
<string name="camera_setting">相机控制</string>
|
||||
<string name="front_camera">前置摄像头</string>
|
||||
<string name="auto_focus">自动对焦</string>
|
||||
<string name="camera_capture_output_preference">摄像头采集偏好</string>
|
||||
<string name="camera_capture_output_preference_auto">自动</string>
|
||||
<string name="camera_capture_output_preference_performance">性能</string>
|
||||
<string name="camera_capture_output_preference_preview">高清预览</string>
|
||||
<string name="beauty_setting">美颜开关</string>
|
||||
<string name="beauty_enable">开启美颜</string>
|
||||
<string name="image_push">图片推流</string>
|
||||
<string name="pause_image">暂停图片</string>
|
||||
<string name="network_image">网络差图片</string>
|
||||
<string name="push_mode">推流模式</string>
|
||||
<string name="url_auth">推流鉴权</string>
|
||||
<string name="auth_text">有效时长</string>
|
||||
<string name="privacy_text">鉴权key</string>
|
||||
<string name="other_func">其他功能</string>
|
||||
<string name="asynchronous_interface">异步接口</string>
|
||||
<string name="music_mode">音乐模式</string>
|
||||
<string name="extern_stream_main">外部音视频</string>
|
||||
<string name="local_log">本地日志</string>
|
||||
|
||||
<string name="push_args">推流参数</string>
|
||||
<string name="stream_pusher_tip">推流功能</string>
|
||||
|
||||
<string name="second_rate">/次</string>
|
||||
<string name="tv_sei_message">message</string>
|
||||
<string name="tv_sei_payload">payload</string>
|
||||
|
||||
<string name="local_record_tv">本地录制</string>
|
||||
<string name="manual_create_egl_context_tv">手动创建EGLContext</string>
|
||||
<string name="sei_send_custom_message_tv">发送自定义消息</string>
|
||||
|
||||
<string name="backdoor_title">Live Push Demo配置页面</string>
|
||||
<string name="backdoor_tip">用于手动配置demo相应功能</string>
|
||||
<string name="backdoor_multi_pk_16in">16方多人PK</string>
|
||||
|
||||
</resources>
|
||||
18
LiveCommon/live_commonui/src/main/res/values/attrs.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--MaxHeightLayout 使用-->
|
||||
<declare-styleable name="mMaxRatio">
|
||||
<attr name="linear_max_ratio" format="float"></attr>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="av_actionbar">
|
||||
<attr name="showTitle" format="boolean" />
|
||||
<attr name="showLeftView" format="boolean" />
|
||||
<attr name="showRightView" format="boolean" />
|
||||
<attr name="title" format="string" />
|
||||
<attr name="leftImageBackground" format="reference" />
|
||||
<attr name="leftImageSrc" format="reference" />
|
||||
<attr name="rightImageBackground" format="reference" />
|
||||
<attr name="rightImageSrc" format="reference" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
117
LiveCommon/live_commonui/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="system_error">System error:</string>
|
||||
<string name="sdk_error">SDK error:</string>
|
||||
<string name="connect_fail">Connection failed</string>
|
||||
<string name="view_string_hint_push_url">Enter the ingest URL.</string>
|
||||
<string name="url_empty">Please enter url</string>
|
||||
<string name="btn_confirm">Confirm</string>
|
||||
<string name="pull_cancel">Cancel</string>
|
||||
<string name="stop_button">Stop pushing</string>
|
||||
<string name="start_push">Start pushing</string>
|
||||
<string name="resolution_label">Resolution</string>
|
||||
<string name="setting_resolution_180P">180P</string>
|
||||
<string name="setting_resolution_240P">240P</string>
|
||||
<string name="setting_resolution_360P">360P</string>
|
||||
<string name="setting_resolution_480P">480P</string>
|
||||
<string name="setting_resolution_540P">540P</string>
|
||||
<string name="setting_resolution_720P">720P</string>
|
||||
<string name="setting_resolution_1080P">1080P</string>
|
||||
<string name="setting_resolution_self_define">Self Define</string>
|
||||
<string name="bitrate_control">Bitrate Control</string>
|
||||
<string name="variable_resolution">Variable Resolution</string>
|
||||
<string name="resolution_width">width:</string>
|
||||
<string name="resolution_height">height:</string>
|
||||
<string name="resolution_label_desc">To enable the system to automatically switch to the most suitable resolution, you must enable adaptive bitrate streaming. For more information, see the API reference.</string>
|
||||
<string name="advance_config">Advanced Settings</string>
|
||||
<string name="display_mode">DisplayMode</string>
|
||||
<string name="display_mode_full">scaleToFill</string>
|
||||
<string name="display_mode_fit">aspectFit</string>
|
||||
<string name="display_mode_cut">aspectFill</string>
|
||||
<string name="quality_resolution_first">High quality priority</string>
|
||||
<string name="quality_fluency_first">fluency priority</string>
|
||||
<string name="video_label_desc">You can adjust the video bitrate and frame rate only in custom mode.</string>
|
||||
<string name="quality_custom">custom</string>
|
||||
<string name="target_bitrate">Target bitrate</string>
|
||||
<string name="target_rate_value">1200</string>
|
||||
<string name="min_bitrate">Min bitrate</string>
|
||||
<string name="min_rate_value">300</string>
|
||||
<string name="initial_bitrate">Initial bitrate</string>
|
||||
<string name="audio_bitrate">Audio bitrate</string>
|
||||
<string name="initial_bit_value">1000</string>
|
||||
<string name="audio_bitrate_value">64</string>
|
||||
<string name="min_fps">Min fps</string>
|
||||
<string name="captrue_fps">Captrue fps</string>
|
||||
<string name="init_fps">20</string>
|
||||
<string name="audio_sampling_rate">Audio sampling rate</string>
|
||||
<string name="setting_audio_480">48KHz</string>
|
||||
<string name="setting_audio_441">44.1KHz</string>
|
||||
<string name="setting_audio_320">32KHz</string>
|
||||
<string name="setting_audio_160">16KHz</string>
|
||||
<string name="GOP">Gop</string>
|
||||
<string name="audio_profile">Audio profile</string>
|
||||
<string name="sound_track">Sound track</string>
|
||||
<string name="video_encoder">Video Encoder</string>
|
||||
<string name="b_frames">B Frames</string>
|
||||
<string name="hardware_encode">Hardware encoder</string>
|
||||
<string name="audio_hardware_encode">Audio Hardware encoder</string>
|
||||
<string name="setting_audio_aac_lc">LC</string>
|
||||
<string name="setting_audio_aac_he">HE-AAC</string>
|
||||
<string name="setting_audio_aac_hev2">HEv2-AAC</string>
|
||||
<string name="setting_audio_aac_ld">AAC-LD</string>
|
||||
<string name="single_track">Single track</string>
|
||||
<string name="dual_track">Dual track</string>
|
||||
<string name="h264">H264</string>
|
||||
<string name="h265">H265</string>
|
||||
<string name="portrait">Portrait</string>
|
||||
<string name="homeLeft">HomeLeft</string>
|
||||
<string name="homeRight">HomeRight</string>
|
||||
<string name="video_push_streaming">Default</string>
|
||||
<string name="audio_only_push_streaming">Audio only</string>
|
||||
<string name="video_only_push_streaming">Video only</string>
|
||||
<string name="push_orientation">Ingest To</string>
|
||||
<string name="landscape_model">Orientation</string>
|
||||
<string name="auto_reconnect">Auto Reconnection</string>
|
||||
<string name="reconnect_duration">Reconnection duration</string>
|
||||
<string name="input_desc">Enter</string>
|
||||
<string name="reconnect_times">Reconnection times</string>
|
||||
<string name="watermark">Watermark</string>
|
||||
<string name="watermark_open">Watermark</string>
|
||||
<string name="watermark_setting">Setting</string>
|
||||
<string name="mirror_desc">Mirroring</string>
|
||||
<string name="setting_pre_mirror">Preview mirror</string>
|
||||
<string name="setting_push_mirror">Push mirror</string>
|
||||
<string name="camera_setting">Camera Control</string>
|
||||
<string name="front_camera">Front camera</string>
|
||||
<string name="auto_focus">Auto focus</string>
|
||||
<string name="camera_capture_output_preference">Camera Capture Output Preference</string>
|
||||
<string name="camera_capture_output_preference_auto">Auto</string>
|
||||
<string name="camera_capture_output_preference_performance">Performance</string>
|
||||
<string name="camera_capture_output_preference_preview">Preview</string>
|
||||
<string name="beauty_setting">Retouching Switch</string>
|
||||
<string name="beauty_enable">Beauty</string>
|
||||
<string name="image_push">Ingest Standby Stream</string>
|
||||
<string name="pause_image">Pause Image</string>
|
||||
<string name="network_image">NetworkPoor Image</string>
|
||||
<string name="push_mode">Push Mode</string>
|
||||
<string name="url_auth">Url Auth Setting</string>
|
||||
<string name="auth_text">Auth Time</string>
|
||||
<string name="privacy_text">Privacy Key</string>
|
||||
<string name="other_func">Other Features</string>
|
||||
<string name="asynchronous_interface">Asynchronous interface</string>
|
||||
<string name="music_mode">Music Mode</string>
|
||||
<string name="extern_stream_main">Main Extern Stream</string>
|
||||
<string name="local_log">Local log</string>
|
||||
|
||||
<string name="push_args">Stream Ingest Parameters</string>
|
||||
<string name="stream_pusher_tip">Stream Ingest Features</string>
|
||||
|
||||
<string name="second_rate">/Times</string>
|
||||
<string name="tv_sei_message">message</string>
|
||||
<string name="tv_sei_payload">payload</string>
|
||||
|
||||
<string name="local_record_tv">Local Record</string>
|
||||
<string name="manual_create_egl_context_tv">Manual Create EGLContext</string>
|
||||
<string name="sei_send_custom_message_tv">Send Custom Message</string>
|
||||
|
||||
</resources>
|
||||
66
LiveCommon/live_commonui/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<resources>
|
||||
<style name="AVLiveBaseTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AVLiveAppTheme" parent="AVLiveBaseTheme">
|
||||
</style>
|
||||
|
||||
<style name="AVLive_ProgressBar_Horizontal_Style" parent="Widget.AppCompat.ProgressBar.Horizontal">
|
||||
<item name="colorAccent">#4DCFE1</item>
|
||||
</style>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AVLiveTheme" parent="AVLiveBaseTheme">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="dialog_animation">
|
||||
<item name="android:windowEnterAnimation">@anim/anim_trans_from_bottom</item>
|
||||
<item name="android:windowExitAnimation">@anim/anim_layout_bottom_out</item>
|
||||
</style>
|
||||
|
||||
<style name="DialogStyle">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:cacheColorHint">@android:color/transparent</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
</style>
|
||||
|
||||
<style name="AUILiveDialog" parent="android:Theme.Dialog">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<!-- 为了避免在有 NavigationBar 的手机上 Dialog 从 NavigationBar 底部上来。去掉 Dialog 的动画,使用 View 的动画。-->
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:padding">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="LogText">
|
||||
<item name="android:textColor">@color/colorAccent</item>
|
||||
<item name="android:textSize">@dimen/font_size_28px</item>
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:padding">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Push_SeekBar_Style" parent="Widget.AppCompat.SeekBar">
|
||||
<item name="colorAccent">#4DCFE1</item>
|
||||
</style>
|
||||
|
||||
<style name="AUIEditText">
|
||||
<item name="colorControlNormal">#3A3D48</item>
|
||||
<item name="colorControlActivated">#3A3D48</item>
|
||||
</style>
|
||||
|
||||
<style name="Live.BaseDialog" parent="Theme.AppCompat.Dialog">
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Live.BottomSheetDialog" parent="Live.BaseDialog">
|
||||
<item name="android:backgroundDimAmount">0</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
10
LiveCommon/live_commonui/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="LiveBaseActionBar_Style">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">44dp</item>
|
||||
</style>
|
||||
<color name="text_true_color">#FF6500</color>
|
||||
<color name="des_txt_color">#8016243C</color>
|
||||
|
||||
</resources>
|
||||