commit ab66b70e5580562a5944eb4de0dfd3454036145c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sat Aug 13 23:50:29 2022 +0200

    IAP, part 3: non-free objects appear in the popup with a lock icon.

diff --git a/src/main/java/org/distorted/helpers/PopupCreator.java b/src/main/java/org/distorted/helpers/PopupCreator.java
index 7a3a63f1..6f925afb 100644
--- a/src/main/java/org/distorted/helpers/PopupCreator.java
+++ b/src/main/java/org/distorted/helpers/PopupCreator.java
@@ -10,9 +10,13 @@
 package org.distorted.helpers;
 
 import android.app.Activity;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
 import android.widget.GridLayout;
 import android.widget.ImageButton;
 
+import org.distorted.main.R;
 import org.distorted.objects.RubikObject;
 import org.distorted.objects.RubikObjectList;
 
@@ -40,12 +44,12 @@ public class PopupCreator
       colSpecs[col] = GridLayout.spec(col);
       }
 
+    LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
     for(int object=0; object<numObjects; object++)
       {
-      final RubikObject rObject = RubikObjectList.getObject(object);
+      View v = createView(act,layoutInflater,object);
       int row = object/colCount;
-      ImageButton button = new ImageButton(act);
-      if( rObject!=null ) rObject.setIconTo(act,button);
 
       GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
       params.bottomMargin = margin;
@@ -58,7 +62,33 @@ public class PopupCreator
 
       nextInRow[row]++;
 
-      grid.addView(button, params);
+      grid.addView(v,params);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private static View createView(Activity act, LayoutInflater inflater, int ordinal)
+    {
+    final RubikObject obj = RubikObjectList.getObject(ordinal);
+
+    if( obj!=null )
+      {
+      if( obj.isFree() )
+        {
+        ImageButton button = new ImageButton(act);
+        obj.setIconTo(act,button);
+        return button;
+        }
+      else
+        {
+        final View layout = inflater.inflate(R.layout.non_free_object, null);
+        ImageButton button= layout.findViewById(R.id.non_free_button);
+        obj.setIconTo(act,button);
+        return layout;
+        }
       }
+
+    return null;
     }
   }
diff --git a/src/main/res/layout/non_free_object.xml b/src/main/res/layout/non_free_object.xml
new file mode 100644
index 00000000..6bc1bf50
--- /dev/null
+++ b/src/main/res/layout/non_free_object.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/non_free_layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" >
+
+        <ImageButton
+            android:id="@+id/non_free_button"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"/>
+
+        <ImageView
+            android:id="@+id/non_free_lock"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom|end"
+            android:adjustViewBounds="true"
+            android:paddingTop="-10dp"
+            android:scaleType="fitStart"
+            android:src="@drawable/ui_big_locked"/>
+
+    </FrameLayout>
\ No newline at end of file
