@Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   // save controls state
   outState.putString("subject", edSubject.getText().toString());
   outState.putBoolean("alarm", chkAlarm.isChecked());
   outState.putLong("dateStart", dateStart.getTimeInMillis());
   outState.putBoolean("allday", chkAllDay.isChecked());
   outState.putInt("repeatType", iRepeatType);
   outState.putInt("repeatEvery", iRepeatEvery);
   outState.putLong("dateEndOn", dateEndOn.getTimeInMillis());
 }
  public void action() {
    Uri uri = mItem.getUri();

    if (uri == null) {
      showToast("Please select a valid video file first");

      return;
    }

    mItem.stopVideoView();

    int segmentFrom = mItem.getSegmentFrom();
    int segmentTo = mItem.getSegmentTo();

    Intent intent = new Intent();
    intent.setClass(this, ComposerCutCoreActivity.class);

    Bundle b = new Bundle();
    b.putString("srcMediaName1", mItem.getMediaFileName());
    intent.putExtras(b);
    b.putString("dstMediaPath", mItem.genDstPath(mItem.getMediaFileName(), "segment"));
    intent.putExtras(b);
    b.putLong("segmentFrom", segmentFrom);
    intent.putExtras(b);
    b.putLong("segmentTo", segmentTo);
    intent.putExtras(b);
    b.putString("srcUri1", uri.getString());
    intent.putExtras(b);

    startActivity(intent);
  }
 public int getStatuses(final long maxId, final long sinceId) {
   final Bundle args = new Bundle(getArguments());
   args.putLong(EXTRA_MAX_ID, maxId);
   args.putLong(EXTRA_SINCE_ID, sinceId);
   getLoaderManager().restartLoader(0, args, this);
   return -1;
 }
  @Override
  public void onItemSelected(String type, long id) {

    // No matter which type of item is selected, we want to split the view
    // evenly between col0 and col1.
    showColumns(2);

    if (type == "Meal") {
      Log.v(CommunityCookbookActivity.TAG, "Meal selected");
      Bundle arguments = new Bundle();
      arguments.putLong(CCMealDetailFragment.ARG_ITEM_ID, id);
      CCMealDetailFragment fragment = new CCMealDetailFragment();
      fragment.setArguments(arguments);
      getSupportFragmentManager()
          .beginTransaction()
          .replace(R.id.CC_col1_container, fragment)
          .commit(); /// changed home to comm
    } else if (type == "Recipe") {
      Log.v(CommunityCookbookActivity.TAG, "Recipe selected");
      Bundle arguments = new Bundle();
      arguments.putLong(CCRecipeDetailFragment.ARG_ITEM_ID, id);
      CCRecipeDetailFragment fragment = new CCRecipeDetailFragment();
      fragment.setArguments(arguments);
      getSupportFragmentManager()
          .beginTransaction()
          .replace(R.id.CC_col1_container, fragment)
          .commit(); ///// Same
    }
  }
      @Override
      public void onClick(View view) {
        try {
          long genreId = genres.get(getAdapterPosition()).getId();
          Context context = getActivity();
          Intent mIntent = new Intent(context, PlaylistActivity.class);

          Bundle mBundle = new Bundle();
          mBundle.putLong("id", genreId);
          mBundle.putLong("tagfor", PhoneMediaControl.SongsLoadFor.Genre.ordinal());
          mBundle.putString(
              "albumname", ((TextView) view.findViewById(R.id.title)).getText().toString().trim());
          mBundle.putString("title_one", "All my songs");
          mBundle.putString(
              "title_sec",
              ((TextView) view.findViewById(R.id.details)).getText().toString().trim());

          mIntent.putExtras(mBundle);

          context.startActivity(mIntent);
          ((Activity) context).overridePendingTransition(0, 0);
        } catch (Exception e) {
          Log.i(TAG, Log.getStackTraceString(e));
        }
      }
