added vote dialog
This commit is contained in:
@@ -71,7 +71,7 @@ public final class AdMarkHolder extends BaseNewsEntryHolder<NewsEntry> {
|
||||
this.F.setText(disclamer);
|
||||
}
|
||||
|
||||
private static void voteDialog(int ownerId, int postId, Context ctx) {
|
||||
public static void voteDialog(int ownerId, int postId, Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle("SponsorPost")
|
||||
.setMessage("Этот пост является рекламным?")
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
package ru.vtosters.hooks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.vk.dto.newsfeed.entries.NewsEntry;
|
||||
import com.vk.dto.newsfeed.entries.Post;
|
||||
import com.vk.newsfeed.NewsEntryActionsAdapter;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import com.vk.newsfeed.holders.AdMarkHolder;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
|
||||
public class PostsMenuHook {
|
||||
private static final int id = 200;
|
||||
|
||||
public static void injectList(NewsEntryActionsAdapter actionsAdapter, NewsEntry newsEntry) {
|
||||
actionsAdapter.a(id, "SponsorPost");
|
||||
if (newsEntry instanceof Post) {
|
||||
int ownerId = ((Post) newsEntry).b();
|
||||
|
||||
if (ownerId != AccountManagerUtils.getUserId()) {
|
||||
actionsAdapter.a(id, "SponsorPost");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void injectButtons(int i, NewsEntry newsEntry) {
|
||||
AndroidUtils.sendToast("SponsorPost");
|
||||
public static void injectButtons(int i, NewsEntry newsEntry, Context context) {
|
||||
if (newsEntry instanceof Post) {
|
||||
Post post = (Post) newsEntry;
|
||||
int ownerId = post.b();
|
||||
int postId = post.P1();
|
||||
|
||||
AdMarkHolder.voteDialog(ownerId, postId, context);
|
||||
} else {
|
||||
Log.d("PostsMenuHook", "unsupported instance");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCustomButton(int i) {
|
||||
|
||||
@@ -897,7 +897,7 @@
|
||||
|
||||
if-eqz v2, :cond_99
|
||||
|
||||
invoke-static {p1, p2}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
invoke-static {p1, p2, v0}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;Landroid/content/Context;)V
|
||||
|
||||
return-void
|
||||
|
||||
|
||||
@@ -2866,7 +2866,7 @@
|
||||
|
||||
if-eqz v3, :cond_20
|
||||
|
||||
invoke-static {p2, p3}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
invoke-static {p2, p3, v2}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;Landroid/content/Context;)V
|
||||
|
||||
goto/16 :goto_1
|
||||
|
||||
|
||||
@@ -3803,7 +3803,7 @@
|
||||
|
||||
if-eqz v3, :cond_20
|
||||
|
||||
invoke-static {p1, v4}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
invoke-static {p1, v4, v0}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;Landroid/content/Context;)V
|
||||
|
||||
goto/16 :goto_5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user