Initial commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package com.twitter.sdk.android.tweetui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.models.Tweet;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TweetActionBarView extends LinearLayout {
|
||||
final DependencyProvider a;
|
||||
ToggleImageButton b;
|
||||
ImageButton c;
|
||||
Callback<Tweet> d;
|
||||
|
||||
static class DependencyProvider {
|
||||
DependencyProvider() {
|
||||
}
|
||||
|
||||
TweetUi a() {
|
||||
return TweetUi.s();
|
||||
}
|
||||
}
|
||||
|
||||
public TweetActionBarView(Context context) {
|
||||
this(context, null, new DependencyProvider());
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.b = (ToggleImageButton) findViewById(R$id.tw__tweet_like_button);
|
||||
this.c = (ImageButton) findViewById(R$id.tw__tweet_share_button);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
a();
|
||||
}
|
||||
|
||||
void setLike(Tweet tweet) {
|
||||
TweetUi a = this.a.a();
|
||||
if (tweet != null) {
|
||||
this.b.setToggledOn(tweet.g);
|
||||
this.b.setOnClickListener(new LikeTweetAction(tweet, a, this.d));
|
||||
}
|
||||
}
|
||||
|
||||
void setOnActionCallback(Callback<Tweet> callback) {
|
||||
this.d = callback;
|
||||
}
|
||||
|
||||
void setShare(Tweet tweet) {
|
||||
TweetUi a = this.a.a();
|
||||
if (tweet != null) {
|
||||
this.c.setOnClickListener(new ShareTweetAction(tweet, a));
|
||||
}
|
||||
}
|
||||
|
||||
void setTweet(Tweet tweet) {
|
||||
setLike(tweet);
|
||||
setShare(tweet);
|
||||
}
|
||||
|
||||
public TweetActionBarView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, new DependencyProvider());
|
||||
}
|
||||
|
||||
TweetActionBarView(Context context, AttributeSet attributeSet, DependencyProvider dependencyProvider) {
|
||||
super(context, attributeSet);
|
||||
this.a = dependencyProvider;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user