Esempio n. 1
1
  /**
   * Method used to send back the result to the {@link RequestManager}
   *
   * @param intent The value passed to {@link onHandleIntent(Intent)}. It must contain the {@link
   *     ResultReceiver} and the requestId
   * @param data A {@link Bundle} the data to send back
   * @param code The success/error code to send back
   */
  protected void sendResult(final Intent intent, Bundle data, final int code) {

    if (LogConfig.DP_DEBUG_LOGS_ENABLED) {
      Log.d(LOG_TAG, "sendResult : " + ((code == SUCCESS_CODE) ? "Success" : "Failure"));
    }

    ResultReceiver receiver = (ResultReceiver) intent.getParcelableExtra(INTENT_EXTRA_RECEIVER);

    if (receiver != null) {
      Bundle result = null;
      // Also adding the request parameters (can be useful when receiving the result)
      if (intent != null && intent.getExtras() != null) {
        result = intent.getExtras();
        result.putAll(data);
      }

      if (result == null) {
        result = new Bundle();
      }

      result.putInt(
          RequestManager.RECEIVER_EXTRA_REQUEST_ID,
          intent.getIntExtra(INTENT_EXTRA_REQUEST_ID, -1));

      result.putBoolean(
          RequestManager.RECEIVER_EXTRA_REQUEST_SAVE_IN_MEMORY,
          intent.getBooleanExtra(INTENT_EXTRA_IS_POST_REQUEST, false)
              || intent.getBooleanExtra(INTENT_EXTRA_SAVE_IN_MEMORY, false));

      result.putInt(RequestManager.RECEIVER_EXTRA_RESULT_CODE, code);

      receiver.send(code, result);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root =
        (ViewGroup) inflater.inflate(R.layout.fragment_default_view_pager, container, false);
    ButterKnife.inject(this, root);

    Bundle tvArgs = new Bundle(), radioArgs = new Bundle();
    if (getArguments() != null) {
      tvArgs.putAll(getArguments());
      radioArgs.putAll(getArguments());
    }
    tvArgs.putInt(PVR_LIST_TYPE_KEY, LIST_TV_CHANNELS);
    radioArgs.putInt(PVR_LIST_TYPE_KEY, LIST_RADIO_CHANNELS);

    tabsAdapter =
        new TabsAdapter(getActivity(), getChildFragmentManager())
            .addTab(PVRChannelsListFragment.class, tvArgs, R.string.tv_channels, 1)
            .addTab(PVRChannelsListFragment.class, radioArgs, R.string.radio_channels, 2)
            .addTab(PVRRecordingsListFragment.class, getArguments(), R.string.recordings, 3);

    viewPager.setAdapter(tabsAdapter);
    pagerTabStrip.setViewPager(viewPager);

    return root;
  }
 public Bundle parseResponseUri(String paramString)
 {
   paramString = Uri.parse(paramString);
   Bundle localBundle = Utility.parseUrlQueryString(paramString.getQuery());
   localBundle.putAll(Utility.parseUrlQueryString(paramString.getFragment()));
   return localBundle;
 }
Esempio n. 4
0
 /**
  * Add a set of extended data to the extra.
  *
  * @param extras The Bundle of extras to add to this extra.
  * @see #putExtra
  * @see #removeExtra
  */
 public Request putExtras(Bundle extras) {
   if (mExtras == null) {
     mExtras = new Bundle();
   }
   mExtras.putAll(extras);
   return this;
 }
 /**
  * Device Connectにイベントを送信する.
  *
  * @param event イベントパラメータ
  * @param bundle パラメータ
  * @return 送信成功の場合true、アクセストークンエラーの場合はfalseを返す。
  */
 public final boolean sendEvent(final Event event, final Bundle bundle) {
   Intent intent = EventManager.createEventMessage(event);
   Bundle original = intent.getExtras();
   original.putAll(bundle);
   intent.putExtras(original);
   return sendEvent(intent, event.getAccessToken());
 }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    AppState.logX(TAG, "onSaveInstanceState");

    if (getArguments() != null) outState.putAll(getArguments());
  }
  @Override
  public void onSaveInstanceState(Bundle outState) {

    // Save values from most recent bundle (ie. most recent message)
    outState.putAll(getIntent().getExtras());

    super.onSaveInstanceState(outState);
  }
