Skip to content

Commit

Permalink
Merge pull request q215613905#37 from zyjia/main
Browse files Browse the repository at this point in the history
播放页增加显示播放地址,点击复制地址到剪贴板 by zyjia
  • Loading branch information
q215613905 committed Aug 26, 2022
2 parents 15a4553 + e8c558f commit ab16277
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.content.ClipboardManager;
import android.content.ClipData;

import androidx.fragment.app.FragmentContainerView;
import androidx.lifecycle.Observer;
Expand Down Expand Up @@ -97,6 +99,7 @@ public class DetailActivity extends BaseActivity {
private TextView tvType;
private TextView tvActor;
private TextView tvDirector;
private TextView tvPlayUrl;
private TextView tvDes;
private TextView tvPlay;
private TextView tvSort;
Expand Down Expand Up @@ -147,6 +150,7 @@ private void initView() {
tvType = findViewById(R.id.tvType);
tvActor = findViewById(R.id.tvActor);
tvDirector = findViewById(R.id.tvDirector);
tvPlayUrl = findViewById(R.id.tvPlayUrl);
tvDes = findViewById(R.id.tvDes);
tvPlay = findViewById(R.id.tvPlay);
tvSort = findViewById(R.id.tvSort);
Expand Down Expand Up @@ -201,6 +205,17 @@ public void onClick(View v) {
}
}
});

tvPlayUrl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//获取剪切板管理器
ClipboardManager cm = (ClipboardManager)getSystemService(mContext.CLIPBOARD_SERVICE);
//设置内容到剪切板
cm.setPrimaryClip(ClipData.newPlainText(null, tvPlayUrl.getText().toString()));
Toast.makeText(DetailActivity.this, "已复制", Toast.LENGTH_SHORT).show();
}
});
tvQuickSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -281,6 +296,8 @@ private void refresh(View itemView, int position) {
vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = false;
}
vodInfo.playFlag = newFlag;
//更新播放地址
setTextShow(tvPlayUrl, "播放地址:", vodInfo.seriesMap.get(vodInfo.playFlag).get(0).url);
seriesFlagAdapter.notifyItemChanged(position);
refreshList();
}
Expand Down Expand Up @@ -507,6 +524,8 @@ public void onChanged(AbsXml absXml) {
} else
flag.selected = false;
}
//设置播放地址
setTextShow(tvPlayUrl, "播放地址:", vodInfo.seriesMap.get(vodInfo.playFlag).get(0).url);

seriesFlagAdapter.setNewData(vodInfo.seriesFlags);
mGridViewFlag.scrollToPosition(flagScrollTo);
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/activity_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@
android:textColor="@color/color_CCFFFFFF"
android:textSize="@dimen/ts_20" />

<TextView
android:id="@+id/tvPlayUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/color_CCFFFFFF"
android:textSize="@dimen/ts_20" />


<TextView
android:id="@+id/tvDes"
android:layout_width="match_parent"
Expand Down

0 comments on commit ab16277

Please sign in to comment.