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

TransitSchemeState.java « subway « maplayer « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aec8f96b42963506901dbdd2cdaf56aa7a1706a5 (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
package com.mapswithme.maps.maplayer.subway;

import android.support.annotation.NonNull;
import android.widget.Toast;

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

public enum TransitSchemeState
{
  DISABLED,
  ENABLED
      {
        @Override
        public void onReceived(@NonNull MwmApplication app)
        {
          Statistics.INSTANCE.trackSubwayEvent(Statistics.ParamValue.SUCCESS);
        }
      },
  NO_DATA
      {
        @Override
        public void onReceived(@NonNull MwmApplication app)
        {
          Toast.makeText(app, R.string.subway_data_unavailable, Toast.LENGTH_SHORT).show();
          Statistics.INSTANCE.trackSubwayEvent(Statistics.ParamValue.UNAVAILABLE);
        }
      };

  @NonNull
  public static TransitSchemeState makeInstance(int index)
  {
    if (index < 0 || index >= TransitSchemeState.values().length)
      throw new IllegalArgumentException("No value for index = " + index);
    return TransitSchemeState.values()[index];
  }

  public void onReceived(@NonNull MwmApplication app)
  {
    /* Do nothing by default */
  }
}