use overflow for video player
This commit is contained in:
parent
863860201a
commit
13da30911a
|
@ -393,9 +393,6 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
||||||
|
|
||||||
public boolean onImageMenuItemSelected(MenuItem item, String url) {
|
public boolean onImageMenuItemSelected(MenuItem item, String url) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
/*case android.R.id.home:
|
|
||||||
onBackPressed();
|
|
||||||
return true;*/
|
|
||||||
case R.id.article_img_open:
|
case R.id.article_img_open:
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -416,15 +413,14 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
||||||
shareText(url);
|
shareText(url);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
// TODO: this needs access to article text, I'm afraid
|
|
||||||
case R.id.article_img_view_caption:
|
case R.id.article_img_view_caption:
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
displayImageCaption(url, m_content);
|
displayImageCaption(url, m_content);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId());
|
Log.d(TAG, "onImageMenuItemSelected, unhandled id=" + item.getItemId());
|
||||||
return super.onContextItemSelected(item);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,14 @@ import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.MediaController;
|
import android.widget.MediaController;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -40,9 +42,7 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().hide();
|
||||||
if (!isPortrait())
|
|
||||||
getSupportActionBar().hide();
|
|
||||||
|
|
||||||
surfaceView = (SurfaceView) findViewById(R.id.video_player);
|
surfaceView = (SurfaceView) findViewById(R.id.video_player);
|
||||||
registerForContextMenu(surfaceView);
|
registerForContextMenu(surfaceView);
|
||||||
|
@ -55,6 +55,25 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||||
m_streamUri = savedInstanceState.getString("streamUri");
|
m_streamUri = savedInstanceState.getString("streamUri");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findViewById(R.id.video_player_overflow).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
PopupMenu popup = new PopupMenu(VideoPlayerActivity.this, v);
|
||||||
|
MenuInflater inflater = popup.getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.activity_video_player, popup.getMenu());
|
||||||
|
|
||||||
|
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
return onVideoMenuItemSelected(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
popup.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
final MediaController mediaController = new MediaController(this);
|
final MediaController mediaController = new MediaController(this);
|
||||||
|
|
||||||
surfaceView.setOnClickListener(new View.OnClickListener() {
|
surfaceView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -182,11 +201,6 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
if (!isPortrait())
|
|
||||||
getSupportActionBar().hide();
|
|
||||||
else
|
|
||||||
getSupportActionBar().show();
|
|
||||||
|
|
||||||
resizeSurface();
|
resizeSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +212,7 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.activity_video_player, menu);
|
getMenuInflater().inflate(R.menu.activity_video_player, menu);
|
||||||
return true;
|
return true;
|
||||||
|
@ -218,14 +232,10 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
return onContextItemSelected(item); // this is really bad :()
|
return onContextItemSelected(item); // this is really bad :()
|
||||||
}
|
} */
|
||||||
|
|
||||||
@Override
|
public boolean onVideoMenuItemSelected(android.view.MenuItem item) {
|
||||||
public boolean onContextItemSelected(android.view.MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
|
||||||
onBackPressed();
|
|
||||||
return true;
|
|
||||||
case R.id.article_vid_open:
|
case R.id.article_vid_open:
|
||||||
if (m_streamUri != null) {
|
if (m_streamUri != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -236,14 +246,19 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.article_vid_copy:
|
||||||
|
if (m_streamUri != null) {
|
||||||
|
copyToClipboard(m_streamUri);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
case R.id.article_vid_share:
|
case R.id.article_vid_share:
|
||||||
if (m_streamUri != null) {
|
if (m_streamUri != null) {
|
||||||
shareText(m_streamUri);
|
shareText(m_streamUri);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId());
|
Log.d(TAG, "onVideoMenuItemSelected, unhandled id=" + item.getItemId());
|
||||||
return super.onContextItemSelected(item);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,19 @@
|
||||||
android:id="@+id/video_loading"
|
android:id="@+id/video_loading"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:indeterminate="true" />
|
android:indeterminate="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/video_player_overflow"
|
||||||
|
android:clickable="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:background="@drawable/ripple"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:src="@drawable/ic_dots_vertical"
|
||||||
|
android:layout_gravity="right|bottom"
|
||||||
|
android:layout_marginBottom="8dp" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<include layout="@layout/toolbar" android:id="@+id/toolbar" />
|
<include layout="@layout/toolbar" android:id="@+id/toolbar" />
|
||||||
|
|
|
@ -6,7 +6,12 @@
|
||||||
<item
|
<item
|
||||||
android:id="@+id/article_vid_open"
|
android:id="@+id/article_vid_open"
|
||||||
app:showAsAction=""
|
app:showAsAction=""
|
||||||
android:title="@string/video_player_open"/>
|
android:title="@string/open_with"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/article_vid_copy"
|
||||||
|
app:showAsAction=""
|
||||||
|
android:icon="@drawable/ic_content_copy"
|
||||||
|
android:title="@string/article_link_copy"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/article_vid_share"
|
android:id="@+id/article_vid_share"
|
||||||
android:icon="@drawable/ic_share"
|
android:icon="@drawable/ic_share"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user