Esempio n. 8
0
 public void OpenActivity(int iActivityRequestCode, String sAction, long lRowId) {
   bundleDataStartup.clear();
   bundleDataStartup.putLong(CommonActivity.bundleRowId, lRowId);
   bundleDataStartup.putAll(bundleOtherDataStartup);
   Intent it = new Intent(sAction);
   it.putExtras(bundleDataStartup);
   startActivityForResult(it, iActivityRequestCode);
 }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (Log.DEBUG) Log.v("SMSPopupActivity: onSaveInstanceState()");

    // Save values from most recent bundle (ie. most recent message)
    outState.putAll(bundle);
  }
 public void setStatus(int status, Bundle extras, long updateTime) {
   mStatus = status;
   mStatusUpdateTime = updateTime;
   mExtras.clear();
   if (extras != null) {
     mExtras.putAll(extras);
   }
   mHasStatus = true;
 }
 public int getStatus(Bundle extras) {
   if (mHasStatus) {
     extras.clear();
     extras.putAll(mExtras);
     return mStatus;
   } else {
     return LocationProvider.AVAILABLE;
   }
 }
 private void updateTab(String tabId, int placeholder, Fragment frag) {
   FragmentManager fm = getFragmentManager();
   Bundle args = new Bundle();
   args.putAll(getArguments());
   frag.setArguments(args);
   if (fm.findFragmentByTag(tabId) == null) {
     fm.beginTransaction().replace(placeholder, frag, tabId).commit();
   }
 }
 protected void reloadStatuses() {
   if (getActivity() == null || isDetached()) return;
   final Bundle args = new Bundle(), fragmentArgs = getArguments();
   if (fragmentArgs != null) {
     args.putAll(fragmentArgs);
     args.putBoolean(EXTRA_FROM_USER, true);
   }
   getLoaderManager().restartLoader(0, args, this);
 }
Esempio n. 14
0
 /**
  * Copy all extras in 'src' in to this extra.
  *
  * @param src Contains the extras to copy.
  * @see #putExtra
  */
 public Request putExtras(Request src) {
   if (src.mExtras != null) {
     if (mExtras == null) {
       mExtras = new Bundle(src.mExtras);
     } else {
       mExtras.putAll(src.mExtras);
     }
   }
   return this;
 }
 public static ChildrenBrowserFragment newInstance(int folderTypeId) {
   ChildrenBrowserFragment bf = new ChildrenBrowserFragment();
   ListingContext lc = new ListingContext();
   lc.setSortProperty(DocumentFolderService.SORT_PROPERTY_NAME);
   lc.setIsSortAscending(true);
   Bundle b = createBundleArgs(folderTypeId);
   b.putAll(createBundleArgs(lc, LOAD_AUTO));
   bf.setArguments(b);
   return bf;
 }
Esempio n. 16
0
 public static Bundle parseUrl(String url) {
   try {
     URL u = new URL(url);
     Bundle b = decodeUrl(u.getQuery());
     b.putAll(decodeUrl(u.getRef()));
     return b;
   } catch (MalformedURLException e) {
     return new Bundle();
   }
 }
 public final void a(Bundle paramBundle) {
   if (!b(3)) {}
   do {
     return;
     if (paramBundle != null) {
       p.putAll(paramBundle);
     }
   } while (!e());
   k();
 }
  @Override
  protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    this.setContentView(R.layout.topiclist_activity);
    PullToRefreshAttacher.Options options = new PullToRefreshAttacher.Options();
    options.refreshScrollDistance = 0.3f;
    options.refreshOnUp = true;
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this, options);

    if (ActivityUtil.isNotLessThan_4_0()) setNfcCallBack();

    if (null == findViewById(R.id.item_detail_container)) {
      dualScreen = false;
    }
    FragmentManager fm = getSupportFragmentManager();
    Fragment f1 = fm.findFragmentById(R.id.item_list);
    if (f1 == null) {
      f1 = new TopiclistContainer();
      Bundle args = new Bundle(); // (getIntent().getExtras());
      if (null != getIntent().getExtras()) {
        args.putAll(getIntent().getExtras());
      }
      args.putString("url", getIntent().getDataString());
      f1.setArguments(args);
      FragmentTransaction ft = fm.beginTransaction().add(R.id.item_list, f1);
      // .add(R.id.item_detail_container, f);
      ft.commit();
    }
    Fragment f2 = fm.findFragmentById(R.id.item_detail_container);
    if (null == f2) {
      f1.setHasOptionsMenu(true);
    } else if (!dualScreen) {
      this.setTitle(R.string.app_name);
      fm.beginTransaction().remove(f2).commit();
      f1.setHasOptionsMenu(true);
    } else {
      f1.setHasOptionsMenu(false);
      f2.setHasOptionsMenu(true);
    }

    int fid = getIntent().getIntExtra("fid", 0);
    if (fid != 0) {
      String boardName = BoardHolder.boardNameMap.get(fid);
      if (null != boardName) {
        strs[0] = boardName;
      }
    }
    int favor = getIntent().getIntExtra("favor", 0);
    int authorid = getIntent().getIntExtra("authorid", 0);
    if (favor == 0 && authorid == 0) {
      setNavigation();
    } else {
      flags = ThemeManager.ACTION_BAR_FLAG;
    }
  }
 private void reloadData(int position, int verse) {
   ReadingFragment fragment = (ReadingFragment) mAdapter.instantiateItem(mPager, position);
   if (verse > 0) {
     fragment.setForceVerse(verse);
   }
   Bundle bundle = fragment.getArguments();
   if (bundle != null) {
     bundle.putAll(mAdapter.getData(position));
     fragment.reloadData();
   }
 }
 public static ChildrenBrowserFragment newInstanceById(String folderIdentifier) {
   ChildrenBrowserFragment bf = new ChildrenBrowserFragment();
   ListingContext lc = new ListingContext();
   lc.setSortProperty(DocumentFolderService.SORT_PROPERTY_NAME);
   lc.setIsSortAscending(true);
   Bundle b = createBundleArg(folderIdentifier);
   b.putBoolean(PARAM_IS_SHORTCUT, true);
   b.putAll(createBundleArgs(lc, LOAD_AUTO));
   bf.setArguments(b);
   return bf;
 }
