glagchatadapterは、魅惑的なリサイクルビューアダプターを簡単に実装できます。 Adapterをフラッグチャタダプターで拡張するだけで、いくつかの方法と出来上がりを暗示してください!あなたはあなたの携帯電話で最も美しい見た目のチャットを持っています。ゼロボイラープレートコード、変数を正しい方向に配置するだけです

FlagChatAdapterは、Maven、Gradle、または手動でインストールできます。
ステップ1。ビルドファイルにjitpackリポジトリを追加します
< repositories >
< repository >
< id >jitpack.io</ id >
< url >https://jitpack.io</ url >
</ repository >
</ repositories >ステップ2。依存関係を追加します
< dependency >
< groupId >com.github.salmaanahmed</ groupId >
< artifactId >FlagChatAdapter</ artifactId >
< version >1.0.1</ version >
</ dependency >ステップ1。ビルドファイルにjitpackリポジトリを追加します
allprojects {
repositories {
.. .
maven { url ' https://jitpack.io ' }
}
}ステップ2。依存関係を追加します
dependencies {
implementation ' com.github.salmaanahmed:FlagChatAdapter:1.0.1 '
}上記の依存関係マネージャーのいずれかを使用したくない場合は、Javaフォルダに含まれるファイルをプロジェクトに追加することで、FlagChatadapterを手動でプロジェクトに統合できます。
フラッグチャタダプターでアダプターを拡張し、コンテキストをアダプターに渡す
class ChatAdapter ( context : Context , private var list : ArrayList < Any >) : FlagChatAdapter(context)必要なメソッドと変数を実装します。 1つの行機能を書くのはそれほど単純ではありません;)詳細の説明のためにサンプルが表示される場合があります
// return chat message on the position passed as parameter
abstract fun chatMessage ( position : Int ): String
// return time of message as string format on the position passed as parameter
abstract fun messageTime ( position : Int ): String
// return message sender on the position passed as parameter, if its you, return true
abstract fun isMe ( position : Int ): Boolean
// you must have a variable of animation in the object i.e. if you want to animate or not
abstract fun animation ( position : Int ): Boolean
// the animation variable must be set to false when animation is performed once, otherwise flags will animate on every scroll
abstract fun setAnimationStatus ( position : Int , animationStatus : Boolean )
// Name of the sender
abstract val otherName : String
// You shall simply return list.size
abstract val listSize : Intまた、longclickeventsもあります
// You can implement whatever you want onLongClick event
abstract fun onMessageLongClicked ( position : Int )提供されたカスタマイズでチャットを美しくします。フラグの色を変更することもできます。実装が非常に簡単で、見た目は素晴らしいです。詳細については、サンプルアプリをご覧ください。
FlagChatAdapter MITライセンスの下で入手できます。詳細については、ライセンスファイルを参照してください。
プルリクエストは大歓迎です!最良の貢献は、典型的なアプリライフサイクル中にメインスレッドをブロックすることが知られているクラス/方法の代替または構成で構成されます。
あなたがあなたのアプリでglagchatadapterを使用しているかどうかを知りたいです、Salmaan Ahmedにメールを送ってください