當前位置: 首頁>>代碼示例>>Java>>正文


Java AddTrace類代碼示例

本文整理匯總了Java中com.google.firebase.perf.metrics.AddTrace的典型用法代碼示例。如果您正苦於以下問題:Java AddTrace類的具體用法?Java AddTrace怎麽用?Java AddTrace使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AddTrace類屬於com.google.firebase.perf.metrics包,在下文中一共展示了AddTrace類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getStationNames

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
/**
 * @inheritDoc
 */
@Override
@AddTrace(name="StationsDb.getStationNames")
public String[] getStationNames(Station[] Stations) {

    if (Stations == null || Stations.length == 0) {
        FirebaseCrash.logcat(WARNING.intValue(), LOGTAG, "Tried to load station names on empty station list!");
        return new String[0];
    }

    String[] results = new String[Stations.length];
    for (int i = 0; i < Stations.length; i++) {
        results[i] = Stations[i].getLocalizedName();
    }
    return results;
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:19,代碼來源:StationsDb.java

示例2: onCreate

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
@Override
@AddTrace(name = "onCreateLandingActivity")
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  loggedIn = PreferenceManager.getDefaultSharedPreferences(
    getApplicationContext())
    .getBoolean(TOKEN_SAVED_KEY, false);
  analytics = AnalyticsTracker.getInstance(this, false);


  if (!loggedIn) {
    setContentView(R.layout.activity_landing);
    getSupportActionBar().hide();
    buildAccountAuthUrl();
    setUpSkipDialog();
    setUpButtons();
  } else {
    Intent intent = new Intent(this, MainActivity.class);
    startActivity(intent);
  }
}
 
開發者ID:mapbox,項目名稱:mapbox-android-demo,代碼行數:22,代碼來源:LandingActivity.java

示例3: onCreateView

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
@Override
@AddTrace(name="LiveboardSearchFragment.onCreateView")
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_liveboard_search, container, false);
    stationRecyclerView = view.findViewById(R.id.recyclerview_primary);

    return view;
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:12,代碼來源:LiveboardSearchFragment.java

