/**
   * Returns and shows pending/shown SuperCardToasts from orientation change and reattaches any
   * OnToastButtonClickListeners and any OnToastDismissListeners. <br>
   * IMPORTANT: Use this method to save OnToastButtonClickListeners and OnToastDismissListenerHolder
   * on devices with API < 11. Otherwise use onRestoreState(Bundle bundle, Activity activity) as
   * that method uses a retained fragment to save listeners. <br>
   *
   * @param bundle Use onCreate() bundle
   * @param activity The current activity
   * @param onToastButtonClickListeners List of any attached OnToastButtonClickListenerHolders from
   *     previous orientation
   * @param onToastDismissListeners List of any attached OnToastDismissListenerHolders from previous
   *     orientation
   */
  public static void onRestoreState(
      Bundle bundle,
      Activity activity,
      List<OnToastButtonClickListenerHolder> onToastButtonClickListeners,
      List<OnToastDismissListenerHolder> onToastDismissListeners) {

    if (bundle == null) {

      return;
    }

    Parcelable[] savedArray = bundle.getParcelableArray(BUNDLE_TAG);

    int i = 0;

    if (savedArray != null) {

      for (Parcelable parcelable : savedArray) {

        i++;

        new SuperCardToast(
            activity, (Style) parcelable, onToastButtonClickListeners, onToastDismissListeners, i);
      }
    }
  }
  @Override
  @SuppressWarnings("unchecked")
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    LogUtils.logd(TAG, "[onActivityCreated]");

    mSession = JRSession.getInstance();

    if (savedInstanceState != null) {
      mManagedDialogs = (HashMap) savedInstanceState.get(KEY_MANAGED_DIALOGS);
      Parcelable[] p = savedInstanceState.getParcelableArray(KEY_MANAGED_DIALOG_OPTIONS);
      if (mManagedDialogs != null && p != null) {
        for (Parcelable p_ : p) {
          Bundle b = (Bundle) p_;
          mManagedDialogs.get(b.getInt(KEY_DIALOG_ID)).mOptions = b;
        }
      } else {
        mManagedDialogs = new HashMap<Integer, ManagedDialog>();
      }
    }

    for (ManagedDialog d : mManagedDialogs.values()) {
      d.mDialog = onCreateDialog(d.mId, d.mOptions);
      if (d.mShowing) d.mDialog.show();
    }
  }
 // NOTE: Implement any IChildProcessService methods here.
 @Override
 public int setupConnection(Bundle args, IChildProcessCallback callback) {
   mCallback = callback;
   // Required to unparcel FileDescriptorInfo.
   args.setClassLoader(getClassLoader());
   synchronized (mMainThread) {
     // Allow the command line to be set via bind() intent or setupConnection, but
     // the FD can only be transferred here.
     if (mCommandLineParams == null) {
       mCommandLineParams = args.getStringArray(ChildProcessConnection.EXTRA_COMMAND_LINE);
     }
     // We must have received the command line by now
     assert mCommandLineParams != null;
     mCpuCount = args.getInt(ChildProcessConnection.EXTRA_CPU_COUNT);
     mCpuFeatures = args.getLong(ChildProcessConnection.EXTRA_CPU_FEATURES);
     assert mCpuCount > 0;
     Parcelable[] fdInfosAsParcelable =
         args.getParcelableArray(ChildProcessConnection.EXTRA_FILES);
     // For why this arraycopy is necessary:
     // http://stackoverflow.com/questions/8745893/i-dont-get-why-this-classcastexception-occurs
     mFdInfos = new FileDescriptorInfo[fdInfosAsParcelable.length];
     System.arraycopy(fdInfosAsParcelable, 0, mFdInfos, 0, fdInfosAsParcelable.length);
     Bundle sharedRelros = args.getBundle(Linker.EXTRA_LINKER_SHARED_RELROS);
     if (sharedRelros != null) {
       Linker.getInstance().useSharedRelros(sharedRelros);
       sharedRelros = null;
     }
     mMainThread.notifyAll();
   }
   return Process.myPid();
 }