示例#6
0
  @Override
  public RemoteViews getViewAt(int position) {
    if (items == null || position < 0 || position >= items.size()) {
      return null;
    } else {
      // todo cache?
      final Resources r = context.getResources();
      final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
      final int todayDueDateColor =
          prefs.getInt(Preferences.DUE_TODAY_COLOR, r.getColor(R.color.today_due_date_color));
      final int expiredDueDateColor =
          prefs.getInt(Preferences.OVERDUE_COLOR, r.getColor(R.color.expired_due_date_color));
      final int completedColor = r.getColor(R.color.widget_completed);
      final int defaultColor = r.getColor(R.color.white);

      TodoItem item = items.get(position);

      RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_item);
      rv.setTextViewText(R.id.widget_item, item.summary);
      rv.setTextColor(
          R.id.widget_item,
          getItemColor(defaultColor, completedColor, todayDueDateColor, expiredDueDateColor, item));

      final Intent fillInIntent = new Intent();
      final Bundle bundle = new Bundle();
      bundle.putLong(KTodoWidgetProvider.ON_ITEM_CLICK_ITEM_ID_EXTRA, item.id);
      bundle.putLong(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
      fillInIntent.putExtras(bundle);
      rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);

      return rv;
    }
  }
示例#7
0
 public static SplitPartList newInstance(Long parentId, Long accountId) {
   SplitPartList f = new SplitPartList();
   Bundle bundle = new Bundle();
   bundle.putLong(KEY_PARENTID, parentId);
   bundle.putLong(KEY_ACCOUNTID, accountId);
   f.setArguments(bundle);
   return f;
 }
 @Override
 public void SaveDateValuesBeforeChange(Bundle data) {
   super.SaveDateValuesBeforeChange(data);
   if (GetStartMode() == StartMode.EDIT) {
     data.putLong("dateStart", dataRow.GetStartDate().getTimeInMillis());
     data.putLong("dateEndOn", dataRow.GetRepeat().GetEndOnDate().getTimeInMillis());
   }
 }
 /** Returns a new instance of this fragment for the given Ids. */
 public static QuestionPlayerFragment newInstance(long questionId, long answerListId) {
   QuestionPlayerFragment fragment = new QuestionPlayerFragment();
   Bundle args = new Bundle();
   args.putLong(ARG_QUESTION_ID, questionId);
   args.putLong(ARG_ANS_LIST_ID, answerListId);
   fragment.setArguments(args);
   return fragment;
 }
 /**
  * Use this factory method to create a new instance of this fragment using the provided
  * parameters.
  *
  * @param accountId Database id for editing, -1 for adding new.
  * @return A new instance of fragment AddBillDialogFragment.
  */
 public static WithdrawDialogFragment newInstance(long accountId, long transactionId) {
   WithdrawDialogFragment fragment = new WithdrawDialogFragment();
   Bundle args = new Bundle();
   args.putLong(Constant.ARG_ACCOUNT_NUMBER_LONG, accountId);
   args.putLong(Constant.ARG_TRANSACTION_NUMBER_LONG, transactionId);
   fragment.setArguments(args);
   return fragment;
 }
示例#11
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putString("org.taulabs.androidgcs.ObjectName", objectName);
    outState.putLong("org.taulabs.androidgcs.ObjectId", objectID);
    outState.putLong("org.taulabs.androidgcs.InstId", instID);
    outState.putBoolean("org.taulabs.androidgcs.updated", updated);
  }
