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

TaxiType.java « taxi « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08bb300c3808b69f3801205d5bb98aa2631d1d0d (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
package com.mapswithme.maps.taxi;

import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;

import com.mapswithme.maps.R;
import com.mapswithme.util.Utils;

public enum TaxiType
{
  UBER
      {
        @NonNull
        public String getPackageName()
        {
          return "com.ubercab";
        }

        @NonNull
        public Utils.PartnerAppOpenMode getOpenMode()
        {
          return Utils.PartnerAppOpenMode.Direct;
        }

        @DrawableRes
        public int getIcon()
        {
          return R.drawable.ic_logo_uber;
        }

        @StringRes
        public int getTitle()
        {
          return R.string.uber;
        }

        @NonNull
        public String getProviderName()
        {
          return "Uber";
        }
      },
  YANDEX(new LocaleDependentFormatPriceStrategy(), true)
      {
        @NonNull
        public String getPackageName()
        {
          return "ru.yandex.taxi";
        }

        @NonNull
        public Utils.PartnerAppOpenMode getOpenMode()
        {
          return Utils.PartnerAppOpenMode.Indirect;
        }

        @DrawableRes
        public int getIcon()
        {
          return R.drawable.ic_logo_yandex_taxi;
        }

        @StringRes
        public int getTitle()
        {
          return R.string.yandex_taxi_title;
        }

        @NonNull
        public String getProviderName()
        {
          return "Yandex";
        }
      },
  MAXIM(true)
      {
        @NonNull
        public String getPackageName()
        {
          return "com.taxsee.taxsee";
        }

        @NonNull
        public Utils.PartnerAppOpenMode getOpenMode()
        {
          return Utils.PartnerAppOpenMode.Direct;
        }

        @DrawableRes
        public int getIcon()
        {
          return R.drawable.ic_taxi_logo_maksim;
        }

        @StringRes
        public int getTitle()
        {
          return R.string.maxim_taxi_title;
        }

        @NonNull
        public String getProviderName()
        {
          return "Maxim";
        }
      },
  TAXI_VEZET(R.string.place_page_starting_from, new LocaleDependentFormatPriceStrategy(), true)
      {
        @NonNull
        public String getPackageName()
        {
          return "ru.rutaxi.vezet";
        }

        @NonNull
        public Utils.PartnerAppOpenMode getOpenMode()
        {
          return Utils.PartnerAppOpenMode.Direct;
        }

        @DrawableRes
        public int getIcon()
        {
          return R.drawable.ic_taxi_logo_vezet;
        }

        @StringRes
        public int getTitle()
        {
          return R.string.vezet_taxi;
        }

        @NonNull
        public String getProviderName()
        {
          return "Vezet";
        }
      };

  @StringRes
  private final int mWaitingTemplateResId;
  @NonNull
  private final FormatPriceStrategy mFormatPriceStrategy;
  private final boolean mPriceApproximated;

  TaxiType(@StringRes int waitingTemplateResId, @NonNull FormatPriceStrategy strategy,
           boolean priceApproximated)
  {
    mWaitingTemplateResId = waitingTemplateResId;
    mFormatPriceStrategy = strategy;
    mPriceApproximated = priceApproximated;
  }

  TaxiType(@NonNull FormatPriceStrategy strategy, boolean priceApproximated)
  {
    this(R.string.taxi_wait, strategy, priceApproximated);
  }

  TaxiType(boolean priceApproximated)
  {
    this(new DefaultFormatPriceStrategy(), priceApproximated);
  }

  TaxiType()
  {
    this(false);
  }

  @NonNull
  public abstract String getPackageName();

  @NonNull
  public abstract Utils.PartnerAppOpenMode getOpenMode();

  @DrawableRes
  public abstract int getIcon();

  @StringRes
  public abstract int getTitle();

  @NonNull
  public abstract String getProviderName();

  @StringRes
  public int getWaitingTemplateResId()
  {
    return mWaitingTemplateResId;
  }

  public boolean isPriceApproximated()
  {
    return mPriceApproximated;
  }

  @NonNull
  public FormatPriceStrategy getFormatPriceStrategy()
  {
    return mFormatPriceStrategy;
  }
}