Exemplo n.º 1
0
 private void
     comprobarganador() { // si todas las lineas están tachadas y guardadas con 2, alguien ha
                          // ganado
   EasyTracker easyTracker = EasyTracker.getInstance(this);
   for (i = 0; i < 15; i++) {
     if (array[i] == 2) {
       contador++;
     }
   }
   if (contador == 15) {
     if (elturno == 1) {
       Toast toast3 =
           Toast.makeText(
               getApplicationContext(),
               getString(R.string.ganador) + " " + getString(R.string.jugadoruno),
               Toast.LENGTH_LONG);
       toast3.show();
       easyTracker.send(
           MapBuilder.createEvent("Accion", "Ganador", "Primer Jugador", null).build());
       gotomenu();
     } else {
       Toast toast3 =
           Toast.makeText(
               getApplicationContext(),
               getString(R.string.ganador) + " " + getString(R.string.jugadordos),
               Toast.LENGTH_LONG);
       toast3.show();
       easyTracker.send(
           MapBuilder.createEvent("Accion", "Ganador", "Segundo Jugador", null).build());
       gotomenu();
     }
   }
   contador = 0;
 }
Exemplo n.º 2
0
  public void sendAnalyticData(String screen_name) {

    tracker.send(
        MapBuilder.createAppView().set(Fields.SCREEN_NAME, HIT_TYPE + ": " + screen_name).build());

    easyTracker.set(Fields.SCREEN_NAME, HIT_TYPE + ": " + screen_name);

    easyTracker.send(MapBuilder.createAppView().build());
  }
  /**
   * **
   *
   * @param ctx Context.
   * @param eventCatagory Required. For e.g. ui_event, ux_event
   * @param eventName Required. Name of the event. For e.g. button_press
   * @param eventLabel
   * @param eventValue **
   */
  public static void trackEvent(
      Context ctx, String eventCatagory, String eventName, String eventLabel, long eventValue) {
    // May return null if a EasyTracker has not yet been initialized with a
    // property ID.
    EasyTracker easyTracker = EasyTracker.getInstance(ctx);

    // MapBuilder.createEvent().build() returns a Map of event fields and values
    // that are set and sent with the hit.
    easyTracker.send(
        MapBuilder.createEvent(
                eventCatagory, // Event category (required)
                eventName, // Event action (required)
                eventLabel, // Event label
                eventValue) // Event value
            .build());
  }
Exemplo n.º 4
0
        @Override
        public void onClick(View v) {
          sd.close();
          int index = (Integer) v.getTag();
          String className = classNames[index];
          FlurryAgent.logEvent(FlurryStrings.getEventNameForActivity(className));
          Activity currentActivity = (Activity) v.getContext();

          if (!currentActivity.getClass().getName().equals(className)) {
            Intent intent = new Intent();
            intent.setClassName(currentActivity, className);

            if (className.equals(HomeActivity.class.getName())) {
              intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            }

            if (className.equals(EventsAndPromotionsActivity.class.getName())) {
              intent.putExtra(
                  EventsAndPromotionsActivity.CURRENT_TYPE,
                  EventsAndPromotionsActivity.TYPE_PROMOTION);

              EasyTracker easyTracker = EasyTracker.getInstance(context);
              easyTracker.set(Fields.SCREEN_NAME, Const.GAStrings.DEALS_MAIN);
              easyTracker.send(MapBuilder.createAppView().build());
            }

            if (className.equals(ThingsToDo_MySentosaActivity.class.getName()))
              intent.putExtra(
                  ThingsToDo_MySentosaActivity.CURRENT_TYPE,
                  index == 1
                      ? ThingsToDo_MySentosaActivity.TYPE_THINGSTODO
                      : ThingsToDo_MySentosaActivity.TYPE_MYSENTOSA);

            if (className.equals(TicketsActivity.class.getName()))
              intent.putExtra(TicketsActivity.TICKET_TYPE, "Package");

            if (className.equals(IslanderActivity.class.getName())) {
              EasyTracker easyTracker = EasyTracker.getInstance(context);
              easyTracker.set(Fields.SCREEN_NAME, Const.GAStrings.ISLANDER_MAIN);
              easyTracker.send(MapBuilder.createAppView().build());
            }

            currentActivity.startActivity(intent);

          } else {
            // we have an exception here, EVENTS and PROMOTIONS use a same activity => code above
            // will not run in case moving from EVENTS to PROMOTIONS screen
            if (className.equals(EventsAndPromotionsActivity.class.getName())) {
              if (((EventsAndPromotionsActivity) currentActivity).isEvent()) {
                // Can not move from PROMOTIONS to EVENTS, only 1 way: EVENTS to PROMOTIONS
                Intent intent = new Intent();
                intent.setClassName(currentActivity, className);

                intent.putExtra(
                    EventsAndPromotionsActivity.CURRENT_TYPE,
                    EventsAndPromotionsActivity.TYPE_PROMOTION);

                EasyTracker easyTracker = EasyTracker.getInstance(context);
                easyTracker.set(Fields.SCREEN_NAME, Const.GAStrings.DEALS_MAIN);
                easyTracker.send(MapBuilder.createAppView().build());

                currentActivity.startActivity(intent);
              }
            }
          }
        }
