3838
3939public class receiverpictureactivity extends AppCompatActivity {
4040
41+ //to make sure back button doesn't open old images
4142 @ Override
4243 protected void onNewIntent (Intent intent ) {
4344 finish ();
@@ -50,16 +51,16 @@ protected void onNewIntent(Intent intent) {
5051 @ Override
5152 protected void onCreate (Bundle savedInstanceState ) {
5253 super .onCreate (savedInstanceState );
53-
54+ //makes Window Fullscreen and show ontop of the Lockscreen
5455 getWindow ().requestFeature (Window .FEATURE_ACTION_BAR );
5556 getSupportActionBar ().hide ();
5657 setContentView (R .layout .activity_receiverpictureactivity );
5758 Window wind = this .getWindow ();
5859 wind .addFlags (WindowManager .LayoutParams .FLAG_SHOW_WHEN_LOCKED );
5960 wind .addFlags (WindowManager .LayoutParams .FLAG_FULLSCREEN );
6061
62+ //periodically checks if the screen is locked, if it is calls screenislocked()
6163 handly = new Handler ();
62-
6364 goahead = new Runnable () {
6465 @ Override
6566 public void run () {
@@ -79,7 +80,7 @@ public void run() {
7980
8081 }
8182
82- public void buttonpressed (View view ) {
83+ public void buttonpressed (View view ) { //called when button is pressed
8384 screenislocked ();
8485 }
8586
@@ -91,6 +92,7 @@ public void screenislocked() {
9192 screenLock .acquire (1 );
9293
9394 screenLock .release ();
95+ //removes handler, wakes up screen and realeases Wakelock immediately
9496
9597 Intent intent = getIntent ();
9698 String action = intent .getAction ();
@@ -100,13 +102,13 @@ public void screenislocked() {
100102
101103 ArrayList <Uri > imageUris = null ;
102104
103- if (Intent .ACTION_SEND .equals (action )) {
105+ if (Intent .ACTION_SEND .equals (action )) { //puts Uris into an array, wheter there is one or multiple
104106 Uri imageUri = intent .getParcelableExtra (Intent .EXTRA_STREAM );
105107 imageUris = new ArrayList <>();
106108 imageUris .add (imageUri );
107109 } else if (Intent .ACTION_SEND_MULTIPLE .equals (action )) {
108110 imageUris = intent .getParcelableArrayListExtra (Intent .EXTRA_STREAM );
109- }
111+ } //puts Uris into an array, wheter there is one or multiple
110112
111113 DemoCollectionPagerAdapter .setCounts (imageUris .size ());
112114 DemoCollectionPagerAdapter .setUris (imageUris );
@@ -131,7 +133,7 @@ public DemoCollectionPagerAdapter(FragmentManager fm) {
131133
132134 static ArrayList <Uri > uris ;
133135
134- public static void recreateafterpermission () {
136+ public static void recreateafterpermission () { //this is called when the user gives permission to view file
135137 atp .notifyDataSetChanged ();
136138 }
137139
@@ -239,8 +241,6 @@ private void pictureSet(final TouchImageView imageset, Uri urinormal) {
239241 .with (this )
240242 .load (urinormal )
241243 .override (Target .SIZE_ORIGINAL , Target .SIZE_ORIGINAL )
242- //.override(getActivity().findViewById(R.id.pager).getMeasuredWidth(),getActivity().findViewById(R.id.pager).getMeasuredHeight())
243- //.into(imageset);
244244 .into (new GlideDrawableImageViewTarget (imageset ) {
245245 @ Override
246246 public void onResourceReady (GlideDrawable resource , GlideAnimation <? super GlideDrawable > animation ) {
@@ -257,8 +257,6 @@ private void pictureSetFile(final TouchImageView imageset, Uri urinormal) {
257257 .with (this )
258258 .load (urinormal )
259259 .override (Target .SIZE_ORIGINAL , Target .SIZE_ORIGINAL )
260- //.override(getActivity().findViewById(R.id.pager).getMeasuredWidth(),getActivity().findViewById(R.id.pager).getMeasuredHeight())
261- //.into(imageset);
262260 .into (new GlideDrawableImageViewTarget (imageset ) {
263261 @ Override
264262 public void onResourceReady (GlideDrawable resource , GlideAnimation <? super GlideDrawable > animation ) {
0 commit comments