Skip to content
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

Dev/1.1.4 #67

Merged
merged 36 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cad4f59
1.切分出1.1.4开发分支
xuexiangjys Mar 9, 2020
35fcd95
增加内联布局使用演示
xuexiangjys Mar 11, 2020
030f637
增加vlayout演示
xuexiangjys Mar 19, 2020
a6350a2
修复AdapterItem可能存在的问题
xuexiangjys Mar 21, 2020
833548a
删除wiki图片
xuexiangjys Mar 24, 2020
be78ca6
调整快捷搜索功能页面
xuexiangjys Mar 31, 2020
14e93ba
修改多个页面的启动模式
xuexiangjys Apr 1, 2020
10dcaeb
MaterialEditText增加支持下划线高度设置的属性
xuexiangjys Apr 1, 2020
d84066f
增加控件自定义动画
xuexiangjys Apr 1, 2020
828dcf7
增加NestedScrollingParent2使用
xuexiangjys Apr 6, 2020
3ab59a4
完善vlayout的使用案例
xuexiangjys Apr 6, 2020
cdd6df0
完善阿里巴巴组件使用案例
xuexiangjys Apr 6, 2020
b589073
完善阿里巴巴组件使用案例
xuexiangjys Apr 8, 2020
d12d30c
完善阿里巴巴组件使用案例
xuexiangjys Apr 9, 2020
9508882
增加复杂嵌套滚动效果案例
xuexiangjys Apr 12, 2020
f86a4b0
增加内容
xuexiangjys Apr 18, 2020
c6fea3a
优化选项卡使用案例
xuexiangjys Apr 20, 2020
021088d
增加粘顶嵌套滚动布局使用案例
xuexiangjys Apr 24, 2020
6598a0a
增加多状态布局加载者
xuexiangjys Apr 28, 2020
30025c6
完善多状态布局加载者演示
xuexiangjys Apr 29, 2020
a99896e
粘顶效果的多种实现方式演示
xuexiangjys May 2, 2020
0df7ace
增加工具类
xuexiangjys May 2, 2020
f80b6d8
解决图片预览可能存在的崩溃问题
xuexiangjys May 3, 2020
0ca0e24
优化代码,提高代码质量
xuexiangjys May 3, 2020
0823acb
优化代码,提高代码质量
xuexiangjys May 7, 2020
624f79d
优化代码,提高代码质量
xuexiangjys May 8, 2020
2dd304a
增加工具类
May 13, 2020
9b08517
优化代码,提高代码质量
xuexiangjys May 13, 2020
c3a9680
升级target版本为29
xuexiangjys May 13, 2020
700f61e
升级字体库版本
xuexiangjys May 19, 2020
10b0d3e
增加自动断字演示
xuexiangjys May 19, 2020
88a96b6
完善组件
xuexiangjys May 20, 2020
513361f
设置存储兼容模式
xuexiangjys May 20, 2020
71128d2
增加ViewPager2使用案例
May 29, 2020
8782ae8
升级XUtil库的版本
xuexiangjys Jun 5, 2020
6bfc161
发布1.1.4版本
xuexiangjys Jun 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
完善阿里巴巴组件使用案例
  • Loading branch information
xuexiangjys committed Apr 9, 2020
commit d12d30c80a07666bcfc4fed6482fe787c7042141
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ C*y | 1¥ | 微信
*毛 | 6.66¥ | 微信
*凯 | 10¥ | 微信
r*o | 8.88¥ | 微信
T*8 | 7.77¥ | 微信
v*d | 20¥ | 微信

## 联系方式