示例#12
0
 /**
  * Send playback progress to UI
  *
  * @param currentPosition
  * @param totalDuration
  */
 public void sendProgressEvent(long currentPosition, long totalDuration) {
   Bundle b = new Bundle();
   b.putInt(EVENT_TYPE, PLAY_PROGRESS_UPDATE);
   b.putLong(EVENT_PLAY_PROGRESS_POSITION, currentPosition);
   b.putLong(EVENT_PLAY_DURATION, totalDuration);
   Intent i = new Intent();
   i.setAction(mAction);
   i.putExtras(b);
   mContext.sendBroadcast(i);
 }
 public static AddUserListMemberDialogFragment show(
     final FragmentManager fm, final long accountId, final long listId) {
   final Bundle args = new Bundle();
   args.putLong(EXTRA_ACCOUNT_ID, accountId);
   args.putLong(EXTRA_LIST_ID, listId);
   final AddUserListMemberDialogFragment f = new AddUserListMemberDialogFragment();
   f.setArguments(args);
   f.show(fm, FRAGMENT_TAG);
   return f;
 }
  public static TrackSessionFragment newInstance(
      Session session, CompletedWorkout completedWorkout, int position) {
    TrackSessionFragment fragment = new TrackSessionFragment();
    Bundle args = new Bundle();
    args.putLong("sessionId", session.getId());
    args.putLong("completedWorkoutId", completedWorkout.getId());
    args.putInt("position", position);

    fragment.setArguments(args);
    return fragment;
  }
 @Override
 public final int getStatuses(
     final long[] account_ids, final long[] max_ids, final long[] since_ids) {
   final long max_id = max_ids != null && max_ids.length == 1 ? max_ids[0] : -1;
   final long since_id = since_ids != null && since_ids.length == 1 ? since_ids[0] : -1;
   final Bundle args = (Bundle) getArguments().clone();
   args.putLong(INTENT_KEY_MAX_ID, max_id);
   args.putLong(INTENT_KEY_SINCE_ID, since_id);
   getLoaderManager().restartLoader(0, args, this);
   return -1;
 }
示例#16
0
  public static NoteFragment newInstance(long listId, long id, String note, String status) {
    NoteFragment f = new NoteFragment();

    Bundle args = new Bundle();
    args.putLong(ARG_LIST_ID, listId);
    args.putLong(ARG_ID, id);
    args.putString(ARG_NOTE, note);
    args.putString(ARG_STATUS, status);
    f.setArguments(args);

    return f;
  }
示例#17
0
  /**
   * Save game state so that the user does not lose anything if the game process is killed while we
   * are in the background.
   *
   * @return a Bundle with this view's state
   */
  public Bundle saveState() {
    Bundle map = new Bundle();

    map.putIntArray("mAppleList", coordArrayListToArray(mAppleList));
    map.putInt("mDirection", Integer.valueOf(mDirection));
    map.putInt("mNextDirection", Integer.valueOf(mNextDirection));
    map.putLong("mMoveDelay", Long.valueOf(mMoveDelay));
    map.putLong("mScore", Long.valueOf(mScore));
    map.putIntArray("mSnakeTrail", coordArrayListToArray(mSnakeTrail));

    return map;
  }
示例#18
0
  public Bundle toBundle() {
    Bundle bundle = new Bundle();

    bundle.putLong(KEY_ID, id);
    bundle.putString(KEY_TITLE, title);
    bundle.putString(KEY_OVERVIEW, overview);
    bundle.putString(KEY_POSTER_PATH, poster_path);
    bundle.putDouble(KEY_VOTE_AVERAGE, vote_average);
    bundle.putLong(KEY_VOTE_COUNT, vote_count);
    bundle.putString(KEY_RELEASE_DATE, release_date);

    return bundle;
  }
 /** Loads the fragment for creating/editing transactions and initializes it to be displayed */
 private void initializeCreateOrEditTransaction() {
   long transactionId = getIntent().getLongExtra(UxArgument.SELECTED_TRANSACTION_ID, -1);
   Bundle args = new Bundle();
   if (transactionId > 0) {
     mSectionHeaderTransactions.setText(R.string.title_edit_transaction);
     args.putLong(UxArgument.SELECTED_TRANSACTION_ID, transactionId);
     args.putLong(UxArgument.SELECTED_ACCOUNT_ID, mAccountId);
   } else {
     mSectionHeaderTransactions.setText(R.string.title_add_transaction);
     args.putLong(UxArgument.SELECTED_ACCOUNT_ID, mAccountId);
   }
   mSectionHeaderTransactions.setBackgroundColor(sLastTitleColor);
   showTransactionFormFragment(args);
 }
  /** kicks off the actual signing process on a background thread */
  private void startSigning() {
    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_CERTIFY_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in ApgService
    KeychainIntentServiceHandler saveHandler =
        new KeychainIntentServiceHandler(
            this, getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
          public void handleMessage(Message message) {
            // handle messages by standard ApgHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {

              Toast.makeText(CertifyKeyActivity.this, R.string.key_sign_success, Toast.LENGTH_SHORT)
                  .show();

              // check if we need to send the key to the server or not
              if (mUploadKeyCheckbox.isChecked()) {
                // upload the newly signed key to the keyserver
                uploadKey();
              } else {
                setResult(RESULT_OK);
                finish();
              }
            }
          }
        };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
  }
