示例#1
0
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
 @Override
 public Object instantiateItem(ViewGroup container, int position) {
   LayoutInflater inflater =
       (LayoutInflater) QuickLaunchView.this.getContext().getSystemService("layout_inflater");
   LinearLayout pageView =
       (LinearLayout) inflater.inflate(R.layout.shade_quick_launch_page, null);
   for (int i = position * 5; i < (position * 5) + 5; i++) {
     ImageButton button = (ImageButton) inflater.inflate(R.layout.quicklaunch_button, null);
     button.setScaleType(ScaleType.FIT_CENTER);
     if (i < this.quickLaunchApps.size()) {
       App app = this.quickLaunchApps.get(i);
       button.setImageDrawable(app.getAppIcon());
       button.setOnClickListener(new AnonymousClass_1(app));
     } else {
       button.setBackground(null);
       button.setOnClickListener(null);
     }
     pageView.addView(button, new LayoutParams(-1, -1, 0.5f));
   }
   container.addView(pageView);
   return pageView;
 }
 public boolean generateWelcomeMessage() {
   List<App> quickLaunchApps = this.appManager.getQuickLaunchApps();
   if (quickLaunchApps.size() == 0) {
     return false;
   }
   App janeyApp;
   App valentinaApp;
   App laurenApp;
   if (quickLaunchApps.size() == 1) {
     janeyApp = (App) quickLaunchApps.get(0);
     valentinaApp = janeyApp;
     laurenApp = janeyApp;
   } else if (quickLaunchApps.size() == 2) {
     janeyApp = (App) quickLaunchApps.get(0);
     valentinaApp = (App) quickLaunchApps.get(1);
     laurenApp = janeyApp;
   } else {
     janeyApp = (App) quickLaunchApps.get(0);
     valentinaApp = (App) quickLaunchApps.get(1);
     laurenApp = (App) quickLaunchApps.get(2);
   }
   App snowballTeamApp = valentinaApp;
   String janeyName = this.context.getResources().getString(R.string.dummy_person_one);
   BitmapDrawable janeyPhoto =
       (BitmapDrawable) this.context.getResources().getDrawable(R.drawable.janey_profile);
   String valentinaName = this.context.getResources().getString(R.string.dummy_person_two);
   BitmapDrawable valentinaPhoto =
       (BitmapDrawable) this.context.getResources().getDrawable(R.drawable.valentina_profile);
   String laurenName = this.context.getResources().getString(R.string.dummy_person_three);
   BitmapDrawable laurenPhoto =
       (BitmapDrawable) this.context.getResources().getDrawable(R.drawable.lauren_profile);
   String snowballTeamName = this.context.getResources().getString(R.string.dummy_person_four);
   String janeyMessage = this.context.getResources().getString(R.string.dummy_message_one);
   long janeyTimestamp = System.currentTimeMillis();
   String valentinaMessage = this.context.getResources().getString(R.string.dummy_message_two);
   long valentinaTimestamp = janeyTimestamp - MESSAGE_GAP;
   String laurenMessage = this.context.getResources().getString(R.string.dummy_message_three);
   long laurenTimestamp = valentinaTimestamp - MESSAGE_GAP;
   String snowballTeamMessage = this.context.getResources().getString(R.string.dummy_message_four);
   long snowballTeamTimestamp = laurenTimestamp - MESSAGE_GAP;
   RawMessage message1 =
       new RawMessage(
           janeyApp.getAppId(),
           null,
           janeyName,
           janeyMessage,
           janeyTimestamp,
           janeyPhoto.getBitmap(),
           null,
           null);
   message1.setState(1);
   RawMessage message2 =
       new RawMessage(
           valentinaApp.getAppId(),
           null,
           valentinaName,
           valentinaMessage,
           valentinaTimestamp,
           valentinaPhoto.getBitmap(),
           null,
           null);
   message2.setState(1);
   RawMessage message3 =
       new RawMessage(
           laurenApp.getAppId(),
           null,
           laurenName,
           laurenMessage,
           laurenTimestamp,
           laurenPhoto.getBitmap(),
           getSendFeedbackPendingIntent(),
           null);
   message3.setState(1);
   RawMessage message4 =
       new RawMessage(
           snowballTeamApp.getAppId(),
           null,
           snowballTeamName,
           snowballTeamMessage,
           snowballTeamTimestamp,
           null,
           null,
           null);
   message4.setState(1);
   this.inboxManager.injectMessage(message4);
   this.inboxManager.injectMessage(message3);
   this.inboxManager.injectMessage(message2);
   this.inboxManager.injectMessage(message1);
   return true;
 }