Exemplo n.º 5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);

    int actionBarTitle = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
    TextView actionBarTitleView = (TextView) getWindow().findViewById(actionBarTitle);

    Typeface robotoBoldCondensedItalic =
        Typeface.createFromAsset(getAssets(), "fonts/Mallanna.ttf");
    if (actionBarTitleView != null) {
      actionBarTitleView.setTypeface(robotoBoldCondensedItalic);
    }

    setContentView(R.layout.eng_activity_main);

    FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/Mallanna.ttf");
    FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/Mallanna.ttf");
    FontsOverride.setDefaultFont(this, "SERIF", "fonts/Mallanna.ttf");
    FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/Mallanna.ttf");

    // Adding Google Analytics...
    easyTracker = EasyTracker.getInstance(EngSongs.this);
    easyTracker.send(
        MapBuilder.createEvent("TrackEventTest", "page_loaded", "main_page", null).build());

    try {
      int a[] = new int[2];
      int num = a[4];
    } catch (ArrayIndexOutOfBoundsException e) {
      easyTracker.send(
          MapBuilder.createException(
                  new StandardExceptionParser(EngSongs.this, null)
                      .getDescription(Thread.currentThread().getName(), e),
                  false)
              .build());
    }

    // Locate the Banner Ad in activity_main.xml
    AdView adView = (AdView) this.findViewById(R.id.adView);

    // Request for Ads
    AdRequest adRequest =
        new AdRequest.Builder()

            // Add a test device to show Test Ads

            .addTestDevice("2181F924609987B5E1B7117BAB38E3DA")
            .build();

    // Load ads into Banner Ads
    adView.loadAd(adRequest);

    // Load ads into Interstitial Ads

    // Prepare an Interstitial Ad Listener

    ll = (LinearLayout) findViewById(R.id.adLayoutView);
    if (isNetworkAvailable(getBaseContext())) {
      ll.setVisibility(LinearLayout.VISIBLE);

    } else {
      ll.setVisibility(LinearLayout.GONE);
    }

    Locale locale = new Locale("te");
    Locale.setDefault(locale);
    config = new Configuration();
    config.locale = locale;
    getBaseContext()
        .getResources()
        .updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());

    mfont = Typeface.createFromAsset(getAssets(), "fonts/Mallanna.ttf");

    Resources res = getResources();

    String lis[] = res.getStringArray(R.array.Eng_Alphabets);
    final List<String> Alphalist = Arrays.asList(lis);
    songlis = res.getStringArray(R.array.Eng_SongList);
    lv = (ListView) findViewById(R.id.listView1);
    lv2 = (ListView) findViewById(R.id.listView2);
    adapter = new ArrayAdapter<String>(EngSongs.this, R.layout.activity_listview, lis);

    lv.setAdapter(adapter);

    String str = songlis[0];
    String result[] = str.split(",");
    adapter2 = new ArrayAdapter<String>(EngSongs.this, R.layout.activity_listview, result);
    lv2.setAdapter(adapter2);

    LayoutAnimationController controller =
        AnimationUtils.loadLayoutAnimation(this, R.anim.list_layout_controller);
    lv2.setLayoutAnimation(controller);

    lv.setOnItemClickListener(this);
    lv2.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            song = position;
            Intent i = new Intent(getApplicationContext(), EngLyricDisp.class);
            i.putExtra("pos", "" + (indexes[letter] + song));

            startActivity(i);
          }
        });
  }
Exemplo n.º 6
0
 public static void trackView(Context context, String screenName) {
   EasyTracker tracker = EasyTracker.getInstance(context);
   tracker.set(Fields.SCREEN_NAME, screenName);
   tracker.send(MapBuilder.createAppView().build());
   tracker.set(Fields.SCREEN_NAME, null);
 }
