本文整理匯總了Java中com.google.android.apps.iosched.ui.HomeActivity類的典型用法代碼示例。如果您正苦於以下問題:Java HomeActivity類的具體用法?Java HomeActivity怎麽用?Java HomeActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HomeActivity類屬於com.google.android.apps.iosched.ui包,在下文中一共展示了HomeActivity類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onOptionsItemSelected
import com.google.android.apps.iosched.ui.HomeActivity; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
// Up to this session's track details, or Home if no track is available
Intent parentIntent;
if (mTrackId != null) {
parentIntent = new Intent(Intent.ACTION_VIEW,
ScheduleContract.Tracks.buildTrackUri(mTrackId));
} else {
parentIntent = new Intent(this, HomeActivity.class);
}
NavUtils.navigateUpTo(this, parentIntent);
return true;
}
return super.onOptionsItemSelected(item);
}
示例2: displayNotification
import com.google.android.apps.iosched.ui.HomeActivity; //導入依賴的package包/類
private void displayNotification(Context context, String message) {
LOGI(TAG, "displayNotification: " + message);
((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
.notify(0, new NotificationCompat.Builder(context)
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_stat_notification)
.setTicker(message)
.setContentTitle(context.getString(R.string.app_name))
.setContentText(message)
.setContentIntent(
PendingIntent.getActivity(context, 0,
new Intent(context, HomeActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP),
0))
.setAutoCancel(true)
.getNotification());
}
示例3: displayNotification
import com.google.android.apps.iosched.ui.HomeActivity; //導入依賴的package包/類
private void displayNotification(Context context, String message) {
LOGI(TAG, "Displaying notification: " + message);
((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
.notify(0, new NotificationCompat.Builder(context)
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_stat_notification)
.setTicker(message)
.setContentTitle(context.getString(R.string.app_name))
.setContentText(message)
.setContentIntent(
PendingIntent.getActivity(context, 0,
new Intent(context, HomeActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP),
0))
.setAutoCancel(true)
.build());
}
示例4: getParentActivityIntent
import com.google.android.apps.iosched.ui.HomeActivity; //導入依賴的package包/類
@Override
public Intent getParentActivityIntent() {
// Up to this session's track details, or Home if no track is available
if (mSessionId != null) {
return new Intent(Intent.ACTION_VIEW,
ScheduleContract.Sessions.buildSessionUri(mSessionId));
} else {
return new Intent(this, HomeActivity.class);
}
}
示例5: onUpdate
import com.google.android.apps.iosched.ui.HomeActivity; //導入依賴的package包/類
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
final boolean isAuthenticated = AccountUtils.isAuthenticated(context);
for (int appWidgetId : appWidgetIds) {
// Specify the service to provide data for the collection widget. Note that we need to
// embed the appWidgetId via the data otherwise it will be ignored.
final Intent intent = new Intent(context, ScheduleWidgetRemoteViewsService.class)
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
final RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget);
rv.setRemoteAdapter(appWidgetId, R.id.widget_schedule_list, intent);
// Set the empty view to be displayed if the collection is empty. It must be a sibling
// view of the collection view.
rv.setEmptyView(R.id.widget_schedule_list, android.R.id.empty);
rv.setTextViewText(android.R.id.empty, context.getResources().getString(isAuthenticated
? R.string.empty_widget_text
: R.string.empty_widget_text_signed_out));
final PendingIntent refreshPendingIntent = PendingIntent.getBroadcast(context, 0,
getRefreshBroadcastIntent(context, true), PendingIntent.FLAG_UPDATE_CURRENT);
rv.setOnClickPendingIntent(R.id.widget_refresh_button, refreshPendingIntent);
final Intent onClickIntent = TaskStackBuilderProxyActivity.getTemplate(context);
final PendingIntent onClickPendingIntent = PendingIntent.getActivity(context, 0,
onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setPendingIntentTemplate(R.id.widget_schedule_list, onClickPendingIntent);
final Intent openAppIntent = new Intent(context, HomeActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0,
openAppIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setOnClickPendingIntent(R.id.widget_logo, openAppPendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, rv);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
示例6: onUpdate
import com.google.android.apps.iosched.ui.HomeActivity; //導入依賴的package包/類
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
final boolean isAuthenticated = AccountUtils.isAuthenticated(context);
for (int appWidgetId : appWidgetIds) {
// Specify the service to provide data for the collection widget. Note that we need to
// embed the appWidgetId via the data otherwise it will be ignored.
final Intent intent = new Intent(context, MyScheduleWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
final RemoteViews rv = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
compatSetRemoteAdapter(rv, appWidgetId, intent);
// Set the empty view to be displayed if the collection is empty. It must be a sibling
// view of the collection view.
rv.setEmptyView(R.id.widget_schedule_list, android.R.id.empty);
rv.setTextViewText(android.R.id.empty, context.getResources().getString(isAuthenticated
? R.string.empty_widget_text
: R.string.empty_widget_text_signed_out));
final Intent onClickIntent = new Intent(context, MyScheduleWidgetProvider.class);
onClickIntent.setAction(MyScheduleWidgetProvider.CLICK_ACTION);
onClickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
onClickIntent.setData(Uri.parse(onClickIntent.toUri(Intent.URI_INTENT_SCHEME)));
final PendingIntent onClickPendingIntent = PendingIntent.getBroadcast(context, 0,
onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setPendingIntentTemplate(R.id.widget_schedule_list, onClickPendingIntent);
final Intent refreshIntent = new Intent(context, MyScheduleWidgetProvider.class);
refreshIntent.setAction(MyScheduleWidgetProvider.REFRESH_ACTION);
refreshIntent.putExtra(MyScheduleWidgetProvider.EXTRA_PERFORM_SYNC, true);
final PendingIntent refreshPendingIntent = PendingIntent.getBroadcast(context, 0,
refreshIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setOnClickPendingIntent(R.id.widget_refresh_button, refreshPendingIntent);
final Intent openAppIntent = new Intent(context, HomeActivity.class);
final PendingIntent openAppPendingIntent = PendingIntent.getActivity(context, 0,
openAppIntent, PendingIntent.FLAG_UPDATE_CURRENT);
rv.setOnClickPendingIntent(R.id.widget_logo, openAppPendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, rv);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}