Example #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Utils.showUpdateDialogIfNecessary(this);
    setContentView(R.layout.activity_repcast);
    if (savedInstanceState == null) {
      mPagerAdapter =
          new RepcastPageAdapter(getSupportFragmentManager(), this, getApplicationContext());
    } else {
      mBackSelectFileFragments.addAll(
          Arrays.asList(savedInstanceState.getParcelableArray(INSTANCE_STATE_BACK_STACK_FILES)));
      mBackTorrentFragments.addAll(
          Arrays.asList(savedInstanceState.getParcelableArray(INSTANCE_STATE_BACK_STACK_TORRENTS)));
      mPagerAdapter =
          new RepcastPageAdapter(
              getSupportFragmentManager(),
              getApplicationContext(),
              (JsonDirectory.JsonFileDir) mBackSelectFileFragments.peek(),
              (JsonTorrent.JsonTorrentResult) mBackTorrentFragments.peek());
    }
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    mViewPager = (ViewPager) findViewById(R.id.viewpager);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setCurrentItem(RepcastPageAdapter.FILE_INDEX);
    mViewPager.addOnPageChangeListener(this);

    completeOnCreate(savedInstanceState, true);
    tabLayout.setupWithViewPager(mViewPager);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_expositores, container, false);

    if (savedInstanceState != null) {
      Colaborador[] categoriaColaboradorArray =
          (Colaborador[]) savedInstanceState.getParcelableArray(COLABORADORLIST_KEY);
      if (categoriaColaboradorArray != null) {
        colaboradorList = Arrays.asList(categoriaColaboradorArray);
      } else {
        colaboradorList = getAllCategoriaColaboradorFromDatabase();
      }
    } else {
      colaboradorList = getAllCategoriaColaboradorFromDatabase();
    }

    listViewColaborador = (ListView) view.findViewById(R.id.listview_colaborador);
    listViewColaborador.setAdapter(new ColaboradorAdapter(colaboradorList, getActivity()));
    listViewColaborador.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Colaborador colaborador = (Colaborador) parent.getAdapter().getItem(position);
            startActivity(VisualizarColaborador.newIntent(getActivity(), colaborador));
          }
        });

    return view;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
      imgAdpt = new ImageGridAdapter(getActivity(), cameraButton);
    } else {
      if (savedInstanceState != null) {
        if (savedInstanceState.containsKey("img")) {

          Parcelable[] parcelableArray = savedInstanceState.getParcelableArray("img");
          Uri[] mThumbUri = null;
          if (parcelableArray != null) {
            mThumbUri = Arrays.copyOf(parcelableArray, parcelableArray.length, Uri[].class);
            imgAdpt = new ImageGridAdapter(getActivity());
            int numOfImages = mThumbUri.length;
            Log.e(TAG, "images in numOfImages " + numOfImages);
            for (int i = 0; i < numOfImages; i++) {
              imgAdpt.addUri(mThumbUri[i]);
              Log.e(TAG, "images in loop " + mThumbUri[i]);
            }
            // Toast.makeText(getActivity(), " images in oncreate" + imgAdpt.getCount(),
            // Toast.LENGTH_SHORT).show();
            Log.e(TAG, "images in oncreate " + imgAdpt.getCount());
          }
        }
      }
    }
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   super.onCreateView(inflater, container, savedInstanceState);
   RelativeLayout root =
       (RelativeLayout) inflater.inflate(R.layout.fragment_networks_list, container, false);
   listview = (ListView) root.findViewById(R.id.networks_list);
   wifiListAdapter = new WifiListAdapter(getActivity());
   listview.setAdapter(wifiListAdapter);
   noNetworksMessage = root.findViewById(R.id.message_group);
   if (savedInstanceState != null) {
     if (savedInstanceState.containsKey(NETWORKS_FOUND)) {
       Parcelable[] storedNetworksFound = savedInstanceState.getParcelableArray(NETWORKS_FOUND);
       networksFound = new WiFiNetwork[storedNetworksFound.length];
       for (int i = 0; i < storedNetworksFound.length; ++i)
         networksFound[i] = (WiFiNetwork) storedNetworksFound[i];
       onScanFinished(networksFound);
     }
     if (savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
       setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
     }
   }
   registerForContextMenu(listview);
   listview.setOnItemClickListener(this);
   return root;
 }
  public void onReceiveResult(int resultCode, Bundle resultData) {
    switch (resultCode) {
      case STATUS_RUNNING:
        {
          mState.mSyncing = true;
          ToolKit.updateRefreshStatus(mState.mSyncing);
          break;
        }
      case STATUS_FINISHED:
        {
          ShortSite[] s = (ShortSite[]) resultData.getParcelableArray(GET_SITES);
          m_adapter.notifyDataSetChanged();
          mState.listSites.clear();
          mState.listSites.addAll(Arrays.asList(s));
          m_adapter.notifyDataSetChanged();
          //			runOnUiThread(returnRes);

          mState.mSyncing = false;
          ToolKit.updateRefreshStatus(mState.mSyncing);
          break;
        }
      case STATUS_ERROR:
        {
          // Error happened down in SyncService, show as toast.
          mState.mSyncing = false;
          ToolKit.updateRefreshStatus(mState.mSyncing);
          Toast.makeText(
                  ExploreRecentsActivity.this,
                  resultData.getString(Intent.EXTRA_TEXT),
                  Toast.LENGTH_LONG)
              .show();
          break;
        }
    }
  }
Example #9
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Bundle args = getArguments();
    mDevices = (Device[]) args.getParcelableArray("devices");

    View view = inflater.inflate(R.layout.fragment_dashboard, container, false);

    gridView = (GridView) view.findViewById(R.id.device_gridview);
    gridView.setAdapter(new DeviceAdapter(view.getContext()));

    gridView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (mDevices[i].enabled) {
              /* let MainActivity handle long clicks */
              mCallback.onDeviceLongClick(i);
            } else {
              /* If this device isn't enabled, tell the user */
              Toast.makeText(
                      view.getContext(), mDevices[i].name + " is disabled.", Toast.LENGTH_LONG)
                  .show();
            }
            return true;
          }
        });
    /* handle when an item in the gridview is clicked */
    gridView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long length) {

            Device device = mDevices[i];

            if (device.enabled) {
              /* set background based on if it is selected or unselected */
              device.selected = !device.selected;
              if (device.selected) {
                /* let MainActivity handle a device being added */
                mCallback.onDeviceAdded(i);

              } else {
                /* let MainActivity handle a device being removed */
                mCallback.onDeviceRemoved(i);
              }

            } else {
              /* If this device isn't enabled, tell the user */
              Toast.makeText(view.getContext(), device.name + " is disabled.", Toast.LENGTH_LONG)
                  .show();
            }
          }
        });

    return view;
  }
Example #10
0
 public void onRestoreInstanceState(Bundle state) {
   Message currentMessage = state.getParcelable(STATE_CURRENT_MESSAGE);
   if (currentMessage != null) {
     show(currentMessage, true);
     Parcelable[] messages = state.getParcelableArray(STATE_MESSAGES);
     for (Parcelable p : messages) {
       mMessages.add((Message) p);
     }
   }
 }
 @Override
 protected void onFinish(Bundle data) {
   SimpleBlog[] blogs = (SimpleBlog[]) data.getParcelableArray(QueryService.KEY_BLOG);
   if (blogs != null) {
     int total = data.getInt(QueryService.KEY_TOTAL);
     int limit = data.getInt(QueryService.KEY_LIMIT);
     int offset = data.getInt(QueryService.KEY_OFFSET);
     getListener().onUserFollowingBlogsSuccess(Arrays.asList(blogs), total, limit, offset);
   } else getListener().onUserFollowingBlogsFail(null);
 }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_list);

    listview = (ListView) findViewById(R.id.userList);
    adapter = new ArrayAdapter<User>(this, android.R.layout.simple_list_item_1, userLiset);

    // For the Restore of the list on the screen when the activity is destroid.
    try {
      userArray = (User[]) savedInstanceState.getParcelableArray(USER_LIST);
      if (userArray.length > 0) {
        for (int i = 0; i < userArray.length; i++) {
          userLiset.add(userArray[i]);
        }
      }

      listview.setAdapter(adapter);
    } catch (Exception e) {

    }
    // restore the User to edit index
    try {
      editedUserIndex = savedInstanceState.getInt("userEditedIndex");
    } catch (Exception e) {

    }

    addUserButton = (Button) findViewById(R.id.from_userList_addUser);
    addUserButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent(UserListActivity.this, AddUserActivity.class);
            startActivityForResult(intent, ADD_USER);
          }
        });

    // Set a listner for the list view items - send the user selected to the edit user activity
    listview.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(UserListActivity.this, DetailsActivity.class);
            userToEdit = userLiset.get(position);
            // In order to know which user should be replaced from the list of users.
            editedUserIndex = position;
            intent.putExtra("user_to_edit", userToEdit);
            startActivityForResult(intent, EDIT_USER);
          }
        });
  }
 private void readExtras(Bundle extras) {
   Parcelable[] parcelCardsArray = extras.getParcelableArray(EXTRA_CARDS);
   for (int i = 0; i < parcelCardsArray.length; i++) {
     mCardPresenters.add((CardPresenter) parcelCardsArray[i]);
     firstCard = (CardPresenter) parcelCardsArray[0];
   }
   Log.i("cardData", mCardPresenters.toString());
   Uri imageUri = (Uri) extras.getParcelable(EXTRA_IMAGE_URI);
   if (imageUri != null) {
     mImage = new ImageManager(this).getImage(imageUri);
   }
   Log.i("ImageURI", imageUri.toString());
 }
Example #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_game);

    Bundle bundle = getIntent().getExtras();

    Parcelable ps1[] = bundle.getParcelableArray("player1Ships");
    Parcelable ps2[] = bundle.getParcelableArray("player2Ships");

    player1Ships = new Ship[ps1.length];
    player2Ships = new Ship[ps2.length];

    System.arraycopy(ps1, 0, player1Ships, 0, ps1.length);

    System.arraycopy(ps2, 0, player2Ships, 0, ps1.length);

    getIntent().removeExtra("player1Ships");
    getIntent().removeExtra("player2Ships");

    game = new Game(player1Ships, player2Ships);
    player1 = PLAYER_PLAYER_NUMBER;
    player2 = ENEMY_PLAYER_NUMBER;

    playerTurn = 0;
    playerNumberText = "Player 1";
    oppositePlayerNumberText = "Player 2";

    topTV = (TextView) findViewById(R.id.play_tv1);

    submarine = (ImageView) findViewById(R.id.submarine);
    smallShip = (ImageView) findViewById(R.id.small_ship);
    battleship = (ImageView) findViewById(R.id.battleship);
    destroyer = (ImageView) findViewById(R.id.destroyer);
    aircraftCarrier = (ImageView) findViewById(R.id.aircraft_carrier);

    showSmallShip1 = true;
    showSub1 = true;
    showDestroyer1 = true;
    showAC1 = true;

    showSmallShip2 = true;
    showSub2 = true;
    showDestroyer2 = true;
    showAC2 = true;

    makeFragments();
    playGame();
  }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   personCode = getArguments().getString(PROFILE_CODE);
   if (personCode == null) personCode = AccountUtils.getActiveUserCode(getActivity());
   if (savedInstanceState != null) {
     final Parcelable[] storedFiles = savedInstanceState.getParcelableArray(FILES_KEY);
     if (storedFiles == null) {
       task = DynamicEmailUtils.getDynamicEmailFiles(personCode, this, getActivity());
     } else {
       files = new DynamicMailFile[storedFiles.length];
       for (int i = 0; i < storedFiles.length; ++i) files[i] = (DynamicMailFile) storedFiles[i];
       if (populateList()) showMainScreen();
     }
   } else task = DynamicEmailUtils.getDynamicEmailFiles(personCode, this, getActivity());
 }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   ocorrId = getArguments().getString(OCORR_CODE);
   if (savedInstanceState != null) {
     final Parcelable[] storedOoccurrences =
         savedInstanceState.getParcelableArray(OCCURRENCES_KEY);
     if (storedOoccurrences == null) {
       task = SubjectUtils.getOtherSubjectOccurrences(ocorrId, this, getActivity());
     } else {
       occurrences = new OtherSubjectOccurrences[storedOoccurrences.length];
       for (int i = 0; i < storedOoccurrences.length; ++i)
         occurrences[i] = (OtherSubjectOccurrences) storedOoccurrences[i];
       if (populateList()) showMainScreen();
     }
   } else task = SubjectUtils.getOtherSubjectOccurrences(ocorrId, this, getActivity());
 }
  @Override
  public void restoreState(Parcelable state, ClassLoader loader) {
    if (state != null) {
      Bundle bundle = (Bundle) state;
      bundle.setClassLoader(loader);

      mItemIds = bundle.getLongArray("itemids");
      if (mItemIds == null) {
        mItemIds = new long[] {};
      }

      Parcelable[] fss = bundle.getParcelableArray("states");
      mSavedState.clear();
      mFragments.clear();
      if (fss != null) {
        for (int i = 0; i < fss.length; i++) {
          mSavedState.add((Fragment.SavedState) fss[i]);
        }
      }
      Iterable<String> keys = bundle.keySet();
      for (String key : keys) {
        if (key.startsWith("f")) {
          int index = Integer.parseInt(key.substring(1));
          try {
            Fragment f = mFragmentManager.getFragment(bundle, key);
            if (f != null) {
              while (mFragments.size() <= index) {
                mFragments.add(null);
              }
              f.setMenuVisibility(false);
              mFragments.set(index, f);
            } else {
              Log.w(TAG, "Bad fragment at key " + key);
            }
          } catch (Exception ex) {
            Log.w(TAG, "Cannot restore fragment " + key, ex);
          }
        }
      }
      checkForIdChanges();
    }
  }
