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

PromoCategory.java « search « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38f87db252ea828f2bf7c0216f96b13da3871737 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.mapswithme.maps.search;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.text.TextUtils;

import com.mapswithme.maps.R;
import com.mapswithme.util.statistics.Statistics;

public enum PromoCategory
{
  LUGGAGE_HERO
      {
        @NonNull
        @Override
        String getKey()
        {
          return "luggagehero";
        }

        @Override
        int getStringId()
        {
          return R.string.luggage_storage;
        }

        @NonNull
        @Override
        String getStatisticValue()
        {
          return Statistics.ParamValue.LUGGAGE_HERO;
        }
      };

  @NonNull
  abstract String getKey();

  @StringRes
  abstract int getStringId();

  @NonNull
  abstract String getStatisticValue();

  @Nullable
  static PromoCategory findByStringId(@StringRes int nameId)
  {
    for (PromoCategory category : values())
    {
      if (category.getStringId() == nameId)
        return category;
    }
    return null;
  }

  @Nullable
  static PromoCategory findByKey(@Nullable String key)
  {
    if (TextUtils.isEmpty(key))
      return null;

    for (PromoCategory cat : values())
    {
      if (cat.getKey().equals(key))
        return cat;
    }
    return null;
  }
}