Commit 42a283f9 authored by wanglei's avatar wanglei

...ad

parent 800f8210
......@@ -6,6 +6,7 @@ import android.content.Intent
import android.graphics.drawable.Drawable
import android.view.View
import android.view.View.OnClickListener
import android.widget.FrameLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
......@@ -13,8 +14,9 @@ import androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator
import com.test.easy.easycleanerjunk.R
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
class PhotoListManager(context: Activity) : OnItemClickListener<PhotoBean>, SpanSizeLookup(), OnClickListener {
class PhotoListManager(val context: Activity) : OnItemClickListener<PhotoBean>, SpanSizeLookup(), OnClickListener {
private var mRecycleView: RecyclerView? = null
......@@ -57,6 +59,10 @@ class PhotoListManager(context: Activity) : OnItemClickListener<PhotoBean>, Span
}
override fun onUpdateBtn(isChecked: Boolean, entity: PhotoBean) {
if (entity.size > 6) {
val flAd = context.findViewById<FrameLayout>(R.id.fl_ad)
AdmobUtils.showNativeAd(context, flAd)
}
PhotoCache.getInstance().let {
if (isChecked) it.addPhoto(entity) else it.removePhoto(entity)
}
......@@ -74,7 +80,7 @@ class PhotoListManager(context: Activity) : OnItemClickListener<PhotoBean>, Span
mCompressionPhotoListAdapter?.updateData(list)
updateBtnContinue()
mNoText.visibility = View.GONE
}else{
} else {
mNoText.visibility = View.VISIBLE
}
}
......
......@@ -41,12 +41,18 @@
</RelativeLayout>
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title_layout" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_continue_layout"
android:layout_below="@+id/title_layout"
android:layout_below="@+id/fl_ad"
android:layout_marginLeft="14dp"
android:layout_marginRight="14dp" />
......
......@@ -54,19 +54,6 @@
app:layout_constraintVertical_bias="0.1"
tools:ignore="HardcodedText" />
<FrameLayout
android:id="@+id/fl_recycle_bin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="16dp"
android:padding="8dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.3"></FrameLayout>
<LinearLayout
android:id="@+id/ll_size"
android:layout_width="wrap_content"
......@@ -116,6 +103,12 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
......@@ -123,10 +116,6 @@
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment