Skip to content

Commit

Permalink
add TMarker.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamsiree committed Apr 1, 2020
1 parent 9eaa197 commit f804a50
Show file tree
Hide file tree
Showing 100 changed files with 1,733 additions and 291 deletions.
1 change: 1 addition & 0 deletions RxDemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".activity.ActivityTMarker"></activity>
<activity android:name=".activity.ActivityTLoadingView" />
<activity android:name=".activity.ActivityTStepperIndicator" />
<activity android:name=".activity.ActivityTCardGallery" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ActivityPopupView : ActivityBase(), TipListener {
mRxPopupViewManager?.findAndDismiss(text_view)
builder = RxPopupView.Builder(this, text_view, parent_layout, text, RxPopupView.POSITION_LEFT_TO)
builder.setBackgroundColor(resources.getColor(R.color.greenyellow))
builder.setTextColor(resources.getColor(R.color.black))
builder.setTextColor(resources.getColor(R.color.Black))
builder.setGravity(RxPopupView.GRAVITY_CENTER)
builder.setTextSize(12)
tipvView = mRxPopupViewManager?.show(builder.build())!!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.tamsiree.rxdemo.activity

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.tamsiree.rxdemo.R
import com.tamsiree.rxdemo.adapter.AdapterTMarker
import com.tamsiree.rxdemo.repository.RepositoryDummySwipe
import com.tamsiree.rxdemo.viewholder.ViewHolderSwipeable
import com.tamsiree.rxui.activity.ActivityBase
import com.tamsiree.rxui.view.mark.TMarker
import kotlinx.android.synthetic.main.activity_tmarker.*

class ActivityTMarker : ActivityBase() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_tmarker)
}

override fun initView() {
val tMarker = TMarker.with(covertConfig)
.setIsActiveCallback {
it is ViewHolderSwipeable && repository.isActive(it.adapterPosition)
}
.doOnSwipe { viewHolder, _ ->
repository.toggleActiveState(viewHolder.adapterPosition)
}
.attachTo(recyclerView)

recyclerView.adapter = AdapterTMarker(tMarker)
recyclerView.layoutManager = LinearLayoutManager(this)
}

override fun initData() {

}

private val covertConfig = TMarker.Config(
iconRes = R.drawable.ic_star_border_black_24dp,
iconDefaultColorRes = android.R.color.black,
actionColorRes = R.color.colorPrimary
)

private val repository = RepositoryDummySwipe()

}
35 changes: 35 additions & 0 deletions RxDemo/src/main/java/com/tamsiree/rxdemo/adapter/AdapterTMarker.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.tamsiree.rxdemo.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.tamsiree.rxdemo.R
import com.tamsiree.rxdemo.viewholder.ViewHolderSwipeable
import com.tamsiree.rxui.view.mark.TMarker