示例#21
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putLong("tournamentId", tournament.getId());
   Log.d("ScoresFragment", "onSaveInstanceState " + tournament.getId());
   outState.putInt("activeRound", activeRound);
 }
示例#22
0
  @Override
  protected void onPostExecute(String result) {
    // TODO Auto-generated method stub
    super.onPostExecute(result);
    if (pDialog != null) pDialog.dismiss();

    if (result.contains("success")) {
      Util.showToastMessage(Util.mContext, "Payment done successfully", Toast.LENGTH_LONG);
    } else {
      Log.e(TAG, "Error fetching data: " + result);
      Toast.makeText(Util.mContext, result, Toast.LENGTH_LONG).show();
    }

    // Pass value of
    // {"response":"success","cashbackValue":0,"bookingId":246}
    if (mHandler != null) {
      Message msg = Message.obtain();
      Bundle b = new Bundle();
      b.putBoolean("success", true);
      b.putString("jobId", jobId);
      b.putLong("cashBackReturned", cashBackReturned);
      Log.e(TAG, "b: " + b.toString());
      msg.setData(b);
      msg.what = 2;
      mHandler.sendMessage(msg);
      // mHandler.sendEmptyMessage(2);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transaction_detail);

    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);

    // savedInstanceState is non-null when there is fragment state
    // saved from previous configurations of this activity
    // (e.g. when rotating the screen from portrait to landscape).
    // In this case, the fragment will automatically be re-added
    // to its container so we don't need to manually add it.
    // For more information, see the Fragments API guide at:
    //
    // http://developer.android.com/guide/components/fragments.html
    //
    if (savedInstanceState == null) {
      // Create the detail fragment and add it to the activity
      // using a fragment transaction.
      Bundle arguments = new Bundle();
      arguments.putLong(
          TransactionDetailFragment.ARG_ITEM_ID,
          getIntent().getLongExtra(TransactionDetailFragment.ARG_ITEM_ID, -1));
      TransactionDetailFragment fragment = new TransactionDetailFragment();
      fragment.setArguments(arguments);
      getFragmentManager()
          .beginTransaction()
          .add(R.id.transaction_detail_container, fragment)
          .commit();
    }
  }
    /**
     * React to tap events on Map by showing an appropriate detail activity
     *
     * @see com.google.android.maps.ItemizedOverlay#onTap(com.google.android.maps.GeoPoint,
     *     com.google.android.maps.MapView)
     */
    @Override
    public boolean onTap(GeoPoint p, MapView mvMap1) {
      long lat = p.getLatitudeE6();
      long lon = p.getLongitudeE6();

      long rowid = -1;
      JobsCursor c = db.getJobs(JobsCursor.SortBy.title);
      for (int i = 0; i < c.getCount(); i++) {
        if (Math.abs(c.getColLatitude() - lat) < 1000
            && Math.abs(c.getColLongitude() - lon) < 1000) {
          rowid = c.getColJobsId();
          break;
        } else {
          c.moveToNext();
        }
      }

      if (0 > rowid) {
        return false;
      }

      Bundle b = new Bundle();
      b.putLong("_id", rowid);
      Intent i = new Intent(MicroJobs.this, MicroJobsDetail.class);
      i.putExtras(b);
      startActivity(i);

      return true;
    }
 public static ArticleDetailFragment newInstance(long itemId) {
   Bundle arguments = new Bundle();
   arguments.putLong(ARG_ITEM_ID, itemId);
   ArticleDetailFragment fragment = new ArticleDetailFragment();
   fragment.setArguments(arguments);
   return fragment;
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mVolleyRequestQueue = Volley.newRequestQueue(getActivity());
    intilizeStatic();
    mMovieAdapter = new MovieAdapter(getActivity(), null, 0);
    trailerDataModified.set(false);
    reviewDataModified.set(false);
    movieDetailsModified.set(false);
    movieMinutesModified.set(false);

    if (savedInstanceState != null) {
      synchronized (mMovieId) {
        mMovieId = savedInstanceState.getLong(sMovieIdKey);
        YouTubeFirstTrailerURL = savedInstanceState.getParcelable("ShareYoutubeLinkKey");
        if (YouTubeFirstTrailerURL != null)
          if (mShareActionProvider != null) {
            mMenu.findItem(R.id.action_share).setVisible(true);
          } else Log.e(LOG_TAG, "mShareActionProvider not set");
        try {
          mMovieId.notifyAll();
        } catch (IllegalMonitorStateException x) {
        }
      }
      Bundle b = new Bundle();
      b.putLong(sMovieIdKey, mMovieId);
      getLoaderManager().restartLoader(MovieQuery.DETAIL_LOADER, b, this);
      getLoaderManager().restartLoader(TrailerQuery.TRAILER_LOADER, b, this);
      getLoaderManager().restartLoader(ReviewQuery.REVIEW_LOADER, b, this);
    }
  }
