mirror of https://github.com/tuskyapp/Tusky.git
13 changed files with 326 additions and 35 deletions
@ -0,0 +1,45 @@
|
||||
package com.keylesspalace.tusky; |
||||
|
||||
import android.os.Bundle; |
||||
import android.support.v4.app.Fragment; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
|
||||
import com.android.volley.toolbox.ImageLoader; |
||||
import com.android.volley.toolbox.NetworkImageView; |
||||
|
||||
public class ViewMediaFragment extends Fragment { |
||||
public static ViewMediaFragment newInstance(String url) { |
||||
Bundle arguments = new Bundle(); |
||||
ViewMediaFragment fragment = new ViewMediaFragment(); |
||||
arguments.putString("url", url); |
||||
fragment.setArguments(arguments); |
||||
return fragment; |
||||
} |
||||
|
||||
@Override |
||||
public View onCreateView(LayoutInflater inflater, final ViewGroup container, |
||||
Bundle savedInstanceState) { |
||||
View rootView = inflater.inflate(R.layout.fragment_view_media, container, false); |
||||
|
||||
Bundle arguments = getArguments(); |
||||
String url = arguments.getString("url"); |
||||
NetworkImageView image = (NetworkImageView) rootView.findViewById(R.id.view_media_image); |
||||
ImageLoader imageLoader = VolleySingleton.getInstance(getContext()).getImageLoader(); |
||||
image.setImageUrl(url, imageLoader); |
||||
|
||||
rootView.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
dismiss(); |
||||
} |
||||
}); |
||||
|
||||
return rootView; |
||||
} |
||||
|
||||
private void dismiss() { |
||||
getFragmentManager().popBackStack(); |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@
|
||||
package com.keylesspalace.tusky; |
||||
|
||||
import android.os.Bundle; |
||||
import android.support.v7.app.AppCompatActivity; |
||||
import android.widget.MediaController; |
||||
import android.widget.VideoView; |
||||
|
||||
public class ViewVideoActivity extends AppCompatActivity { |
||||
@Override |
||||
public void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
setContentView(R.layout.activity_view_video); |
||||
String url = getIntent().getStringExtra("url"); |
||||
VideoView videoView = (VideoView) findViewById(R.id.video_player); |
||||
videoView.setVideoPath(url); |
||||
MediaController controller = new MediaController(this); |
||||
videoView.setMediaController(controller); |
||||
controller.show(); |
||||
videoView.start(); |
||||
} |
||||
} |
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout 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/view_video_background"> |
||||
|
||||
<VideoView |
||||
android:id="@+id/video_player" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_centerInParent="true" /> |
||||
|
||||
</RelativeLayout> |
||||
@ -0,0 +1,14 @@
|
||||
<?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="match_parent" |
||||
android:background="#60000000"> |
||||
|
||||
<com.android.volley.toolbox.NetworkImageView |
||||
android:id="@+id/view_media_image" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_centerInParent="true" |
||||
android:scaleType="fitCenter" /> |
||||
|
||||
</RelativeLayout> |
||||
Loading…
Reference in new issue