Example #18
0
 static bs a(Bundle bundle, bt btVar, cb cbVar) {
   Object obj = null;
   if (bundle == null) {
     return null;
   }
   String[] strArr;
   Parcelable[] parcelableArray = bundle.getParcelableArray(q);
   if (parcelableArray != null) {
     String[] strArr2 = new String[parcelableArray.length];
     for (int i = 0; i < strArr2.length; i++) {
       if (!(parcelableArray[i] instanceof Bundle)) {
         break;
       }
       strArr2[i] = ((Bundle) parcelableArray[i]).getString(p);
       if (strArr2[i] == null) {
         break;
       }
     }
     int i2 = 1;
     if (obj == null) {
       return null;
     }
     strArr = strArr2;
   } else {
     strArr = null;
   }
   PendingIntent pendingIntent = (PendingIntent) bundle.getParcelable(t);
   PendingIntent pendingIntent2 = (PendingIntent) bundle.getParcelable(s);
   RemoteInput remoteInput = (RemoteInput) bundle.getParcelable(r);
   String[] stringArray = bundle.getStringArray(u);
   if (stringArray == null || stringArray.length != 1) {
     return null;
   }
   return btVar.b(
       strArr,
       remoteInput != null ? C0056bn.a(remoteInput, cbVar) : null,
       pendingIntent2,
       pendingIntent,
       stringArray,
       bundle.getLong(v));
 }
  /**
   * Returns and shows pending/shown SuperCardToasts from orientation change. <br>
   * IMPORTANT: On devices > API 11 this method will automatically save any OnClickListeners and
   * OnDismissListeners via retained Fragment. <br>
   *
   * @param bundle Use onCreate() bundle
   * @param activity The current activity
   */
  public static void onRestoreState(Bundle bundle, Activity activity) {

    if (bundle == null) {

      return;
    }

    Parcelable[] savedArray = bundle.getParcelableArray(BUNDLE_TAG);

    int i = 0;

    if (savedArray != null) {

      for (Parcelable parcelable : savedArray) {

        i++;

        new SuperCardToast(activity, (Style) parcelable, null, null, i);
      }
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final ViewGroup rootView =
        (ViewGroup) inflater.inflate(R.layout.fragment_edit_post_content, container, false);

    mFormatBar = (LinearLayout) rootView.findViewById(R.id.format_bar);
    mTitleEditText = (EditText) rootView.findViewById(R.id.post_title);
    mTitleEditText.setText(mTitle);
    mTitleEditText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            // Go to full screen editor when 'next' button is tapped on soft keyboard
            ActionBar actionBar = getActionBar();
            if (actionId == EditorInfo.IME_ACTION_NEXT
                && actionBar != null
                && actionBar.isShowing()) {
              setContentEditingModeVisible(true);
            }
            return false;
          }
        });

    mContentEditText = (WPEditText) rootView.findViewById(R.id.post_content);
    mContentEditText.setText(mContent);

    mPostContentLinearLayout = (LinearLayout) rootView.findViewById(R.id.post_content_wrapper);
    mPostSettingsLinearLayout = (LinearLayout) rootView.findViewById(R.id.post_settings_wrapper);
    Button postSettingsButton = (Button) rootView.findViewById(R.id.post_settings_button);
    postSettingsButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mEditorFragmentListener.onSettingsClicked();
          }
        });
    mBoldToggleButton = (ToggleButton) rootView.findViewById(R.id.bold);
    mEmToggleButton = (ToggleButton) rootView.findViewById(R.id.em);
    mBquoteToggleButton = (ToggleButton) rootView.findViewById(R.id.bquote);
    mUnderlineToggleButton = (ToggleButton) rootView.findViewById(R.id.underline);
    mStrikeToggleButton = (ToggleButton) rootView.findViewById(R.id.strike);
    mAddPictureButton = (Button) rootView.findViewById(R.id.addPictureButton);
    Button linkButton = (Button) rootView.findViewById(R.id.link);
    Button moreButton = (Button) rootView.findViewById(R.id.more);

    registerForContextMenu(mAddPictureButton);
    mContentEditText = (WPEditText) rootView.findViewById(R.id.post_content);
    mContentEditText.setOnSelectionChangedListener(this);
    mContentEditText.setOnTouchListener(this);
    mContentEditText.addTextChangedListener(this);
    mContentEditText.setOnEditTextImeBackListener(
        new WPEditText.EditTextImeBackListener() {
          @Override
          public void onImeBack(WPEditText ctrl, String text) {
            // Go back to regular editor if IME keyboard is dismissed
            // Bottom comparison is there to ensure that the keyboard is actually showing
            ActionBar actionBar = getActionBar();
            if (mRootView.getBottom() < mFullViewBottom
                && actionBar != null
                && !actionBar.isShowing()) {
              setContentEditingModeVisible(false);
            }
          }
        });
    mAddPictureButton.setOnClickListener(mFormatBarButtonClickListener);
    mBoldToggleButton.setOnClickListener(mFormatBarButtonClickListener);
    linkButton.setOnClickListener(mFormatBarButtonClickListener);
    mEmToggleButton.setOnClickListener(mFormatBarButtonClickListener);
    mUnderlineToggleButton.setOnClickListener(mFormatBarButtonClickListener);
    mStrikeToggleButton.setOnClickListener(mFormatBarButtonClickListener);
    mBquoteToggleButton.setOnClickListener(mFormatBarButtonClickListener);
    moreButton.setOnClickListener(mFormatBarButtonClickListener);
    mEditorFragmentListener.onEditorFragmentInitialized();

    if (savedInstanceState != null) {
      Parcelable[] spans = savedInstanceState.getParcelableArray(KEY_IMAGE_SPANS);

      mContent = savedInstanceState.getString(KEY_CONTENT, "");
      mContentEditText.setText(mContent);
      mContentEditText.setSelection(
          savedInstanceState.getInt(KEY_START, 0), savedInstanceState.getInt(KEY_END, 0));

      if (spans != null && spans.length > 0) {
        for (Parcelable s : spans) {
          WPImageSpan editSpan = (WPImageSpan) s;
          addMediaFile(
              editSpan.getMediaFile(),
              editSpan.getMediaFile().getFilePath(),
              mImageLoader,
              editSpan.getStartPosition(),
              editSpan.getEndPosition());
        }
      }
    }

    return rootView;
  }
  @Override
  protected void onHandleIntent(Intent intent) {
    Context context = getApplicationContext();

    // Get the class to call
    String implementationClass =
        context
            .getSharedPreferences("EndlessJabberSDK", Context.MODE_PRIVATE)
            .getString("InterfaceClass", null);

    if (implementationClass != null) {
      IEndlessJabberImplementation instanceOfMyClass;
      try {
        instanceOfMyClass =
            (IEndlessJabberImplementation) Class.forName(implementationClass).newInstance();

        Bundle extras = intent.getExtras();

        switch (extras.getString("Action")) {
          case "UpdateRead":
            {
              long time = extras.getLong("Time");
              int conversationID = extras.getInt("ConversationID");
              instanceOfMyClass.UpdateReadMessages(context, time, conversationID);
              break;
            }
          case "DeleteThread":
            {
              int conversationID = extras.getInt("ConversationID");
              instanceOfMyClass.DeleteThread(context, conversationID);
              break;
            }
          case "SendMMS":
            {
              boolean save = extras.getBoolean("Save");
              boolean send = extras.getBoolean("Send");
              String[] Recipients = extras.getStringArray("Recipients");

              MMSPart[] parts = new MMSPart[extras.getParcelableArray("Parts").length];

              for (int i = 0; i < parts.length; i++) {
                parts[i] = (MMSPart) extras.getParcelableArray("Parts")[i];
              }

              instanceOfMyClass.SendMMS(
                  context, Recipients, parts, extras.getString("Subject"), save, send);
              break;
            }
          case "SendSMS":
            {
              boolean send = extras.getBoolean("Send");
              String[] Recipients = extras.getStringArray("Recipients");
              String message = extras.getString("Message");

              instanceOfMyClass.SendSMS(context, Recipients, message, send);
              break;
            }
          case "UpdateInfo":
            {
              EndlessJabberInterface.SendInfoToEndlessJabber(context);
              break;
            }
        }
      } catch (InstantiationException e) {

      } catch (IllegalAccessException e) {

      } catch (ClassNotFoundException e) {

      }
    }
    EndlessJabberReceiver.completeWakefulIntent(intent);
  }
Example #22
0
 /**
  * Retrieve extended data from the request.
  *
  * @param name The name of the desired item.
  * @return the value of an item that previously added with putExtra() or null if no Parcelable[]
  *     value was found.
  * @see #putExtra(String, Parcelable[])
  */
 public Parcelable[] getParcelableArrayExtra(String name) {
   return mExtras == null ? null : mExtras.getParcelableArray(name);
 }
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   data = (Entry[]) savedInstanceState.getParcelableArray("data");
   isLoading = savedInstanceState.getBoolean("isLoading");
 }