public static void startDownload(
      Context context, Magazine magazine, boolean isTemp, String tempUrlKey) {
    String fileUrl = magazine.getItemUrl();
    String filePath = magazine.getItemPath();
    if (magazine.isSample()) {
      fileUrl = magazine.getSamplePdfUrl();
      filePath = magazine.getSamplePdfPath();
    } else if (isTemp) {
      fileUrl = tempUrlKey;
    }
    Log.d(
        TAG,
        "isSample: " + magazine.isSample() + "\nfileUrl: " + fileUrl + "\nfilePath: " + filePath);
    EasyTracker.getTracker().sendView("Downloading/" + FilenameUtils.getBaseName(filePath));
    DownloadManager dm = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
    DownloadManager.Request request = new DownloadManager.Request(Uri.parse(fileUrl));
    request
        .setVisibleInDownloadsUi(false)
        .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
        .setDescription(magazine.getSubtitle())
        .setTitle(magazine.getTitle() + (magazine.isSample() ? " Sample" : ""))
        .setDestinationInExternalFilesDir(context, null, FilenameUtils.getName(filePath));
    // TODO should use cache directory?
    magazine.setDownloadManagerId(dm.enqueue(request));

    MagazineManager magazineManager = new MagazineManager(context);
    magazineManager.removeDownloadedMagazine(context, magazine);
    magazineManager.addMagazine(magazine, Magazine.TABLE_DOWNLOADED_MAGAZINES, true);
    magazine.clearMagazineDir();
    EventBus.getDefault().post(new LoadPlistEvent());
  }
 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;
 }
  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());
  }