Esempio n. 21
0
 @SuppressWarnings("Recycle")
 protected void readSyncState() throws ContactsStorageException {
   @Cleanup("recycle")
   Parcel parcel = Parcel.obtain();
   byte[] raw = getSyncState();
   syncState.clear();
   if (raw != null) {
     parcel.unmarshall(raw, 0, raw.length);
     parcel.setDataPosition(0);
     syncState.putAll(parcel.readBundle());
   }
 }
 private static ChildrenBrowserFragment newInstance(
     Folder parentFolder, String pathFolder, Site site, boolean isShortcut) {
   ChildrenBrowserFragment bf = new ChildrenBrowserFragment();
   ListingContext lc = new ListingContext();
   lc.setSortProperty(DocumentFolderService.SORT_PROPERTY_NAME);
   lc.setIsSortAscending(true);
   Bundle b = createBundleArgs(parentFolder, pathFolder, site);
   b.putBoolean(PARAM_IS_SHORTCUT, isShortcut);
   b.putAll(createBundleArgs(lc, LOAD_AUTO));
   bf.setArguments(b);
   return bf;
 }
Esempio n. 23
0
 /**
  * Parse a URL query and fragment parameters into a key-value bundle.
  *
  * @param url the URL to parse
  * @return a dictionary bundle of keys and values
  */
 public static Bundle parseUrl(String url) {
   // hack to prevent MalformedURLException
   url = url.replace("fbconnect", "http");
   try {
     URL u = new URL(url);
     Bundle b = decodeUrl(u.getQuery());
     b.putAll(decodeUrl(u.getRef()));
     return b;
   } catch (MalformedURLException e) {
     return new Bundle();
   }
 }
Esempio n. 24
0
        public void onReceive(Context context, Intent intent) {

          /*
           * Dispatch intent commands to handler
           */
          Message message = drawhandler.obtainMessage(STATUS_MESSAGE);
          Bundle data = new Bundle();
          if (intent.getExtras() != null) {
            data.putAll(intent.getExtras());
          }
          message.setData(data);
          drawhandler.sendMessage(message);
        }
    public mActions addExtras(Bundle bundle)
    {
label0:
        {
            if (bundle != null)
            {
                if (mExtras != null)
                {
                    break label0;
                }
                mExtras = new Bundle(bundle);
            }
            return this;
        }
        mExtras.putAll(bundle);
        return this;
    }