class AdapterTMarker(
private val covert: TMarker
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
ViewHolderSwipeable(
itemView = LayoutInflater.from(viewGroup.context).inflate(R.layout.viewholder_swipeable, viewGroup, false))


override fun getItemCount(): Int = 50

override fun onBindViewHolder(viewHolder: RecyclerView.ViewHolder, index: Int) {
covert.drawCornerFlag(viewHolder)

(viewHolder as? ViewHolderSwipeable)?.apply(ViewHolderSwipeable::bind)
}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: List<Any>) {
// The following is an optimisation for Covert, allowing us to skip re-binding of
// ViewHolders if only drawing the child
if (!payloads.contains(TMarker.SKIP_FULL_BIND_PAYLOAD)) {
onBindViewHolder(holder, position)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FragmentDemo : FragmentLazy, OnRefreshListener {
recyclerViewDemo.addItemDecoration(RxRecyclerViewDividerTool(RxImageTool.dp2px(5f)))
mAdapter = AdapterRecyclerViewMain(mDemoList, object : ContentListener {
override fun setListener(position: Int) {
RxActivityTool.skipActivity(mContext, mDemoList!![position].activity)
RxActivityTool.skipActivity(mContext, mDemoList!![position].activity, null, true)
}
})
mAdapter!!.openLoadAnimation(BaseQuickAdapter.SCALEIN)
Expand Down Expand Up @@ -144,6 +144,7 @@ class FragmentDemo : FragmentLazy, OnRefreshListener {
mDemoList!!.add(ModelDemo("卡片画廊效果", R.drawable.circle_outlook, ActivityTCardGallery::class.java))
mDemoList!!.add(ModelDemo("步骤指示器", R.drawable.circle_indicator, ActivityTStepperIndicator::class.java))
mDemoList!!.add(ModelDemo("加载中视图", R.drawable.circle_indicator, ActivityTLoadingView::class.java))
mDemoList!!.add(ModelDemo("左滑标记", R.drawable.circle_indicator, ActivityTMarker::class.java))
mDemoList!!.add(ModelDemo("其他界面效果", R.drawable.circle_icecandy, ActivityOtherEffect::class.java))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.tamsiree.rxdemo.repository

/**
* Class which acts in place of something which would perform a swipe action
*/
class RepositoryDummySwipe {

private val activeStates: MutableMap<Int, Boolean> = hashMapOf()

fun toggleActiveState(index: Int) {
activeStates[index] = !(activeStates[index] ?: false)
}

fun isActive(index: Int): Boolean = activeStates[index] ?: false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.tamsiree.rxdemo.viewholder

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import kotlinx.android.synthetic.main.viewholder_swipeable.view.*

class ViewHolderSwipeable(
itemView: View
) : RecyclerView.ViewHolder(itemView) {

fun bind() {
Glide.with(itemView)
.load("http://i.imgur.com/34vQcpZ.png")
.apply(RequestOptions.circleCropTransform())
.into(itemView.profileImageView)
}
}
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/drawable/bg_btn_login_selected.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</shape></item>

<item android:state_enabled="false"><shape>
<solid android:color="@color/c" />
<solid android:color="@color/C" />
<corners android:radius="6dp" />
</shape></item>

Expand Down
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/drawable/circle_blue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
android:width="@dimen/shopping_cart_circle_size"
android:height="@dimen/shopping_cart_circle_size"/>
<stroke
android:color="@color/light_black"
android:color="@color/Gray38"
android:width="5dp"/>
</shape>
9 changes: 9 additions & 0 deletions RxDemo/src/main/res/drawable/ic_star_border_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z" />
</vector>
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/drawable/map_button_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<stroke android:width="1dp"
android:color="@android:color/darker_gray"/>

<solid android:color="@color/white"/>
<solid android:color="@color/White" />
<corners android:radius="2dp"/>

</shape>
Expand Down
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/layout/activity_ali_pay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:background="@color/White"
android:orientation="vertical"
tools:context=".activity.ActivityAliPay">

Expand Down
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/layout/activity_cobweb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/e"
android:background="@color/E"
android:orientation="vertical">

<com.tamsiree.rxui.view.RxTitle
Expand Down
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/layout/activity_contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:layout_height="@dimen/dp_55"
android:background="@color/colorPrimary"
app:title="联系人侧边栏快速导航"
app:titleColor="@color/white" />
app:titleColor="@color/White" />

<RelativeLayout
android:layout_width="match_parent"
Expand Down
4 changes: 2 additions & 2 deletions RxDemo/src/main/res/layout/activity_create_qrcode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:layout_height="@dimen/dp_55"
android:background="@color/colorPrimary"
app:title="动态生成码"
app:titleColor="@color/white" />
app:titleColor="@color/White" />

<LinearLayout
android:layout_width="fill_parent"
Expand Down Expand Up @@ -50,7 +50,7 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:background="@color/white"
android:background="@color/White"
android:gravity="center"
android:orientation="vertical">

Expand Down
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/layout/activity_device_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:layout_margin="10dp"
android:background="@drawable/shape_round_blue_tr_3dp"
android:text="获取手机信息"
android:textColor="@color/white"/>
android:textColor="@color/White" />

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
Expand Down
18 changes: 9 additions & 9 deletions RxDemo/src/main/res/layout/activity_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
android:background="@color/blue_shadow_50"
android:text="透明的弹窗"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogSure"
Expand All @@ -46,7 +46,7 @@
android:background="@color/pink_50"
android:text="确定的弹窗"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogSureCancle"
Expand All @@ -56,7 +56,7 @@
android:background="@color/blue_shadow_50"
android:text="确认取消的弹窗"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogEditTextSureCancle"
Expand All @@ -66,7 +66,7 @@
android:background="@color/pink_50"
android:text="输入框的弹窗"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogWheelYearMonthDay"
Expand All @@ -76,7 +76,7 @@
android:background="@color/blue_shadow_50"
android:text="可选择年月(日)"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogShapeLoading"
Expand All @@ -86,7 +86,7 @@
android:background="@color/pink_50"
android:text="三种形状的跳跃变换"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogLoadingProgressAcfunVideo"
Expand All @@ -96,7 +96,7 @@
android:background="@color/blue_shadow_50"
android:text="一只可爱的A站舰娘在拼命的奔跑"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogLoadingspinkit"
Expand All @@ -106,7 +106,7 @@
android:background="@color/pink_50"
android:text="一个常用加载Dialog"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

<Button
android:id="@+id/button_DialogScaleView"
Expand All @@ -116,7 +116,7 @@
android:background="@color/blue_shadow_50"
android:text="一个图片缩放Dialog"
android:textAllCaps="false"
android:textColor="@color/white" />
android:textColor="@color/White" />

</LinearLayout>

Expand Down
8 changes: 4 additions & 4 deletions RxDemo/src/main/res/layout/activity_elme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/shopping_cart_height"
android:layout_alignParentBottom="true"
android:background="@color/light_black"
android:background="@color/Gray38"
android:orientation="horizontal">

<TextView
Expand All @@ -36,7 +36,7 @@
android:layout_marginLeft="@dimen/shopping_cart_total_price_left_magrin"
android:text="120"
android:textAlignment="center"
android:textColor="@color/white"
android:textColor="@color/White"
android:textSize="@dimen/shopping_cart_total_price_word_size"
android:textStyle="bold"
android:visibility="gone"/>
Expand All @@ -53,7 +53,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/gray1">
android:background="@color/GrayE7">
</androidx.recyclerview.widget.RecyclerView>

<RelativeLayout
Expand Down Expand Up @@ -101,7 +101,7 @@
android:layout_alignRight="@id/shopping_cart_layout"
android:background="@drawable/small_red_circle"
android:text="1"
android:textColor="@color/white"
android:textColor="@color/White"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="gone"/>
Expand Down
4 changes: 2 additions & 2 deletions RxDemo/src/main/res/layout/activity_flight_seat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
android:clipToPadding="true"
android:fitsSystemWindows="true"
app:title="飞机票选座\n上海 - 长沙"
app:titleColor="@color/white"
app:titleColor="@color/White"
app:titleSize="12sp" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/a9"
android:background="@color/A9"
android:orientation="vertical">

<com.tamsiree.rxui.view.RxSeatAirplane
Expand Down
2 changes: 1 addition & 1 deletion RxDemo/src/main/res/layout/activity_location.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/black"
android:textColor="@color/Black"
android:textSize="18sp" />

</LinearLayout>
Expand Down
Loading

0 comments on commit f804a50

Please sign in to comment.