Beispiel #4
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    // Get the item that was clicked
    NSDictionary item = (NSDictionary) getListAdapter().getItem(position);

    NSObject action;
    if ((action = item.objectForKey("subcontent")) != null) {
      NSArrayWrapper wrapper = new NSArrayWrapper((NSArray) action);

      Intent intent = new Intent(this, Info.class);
      intent.putExtra("class", this.getClass().getCanonicalName());
      intent.putExtra(
          "tracking", getIntent().getStringExtra("tracking") + "/" + item.objectForKey("title"));
      intent.putExtra("content", wrapper);
      startActivity(intent);

    } else if ((action = item.objectForKey("url")) != null
        || (action = item.objectForKey("url-android")) != null) {
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(((NSString) action).toString()));
      // Handle external activities as described in
      // http://developer.android.com/training/implementing-navigation/descendant.html#external-activities
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

      // We can't call the code in the onCreate as we may be opening the play store, so track it
      // here.
      EasyTracker.getTracker()
          .sendView(getIntent().getStringExtra("tracking") + " > " + item.objectForKey("title"));
      Log.i(
          "Tracking", getIntent().getStringExtra("tracking") + " > " + item.objectForKey("title"));

      startActivity(intent);
    } else if ((action = item.objectForKey("html")) != null) {
      Intent intent = new Intent(this, InfoWebActivity.class);
      intent.putExtra("class", this.getClass().getCanonicalName());

      EasyTracker.getTracker()
          .sendView(getIntent().getStringExtra("tracking") + " > " + item.objectForKey("title"));
      Log.i(
          "Tracking", getIntent().getStringExtra("tracking") + " > " + item.objectForKey("title"));

      intent.putExtra("page", ((NSString) action).toString());
      startActivity(intent);
    } else if ((action = item.objectForKey("association")) != null) {
      Toast.makeText(
              this, "TODO: implement the association for " + action.toString(), Toast.LENGTH_SHORT)
          .show();
      System.err.println(action);
    } else {
      System.err.println("WHAT THE F**K IS THIS SHIT?");
    }
  }
    @Override
    protected void onPostExecute(final Provider data) {
      mAuthTask = null;

      if (data == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder
            .setTitle(R.string.no_network)
            .setMessage(R.string.error_no_network)
            .setNeutralButton(R.string.close_button, null);

        mAD = builder.create();
        mAD.setOnDismissListener(
            new DialogInterface.OnDismissListener() {
              public void onDismiss(DialogInterface dialog) {
                getActivity().finish();
              }
            });
        mAD.show();
        return;
      }
      Cache.provider = data;

      if (Cache.provider.isDemo && mAD == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder
            .setTitle(R.string.no_campus)
            .setMessage(R.string.error_no_campus)
            .setNeutralButton(R.string.continue_button, null);

        mAD = builder.create();
        mAD.show();
      }

      // TODO: make sure we still exist
      getActivity().setTitle(Cache.provider.name);
      setListAdapter(new LocationArrayAdapter(getActivity(), Cache.provider.locations));

      EasyTracker.getTracker()
          .sendEvent(
              "dataLoad",
              "provider",
              Cache.provider.name + " - " + Cache.provider.locations.size() + " locs",
              0L);
      EasyTracker.getTracker()
          .sendTiming(
              "dataLoad", System.currentTimeMillis() - startTime, "provider", Cache.provider.name);
    }
 @Override
 protected void onStop() {
   super.onStop();
   if (mTracker != null) {
     mTracker.activityStop(this);
   }
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.tablero);
   EasyTracker.getInstance(this).activityStart(this);
   final TextView turno = (TextView) findViewById(R.id.textView1); // leemos el textView
   final String jugadoruno = getString(R.string.jugadoruno); // más variables
   final String jugadordos = getString(R.string.jugadordos); // más variables
   Button boton = (Button) findViewById(R.id.button1); // definimos el botón
   boton.setOnClickListener(
       new View.OnClickListener() { // leemos cuando el botón es pulsado
         public void onClick(View v) {
           for (i = 0; i < 15; i++) { // este code se encarga de que las lineas tachadas
             if (array[i] == 1) { // se guarden en el array con un 2, o lo que viene a
               array[i] = 2; // ser igual, no se podrán des-tachar.
               contador = 1; // contador es 1 si se ha convertido alguna línea
             }
           }
           if (contador == 1) { // si contador es 1, se cambia de turno
             linea = 0;
             if (elturno == 1) {
               turno.setText(jugadordos);
               elturno = 2;
             } else {
               turno.setText(jugadoruno);
               elturno = 1;
             }
           } else showFallo(); // si contador no es 1, no se ha tachado nada
           // puesto que no se ha cambiado ninguna linea a 2.
           contador = 0;
           comprobarganador(); // y aquí, tras empezar el nuevo turno, se comprueba si ha ganado
                               // alguien
         }
       });
 }
