本文整理汇总了Java中com.google.android.apps.iosched.provider.ScheduleContract.Sessions类的典型用法代码示例。如果您正苦于以下问题:Java Sessions类的具体用法?Java Sessions怎么用?Java Sessions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Sessions类属于com.google.android.apps.iosched.provider.ScheduleContract包,在下文中一共展示了Sessions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSessionSelected
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public boolean onSessionSelected(String sessionId) {
Uri sessionUri = ScheduleContract.Sessions.buildSessionUri(sessionId);
Intent detailIntent = new Intent(Intent.ACTION_VIEW, sessionUri);
if (mTwoPane) {
BeamUtils.setBeamSessionUri(this, sessionUri);
trySetBeamCallback();
SessionDetailFragment fragment = new SessionDetailFragment();
fragment.setArguments(BaseActivity.intentToFragmentArguments(detailIntent));
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container_detail, fragment)
.commit();
mDetailFragment = fragment;
updateDetailBackground();
return true;
} else {
startActivity(detailIntent);
return false;
}
}
示例2: onCreateLoader
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case SessionSummaryQuery._TOKEN:
return new CursorLoader(this, Sessions.buildWithTracksUri(mSessionId),
SessionSummaryQuery.PROJECTION, null, null, null);
case SessionsQuery._TOKEN:
boolean futureSessions = false;
if (args != null) {
futureSessions = args.getBoolean(LOADER_SESSIONS_ARG, false);
}
final long currentTime = UIUtils.getCurrentTime(this);
String selection = Sessions.LIVESTREAM_SELECTION + " and ";
String[] selectionArgs;
if (!futureSessions) {
selection += Sessions.AT_TIME_SELECTION;
selectionArgs = Sessions.buildAtTimeSelectionArgs(currentTime);
} else {
selection += Sessions.UPCOMING_SELECTION;
selectionArgs = Sessions.buildUpcomingSelectionArgs(currentTime);
}
return new CursorLoader(this, Sessions.buildWithTracksUri(),
SessionsQuery.PROJECTION, selection, selectionArgs, null);
}
return null;
}
示例3: onSessionSelected
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public boolean onSessionSelected(String sessionId) {
Uri sessionUri = ScheduleContract.Sessions.buildSessionUri(sessionId);
Intent detailIntent = new Intent(Intent.ACTION_VIEW, sessionUri);
if (mTwoPane) {
BeamUtils.setBeamSessionUri(this, sessionUri);
SessionDetailFragment fragment = new SessionDetailFragment();
fragment.setArguments(BaseActivity.intentToFragmentArguments(detailIntent));
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container_detail, fragment)
.commit();
mDetailFragment = fragment;
updateDetailBackground();
return true;
} else {
startActivity(detailIntent);
return false;
}
}
示例4: onNewIntent
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public void onNewIntent(Intent intent) {
setIntent(intent);
String query = intent.getStringExtra(SearchManager.QUERY);
setTitle(Html.fromHtml(getString(R.string.title_search_query, query)));
mSessionsFragment.reloadFromArguments(intentToFragmentArguments(
new Intent(Intent.ACTION_VIEW, Sessions.buildSearchUri(query))));
EasyTracker.getTracker().trackView("Search: " + query);
LOGD("Tracker", "Search: " + query);
updateDetailBackground();
}
示例5: reloadFromUri
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
/**
* Reloads all data in the activity and fragments from a given uri
*/
private void reloadFromUri(Uri newUri) {
if (newUri != null && newUri.getPathSegments().size() >= 2) {
mSessionId = Sessions.getSessionId(newUri);
getSupportLoaderManager().restartLoader(SessionSummaryQuery._TOKEN, null, this);
}
}
示例6: onItemClick
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int itemPosition, long itemId) {
final Cursor cursor = (Cursor) mLivestreamAdapter.getItem(itemPosition);
final String sessionId = cursor.getString(SessionsQuery.SESSION_ID);
if (sessionId != null) {
reloadFromUri(Sessions.buildSessionUri(sessionId));
}
}
示例7: onCreateLoader
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case SessionSummaryQuery._TOKEN:
return new CursorLoader(
this, Sessions.buildWithTracksUri(mSessionId),
SessionSummaryQuery.PROJECTION, null, null, null);
case SessionsQuery._TOKEN:
final long currentTime = UIUtils.getCurrentTime(this);
String selection = Sessions.LIVESTREAM_SELECTION + " and "
+ Sessions.AT_TIME_SELECTION;
String[] selectionArgs = Sessions.buildAtTimeSelectionArgs(currentTime);
return new CursorLoader(this, Sessions.buildWithTracksUri(),
SessionsQuery.PROJECTION, selection,
selectionArgs, null);
case UPCOMING_SESSIONS_QUERY_ID:
final long newCurrentTime = UIUtils.getCurrentTime(this);
String sessionsSelection = Sessions.LIVESTREAM_SELECTION + " and "
+ Sessions.UPCOMING_SELECTION;
String[] sessionsSelectionArgs =
Sessions.buildUpcomingSelectionArgs(newCurrentTime);
return new CursorLoader(this, Sessions.buildWithTracksUri(),
SessionsQuery.PROJECTION, sessionsSelection,
sessionsSelectionArgs, null);
}
return null;
}
示例8: onLoadFinished
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
mHandler.removeCallbacks(mNextSessionStartsInCountdownRunnable);
switch (loader.getId()) {
case SessionSummaryQuery._TOKEN:
loadSession(data);
break;
case SessionsQuery._TOKEN:
mLivestreamAdapter.swapCursor(data);
final int selected = locateSelectedItem(data);
if (data.getCount() == 0) {
handleNoLiveSessionsAvailable();
} else {
mLiveListView.setSelection(selected);
mLiveListView.requestFocus(selected);
final Cursor cursor = (Cursor) mLivestreamAdapter.getItem(selected);
final String sessionId = cursor.getString(SessionsQuery.SESSION_ID);
if (sessionId != null) {
reloadFromUri(Sessions.buildSessionUri(sessionId));
}
}
break;
case UPCOMING_SESSIONS_QUERY_ID:
if (data != null && data.getCount() > 0) {
data.moveToFirst();
handleUpdateNextUpcomingSession(data);
}
break;
}
}
示例9: reloadFromUri
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
/**
* Reloads all data in the activity and fragments from a given uri
* @param newUri The session uri to load from
*/
private void reloadFromUri(Uri newUri) {
mSessionUri = newUri;
if (mSessionUri != null && mSessionUri.getPathSegments().size() >= 2) {
mSessionId = Sessions.getSessionId(mSessionUri);
getSupportLoaderManager().restartLoader(SessionSummaryQuery._TOKEN, null, this);
} else {
// No session uri, get out
mSessionUri = null;
navigateUpOrFinish();
}
}
示例10: onNavigationItemSelected
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
final Cursor cursor = (Cursor) mLivestreamAdapter.getItem(itemPosition);
setActionBarColor(cursor.getInt(SessionsQuery.TRACK_COLOR));
final String sessionId = cursor.getString(SessionsQuery.SESSION_ID);
if (sessionId != null) {
reloadFromUri(Sessions.buildSessionUri(sessionId));
return true;
}
return false;
}
示例11: createSessionsSearch
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
/**
* Create triggers that automatically build {@link Tables#SESSIONS_SEARCH}
* as values are changed in {@link Tables#SESSIONS}.
*/
private static void createSessionsSearch(SQLiteDatabase db) {
// Using the "porter" tokenizer for simple stemming, so that
// "frustration" matches "frustrated."
db.execSQL("CREATE VIRTUAL TABLE " + Tables.SESSIONS_SEARCH + " USING fts3("
+ BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ SessionsSearchColumns.BODY + " TEXT NOT NULL,"
+ SessionsSearchColumns.SESSION_ID
+ " TEXT NOT NULL " + References.SESSION_ID + ","
+ "UNIQUE (" + SessionsSearchColumns.SESSION_ID + ") ON CONFLICT REPLACE,"
+ "tokenize=porter)");
// TODO: handle null fields in body, which cause trigger to fail
// TODO: implement update trigger, not currently exercised
db.execSQL("CREATE TRIGGER " + Triggers.SESSIONS_SEARCH_INSERT + " AFTER INSERT ON "
+ Tables.SESSIONS + " BEGIN INSERT INTO " + Qualified.SESSIONS_SEARCH + " "
+ " VALUES(new." + Sessions.SESSION_ID + ", " + Subquery.SESSIONS_BODY + ");"
+ " END;");
db.execSQL("CREATE TRIGGER " + Triggers.SESSIONS_SEARCH_DELETE + " AFTER DELETE ON "
+ Tables.SESSIONS + " BEGIN DELETE FROM " + Tables.SESSIONS_SEARCH + " "
+ " WHERE " + Qualified.SESSIONS_SEARCH_SESSION_ID + "=old." + Sessions.SESSION_ID
+ ";" + " END;");
db.execSQL("CREATE TRIGGER " + Triggers.SESSIONS_SEARCH_UPDATE
+ " AFTER UPDATE ON " + Tables.SESSIONS
+ " BEGIN UPDATE sessions_search SET " + SessionsSearchColumns.BODY + " = "
+ Subquery.SESSIONS_BODY + " WHERE session_id = old.session_id"
+ "; END;");
}
示例12: parse
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
public ArrayList<ContentProviderOperation> parse(String json)
throws IOException {
final ArrayList<ContentProviderOperation> batch = Lists.newArrayList();
MyScheduleResponse response = new Gson().fromJson(json, MyScheduleResponse.class);
if (response.error == null) {
LOGI(TAG, "Updating user's schedule");
if (response.schedule_list != null) {
// Un-star all sessions first
batch.add(ContentProviderOperation
.newUpdate(ScheduleContract.addCallerIsSyncAdapterParameter(
Sessions.CONTENT_URI))
.withValue(Sessions.SESSION_STARRED, 0)
.build());
// Star only those sessions in the "my schedule" response
for (MyScheduleItem item : response.schedule_list) {
batch.add(ContentProviderOperation
.newUpdate(ScheduleContract.addCallerIsSyncAdapterParameter(
Sessions.buildSessionUri(item.session_id)))
.withValue(Sessions.SESSION_STARRED, 1)
.build());
}
}
}
return batch;
}
示例13: onNewIntent
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public void onNewIntent(Intent intent) {
setIntent(intent);
String query = intent.getStringExtra(SearchManager.QUERY);
setTitle(Html.fromHtml(getString(R.string.title_search_query, query)));
mSessionsFragment.reloadFromArguments(intentToFragmentArguments(
new Intent(Intent.ACTION_VIEW, Sessions.buildSearchUri(query))));
EasyTracker.getTracker().sendView("Search: " + query);
LOGD("Tracker", "Search: " + query);
updateDetailBackground();
}
示例14: reloadFromUri
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
/**
* Reloads all data in the activity and fragments from a given uri
* @param newUri The session uri to load from
*/
private void reloadFromUri(Uri newUri) {
mSessionUri = newUri;
if (mSessionUri != null && mSessionUri.getPathSegments().size() >= 2) {
mSessionId = Sessions.getSessionId(mSessionUri);
getSupportLoaderManager().restartLoader(SessionSummaryQuery._TOKEN, null, this);
} else {
// No session uri, get out
mSessionUri = null;
finish();
}
}
示例15: onNavigationItemSelected
import com.google.android.apps.iosched.provider.ScheduleContract.Sessions; //导入依赖的package包/类
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
final Cursor cursor = (Cursor) mLivestreamAdapter.getItem(itemPosition);
String trackName = cursor.getString(SessionsQuery.TRACK_NAME);
int trackColor = cursor.getInt(SessionsQuery.TRACK_COLOR);
setActionBarTrackIcon(trackName, trackColor);
final String sessionId = cursor.getString(SessionsQuery.SESSION_ID);
if (sessionId != null) {
reloadFromUri(Sessions.buildSessionUri(sessionId));
return true;
}
return false;
}