-
Notifications
You must be signed in to change notification settings - Fork 4
feat:add flexad sample #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package com.buzzvil.sample.buzzvil_sdk_v6_sample.flexad | ||
|
|
||
| import android.os.Bundle | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import com.buzzvil.buzzbenefit.BuzzAdError | ||
| import com.buzzvil.buzzbenefit.flexad.BuzzFlex | ||
| import com.buzzvil.buzzbenefit.flexad.BuzzFlexAdView | ||
| import com.buzzvil.sample.buzzvil_sdk_v6_sample.Constant | ||
| import com.buzzvil.sample.buzzvil_sdk_v6_sample.databinding.ActivityYourFlexAdBinding | ||
|
|
||
| class YourFlexAdActivity : AppCompatActivity() { | ||
|
|
||
| private lateinit var binding: ActivityYourFlexAdBinding | ||
| private lateinit var buzzFlex: BuzzFlex | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| binding = ActivityYourFlexAdBinding.inflate(layoutInflater) | ||
| setContentView(binding.root) | ||
|
|
||
| val buzzFlexAdView = BuzzFlexAdView(this) | ||
| binding.buzzFlexAdContainer.addView(buzzFlexAdView) | ||
|
|
||
| buzzFlex = BuzzFlex(Constant.YOUR_FLEX_AD_ID) | ||
| buzzFlex.setListener(object : BuzzFlex.Listener { | ||
| override fun onSuccess() { | ||
| // 광고 로드 성공 시 호출됩니다. | ||
| // BuzzFlexAdView에 광고를 표시합니다. | ||
| buzzFlexAdView.bind(buzzFlex) | ||
| } | ||
|
|
||
| override fun onFailure(adError: BuzzAdError) { | ||
| // 광고 로드 실패 시 호출됩니다. | ||
| } | ||
|
|
||
| override fun onClicked() { | ||
| // 광고 클릭 시 호출됩니다. | ||
| } | ||
| }) | ||
|
|
||
| buzzFlex.load() | ||
| } | ||
|
|
||
| override fun onDestroy() { | ||
| super.onDestroy() | ||
| buzzFlex.dispose() | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -226,6 +226,21 @@ | |||||||||||||||||||||||||||||
| android:layout_marginHorizontal="16dp" | ||||||||||||||||||||||||||||||
| android:text="BuzzBanner" /> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <TextView | ||||||||||||||||||||||||||||||
| android:layout_width="wrap_content" | ||||||||||||||||||||||||||||||
| android:layout_height="wrap_content" | ||||||||||||||||||||||||||||||
| android:layout_marginHorizontal="16dp" | ||||||||||||||||||||||||||||||
| android:layout_marginTop="16dp" | ||||||||||||||||||||||||||||||
| android:text="FlexAd" | ||||||||||||||||||||||||||||||
| android:textSize="24dp" /> | ||||||||||||||||||||||||||||||
|
Comment on lines
+229
to
+235
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 235는 🔧 제안 수정안- android:textSize="24dp" />
+ android:textSize="24sp" />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||
| android:id="@+id/flexAdButton" | ||||||||||||||||||||||||||||||
| android:layout_width="match_parent" | ||||||||||||||||||||||||||||||
| android:layout_height="wrap_content" | ||||||||||||||||||||||||||||||
| android:layout_marginHorizontal="16dp" | ||||||||||||||||||||||||||||||
| android:text="FlexAd" /> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| </LinearLayout> | ||||||||||||||||||||||||||||||
| </ScrollView> | ||||||||||||||||||||||||||||||
| </FrameLayout> | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:orientation="vertical" | ||
| android:padding="16dp"> | ||
|
|
||
| <FrameLayout | ||
| android:id="@+id/buzzFlexAdContainer" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" /> | ||
|
|
||
| </LinearLayout> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import UIKit | ||
| import BuzzvilSDK | ||
|
|
||
| class FlexAdViewController: UIViewController { | ||
|
|
||
| private let buzzFlex = BuzzFlex(unitId: "YOUR_FLEX_AD_UNIT_ID") | ||
|
|
||
| private lazy var flexAdView: BuzzFlexAdView = { | ||
| let view = BuzzFlexAdView() | ||
| view.translatesAutoresizingMaskIntoConstraints = false | ||
| return view | ||
| }() | ||
|
|
||
| override func viewDidLoad() { | ||
| super.viewDidLoad() | ||
| view.backgroundColor = .systemBackground | ||
| navigationItem.title = "FlexAd" | ||
|
|
||
| setupLayout() | ||
| loadAd() | ||
| } | ||
|
|
||
| private func setupLayout() { | ||
| view.addSubview(flexAdView) | ||
| NSLayoutConstraint.activate([ | ||
| flexAdView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16), | ||
| flexAdView.leadingAnchor.constraint(equalTo: view.leadingAnchor), | ||
| flexAdView.trailingAnchor.constraint(equalTo: view.trailingAnchor), | ||
| ]) | ||
|
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 하단 안전영역 경계 제약이 없어 화면 침범 가능성이 있습니다. Line 25-29은 상단/좌우만 제약하고 있어, 콘텐츠 높이가 커질 때 safe area 하단 침범/클리핑이 생길 수 있습니다. 제안 수정안 NSLayoutConstraint.activate([
flexAdView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16),
flexAdView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
flexAdView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
+ flexAdView.bottomAnchor.constraint(lessThanOrEqualTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16),
])🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| private func loadAd() { | ||
| buzzFlex.delegate = self | ||
| buzzFlex.load() | ||
| } | ||
| } | ||
|
|
||
| extension FlexAdViewController: BuzzFlexDelegate { | ||
| func buzzFlexOnSuccess() { | ||
| // 광고 로드 성공 시 호출됩니다. | ||
| // BuzzFlexAdView에 광고를 표시합니다. | ||
| flexAdView.bind(buzzFlex) | ||
| } | ||
|
|
||
| func buzzFlexOnFailure(_ error: Error) { | ||
| // 광고 로드 실패 시 호출됩니다. | ||
| } | ||
|
|
||
| func buzzFlexOnClicked() { | ||
| // 광고 클릭 시 호출됩니다. | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
실패 콜백이 비어 있어 문제 원인 추적이 어렵습니다.
Line 32-34에서 최소한 로그/사용자 피드백을 남기는 편이 샘플 품질에 유리합니다.
🔧 제안 수정안
📝 Committable suggestion
🤖 Prompt for AI Agents