Beispiel #8
0
 @Override
 protected void onResume() {
   super.onResume();
   Varios.clearAllNotifications = false;
   AppEventsLogger.activateApp(this, getString(R.string.facebook_app_id));
   EasyTracker.getInstance(this).activityStart(this);
 }
  /**
   * **
   *
   * @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());
  }
 @Override
 protected void onStop() {
   // TODO Auto-generated method stub
   // Stop track using Google Analytics
   super.onStop();
   EasyTracker.getInstance().activityStop(this);
 }
 @Override
 protected void onStart() {
   super.onStart();
   EasyTracker.getInstance().activityStart(this);
   Thread thread =
       new Thread() {
         @Override
         public void run() {
           // Promote Test
           DramaAPI dramaAPI = new DramaAPI(TvChannelViewPagerActivity.this);
           ArrayList<Advertisement> advertisements = dramaAPI.getAdvertisementList(0);
           if (advertisements != null && advertisements.size() > 0) {
             TvDramaApplication.shIO.edit().putInt("advertisemsent_id", -1).commit();
             TvDramaApplication.shIO
                 .edit()
                 .putString("advertisemsent_url", advertisements.get(0).getUrl())
                 .commit();
             TvDramaApplication.shIO
                 .edit()
                 .putString("advertisemsent_title", advertisements.get(0).getTitle())
                 .commit();
             TvDramaApplication.shIO
                 .edit()
                 .putString("advertisemsent_description", advertisements.get(0).getDescription())
                 .commit();
           } else {
             TvDramaApplication.shIO.edit().putInt("advertisemsent_id", 0).commit();
           }
         }
       };
   // 開始執行執行緒
   thread.start();
 }
Beispiel #12
0
  @Override
  protected void onStop() {
    super.onStop();

    if (Log.GANALYTICS) {
      EasyTracker.getInstance(getApplicationContext()).activityStop(this);
    }
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    boolean isValid = false;
    switch (item.getItemId()) {
      case R.id.savetaskMI:
        isValid = editATaskAction();
        if (isValid == true) finish();
        break;

      case R.id.addtaskMI:
        isValid = createATaskAction();
        if (isValid == true) {
          initilizeVariables();
          initilizeForNewTask();
          titleInputext.setText("");
          descriptionInputText.setText("");

          if (drawer.isMenuShowing()) drawer.toggle();

          toastWithGravity("Task Added!");
        }
        EasyTracker.getTracker()
            .sendEvent("UI-ActionBar", "Add Task-Append", "ActionBar", (long) 0);
        break;

      case R.id.proximityMI:
        AlertDialog diaBox = locationEditText();
        diaBox.show();
        EasyTracker.getTracker().sendEvent("UI-ActionBar", "Add Proximity", "ActionBar", (long) 0);
        break;

      case R.id.alarmMI:
        drawer.toggle(false);
        EasyTracker.getTracker()
            .sendEvent("UI-ActionBar", "Toggle Alarm Menu", "ActionBar", (long) 0);
        break;

      case R.id.backMI:
        EasyTracker.getTracker().sendEvent("UI-ActionBar", "back To Main", "ActionBar", (long) 0);
        finish();
        break;
    }

    return super.onOptionsItemSelected(item);
  }
Beispiel #14
0
 @Override
 public void onStop() {
   super.onStop();
   if (AppConfig.MIBOX_VERSION) {
     MiStatInterface.recordPageEnd();
   } else {
     EasyTracker.getInstance(this).activityStop(this);
   }
 }
  @Override
  protected void onStop() {
    SFLogger.d(TAG, "onStop");
    super.onStop();
    EasyTracker.getInstance(this).activityStop(this);

    this.gameSound.release();
    this.surfaceView.setRenderState(HithamsterView.RENDER_STATE.RENDER_STATE_STOP);
  }
 @Override
 protected void onStart() {
   AppEventsLogger logger = uiHelper.getAppEventsLogger();
   super.onStart();
   logger.logEvent("Home");
   mDataLayer = TagManager.getInstance(this).getDataLayer();
   mDataLayer.push(DataLayer.mapOf("event", "screenVisible", "screenName", SCREEN_NAME));
   EasyTracker.getInstance(this).activityStart(this);
 }
Beispiel #17
0
 @Override
 public void onStart() {
   super.onStart();
   if (AppConfig.MIBOX_VERSION) {
     MiStatInterface.recordPageStart(this, "TutorialActivity");
   } else {
     EasyTracker.getInstance(this).activityStart(this);
   }
 }
  @Override
  public void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    EasyTracker.getInstance().setContext(getActivity());

    if (savedState != null && mTopicLeaf == null) {
      mTopicLeaf = (TopicLeaf) savedState.getSerializable(SAVED_TOPIC);
    }
  }
Beispiel #19
0
  @Override
  protected void onStop() {
    super.onStop();

    /* Implementation of Google Analytics for Android */
    if (!(ConstantValues.URL == "http://www.trustripes.com"
        && ConstantValues.isInDevelopmentTeam(realId))) {
      EasyTracker.getInstance().activityStop(this);
    }
  }
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "on create called...");
    activity = this;
    setContentView(R.layout.activity_show_reminder);
    // For hide Keyboard
    View view = (View) findViewById(R.id.reminders);
    Util.setupUI(view, this);
    EasyTracker.getInstance().setContext(getApplicationContext());
    tracker = EasyTracker.getTracker();
    tracker.trackView("List of Reminders Digital_Diary");
    getIds();
    addListener();
    Util.addGoogleAds(this);

    // setContentView(R.layout.custom_adapter);

  }
  @Override
  public void onStart() {
    super.onStart();

    EasyTracker.getInstance().activityStart(this);

    final GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
    mTracker = analytics.getTracker(getString(R.string.ga_trackingId));
    mTracker.sendEvent("activity_phone", "start", "phone", 0l);

    GAServiceManager.getInstance().dispatch();
  }
