Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LoggableItemSelectedListener.java « impl « gallery « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 892cae6892538a6cc1b9259da1db834083bbeccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.mapswithme.maps.gallery.impl;

import android.app.Activity;
import androidx.annotation.NonNull;

import com.mapswithme.maps.discovery.ItemType;
import com.mapswithme.maps.gallery.Items;

public abstract class LoggableItemSelectedListener<I extends Items.Item> extends BaseItemSelectedListener<I>
{
  @NonNull
  private final ItemType mType;

  public LoggableItemSelectedListener(@NonNull Activity context, @NonNull ItemType type)
  {
    super(context);
    mType = type;
  }

  @Override
  public final void onMoreItemSelected(@NonNull I item)
  {
    super.onMoreItemSelected(item);
    onMoreItemSelectedInternal(item);
    mType.getMoreClickEvent().log();
  }

  @Override
  public final void onItemSelected(@NonNull I item, int position)
  {
    super.onItemSelected(item, position);
    onItemSelectedInternal(item, position);
    mType.getItemClickEvent().log();
  }

  @NonNull
  protected ItemType getType()
  {
    return mType;
  }

  protected abstract void onMoreItemSelectedInternal(@NonNull I item);

  protected abstract void onItemSelectedInternal(@NonNull I item, int position);
}