示例4: getStationsOrderBySize

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
@Override
@AddTrace(name="StationsDb.getStationsOrderBySize")
public Station[] getStationsOrderBySize() {
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor c = db.query(
            StationsDataColumns.TABLE_NAME,
            new String[]{
                    StationsDataColumns._ID,
                    StationsDataColumns.COLUMN_NAME_NAME,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_NL,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_FR,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_DE,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_EN,
                    StationsDataColumns.COLUMN_NAME_COUNTRY_CODE,
                    StationsDataColumns.COLUMN_NAME_LATITUDE,
                    StationsDataColumns.COLUMN_NAME_LONGITUDE,
                    StationsDataColumns.COLUMN_NAME_AVG_STOP_TIMES
            },
            null,
            null,
            null,
            null,
            StationsDataColumns.COLUMN_NAME_AVG_STOP_TIMES + " DESC"
    );

    Station[] stations = loadStationCursor(c);
    c.close();
    db.close();
    return stations;
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:31,代碼來源:StationsDb.java

示例5: getStationById

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
/**
 * @inheritDoc
 */
@Override
@AddTrace(name="StationsDb.getStationById")
public Station getStationById(String id) {

    SQLiteOpenHelper StationsDbHelper = new StationsDb(context);
    SQLiteDatabase db = StationsDbHelper.getReadableDatabase();
    Cursor c = db.query(
            StationsDataColumns.TABLE_NAME,
            new String[]{
                    StationsDataColumns._ID,
                    StationsDataColumns.COLUMN_NAME_NAME,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_NL,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_FR,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_DE,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_EN,
                    StationsDataColumns.COLUMN_NAME_COUNTRY_CODE,
                    StationsDataColumns.COLUMN_NAME_LATITUDE,
                    StationsDataColumns.COLUMN_NAME_LONGITUDE,
                    StationsDataColumns.COLUMN_NAME_AVG_STOP_TIMES
            },
            StationsDataColumns._ID + "=?",
            new String[]{id},
            null,
            null,
            null,
            "1");

    Station[] results = loadStationCursor(c);

    c.close();
    db.close();

    if (results == null) {
        return null;
    }

    return results[0];
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:42,代碼來源:StationsDb.java

示例6: onCreateView

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
@Override
@AddTrace(name="RouteSearchFragment.onCreateView")
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    return inflater.inflate(R.layout.fragment_route_search, container, false);
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:9,代碼來源:RouteSearchFragment.java

示例7: onCreate

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
@Override
@AddTrace(name = "onCreateMainActivity")
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  analytics = AnalyticsTracker.getInstance(this, true);

  WearableRecyclerView wearableRecyclerView = (WearableRecyclerView) findViewById(R.id.recycler_launcher_view);
  wearableRecyclerView.setHasFixedSize(true);

  OffsettingHelper offsettingHelper = new OffsettingHelper();

  wearableRecyclerView.setCenterEdgeItems(true);
  wearableRecyclerView.setOffsettingHelper(offsettingHelper);

  exampleItemModels = new ArrayList<>();
  exampleItemModels.add(new ExampleItemModel(R.string.activity_simple_mapview_title,
    R.drawable.simple_map_view_screen, new Intent(MainActivity.this, SimpleMapViewActivity.class)));
  exampleItemModels.add(new ExampleItemModel(R.string.activity_map_fragment_title,
    R.drawable.simple_map_view_screen, new Intent(MainActivity.this, MapFragmentActivity.class)));
  exampleItemModels.add(new ExampleItemModel(R.string.activity_map_offline_title,
    R.drawable.simple_map_view_screen, new Intent(MainActivity.this, OfflineMapActivity.class)));
  exampleItemModels.add(new ExampleItemModel(R.string.activity_location_tracking_title,
    R.drawable.simple_map_view_screen, new Intent(MainActivity.this, LocationTrackingActivity.class)));

  ExampleAdapter exampleAdapter = new ExampleAdapter(MainActivity.this, exampleItemModels);
  wearableRecyclerView.setAdapter(exampleAdapter);

  exampleAdapter.setListener(this);
  checkForFirstTimeOpen();
}
 
開發者ID:mapbox,項目名稱:mapbox-android-demo,代碼行數:33,代碼來源:MainActivity.java

示例8: onItemSelected

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
@Override
@AddTrace(name = "onItemSelected")
public void onItemSelected(int position) {
  startActivity(exampleItemModels.get(position).getActivity());
  analytics.clickedOnIndividualExample(getString(exampleItemModels.get(position).getTitle()), false);
  analytics.viewedScreen(getString(exampleItemModels.get(position).getTitle()), false);
}
 
開發者ID:mapbox,項目名稱:mapbox-android-demo,代碼行數:8,代碼來源:MainActivity.java

示例9: getStationsOrderByLocation

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
/**
 * @inheritDoc
 */
@Override
@AddTrace(name="StationsDb.getStationsOrderByLocation")
public Station[] getStationsOrderByLocation(Location location) {
    return this.getStationsByNameOrderByLocation("", location);
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:9,代碼來源:StationsDb.java

示例10: compare

import com.google.firebase.perf.metrics.AddTrace; //導入依賴的package包/類
/**
 * @inheritDoc
 */
@Override
@AddTrace(name="StationsDb.getStationsOrderByLocationAndSize")
public Station[] getStationsOrderByLocationAndSize(Location location, int limit) {
    SQLiteDatabase db = this.getReadableDatabase();
    double longitude = Math.round(location.getLongitude() * 1000000.0) / 1000000.0;
    double latitude = Math.round(location.getLatitude() * 1000000.0) / 1000000.0;

    Cursor c = db.query(
            StationsDataColumns.TABLE_NAME,
            new String[]{
                    StationsDataColumns._ID,
                    StationsDataColumns.COLUMN_NAME_NAME,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_NL,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_FR,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_DE,
                    StationsDataColumns.COLUMN_NAME_ALTERNATIVE_EN,
                    StationsDataColumns.COLUMN_NAME_COUNTRY_CODE,
                    StationsDataColumns.COLUMN_NAME_LATITUDE,
                    StationsDataColumns.COLUMN_NAME_LONGITUDE,
                    StationsDataColumns.COLUMN_NAME_AVG_STOP_TIMES,
                    "(" + StationsDataColumns.COLUMN_NAME_LATITUDE + " - " + latitude + ")*(" + StationsDataColumns.COLUMN_NAME_LATITUDE + " - " + latitude
                            + ")+(" + StationsDataColumns.COLUMN_NAME_LONGITUDE + " - " + longitude + ")*(" + StationsDataColumns.COLUMN_NAME_LONGITUDE + " - " + longitude
                            + ") AS distance"
            },
            null,
            null,
            null,
            null,
            "distance ASC, " + StationsDataColumns.COLUMN_NAME_AVG_STOP_TIMES + " DESC",
            String.valueOf(limit)
    );

    Station[] stations = loadStationCursor(c);

    c.close();
    db.close();

    if (stations == null) {
        return null;
    }

    Arrays.sort(stations, new Comparator<Station>() {
        @Override
        public int compare(Station o1, Station o2) {
            return Float.compare(o2.getAvgStopTimes(), o1.getAvgStopTimes());
        }
    });

    return stations;
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:54,代碼來源:StationsDb.java


注:本文中的com.google.firebase.perf.metrics.AddTrace類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。