Expand Down
167 changes: 167 additions & 0 deletions app/src/main/assets/alibaba/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,172 @@
"style": {
"bgColor": "#299ee3"
}
},
{
"type": "container-scrollFix",
"items": [
{
"type": "CustomCell",
"text": "滚动固定View",
"imageUrl": "https://gw.alicdn.com/tfs/TB1vqF.PpXXXXaRaXXXXXXXXXXX-110-72.png",
"style": {
"width": "120"
}
}
],
"style": {
"x": 20,
"y": 20,
"showType": "showOnEnter"
}
},
{
"type": "container-float",
"items": [
{
"type": "InterfaceCell",
"text": "浮动View",
"style": {
"width": "120"
}
}
],
"style": {
"align": "bottom_right",
"x": 20,
"y": 20
}
},
{
"type": "container-fix",
"items": [
{
"type": "AnnotationCell",
"text": "固定View",
"style": {
"width": "120"
}
}
],
"style": {
"align": "top_right",
"x": 20,
"y": 20
}
},
{
"type": "container-banner",
"items": [
{
"type": "InterfaceCell",
"text": "轮播滚动View"
},
{
"type": "InterfaceCell",
"text": "轮播滚动View"
},
{
"type": "InterfaceCell",
"text": "轮播滚动View"
},
{
"type": "InterfaceCell",
"text": "轮播滚动View"
}
],
"style": {
"itemRatio": 2.4,
"pageRatio": 1,
"autoScroll": 3000,
"specialInterval": {
"0": 2000,
"1": 1000
},
"infinite": true,
"indicatorImg1": "https://img.alicdn.com/tps/TB16i4qNXXXXXbBXFXXXXXXXXXX-32-4.png",
"indicatorImg2": "https://img.alicdn.com/tps/TB1XRNFNXXXXXXKXXXXXXXXXXXX-32-4.png",
"indicatorGravity": "center",
"indicatorPosition": "inside",
"indicatorGap": 5,
"indicatorMargin": 8,
"indicatorHeight": 2,
"scrollMarginLeft": 50,
"scrollMarginRight": 50,
"hGap": 10
}
},
{
"type": "container-scroll",
"items": [
{
"type": "AnnotationCell",
"text": "横向滚动View"
},
{
"type": "AnnotationCell",
"text": "横向滚动View"
},
{
"type": "AnnotationCell",
"text": "横向滚动View"
},
{
"type": "AnnotationCell",
"text": "横向滚动View"
}
],
"style": {
"pageWidth": 150,
"pageHeight": -1,
"hasIndicator": true,
"indicatorColor": "#FF0000",
"defaultIndicatorColor": "#666666"
}
},
{
"type": "container-waterfall",
"items": [
{
"type": "CustomCell",
"text": "瀑布流",
"imageUrl": "https://gw.alicdn.com/tfs/TB1vqF.PpXXXXaRaXXXXXXXXXXX-110-72.png"
},
{
"type": "CustomCell",
"text": "瀑布流",
"imageUrl": "https://gw.alicdn.com/tfs/TB1vqF.PpXXXXaRaXXXXXXXXXXX-110-72.png",
"style": {
"ratio": 1
}
},
{
"type": "CustomCell",
"text": "瀑布流",
"imageUrl": "https://gw.alicdn.com/tfs/TB1vqF.PpXXXXaRaXXXXXXXXXXX-110-72.png",
"style": {
"ratio": 1
}
},
{
"type": "CustomCell",
"text": "瀑布流",
"imageUrl": "https://gw.alicdn.com/tfs/TB1vqF.PpXXXXaRaXXXXXXXXXXX-110-72.png",
"style": {
"ratio": 1
}
}
],
"style": {
"margin": [
10,
10,
10,
10
],
"vGap": 10,
"hGap": 10,
"bgColor": "#CC00FF00",
"column": 2
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

import com.tmall.wireless.tangram.TangramBuilder;
import com.tmall.wireless.tangram.TangramEngine;
import com.tmall.wireless.tangram.structure.viewcreator.ViewHolderCreator;
import com.tmall.wireless.tangram.util.IInnerImageSetter;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xui.widget.actionbar.TitleBar;
Expand All @@ -38,6 +40,9 @@
import com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.model.CustomCellView;
import com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.support.CustomClickSupport;
import com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.CustomInterfaceView;
import com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.support.CustomExposureSupport;
import com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.viewholder.CustomHolderCell;
import com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.viewholder.CustomViewHolder;
import com.xuexiang.xuidemo.utils.Utils;
import com.xuexiang.xutil.resource.ResourceUtils;

Expand All @@ -48,7 +53,7 @@

/**
* Tangram-Android使用步骤
*
* <p>
* 1.初始化 Tangram 环境
* 2.初始化 TangramBuilder
* 3.注册自定义的卡片和组件
Expand Down Expand Up @@ -92,17 +97,20 @@ public <IMAGE extends ImageView> void doLoadImageUrl(@NonNull IMAGE view,
// 3.注册自定义的卡片和组件
/// 使用接口方式的自定义View
builder.registerCell("InterfaceCell", CustomInterfaceView.class);
builder.registerCell("NoBackground", NoBackgroundView.class);
/// 使用注解方式的自定义View
builder.registerCell("AnnotationCell", CustomAnnotationView.class);
/// 自定义model组件
builder.registerCell("CustomCell", CustomCell.class, CustomCellView.class);
builder.registerCell("NoBackground", NoBackgroundView.class);
builder.registerCell("CustomHolderCell", CustomHolderCell.class,
new ViewHolderCreator<>(R.layout.tangram_item_holder, CustomViewHolder.class, TextView.class));

// 4.生成TangramEngine实例
mEngine = builder.build();

// 5.绑定业务 support 类到 engine
mEngine.addSimpleClickSupport(new CustomClickSupport());
mEngine.addExposureSupport(new CustomExposureSupport());

// 6.绑定 recyclerView
mEngine.bindView(recyclerView);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.support;

import android.util.Log;
import android.view.View;

import androidx.annotation.NonNull;

import com.tmall.wireless.tangram.dataparser.concrete.Card;
import com.tmall.wireless.tangram.structure.BaseCell;
import com.tmall.wireless.tangram.support.ExposureSupport;

/**
* @author SunQiang
* @since 2019-04-22
*/

/**
* 自定义曝光事件
*
* @author xuexiang
* @since 2020/4/10 1:13 AM
*/
public class CustomExposureSupport extends ExposureSupport {

private static final String TAG = "CustomExposureSupport";

public CustomExposureSupport() {
setOptimizedMode(true);
}

/**
* 布局的整体曝光
*
* @param card
* @param offset
* @param position
*/
@Override
public void onExposure(@NonNull Card card, int offset, int position) {
Log.e(TAG, "onExposure: card=" + card.getClass().getSimpleName() + ", offset=" + offset + ", position=" + position);
}

/**
* 布局的整体曝光
*
* @param targetView
* @param cell
* @param type
*/
@Override
public void defaultExposureCell(@NonNull View targetView, @NonNull BaseCell cell, int type) {
Log.e(TAG, "defaultExposureCell: targetView=" + targetView.getClass().getSimpleName() + ", pos=" + cell.pos + ", type=" + type);
}

/**
* 组件的局部区域曝光
*
* @param targetView
* @param cell
* @param type
*/
@Override
public void defaultTrace(@NonNull View targetView, @NonNull BaseCell cell, int type) {
Log.e(TAG, "defaultTrace: targetView=" + targetView.getClass().getSimpleName() + ", pos=" + cell.pos + ", type=" + type);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.xuexiang.xuidemo.fragment.expands.alibaba.tangram.viewholder;

import android.widget.TextView;

import androidx.annotation.NonNull;

import com.tmall.wireless.tangram.structure.BaseCell;
import com.tmall.wireless.tangram.support.ExposureSupport;

import java.util.Locale;

/**
* 自定义ViewHolder的model
*
* @author xuexiang
* @since 2020/4/10 12:39 AM
*/
public class CustomHolderCell extends BaseCell<TextView> {

@Override
public void bindView(@NonNull TextView view) {
if (pos % 2 == 0) {
view.setBackgroundColor(0xff000fff);
} else {
view.setBackgroundColor(0xfffff000);
}
view.setText(String.format(Locale.CHINA, "%s%d: %s", getClass().getSimpleName(), pos, optParam("text")));
view.setOnClickListener(this);
if (serviceManager != null) {
ExposureSupport exposureSupport = serviceManager.getService(ExposureSupport.class);
if (exposureSupport != null) {
exposureSupport.onTrace(view, this, type);
}
}
}
}
Loading