Exemplo n.º 7
0
 public void onClick(View v) { // acción realizada al pulsar sobre un Imageview
   EasyTracker easyTracker = EasyTracker.getInstance(this);
   switch (v.getId()) {
     case R.id.imageView1: // 1 fila //
       numimagen = 0;
       break;
     case R.id.imageView2: // 2 fila //
       numimagen = 1;
       break;
     case R.id.ImageView01:
       numimagen = 2;
       break;
     case R.id.ImageView04: // 3 fila //
       numimagen = 3;
       break;
     case R.id.ImageView02:
       numimagen = 4;
       break;
     case R.id.ImageView03:
       numimagen = 5;
       break;
     case R.id.ImageView08: // 4 fila//
       numimagen = 6;
       break;
     case R.id.ImageView06:
       numimagen = 7;
       break;
     case R.id.ImageView05:
       numimagen = 8;
       break;
     case R.id.ImageView07:
       numimagen = 9;
       break;
     case R.id.ImageView13: // 5 fila //
       numimagen = 10;
       break;
     case R.id.ImageView09:
       numimagen = 11;
       break;
     case R.id.ImageView10:
       numimagen = 12;
       break;
     case R.id.ImageView11:
       numimagen = 13;
       break;
     case R.id.ImageView12:
       numimagen = 14;
       break;
   }
   ImageView imagen = (ImageView) findViewById(v.getId()); // se lee la imagen pulsada
   if (array[numimagen] == 0) {
     array[numimagen] = 1;
     if (comprobar() == 0) { // se comprueba que no se haya pulsado en vertical o diagonal
       array[numimagen] = 0;
     } else {
       easyTracker.send(MapBuilder.createEvent("Accion", "Lineas", "linea tachada", null).build());
       imagen.setImageResource(R.drawable.linea2); // se cambia la imagen de la linea tachada
     }
   } else if (array[numimagen] == 1) { // código para des-tachar lineas
     array[numimagen] = 0;
     easyTracker.send(
         MapBuilder.createEvent("Accion", "Lineas", "linea destachada", null).build());
     imagen.setImageResource(R.drawable.linea);
     linea = 0;
   }
 }
Exemplo n.º 8
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   EasyTracker easyTracker = EasyTracker.getInstance(this);
   // Handle presses on the action bar items
   if (getString(R.string.sign_out).equals(item.getTitle())) {
     easyTracker.send(MapBuilder.createEvent(TAG, MENU, "sign_out", null).build());
     Intent intent = new Intent(this, SignOutActivity.class);
     startActivity(intent);
     finish();
     return true;
   } else {
     switch (item.getItemId()) {
       case R.id.refresh:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "refresh", null).build());
         refresh();
         return true;
       case R.id.latest_news:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "latest_news", null).build());
         setSelectedNewsUrl(TODAYS_NEWS);
         refresh();
         return true;
       case R.id.trending_news:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "trending_news", null).build());
         setSelectedNewsUrl(TRENDING_NEWS);
         refresh();
         return true;
       case R.id.send_mail:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "send_mail", null).build());
         sendEmail(
             new String[] {""},
             "Newspin",
             "Newspin is a rad application",
             "What are your thoughts about "
                 + currentNews
                 + "\n\n\n\n"
                 + "My life hasn't been the same since Newspin. Download Newspin from the google play store at https://play.google.com/store/apps/details?id=com.ak.newstag");
         return true;
       case R.id.rate_app:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "rate_app", null).build());
         rateApp();
         return true;
       case R.id.tag:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "tag", null).build());
         loadTags();
         return true;
       case R.id.business_standard:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "business_standard", null).build());
         setSelectedNewsUrl(Business_Standard);
         refresh();
         return true;
       case R.id.economic_times_india:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "economic_times_india", null).build());
         setSelectedNewsUrl(Economic_Times_of_India);
         refresh();
         return true;
       case R.id.indian_express_finance:
         easyTracker.send(
             MapBuilder.createEvent(TAG, MENU, "indian_express_finance", null).build());
         setSelectedNewsUrl(Indian_Express);
         refresh();
         return true;
       case R.id.live_mint:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "live_mint", null).build());
         setSelectedNewsUrl(Live_mint);
         refresh();
         return true;
       case R.id.money_control:
         easyTracker.send(MapBuilder.createEvent(TAG, MENU, "money_control", null).build());
         setSelectedNewsUrl(Money_Control);
         refresh();
         return true;
       case R.id.hindustan_times_business:
         easyTracker.send(
             MapBuilder.createEvent(TAG, MENU, "hindustan_times_business", null).build());
         setSelectedNewsUrl(HINDUSTAN_TIMES);
         refresh();
         return true;
       default:
         return super.onOptionsItemSelected(item);
     }
   }
 }