Beispiel #22
0
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   ActionBar actionBar = getActionBar();
   //		actionBar.setDisplayHomeAsUpEnabled(true);
   setContentView(R.layout.tsquare_main);
   overridePendingTransition(R.anim.fade, R.anim.hold);
   EasyTracker.getInstance(this).activityStart(this);
   GoogleAnalytics.getInstance(this).getTracker(MainActivity.TRACKING);
   Tracker tracker = GoogleAnalytics.getInstance(this).getTracker(MainActivity.TRACKING);
   tracker.send(
       MapBuilder.createAppView()
           .set(Fields.SCREEN_NAME, "T-Square Final " + actionBar.getTitle())
           .build());
 }
Beispiel #23
0
  private void initGCM() {
    try {
      // Make sure the device has the proper dependencies.
      GCMRegistrar.checkDevice(this);

      final String regId = GCMRegistrar.getRegistrationId(this);
      if (regId.equals("")) {
        // Automatically registers application on startup.
        GCMRegistrar.register(this, SENDER_ID);
      }
    } catch (Exception e) {
      EasyTracker.getTracker().trackException("cannot init GCM", e, false);
    }
  }
Beispiel #24
0
  @Override
  public void onCreate() {
    super.onCreate();
    EasyTracker.getInstance().setContext(this);

    TraceDroid.init(this);
    Log.setTAG("gobandroid");

    interaction_scope = new InteractionScope();

    if (Build.VERSION.SDK_INT > 7) // need at least 8 for C2DM
    initGCM();

    GobandroidBackend.registerDevice(this);
  }
  public static void trackScreen(Context ctx, String screenName) {
    // May return null if EasyTracker has not yet been initialized with a property ID.
    Tracker easyTracker = EasyTracker.getInstance(ctx);

    // This screen name value will remain set on the tracker and sent with
    // hits until it is set to a new value or to null.
    // easyTracker.set( Fields.SCREEN_NAME, screenName );

    // Set dispatch period.
    easyTracker.send(
        MapBuilder.createAppView()
            .set(Fields.SCREEN_NAME, screenName)
            .set(Fields.HIT_TYPE, "appview")
            .build());
  }
