コード例 #1
0
 public static void loadImages() {
   activity.runOnUiThread(
       new Runnable() {
         @Override
         public void run() {
           DrawerManager.getInstance().selectItem(0, -1);
         }
       });
 }
コード例 #2
0
  public void initialize(
      ReaderMainActivity readerMainActivity, Bundle savedInstanceState, final int messageId) {
    if (readerMainActivity != null) {
      activity = readerMainActivity;
      // getting unique id for device
      if (deviceId == null) {
        deviceId =
            android.provider.Settings.Secure.getString(
                activity.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
      }

      if (mNewsHandler instanceof QueryNewsHandler) {
        tempHandler = (QueryNewsHandler) mNewsHandler;
      }
      mNewsHandler = new UIHandler(readerMainActivity);
      I13N.getNew().registerSession(readerMainActivity);
      DrawerManager.getInstance(readerMainActivity).onCreateDrawer(savedInstanceState);
    } else {
      if (mNewsHandler == null) {
        mNewsHandler = new QueryNewsHandler();
      } else if (mNewsHandler instanceof UIHandler) {
        mNewsHandler = tempHandler;
      }
      I13N.getNew().registerSession(mApp);
      DrawerManager.getInstance(mApp);
    }

    ReaderController.getInstance().registerUIHandler(mNewsHandler);
    ReaderController.getInstance().getDataHandler().registerUiHandler(mNewsHandler);
    // Select/create the first Fragment
    if (savedInstanceState == null) {
      mNewsHandler.post(
          new Runnable() {
            @Override
            public void run() {
              // implicitly select the first item (which is the default news list)
              DrawerManager.getInstance().selectItem(DrawerManager.DRAWER_DEFAULT, messageId);
            }
          });
    }
    isInitialized = true;
  }