示例#27
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt("mCurrGraphPosX", mCurrGraphPosX);
   outState.putLong("mLastVoteTime", mLastVoteTime);
   outState.putParcelable("mSeries", mSeries);
 }
示例#28
0
 /** 新实例,新建时必须调用 */
 public static PhotoFragment newInstance(long photoId) {
   PhotoFragment pf = new PhotoFragment();
   Bundle args = new Bundle();
   args.putLong("photoId", photoId);
   pf.setArguments(args);
   return pf;
 }
示例#29
0
 public static Bundle Json2Bundle(JSONObject json) {
   Bundle mBundle = new Bundle();
   @SuppressWarnings("unchecked")
   Iterator<String> iter = json.keys();
   Object value;
   while (iter.hasNext()) {
     String key = iter.next();
     try {
       value = json.get(key);
       if (Boolean.class.isInstance(value)) {
         mBundle.putBoolean(key, (Boolean) value);
       } else if (Double.class.isInstance(value)) {
         mBundle.putDouble(key, (Double) value);
       } else if (Integer.class.isInstance(value)) {
         mBundle.putInt(key, (Integer) value);
       } else if (Long.class.isInstance(value)) {
         mBundle.putLong(key, (Long) value);
       } else if (JSONObject.class.isInstance(value)) {
         mBundle.putBundle(key, Json2Bundle((JSONObject) value));
       } else {
         mBundle.putString(key, json.getString(key));
       }
     } catch (JSONException e) {
       e.printStackTrace();
     }
   }
   return mBundle;
 }
示例#30
0
              @Override
              public void handleMessage(Message msg) {
                String token = msg.getData().getString(TOKEN);
                long expiresAt = msg.getData().getLong(EXPIRES) * 1000L;

                // To avoid confusion we should return the expiration time in
                // the same format as the getAccessExpires() function - that
                // is in milliseconds.
                Bundle resultBundle = (Bundle) msg.getData().clone();
                resultBundle.putLong(EXPIRES, expiresAt);

                if (token != null) {
                  setAccessToken(token);
                  setAccessExpires(expiresAt);
                  if (serviceListener != null) {
                    serviceListener.onComplete(resultBundle);
                  }
                } else if (serviceListener != null) { // extract errors only if client wants them
                  String error = msg.getData().getString("error");
                  if (msg.getData().containsKey("error_code")) {
                    int errorCode = msg.getData().getInt("error_code");
                    serviceListener.onFacebookError(new FacebookError(error, null, errorCode));
                  } else {
                    serviceListener.onError(
                        new Error(error != null ? error : "Unknown service error"));
                  }
                }

                // The refreshToken function should be called rarely,
                // so there is no point in keeping the binding open.
                applicationsContext.unbindService(TokenRefreshServiceConnection.this);
              }