Esempio n. 26
0
  /** Converts an intent into a {@link Bundle} suitable for use as fragment arguments. */
  public static Bundle intentToFragmentArguments(Intent intent) {
    Bundle arguments = new Bundle();
    if (intent == null) {
      return arguments;
    }

    final Uri data = intent.getData();
    if (data != null) {
      arguments.putParcelable("_uri", data);
    }

    final Bundle extras = intent.getExtras();
    if (extras != null) {
      arguments.putAll(intent.getExtras());
    }

    return arguments;
  }
 private void a(Bundle paramBundle, fxw paramfxw) {
   if (a != null) {
     paramfxw.b();
     return;
   }
   if (c == null) {
     c = new LinkedList();
   }
   c.add(paramfxw);
   if (paramBundle != null) {
     if (b != null) {
       break label72;
     }
     b = ((Bundle) paramBundle.clone());
   }
   for (; ; ) {
     a(i);
     return;
     label72:
     b.putAll(paramBundle);
   }
 }
Esempio n. 28
0
    protected void onCreate(Bundle bundle)
    {
        super.onCreate(bundle);
        setContentView(k.bc_activity_me);
        Intent intent = getIntent();
        int i;
        if (intent != null)
        {
            bundle = intent.getStringExtra("Title");
        } else
        {
            bundle = null;
        }
        b(bundle);
        b().a();
        if (intent != null)
        {
            i = intent.getIntExtra("ListMode", 1);
        } else
        {
            i = 1;
        }
        i;
        JVM INSTR tableswitch 1 1: default 72
    //                   1 130;
           goto _L1 _L2
_L1:
        if (e != null)
        {
            bundle = new Bundle();
            bundle.putAll(intent.getExtras());
            e.setArguments(bundle);
            getSupportFragmentManager().beginTransaction().add(j.fragment_main_panel, e).commit();
        }
        return;
_L2:
        e = new n();
        if (true) goto _L1; else goto _L3
  protected Bundle makeExtrasBundle(String email, String password) {
    final Bundle bundle = new Bundle();

    // Pass through any extras that we were started with.
    if (getIntent() != null && getIntent().getExtras() != null) {
      bundle.putAll(getIntent().getExtras());
    }

    // Overwrite with current settings.
    if (email == null) {
      email = emailEdit.getText().toString();
    }
    if (password == null) {
      password = passwordEdit.getText().toString();
    }
    bundle.putString(EXTRA_EMAIL, email);
    bundle.putString(EXTRA_PASSWORD, password);

    boolean isPasswordShown =
        passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
    bundle.putBoolean(EXTRA_PASSWORD_SHOWN, isPasswordShown);

    return bundle;
  }
  @Override
  public void getServerDiffs(
      SyncContext context,
      SyncData baseSyncData,
      SyncableContentProvider tempProvider,
      Bundle extras,
      Object baseSyncInfo,
      SyncResult syncResult) {
    final ContentResolver cr = getContext().getContentResolver();
    mServerDiffs++;
    final boolean syncingSingleFeed = (extras != null) && extras.containsKey("feed");
    if (syncingSingleFeed) {
      String feedUrl = extras.getString("feed");
      getServerDiffsForFeed(context, baseSyncData, tempProvider, feedUrl, baseSyncInfo, syncResult);
      return;
    }

    // select the set of calendars for this account.
    Cursor cursor =
        cr.query(
            Calendar.Calendars.CONTENT_URI,
            CALENDARS_PROJECTION,
            SELECT_BY_ACCOUNT,
            new String[] {getAccount()},
            null /* sort order */);

    Bundle syncExtras = new Bundle();

    boolean refreshCalendars = true;

    try {
      while (cursor.moveToNext()) {
        boolean syncEvents = (cursor.getInt(6) == 1);
        String feedUrl = cursor.getString(3);

        if (!syncEvents) {
          continue;
        }

        // since this is a poll (no specific feed selected), refresh the list of calendars.
        // we can move away from this when we move to the new allcalendars feed, which is
        // syncable.  until then, we'll rely on the daily poll to keep the list of calendars
        // up to date.
        if (refreshCalendars) {
          mRefresh++;
          context.setStatusText("Fetching list of calendars");
          // get rid of the current cursor and fetch from the server.
          cursor.close();
          final String[] accountSelectionArgs = new String[] {getAccount()};
          cursor =
              cr.query(
                  Calendar.Calendars.LIVE_CONTENT_URI,
                  CALENDARS_PROJECTION,
                  SELECT_BY_ACCOUNT,
                  accountSelectionArgs,
                  null /* sort order */);
          // start over with the loop
          refreshCalendars = false;
          continue;
        }

        // schedule syncs for each of these feeds.
        syncExtras.clear();
        syncExtras.putAll(extras);
        syncExtras.putString("feed", feedUrl);
        cr.startSync(Calendar.CONTENT_URI, syncExtras);
      }
    } finally {
      cursor.close();
    }
  }