Commit fa364e4c0bed70e97a03654e3e39afe5497bf35e
1 parent
24286363
1.增加监测宏处理
2.Demo更新
Showing
10 changed files
with
351 additions
and
66 deletions
app/build.gradle
| @@ -27,5 +27,5 @@ dependencies { | @@ -27,5 +27,5 @@ dependencies { | ||
| 27 | compile 'com.github.bumptech.glide:glide:4.3.1' | 27 | compile 'com.github.bumptech.glide:glide:4.3.1' |
| 28 | annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1' | 28 | annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1' |
| 29 | //引入广告SDK | 29 | //引入广告SDK |
| 30 | - compile 'cn.vlion:vlion-ad:1.2.0' | 30 | + compile 'cn.vlion:vlion-ad:1.2.2' |
| 31 | } | 31 | } |
app/src/main/AndroidManifest.xml
| @@ -50,7 +50,12 @@ | @@ -50,7 +50,12 @@ | ||
| 50 | android:screenOrientation="portrait" /> | 50 | android:screenOrientation="portrait" /> |
| 51 | 51 | ||
| 52 | <activity | 52 | <activity |
| 53 | - android:name="cn.vlion.simple.NativeFeedsDemoActivity" | 53 | + android:name="cn.vlion.simple.NativeFeedsDemo1Activity" |
| 54 | + android:configChanges="keyboardHidden|screenSize|orientation" | ||
| 55 | + android:screenOrientation="portrait" /> | ||
| 56 | + | ||
| 57 | + <activity | ||
| 58 | + android:name="cn.vlion.simple.NativeFeedsDemo2Activity" | ||
| 54 | android:configChanges="keyboardHidden|screenSize|orientation" | 59 | android:configChanges="keyboardHidden|screenSize|orientation" |
| 55 | android:screenOrientation="portrait" /> | 60 | android:screenOrientation="portrait" /> |
| 56 | 61 |
app/src/main/java/cn/vlion/simple/NativeActivity.java
| @@ -123,7 +123,11 @@ public class NativeActivity extends AppCompatActivity { | @@ -123,7 +123,11 @@ public class NativeActivity extends AppCompatActivity { | ||
| 123 | }); | 123 | }); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | - public void showFeedsDemo(View view) { | ||
| 127 | - startActivity(new Intent(this, NativeFeedsDemoActivity.class)); | 126 | + public void showFeedsDemo1(View view) { |
| 127 | + startActivity(new Intent(this, NativeFeedsDemo1Activity.class)); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + public void showFeedsDemo2(View view) { | ||
| 131 | + startActivity(new Intent(this, NativeFeedsDemo2Activity.class)); | ||
| 128 | } | 132 | } |
| 129 | } | 133 | } |
app/src/main/java/cn/vlion/simple/NativeFeedsDemo1Activity.java
0 → 100644
| 1 | +package cn.vlion.simple; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.os.Bundle; | ||
| 5 | +import android.support.annotation.Nullable; | ||
| 6 | +import android.support.v7.app.AppCompatActivity; | ||
| 7 | +import android.text.TextUtils; | ||
| 8 | +import android.util.Log; | ||
| 9 | +import android.util.TypedValue; | ||
| 10 | +import android.view.View; | ||
| 11 | +import android.widget.Button; | ||
| 12 | +import android.widget.ImageView; | ||
| 13 | +import android.widget.TextView; | ||
| 14 | + | ||
| 15 | +import com.bumptech.glide.Glide; | ||
| 16 | +import com.google.gson.Gson; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import cn.vlion.ad.core.Config; | ||
| 21 | +import cn.vlion.ad.moudle.natives.NativeAdStatusChangeListener; | ||
| 22 | +import cn.vlion.ad.moudle.natives.NativeListener; | ||
| 23 | +import cn.vlion.ad.moudle.natives.NativeManager; | ||
| 24 | +import cn.vlion.ad.moudle.natives.model.NativeAdStateData; | ||
| 25 | +import cn.vlion.ad.moudle.natives.model.NativeFeeds; | ||
| 26 | +import cn.vlion.ad.moudle.natives.model.NativeFeedsData; | ||
| 27 | +import cn.vlion.ad.view.natives.NativeRelativeLayout; | ||
| 28 | +import cn.vlion.simple.util.ScreenUtil; | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * Created by gujun on 2017/11/15. | ||
| 32 | + */ | ||
| 33 | + | ||
| 34 | +public class NativeFeedsDemo1Activity extends AppCompatActivity { | ||
| 35 | + | ||
| 36 | + private static final String adId_Feeds = "441"; | ||
| 37 | + private static final String TAG = "NativeFeedsDemoActivity"; | ||
| 38 | + | ||
| 39 | + private ImageView icon, image; | ||
| 40 | + private TextView title, desc, rating; | ||
| 41 | + private Button click; | ||
| 42 | + private NativeRelativeLayout adLayout; | ||
| 43 | + private int downX = -999, downY = -999, upX = -999, upY = -999; | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
| 47 | + super.onCreate(savedInstanceState); | ||
| 48 | + setContentView(R.layout.activity_native_feeds_demo1); | ||
| 49 | + init(); | ||
| 50 | + loadFeeds(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + private void init() { | ||
| 54 | + icon = findViewById(R.id.icon); | ||
| 55 | + image = findViewById(R.id.image); | ||
| 56 | + title = findViewById(R.id.title); | ||
| 57 | + desc = findViewById(R.id.desc); | ||
| 58 | + rating = findViewById(R.id.rating); | ||
| 59 | + click = findViewById(R.id.click); | ||
| 60 | + adLayout = findViewById(R.id.adLayout); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void loadFeeds() { | ||
| 64 | + NativeManager.getInstance().requestFeeds(this, adId_Feeds, new NativeListener<NativeFeedsData>() { | ||
| 65 | + @Override | ||
| 66 | + public void onRequestSuccess(NativeFeedsData data) { | ||
| 67 | + Log.e("DemoView", "数据获取成功 " + "adId:" + data.getTagid() + "," + new Gson().toJson(data)); | ||
| 68 | + addData(data); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Override | ||
| 72 | + public void onRequestFailed(String adId, int code, String message) { | ||
| 73 | + Log.e("DemoView", "数据加载失败 : code = " + code + " , message = " + message + "," + "adId:" + adId); | ||
| 74 | + } | ||
| 75 | + }); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + private void addData(final NativeFeedsData data) { | ||
| 79 | + if (data == null || data.getNativead() == null) return; | ||
| 80 | + | ||
| 81 | + List<NativeFeeds.IconBean> icons = data.getNativead().getIcon(); | ||
| 82 | + String iconUrl = icons == null || icons.size() <= 0 ? "" : icons.get(0).getUrl(); | ||
| 83 | + if (!TextUtils.isEmpty(iconUrl)) | ||
| 84 | + Glide.with(this).load(iconUrl).into(icon); | ||
| 85 | + | ||
| 86 | + List<NativeFeeds.ImgBean> images = data.getNativead().getImg(); | ||
| 87 | + String imageUrl = images == null || images.size() <= 0 ? "" : images.get(0).getUrl(); | ||
| 88 | + if (!TextUtils.isEmpty(imageUrl)) | ||
| 89 | + Glide.with(this).load(imageUrl).into(image); | ||
| 90 | + int imageHeight = Integer.valueOf(images.get(0).getH()); | ||
| 91 | + int imageWidth = Integer.valueOf(images.get(0).getW()); | ||
| 92 | + int imageRealWidth = ScreenUtil.getScreenWidth(this) - dp2px(this, 20); | ||
| 93 | + image.getLayoutParams().width = imageRealWidth; | ||
| 94 | + image.getLayoutParams().height = imageRealWidth * imageHeight / imageWidth; | ||
| 95 | + | ||
| 96 | + title.setText(data.getNativead().getTitle()); | ||
| 97 | + desc.setText(data.getNativead().getDesc()); | ||
| 98 | + rating.setText(data.getNativead().getRating() == null ? "0分" : data.getNativead().getRating() + "分"); | ||
| 99 | + click.setText(data.getNativead().getButton() == null ? "ad click" : data.getNativead().getButton()); | ||
| 100 | + | ||
| 101 | + //原生广告-点击事件 | ||
| 102 | + //1.用户可按照API接口文档自行处理 | ||
| 103 | + //2.用户交由SDK处理,实现方式如下 | ||
| 104 | + | ||
| 105 | + //已弃用方法 NativeManager -> onClick(Context context, BaseData baseData, NativeAdStatusChangeListener statusChangeListener) | ||
| 106 | + //该方法无法上报监测宏字段 ,会减少开发者广告收益! | ||
| 107 | + | ||
| 108 | + //方式1 | ||
| 109 | + //用户捕获视图触摸事件,将按下\抬起坐标传入MonitorEvent中 | ||
| 110 | + //构造方式设置 | ||
| 111 | + //MonitorEvent monitorEvent = new MonitorEvent(downX, downY, upX, upY); | ||
| 112 | + //动态设置 | ||
| 113 | + //monitorEvent.onTouch(MotionEvent event)//用户触摸事件 | ||
| 114 | + //monitorEvent.setDownX();//用户手指按下时的横坐标 | ||
| 115 | + //monitorEvent.setDownY();//用户手指按下时的纵坐标 | ||
| 116 | + //monitorEvent.setUpX();//用户手指离开设备屏幕时的横坐标 | ||
| 117 | + //monitorEvent.setUpY();//用户手指离开设备屏幕时的横坐标 | ||
| 118 | + //SDK定义的布局容器 NativeFrameLayout / NativeGridLayout / NativeLinearLayout / NativeRelativeLayout | ||
| 119 | + click.setOnClickListener(new View.OnClickListener() { | ||
| 120 | + @Override | ||
| 121 | + public void onClick(View v) { | ||
| 122 | + //SDK布局容器会自动获取MonitorEvent相关信息 | ||
| 123 | + //SDL布局容器.getMonitorEvent()直接获取MonitorEvent无需自己处理自定义视图及事件传递 | ||
| 124 | + //调用NativeManager.onClick(...)通知SDK触发广告点击事件 | ||
| 125 | + NativeManager.getInstance().onClick(NativeFeedsDemo1Activity.this, data, adLayout.getMonitorEvent(), statusChangeListener); | ||
| 126 | + } | ||
| 127 | + }); | ||
| 128 | + | ||
| 129 | + //曝光的调用 | ||
| 130 | + NativeManager.getInstance().onExposure(data); | ||
| 131 | + | ||
| 132 | + //方式2 | ||
| 133 | + //用户使用SDK定义的布局容器 NativeFrameLayout / NativeGridLayout / NativeLinearLayout / NativeRelativeLayout | ||
| 134 | + //在展示广告物料数据时调用容器init()方法 | ||
| 135 | + //其余事情交由SDK内部处理 | ||
| 136 | + //nativeLayout.init(data, statusChangeListener); | ||
| 137 | + | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public static int dp2px(Context context, float dpVal) { | ||
| 141 | + return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, | ||
| 142 | + dpVal, context.getResources().getDisplayMetrics()); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + private NativeAdStatusChangeListener statusChangeListener = new NativeAdStatusChangeListener() { | ||
| 146 | + @Override | ||
| 147 | + public void onAdStatusChange(NativeAdStateData stateData) { | ||
| 148 | + switch (stateData.getDownloadType()) { | ||
| 149 | + case Config.NATIVE_AD_CLICK_TYPE_DOWNLOAD_PENDING: | ||
| 150 | + Log.e(TAG, "onAdStatusChange: adId:" + stateData.getAdId() + ",等待下载" + stateData.getDownloadProgress()); | ||
| 151 | + break; | ||
| 152 | + case Config.NATIVE_AD_CLICK_TYPE_DOWNLOAD_RUNNING: | ||
| 153 | + Log.e(TAG, "onAdStatusChange: adId:" + stateData.getAdId() + ",正在下载" + stateData.getDownloadProgress()); | ||
| 154 | + break; | ||
| 155 | + case Config.NATIVE_AD_CLICK_TYPE_DOWNLOAD_FAILED: | ||
| 156 | + Log.e(TAG, "onAdStatusChange: adId:" + stateData.getAdId() + ",下载失败" + stateData.getDownloadProgress()); | ||
| 157 | + break; | ||
| 158 | + case Config.NATIVE_AD_CLICK_TYPE_DOWNLOAD_SUCCESS: | ||
| 159 | + Log.e(TAG, "onAdStatusChange: adId:" + stateData.getAdId() + ",成功" + stateData.getDownloadProgress()); | ||
| 160 | + break; | ||
| 161 | + case Config.NATIVE_AD_CLICK_TYPE_DOWNLOAD_PAUSED: | ||
| 162 | + Log.e(TAG, "onAdStatusChange: adId:" + stateData.getAdId() + ",暂停" + stateData.getDownloadProgress()); | ||
| 163 | + break; | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + }; | ||
| 167 | +} |
app/src/main/java/cn/vlion/simple/NativeFeedsDemoActivity.java renamed to app/src/main/java/cn/vlion/simple/NativeFeedsDemo2Activity.java
| @@ -24,25 +24,27 @@ import cn.vlion.ad.moudle.natives.NativeManager; | @@ -24,25 +24,27 @@ import cn.vlion.ad.moudle.natives.NativeManager; | ||
| 24 | import cn.vlion.ad.moudle.natives.model.NativeAdStateData; | 24 | import cn.vlion.ad.moudle.natives.model.NativeAdStateData; |
| 25 | import cn.vlion.ad.moudle.natives.model.NativeFeeds; | 25 | import cn.vlion.ad.moudle.natives.model.NativeFeeds; |
| 26 | import cn.vlion.ad.moudle.natives.model.NativeFeedsData; | 26 | import cn.vlion.ad.moudle.natives.model.NativeFeedsData; |
| 27 | +import cn.vlion.ad.view.natives.NativeRelativeLayout; | ||
| 27 | import cn.vlion.simple.util.ScreenUtil; | 28 | import cn.vlion.simple.util.ScreenUtil; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Created by gujun on 2017/11/15. | 31 | * Created by gujun on 2017/11/15. |
| 31 | */ | 32 | */ |
| 32 | 33 | ||
| 33 | -public class NativeFeedsDemoActivity extends AppCompatActivity { | 34 | +public class NativeFeedsDemo2Activity extends AppCompatActivity { |
| 34 | 35 | ||
| 35 | - private static final String adId_Feeds = "440"; | 36 | + private static final String adId_Feeds = "441"; |
| 36 | private static final String TAG = "NativeFeedsDemoActivity"; | 37 | private static final String TAG = "NativeFeedsDemoActivity"; |
| 37 | 38 | ||
| 38 | private ImageView icon, image; | 39 | private ImageView icon, image; |
| 39 | private TextView title, desc, rating; | 40 | private TextView title, desc, rating; |
| 40 | private Button click; | 41 | private Button click; |
| 42 | + private NativeRelativeLayout nativeLayout; | ||
| 41 | 43 | ||
| 42 | @Override | 44 | @Override |
| 43 | protected void onCreate(@Nullable Bundle savedInstanceState) { | 45 | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| 44 | super.onCreate(savedInstanceState); | 46 | super.onCreate(savedInstanceState); |
| 45 | - setContentView(R.layout.activity_native_feeds_demo); | 47 | + setContentView(R.layout.activity_native_feeds_demo1); |
| 46 | init(); | 48 | init(); |
| 47 | loadFeeds(); | 49 | loadFeeds(); |
| 48 | } | 50 | } |
| @@ -54,6 +56,7 @@ public class NativeFeedsDemoActivity extends AppCompatActivity { | @@ -54,6 +56,7 @@ public class NativeFeedsDemoActivity extends AppCompatActivity { | ||
| 54 | desc = findViewById(R.id.desc); | 56 | desc = findViewById(R.id.desc); |
| 55 | rating = findViewById(R.id.rating); | 57 | rating = findViewById(R.id.rating); |
| 56 | click = findViewById(R.id.click); | 58 | click = findViewById(R.id.click); |
| 59 | + nativeLayout = findViewById(R.id.nativeLayout); | ||
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | public void loadFeeds() { | 62 | public void loadFeeds() { |
| @@ -93,17 +96,41 @@ public class NativeFeedsDemoActivity extends AppCompatActivity { | @@ -93,17 +96,41 @@ public class NativeFeedsDemoActivity extends AppCompatActivity { | ||
| 93 | desc.setText(data.getNativead().getDesc()); | 96 | desc.setText(data.getNativead().getDesc()); |
| 94 | rating.setText(data.getNativead().getRating() == null ? "0分" : data.getNativead().getRating() + "分"); | 97 | rating.setText(data.getNativead().getRating() == null ? "0分" : data.getNativead().getRating() + "分"); |
| 95 | click.setText(data.getNativead().getButton() == null ? "ad click" : data.getNativead().getButton()); | 98 | click.setText(data.getNativead().getButton() == null ? "ad click" : data.getNativead().getButton()); |
| 99 | + | ||
| 100 | + //原生广告-点击事件 | ||
| 101 | + //1.用户可按照API接口文档自行处理 | ||
| 102 | + //2.用户交由SDK处理,实现方式如下 | ||
| 103 | + | ||
| 104 | + //已弃用方法 NativeManager -> onClick(Context context, BaseData baseData, NativeAdStatusChangeListener statusChangeListener) | ||
| 105 | + //该方法无法上报监测宏字段 ,会减少开发者广告收益! | ||
| 106 | + | ||
| 107 | + //方式1 | ||
| 108 | + //用户捕获视图触摸事件,将按下\抬起坐标传入MonitorEvent中 | ||
| 109 | + //构造方式设置 | ||
| 110 | + //MonitorEvent monitorEvent = new MonitorEvent(downX, downY, upX, upY); | ||
| 111 | + //动态设置 | ||
| 112 | + //monitorEvent.setDownX();//用户手指按下时的横坐标 | ||
| 113 | + //monitorEvent.setDownY();//用户手指按下时的纵坐标 | ||
| 114 | + //monitorEvent.setUpX();//用户手指离开设备屏幕时的横坐标 | ||
| 115 | + //monitorEvent.setUpY();//用户手指离开设备屏幕时的横坐标 | ||
| 116 | + //点击事件时调用 | ||
| 117 | + //NativeManager.getInstance().onClick(NativeFeedsDemoActivity.this, data, monitorEvent, statusChangeListener); | ||
| 118 | + //曝光的调用 | ||
| 119 | + //NativeManager.getInstance().onExposure(data); | ||
| 120 | + | ||
| 121 | + //方式2 | ||
| 122 | + //用户使用SDK定义的布局容器 NativeFrameLayout / NativeGridLayout / NativeLinearLayout / NativeRelativeLayout | ||
| 123 | + //在展示广告物料数据时调用容器init()方法 | ||
| 124 | + //其余事情交由SDK内部处理 | ||
| 125 | + nativeLayout.init(data, statusChangeListener); | ||
| 126 | + | ||
| 96 | click.setOnClickListener(new View.OnClickListener() { | 127 | click.setOnClickListener(new View.OnClickListener() { |
| 97 | @Override | 128 | @Override |
| 98 | public void onClick(View v) { | 129 | public void onClick(View v) { |
| 99 | - //点击的调用 | ||
| 100 | - boolean clickSuccess = NativeManager.getInstance().onClick(NativeFeedsDemoActivity.this, data, statusChangeListener); | ||
| 101 | - Log.e(TAG, "onClick: " + clickSuccess); | 130 | + //TODO 自定义按钮点击事件,处理方式详见上方说明 |
| 131 | + Log.e(TAG, "Ad click"); | ||
| 102 | } | 132 | } |
| 103 | }); | 133 | }); |
| 104 | - | ||
| 105 | - //曝光的调用 | ||
| 106 | - NativeManager.getInstance().onExposure(data); | ||
| 107 | } | 134 | } |
| 108 | 135 | ||
| 109 | public static int dp2px(Context context, float dpVal) { | 136 | public static int dp2px(Context context, float dpVal) { |
app/src/main/res/layout/activity_native.xml
| @@ -53,11 +53,19 @@ | @@ -53,11 +53,19 @@ | ||
| 53 | android:text="@string/loadWaterfall" /> | 53 | android:text="@string/loadWaterfall" /> |
| 54 | 54 | ||
| 55 | <Button | 55 | <Button |
| 56 | - android:id="@+id/feedsDemo" | 56 | + android:id="@+id/feedsDemo1" |
| 57 | style="@style/buttonTheme" | 57 | style="@style/buttonTheme" |
| 58 | android:layout_width="200dp" | 58 | android:layout_width="200dp" |
| 59 | android:layout_height="wrap_content" | 59 | android:layout_height="wrap_content" |
| 60 | - android:text="@string/showFeedsDemo" | 60 | + android:text="@string/showFeedsDemo1" |
| 61 | android:layout_marginTop="16dp" | 61 | android:layout_marginTop="16dp" |
| 62 | - android:onClick="showFeedsDemo"/> | 62 | + android:onClick="showFeedsDemo1"/> |
| 63 | + <Button | ||
| 64 | + android:id="@+id/feedsDemo2" | ||
| 65 | + style="@style/buttonTheme" | ||
| 66 | + android:layout_width="200dp" | ||
| 67 | + android:layout_height="wrap_content" | ||
| 68 | + android:text="@string/showFeedsDemo2" | ||
| 69 | + android:layout_marginTop="16dp" | ||
| 70 | + android:onClick="showFeedsDemo2"/> | ||
| 63 | </LinearLayout> | 71 | </LinearLayout> |
| 64 | \ No newline at end of file | 72 | \ No newline at end of file |
app/src/main/res/layout/activity_native_feeds_demo1.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<cn.vlion.ad.view.natives.NativeRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + android:id="@+id/adLayout" | ||
| 4 | + android:layout_width="match_parent" | ||
| 5 | + android:layout_height="wrap_content" | ||
| 6 | + android:padding="10dp"> | ||
| 7 | + | ||
| 8 | + <RelativeLayout | ||
| 9 | + android:id="@+id/topLayout" | ||
| 10 | + android:layout_width="match_parent" | ||
| 11 | + android:layout_height="wrap_content"> | ||
| 12 | + | ||
| 13 | + <ImageView | ||
| 14 | + android:id="@+id/icon" | ||
| 15 | + android:layout_width="50dp" | ||
| 16 | + android:layout_height="50dp" | ||
| 17 | + android:layout_marginRight="10dp" | ||
| 18 | + android:scaleType="centerCrop" /> | ||
| 19 | + | ||
| 20 | + <TextView | ||
| 21 | + android:id="@+id/title" | ||
| 22 | + android:layout_width="wrap_content" | ||
| 23 | + android:layout_height="wrap_content" | ||
| 24 | + android:layout_toRightOf="@+id/icon" | ||
| 25 | + android:singleLine="true" | ||
| 26 | + android:textColor="@android:color/black" /> | ||
| 27 | + | ||
| 28 | + <TextView | ||
| 29 | + android:id="@+id/rating" | ||
| 30 | + android:layout_width="wrap_content" | ||
| 31 | + android:layout_height="wrap_content" | ||
| 32 | + android:layout_below="@+id/title" | ||
| 33 | + android:layout_marginTop="5dp" | ||
| 34 | + android:layout_toRightOf="@+id/icon" | ||
| 35 | + android:textColor="@android:color/darker_gray" /> | ||
| 36 | + | ||
| 37 | + </RelativeLayout> | ||
| 38 | + | ||
| 39 | + <ImageView | ||
| 40 | + android:id="@+id/image" | ||
| 41 | + android:layout_width="match_parent" | ||
| 42 | + android:layout_height="100dp" | ||
| 43 | + android:layout_below="@+id/topLayout" | ||
| 44 | + android:layout_marginBottom="10dp" | ||
| 45 | + android:layout_marginTop="10dp" | ||
| 46 | + android:scaleType="centerCrop" /> | ||
| 47 | + | ||
| 48 | + <LinearLayout | ||
| 49 | + android:layout_width="match_parent" | ||
| 50 | + android:layout_height="wrap_content" | ||
| 51 | + android:layout_below="@+id/image" | ||
| 52 | + android:gravity="center_vertical"> | ||
| 53 | + | ||
| 54 | + <TextView | ||
| 55 | + android:id="@+id/desc" | ||
| 56 | + android:layout_width="0dp" | ||
| 57 | + android:layout_height="wrap_content" | ||
| 58 | + android:layout_weight="1" /> | ||
| 59 | + | ||
| 60 | + <Button | ||
| 61 | + android:id="@+id/click" | ||
| 62 | + android:layout_width="wrap_content" | ||
| 63 | + android:layout_height="wrap_content" | ||
| 64 | + android:text="ad click" /> | ||
| 65 | + | ||
| 66 | + </LinearLayout> | ||
| 67 | + | ||
| 68 | +</cn.vlion.ad.view.natives.NativeRelativeLayout> | ||
| 0 | \ No newline at end of file | 69 | \ No newline at end of file |
app/src/main/res/layout/activity_native_feeds_demo.xml renamed to app/src/main/res/layout/activity_native_feeds_demo2.xml
| @@ -4,64 +4,69 @@ | @@ -4,64 +4,69 @@ | ||
| 4 | android:layout_height="wrap_content" | 4 | android:layout_height="wrap_content" |
| 5 | android:padding="10dp"> | 5 | android:padding="10dp"> |
| 6 | 6 | ||
| 7 | - <RelativeLayout | ||
| 8 | - android:id="@+id/topLayout" | ||
| 9 | - android:layout_width="match_parent" | 7 | + <cn.vlion.ad.view.natives.NativeRelativeLayout |
| 8 | + android:id="@+id/nativeLayout" | ||
| 9 | + android:layout_width="wrap_content" | ||
| 10 | android:layout_height="wrap_content"> | 10 | android:layout_height="wrap_content"> |
| 11 | + <RelativeLayout | ||
| 12 | + android:id="@+id/topLayout" | ||
| 13 | + android:layout_width="match_parent" | ||
| 14 | + android:layout_height="wrap_content"> | ||
| 11 | 15 | ||
| 12 | - <ImageView | ||
| 13 | - android:id="@+id/icon" | ||
| 14 | - android:layout_width="50dp" | ||
| 15 | - android:layout_height="50dp" | ||
| 16 | - android:layout_marginRight="10dp" | ||
| 17 | - android:scaleType="centerCrop" /> | 16 | + <ImageView |
| 17 | + android:id="@+id/icon" | ||
| 18 | + android:layout_width="50dp" | ||
| 19 | + android:layout_height="50dp" | ||
| 20 | + android:layout_marginRight="10dp" | ||
| 21 | + android:scaleType="centerCrop" /> | ||
| 18 | 22 | ||
| 19 | - <TextView | ||
| 20 | - android:id="@+id/title" | ||
| 21 | - android:layout_width="wrap_content" | ||
| 22 | - android:layout_height="wrap_content" | ||
| 23 | - android:layout_toRightOf="@+id/icon" | ||
| 24 | - android:singleLine="true" | ||
| 25 | - android:textColor="@android:color/black" /> | ||
| 26 | - | ||
| 27 | - <TextView | ||
| 28 | - android:id="@+id/rating" | ||
| 29 | - android:layout_width="wrap_content" | ||
| 30 | - android:layout_height="wrap_content" | ||
| 31 | - android:layout_below="@+id/title" | ||
| 32 | - android:layout_marginTop="5dp" | ||
| 33 | - android:layout_toRightOf="@+id/icon" | ||
| 34 | - android:textColor="@android:color/darker_gray" /> | 23 | + <TextView |
| 24 | + android:id="@+id/title" | ||
| 25 | + android:layout_width="wrap_content" | ||
| 26 | + android:layout_height="wrap_content" | ||
| 27 | + android:layout_toRightOf="@+id/icon" | ||
| 28 | + android:singleLine="true" | ||
| 29 | + android:textColor="@android:color/black" /> | ||
| 35 | 30 | ||
| 36 | - </RelativeLayout> | 31 | + <TextView |
| 32 | + android:id="@+id/rating" | ||
| 33 | + android:layout_width="wrap_content" | ||
| 34 | + android:layout_height="wrap_content" | ||
| 35 | + android:layout_below="@+id/title" | ||
| 36 | + android:layout_marginTop="5dp" | ||
| 37 | + android:layout_toRightOf="@+id/icon" | ||
| 38 | + android:textColor="@android:color/darker_gray" /> | ||
| 37 | 39 | ||
| 38 | - <ImageView | ||
| 39 | - android:id="@+id/image" | ||
| 40 | - android:layout_width="match_parent" | ||
| 41 | - android:layout_height="100dp" | ||
| 42 | - android:layout_below="@+id/topLayout" | ||
| 43 | - android:layout_marginBottom="10dp" | ||
| 44 | - android:layout_marginTop="10dp" | ||
| 45 | - android:scaleType="centerCrop" /> | 40 | + </RelativeLayout> |
| 46 | 41 | ||
| 47 | - <LinearLayout | ||
| 48 | - android:layout_width="match_parent" | ||
| 49 | - android:layout_height="wrap_content" | ||
| 50 | - android:layout_below="@+id/image" | ||
| 51 | - android:gravity="center_vertical"> | 42 | + <ImageView |
| 43 | + android:id="@+id/image" | ||
| 44 | + android:layout_width="match_parent" | ||
| 45 | + android:layout_height="100dp" | ||
| 46 | + android:layout_below="@+id/topLayout" | ||
| 47 | + android:layout_marginBottom="10dp" | ||
| 48 | + android:layout_marginTop="10dp" | ||
| 49 | + android:scaleType="centerCrop" /> | ||
| 52 | 50 | ||
| 53 | - <TextView | ||
| 54 | - android:id="@+id/desc" | ||
| 55 | - android:layout_width="0dp" | 51 | + <LinearLayout |
| 52 | + android:layout_width="match_parent" | ||
| 56 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
| 57 | - android:layout_weight="1" /> | 54 | + android:layout_below="@+id/image" |
| 55 | + android:gravity="center_vertical"> | ||
| 58 | 56 | ||
| 59 | - <Button | ||
| 60 | - android:id="@+id/click" | ||
| 61 | - android:layout_width="wrap_content" | ||
| 62 | - android:layout_height="wrap_content" | ||
| 63 | - android:text="ad click" /> | 57 | + <TextView |
| 58 | + android:id="@+id/desc" | ||
| 59 | + android:layout_width="0dp" | ||
| 60 | + android:layout_height="wrap_content" | ||
| 61 | + android:layout_weight="1" /> | ||
| 62 | + | ||
| 63 | + <Button | ||
| 64 | + android:id="@+id/click" | ||
| 65 | + android:layout_width="wrap_content" | ||
| 66 | + android:layout_height="wrap_content" | ||
| 67 | + android:text="ad click" /> | ||
| 64 | 68 | ||
| 65 | - </LinearLayout> | 69 | + </LinearLayout> |
| 70 | + </cn.vlion.ad.view.natives.NativeRelativeLayout> | ||
| 66 | 71 | ||
| 67 | </RelativeLayout> | 72 | </RelativeLayout> |
| 68 | \ No newline at end of file | 73 | \ No newline at end of file |
app/src/main/res/values/strings.xml
| @@ -5,5 +5,6 @@ | @@ -5,5 +5,6 @@ | ||
| 5 | <string name="loadFeeds">信息流数据</string> | 5 | <string name="loadFeeds">信息流数据</string> |
| 6 | <string name="loadNews">新闻放送数据</string> | 6 | <string name="loadNews">新闻放送数据</string> |
| 7 | <string name="loadWaterfall">瀑布流数据</string> | 7 | <string name="loadWaterfall">瀑布流数据</string> |
| 8 | - <string name="showFeedsDemo">展示信息流demo</string> | 8 | + <string name="showFeedsDemo1">展示信息流demo1</string> |
| 9 | + <string name="showFeedsDemo2">展示信息流demo2</string> | ||
| 9 | </resources> | 10 | </resources> |
lib/vlion-ad-1.2.0.jar renamed to lib/vlion-ad-1.2.2.jar
No preview for this file type