Beispiel #26
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setTitle(R.string.title_info);

    EasyTracker.getInstance().setContext(this);

    NSArrayWrapper wrapper = (NSArrayWrapper) getIntent().getParcelableExtra("content");
    NSArray content;
    if (wrapper != null) {
      content = wrapper.array;
    } else {
      try {
        content =
            (NSArray)
                XMLPropertyListParser.parse(getResources().openRawResource(R.raw.info_content));

      } catch (Exception ex) {
        Log.e("[Hydra.Info]", "Failed to parse the info content!");
        ex.printStackTrace();
        this.finish();
        return;
      }
    }

    if (getIntent() != null) {
      if (getIntent().getStringExtra("tracking") == null) {
        getIntent().putExtra("tracking", "Info");
      } else {
        EasyTracker.getTracker().sendView(getIntent().getStringExtra("tracking"));
        Log.i("Tracking", getIntent().getStringExtra("tracking"));
      }
    }

    setListAdapter(new InfoList(this, content));
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    UIUtils.tryTranslateHttpIntent(this);
    BeamUtils.tryUpdateIntentFromBeam(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_sessions_sandbox);

    final FragmentManager fm = getSupportFragmentManager();
    mTracksDropdownFragment =
        (TracksDropdownFragment) fm.findFragmentById(R.id.fragment_tracks_dropdown);

    mSlidingPaneLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);

    // Offset the left pane by its full width and left margin when collapsed
    // (ViewPager-like presentation)
    mSlidingPaneLayout.setParallaxDistance(
        getResources().getDimensionPixelSize(R.dimen.sliding_pane_width)
            + getResources().getDimensionPixelSize(R.dimen.multipane_padding));
    mSlidingPaneLayout.setSliderFadeColor(
        getResources().getColor(R.color.sliding_pane_content_fade));

    routeIntent(getIntent(), savedInstanceState != null);

    if (savedInstanceState != null) {
      if (mFullUI) {
        int viewType = savedInstanceState.getInt(STATE_VIEW_TYPE);
        getSupportActionBar().setSelectedNavigationItem(viewType);
      }

      mDetailFragment = fm.findFragmentById(R.id.fragment_container_detail);
      updateDetailBackground();
    }

    // This flag prevents onTabSelected from triggering extra master pane reloads
    // unless it's actually being triggered by the user (and not automatically by
    // the system)
    mInitialTabSelect = false;

    mImageLoader =
        new ImageLoader(this, R.drawable.person_image_empty)
            .setMaxImageSize(getResources().getDimensionPixelSize(R.dimen.speaker_image_size))
            .setFadeInImage(UIUtils.hasHoneycombMR1());

    EasyTracker.getInstance().setContext(this);
  }
  @Override
  public void onTrackNameAvailable(String trackId, String trackName) {
    String trackType = null;

    switch (mViewType) {
      case TracksDropdownFragment.VIEW_TYPE_SESSIONS:
        trackType = getString(R.string.title_sessions);
        break;
      case TracksDropdownFragment.VIEW_TYPE_OFFICE_HOURS:
        trackType = getString(R.string.title_office_hours);
        break;
      case TracksDropdownFragment.VIEW_TYPE_SANDBOX:
        trackType = getString(R.string.title_sandbox);
        break;
    }

    EasyTracker.getTracker().sendView(trackType + ": " + getTitle());
    LOGD("Tracker", trackType + ": " + mTracksDropdownFragment.getTrackName());
  }
Beispiel #29
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    GoPrefs.init(this);

    progress = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progress.setMax(100);
    progress.setProgress(10);

    LinearLayout lin = new LinearLayout(this);

    ImageView img = new ImageView(this);
    img.setImageResource(R.drawable.ic_launcher);
    img.setLayoutParams(
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    lin.setOrientation(LinearLayout.VERTICAL);

    lin.addView(img);

    FrameLayout frame = new FrameLayout(this);
    frame.addView(progress);
    message_tv = new TextView(this);
    message_tv.setText("starting");
    message_tv.setTextColor(0xFF000000);
    message_tv.setPadding(7, 0, 0, 0);
    frame.addView(message_tv);

    lin.addView(frame);

    alert_dlg =
        new AlertDialog.Builder(this)
            .setCancelable(false)
            .setTitle(R.string.loading_sgf)
            .setView(lin)
            .show();

    EasyTracker.getTracker()
        .trackEvent("ui_action", "load_sgf", getIntent().getData().toString(), null);
    new Thread(this).start();
  }
  private void _init() {
    NativeUtils.configure(this);
    if (ConfigUtils.USE_AD_MOB) {
      _initAdMob();
    }

    if (ConfigUtils.USE_ADBUDDIZ) {
      AdBuddiz.setPublisherKey(getResources().getString(R.string.adbuddiz_key));
      if (ConfigUtils.TEST_ADBUDDIZ) {
        AdBuddiz.setLogLevel(AdBuddizLogLevel.Info);
        AdBuddiz.setTestModeActive();
      }
      AdBuddiz.cacheAds(UtilActivity.this);
    }

    tracker =
        GoogleAnalytics.getInstance(this)
            .getTracker(getResources().getString(R.string.ga_trackingId));

    easyTracker = EasyTracker.getInstance(this);
  }