-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
104 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/kotlin/moe/tlaster/openween/core/model/attitude/AttitudeListModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package moe.tlaster.openween.core.model.attitude | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import moe.tlaster.openween.core.model.BaseListModel | ||
import moe.tlaster.openween.core.model.status.MessageModel | ||
|
||
/** | ||
* Created by Asahi on 16/12/01. | ||
*/ | ||
class AttitudeListModel : BaseListModel() { | ||
@SerializedName("attitudes") | ||
var attitudes: List<AttitudeModel>? = null | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/kotlin/moe/tlaster/openween/core/model/attitude/AttitudeModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package moe.tlaster.openween.core.model.attitude | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import moe.tlaster.openween.core.model.BaseModel | ||
import moe.tlaster.openween.core.model.status.MessageModel | ||
|
||
/** | ||
* Created by Asahi on 16/12/01. | ||
*/ | ||
class AttitudeModel : BaseModel() { | ||
@SerializedName("attitude") | ||
var attitude: String = "" | ||
@SerializedName("attitude_type") | ||
var attitudeType: Int = -1 | ||
@SerializedName("last_attitude") | ||
var lastAttitude: String = "" | ||
@SerializedName("status") | ||
var status: MessageModel? = null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/kotlin/moe/tlaster/openween/fragment/main/Attitude.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package moe.tlaster.openween.fragment.main | ||
|
||
import com.chad.library.adapter.base.BaseQuickAdapter | ||
import com.chad.library.adapter.base.BaseViewHolder | ||
import com.mikepenz.google_material_typeface_library.GoogleMaterial | ||
import com.mikepenz.iconics.typeface.IIcon | ||
import moe.tlaster.openween.adapter.BaseModelAdapter | ||
import moe.tlaster.openween.core.api.attitudes.Attitudes | ||
import moe.tlaster.openween.core.model.attitude.AttitudeListModel | ||
import moe.tlaster.openween.core.model.attitude.AttitudeModel | ||
import moe.tlaster.openween.fragment.WeiboListBase | ||
|
||
/** | ||
* Created by Asahi on 16/12/01. | ||
*/ | ||
class Attitude(override val icon: IIcon = GoogleMaterial.Icon.gmd_thumb_up) : WeiboListBase<AttitudeModel>() { | ||
|
||
override fun initAdapter(): BaseQuickAdapter<AttitudeModel, BaseViewHolder> { | ||
return BaseModelAdapter() | ||
} | ||
|
||
override fun loadMoreOverride(callback: Callback<List<AttitudeModel>>) { | ||
Attitudes.likeToMe(count = mLoadCount, max_id = mAdapter?.data?.last()?.id!!, callback = object : WeiboListCallback<AttitudeListModel>() { | ||
override fun onResponse(response: AttitudeListModel, id: Int) { | ||
response.attitudes = response.attitudes?.subList(1, response.attitudes?.lastIndex!!) | ||
callback.onResponse(response.attitudes!!, response.totalNumber) | ||
} | ||
}) | ||
} | ||
|
||
override fun refreshOverride(callback: Callback<List<AttitudeModel>>) { | ||
Attitudes.likeToMe(count = mLoadCount, callback = object : WeiboListCallback<AttitudeListModel>() { | ||
override fun onResponse(response: AttitudeListModel, id: Int) { | ||
callback.onResponse(response.attitudes!!, response.totalNumber) | ||
} | ||
}) | ||
} | ||
} |