Пример #1
1
 public static DetailsFragment newInstance(int index) {
   DetailsFragment details = new DetailsFragment();
   Bundle args = new Bundle();
   args.putInt("index", index);
   details.setArguments(args);
   return details;
 }
Пример #2
1
  @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();
    }
  }
 public static MagicKeyboardFragment newInstance(int sectionNumber) {
   MagicKeyboardFragment fragment = new MagicKeyboardFragment();
   Bundle args = new Bundle();
   args.putInt(ARG_SECTION_NUMBER, sectionNumber);
   fragment.setArguments(args);
   return fragment;
 }
Пример #4
1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDbHelper = new NotesDbAdapter(this);
    mDbHelper.open();

    setContentView(R.layout.note_edit);
    setTitle(R.string.edit_note);

    mTitleText = (EditText) findViewById(R.id.title);
    mBodyText = (EditText) findViewById(R.id.body);

    Button confirmButton = (Button) findViewById(R.id.confirm);

    mRowId =
        (savedInstanceState == null)
            ? null
            : (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
    if (mRowId == null) {
      Bundle extras = getIntent().getExtras();
      mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null;
    }

    populateFields();

    confirmButton.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View view) {
            setResult(RESULT_OK);
            finish();
          }
        });
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
      case REQUEST_CODE_PUBLIC_KEYS:
        {
          if (resultCode == Activity.RESULT_OK) {
            Bundle bundle = data.getExtras();
            setEncryptionKeyIds(
                bundle.getLongArray(SelectPublicKeyActivity.RESULT_EXTRA_MASTER_KEY_IDS));
          }
          break;
        }

      case REQUEST_CODE_SECRET_KEYS:
        {
          if (resultCode == Activity.RESULT_OK) {
            Uri uriMasterKey = data.getData();
            setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
          } else {
            setSignatureKeyId(Constants.key.none);
          }
          break;
        }

      default:
        {
          super.onActivityResult(requestCode, resultCode, data);

          break;
        }
    }
  }
Пример #6
0
 public static PlaceholderFragment newInstance(int sectionNumber) {
   PlaceholderFragment fragment = new PlaceholderFragment();
   Bundle args = new Bundle();
   args.putInt(ARG_SECTION_NUMBER, sectionNumber);
   fragment.setArguments(args);
   return fragment;
 }
Пример #7
0
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
      Util.logd("Facebook-WebView", "Redirect URL: " + url);
      if (url.startsWith(Facebook.REDIRECT_URI)) {
        Bundle values = Util.parseUrl(url);

        String error = values.getString("error");
        if (error == null) {
          error = values.getString("error_type");
        }

        if (error == null) {
          mListener.onComplete(values);
        } else if (error.equals("access_denied") || error.equals("OAuthAccessDeniedException")) {
          mListener.onCancel();
        } else {
          mListener.onFacebookError(new FacebookError(error));
        }

        FbDialog.this.dismiss();
        return true;
      } else if (url.startsWith(Facebook.CANCEL_URI)) {
        mListener.onCancel();
        FbDialog.this.dismiss();
        return true;
      } else if (url.contains(DISPLAY_STRING)) {
        return false;
      }
      // launch non-dialog URLs in a full browser
      getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
      return true;
    }
Пример #8
0
 public static Fragment getInstance(String imgLink) {
   ImageViewFragment frg = new ImageViewFragment();
   Bundle args = new Bundle();
   args.putString(IMG, imgLink);
   frg.setArguments(args);
   return frg;
 }
Пример #9
0
  // [START receive_message]
  @Override
  public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");
    String extra = data.getString("extra");
    Log.d(TAG, "From: " + from);
    Log.d(TAG, "Message: " + message);

    if (from.startsWith("/topics/")) {
      // message received from some topic.
    } else {
      // normal downstream message.
    }

    // [START_EXCLUDE]
    /**
     * Production applications would usually process the message here. Eg: - Syncing with server. -
     * Store message in local database. - Update UI.
     */

    /**
     * In some cases it may be useful to show a notification indicating to the user that a message
     * was received.
     */
    sendNotification(message, extra);
    // [END_EXCLUDE]
  }
Пример #10
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Handle presses on the action bar items
   switch (item.getItemId()) {
     case R.id.action_exit:
       // EXIT
       setResult(WorkoutObjects.BAD_RESULT);
       finish();
       return true;
     case R.id.action_save:
       // SAVE
       checkRemoved();
       if (WorkoutObjects.workoutList.hasWorkout(workout.getName()) && position == -1) {
         Toast.makeText(this, "Workout name already exists!", Toast.LENGTH_SHORT).show();
       } else {
         if (position == -1) FileManagement.addGlobalWorkout(workout);
         MainActivity.onEdit(workout, position);
         FileManagement.writeWorkoutFile();
         setResult(WorkoutObjects.OK_RESULT);
         finish();
       }
       return true;
     case R.id.action_create_exercise:
       android.app.FragmentManager fm = CustomizeWorkout.this.getFragmentManager();
       CreateExercise f = new CreateExercise();
       Bundle bundle = new Bundle();
       bundle.putInt("caller", WorkoutObjects.CUSTOMIZE_WORKOUT);
       f.setArguments(bundle);
       f.show(fm, "dialog");
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Пример #11
0
 public static FeedFragment newInstance(MajorTeamGsonModel model) {
   FeedFragment fragment = new FeedFragment();
   Bundle args = new Bundle();
   args.putParcelable("MajorTeamGsonModel", model);
   fragment.setArguments(args);
   return fragment;
 }
Пример #12
0
 public static LogFragment newInstance(String user_id) {
   Bundle arguments = new Bundle();
   arguments.putString(USER_ID, user_id);
   LogFragment fragment = new LogFragment();
   fragment.setArguments(arguments);
   return fragment;
 }
Пример #13
0
  /**
   * Restores the encryption key from the given Bundle. Expected to be called when an Activity is
   * being restored after being killed in the background. If the Activity was explicitly killed by
   * the user, Android gives no Bundle (and therefore no key).
   *
   * @param savedInstanceState Bundle containing the Activity's previous state. Null if the user
   *     explicitly killed the Activity.
   * @return True if the data was restored successfully from the Bundle, or if the CipherData in use
   *     matches the Bundle contents.
   */
  public boolean restoreFromBundle(Bundle savedInstanceState) {
    if (savedInstanceState == null) return false;

    byte[] wrappedKey = savedInstanceState.getByteArray(BUNDLE_KEY);
    byte[] iv = savedInstanceState.getByteArray(BUNDLE_IV);
    if (wrappedKey == null || iv == null) return false;

    try {
      Key bundledKey = new SecretKeySpec(wrappedKey, "AES");
      synchronized (mDataLock) {
        if (mData == null) {
          mData = new CipherData(bundledKey, iv);
          return true;
        } else if (mData.key.equals(bundledKey) && Arrays.equals(mData.iv, iv)) {
          return true;
        } else {
          Log.e(TAG, "Attempted to restore different cipher data.");
        }
      }
    } catch (IllegalArgumentException e) {
      Log.e(TAG, "Error in restoring the key from the bundle.");
    }

    return false;
  }
Пример #14
0
  private void setupViewObjects(User user) {
    ivCoverPic = (ImageView) mFragmentView.findViewById(R.id.ivCoverPic);
    ivProfilePic = (ImageView) mFragmentView.findViewById(R.id.ivProfilePic);
    TextView tvProfileName = (TextView) mFragmentView.findViewById(R.id.tvProfileName);
    TextView tvProfileLocation = (TextView) mFragmentView.findViewById(R.id.tvProfileLocation);

    Picasso.with(getContext())
        .load(
            "https://graph.facebook.com/"
                + user.getAuthId()
                + "/picture?width="
                + String.valueOf(getContext().getResources().getDisplayMetrics().widthPixels))
        .into(ivProfilePic /*new Target() {
                    @Override
                    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                        src = bitmap;
                        Resources res = getResources();
                        RoundedBitmapDrawable dr =
                                RoundedBitmapDrawableFactory.create(res, src);
                        dr.setCornerRadius(500f);
                        ivProfilePic.setImageDrawable(dr);
                    }

                    @Override
                    public void onBitmapFailed(Drawable errorDrawable) {

                    }

                    @Override
                    public void onPrepareLoad(Drawable placeHolderDrawable) {

                    }
                }*/);

    GraphRequest request =
        GraphRequest.newMeRequest(
            AccessToken.getCurrentAccessToken(),
            new GraphRequest.GraphJSONObjectCallback() {

              @Override
              public void onCompleted(JSONObject ret, GraphResponse graphResponse) {
                JSONObject cover = null;
                String url = null;
                try {
                  cover = ret.getJSONObject("cover");
                  url = cover.getString("source");
                } catch (JSONException e) {
                  e.printStackTrace();
                }
                Picasso.with(getContext()).load(url).into(ivCoverPic);
              }
            });

    Bundle parameters = new Bundle();
    parameters.putString("fields", "cover");
    request.setParameters(parameters);
    request.executeAsync();

    tvProfileName.setText(user.getName());
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Context context = getActivity();

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_training_detail, container, false);

    // Expandable Summary
    ExpandList = (ExpandableListView) view.findViewById(R.id.training_summary);

    Bundle bundle = getArguments();
    String trainingCode = bundle.getString("trainingCode");

    trainingUrl = String.format("http://eas.elephorm.com/api/v1/trainings/%1$s", trainingCode);

    training_title = (TextView) view.findViewById(R.id.training_title);

    training_video = (VideoView) view.findViewById(R.id.training_video);
    training_video.setMediaController(new MediaController(context));

    // BOITE DE DIALOGUE
    pDialog = new ProgressDialog(getActivity());
    pDialog.setMessage("Chargement...");
    pDialog.setCancelable(false);

    makeJsonObjectRequest();

    ExpandList.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView expandableListView,
              View view,
              int parentPosition,
              int childPosition,
              long l) {
            String courseId = list.get(parentPosition).getItems().get(childPosition).getId();
            Intent intent = new Intent(getActivity(), CourseActivity.class);
            intent.putExtra("courseId", courseId);
            intent.putExtra("trainingUrl", trainingUrl);
            startActivity(intent);
            return false;
          }
        });

    training_video.start();

    training_video.setOnCompletionListener(
        new MediaPlayer.OnCompletionListener() {
          @Override
          public void onCompletion(MediaPlayer mediaPlayer) {
            System.out.println("C'est fini :(");
            saveHistory();
          }
        });

    return view;
  }
Пример #16
0
  /* (non-Javadoc)
   * @see uk.ac.swan.digitaltrails.fragments.SearchListFragment.OnWalkSelectedListener#onWalkSelected(uk.ac.swan.digitaltrails.components.Walk)
   */
  @Override
  public void onWalkSelected(Walk walk) {
    Log.d(TAG, "Trying to choose a walk");
    SearchDetailsFragment detailsFrag =
        (SearchDetailsFragment)
            getSupportFragmentManager().findFragmentById(R.id.search_details_fragment);
    mWalk = walk;
    if (detailsFrag != null) {
      Log.d(TAG, "In 2 pane view");
      // if available and we are in 2-pane view.
      detailsFrag.updateDetailsView(walk);
    } else {
      Log.d(TAG, "In 1 pane view");
      // if in 1 pane view
      SearchDetailsFragment newDetailsFragment = new SearchDetailsFragment();
      Bundle args = new Bundle();
      args.putParcelable(SearchDetailsFragment.ARG_POSITION, walk);
      newDetailsFragment.setArguments(args);

      FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

      transaction.replace(R.id.fragment_container, newDetailsFragment);
      transaction.addToBackStack(null);

      transaction.commit();
    }
  }
Пример #17
0
 public void showText(String filename) {
   Intent showIt = new Intent(this, TipsAndTricksShowTextView.class);
   Bundle toShow = new Bundle();
   toShow.putString("tat_show_file", filename);
   showIt.putExtras(toShow);
   startActivity(showIt);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View v = inflater.inflate(R.layout.autofill_credit_card_editor, container, false);
    mNameText = (EditText) v.findViewById(R.id.autofill_credit_card_editor_name_edit);
    mNumberText = (EditText) v.findViewById(R.id.autofill_credit_card_editor_number_edit);

    // Set text watcher to format credit card number
    mNumberText.addTextChangedListener(new CreditCardNumberFormattingTextWatcher());

    mExpirationMonth = (Spinner) v.findViewById(R.id.autofill_credit_card_editor_month_spinner);
    mExpirationYear = (Spinner) v.findViewById(R.id.autofill_credit_card_editor_year_spinner);

    // We know which profile to edit based on the GUID stuffed in
    // our extras by AutofillPreferences.
    Bundle extras = getArguments();
    if (extras != null) {
      mGUID = extras.getString(AutofillPreferences.AUTOFILL_GUID);
    }
    if (mGUID == null) {
      mGUID = "";
      getActivity().setTitle(R.string.autofill_create_credit_card);
    } else {
      getActivity().setTitle(R.string.autofill_edit_credit_card);
    }

    addSpinnerAdapters();
    addCardDataToEditFields();
    hookupSaveCancelDeleteButtons(v);
    return v;
  }
 public static Fragment newInstance(CharSequence text) {
   DummyFragment fragment = new DummyFragment();
   Bundle args = new Bundle();
   args.putString(ARG_TEXT, String.valueOf(text));
   fragment.setArguments(args);
   return fragment;
 }
Пример #20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_grid);

    Bundle bundle = getIntent().getExtras();
    imageUrls = bundle.getStringArray(Extra.IMAGES);

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_stub)
            .showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    listView = (GridView) findViewById(R.id.gridview);
    ((GridView) listView).setAdapter(new ImageAdapter());
    listView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startImagePagerActivity(position);
          }
        });
  }
  public static Bundle convertToBundle(JSONObject jsonObject) throws JSONException {
    Bundle bundle = new Bundle();
    @SuppressWarnings("unchecked")
    Iterator<String> jsonIterator = jsonObject.keys();
    while (jsonIterator.hasNext()) {
      String key = jsonIterator.next();
      Object value = jsonObject.get(key);
      if (value == null || value == JSONObject.NULL) {
        // Null is not supported.
        continue;
      }

      // Special case JSONObject as it's one way, on the return it would be Bundle.
      if (value instanceof JSONObject) {
        bundle.putBundle(key, convertToBundle((JSONObject) value));
        continue;
      }

      Setter setter = SETTERS.get(value.getClass());
      if (setter == null) {
        throw new IllegalArgumentException("Unsupported type: " + value.getClass());
      }
      setter.setOnBundle(bundle, key, value);
    }

    return bundle;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sleepchooser_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.putString(
          sleepChooserDetailFragment.ARG_ITEM_ID,
          getIntent().getStringExtra(sleepChooserDetailFragment.ARG_ITEM_ID));
      sleepChooserDetailFragment fragment = new sleepChooserDetailFragment();
      fragment.setArguments(arguments);
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.sleepchooser_detail_container, fragment)
          .commit();
    }
  }
Пример #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle bundle = getIntent().getExtras();
    strdate = bundle.getString("strdate");
    enddate = bundle.getString("enddate");
    moneyType = bundle.getString("moneyType");
    initTitle(R.drawable.njzq_title_left_back, 0, "资金流水查询");

    String[] toolbarNames = {
      Global.TOOLBAR_DETAIL, Global.TOOLBAR_SHANGYE, Global.TOOLBAR_XIAYIYE, Global.TOOLBAR_REFRESH
    };
    initToolBar(toolbarNames, Global.BAR_TAG);
    super.enabledToolBarfalse();

    colsName = getResources().getStringArray(R.array.zr_trade_stock_query_zjls_name);
    colsIndex = getResources().getStringArray(R.array.zr_trade_stock_query_zjls_index);
    digitColsIndex = new HashSet<Integer>();
    digitColsIndex.add(3);
    digitColsIndex.add(4);

    handlerData();
    allRecords = new JSONArray();
  }
Пример #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_profile);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    db = new SQLiteController(getApplicationContext());
    sessions = new sessionmanager(getApplicationContext());

    Bundle bundle = getIntent().getExtras();
    if (bundle != null) fromActivity = bundle.getString("fromActivity");

    HashMap<String, String> profile = db.getUserDetails();
    String id = profile.get("id");
    String gender = profile.get("gender");
    String age = profile.get("age");
    String race = profile.get("race");
    String religion = profile.get("religion");
    String height = profile.get("height");
    String location = profile.get("location");
    String horoscope = profile.get("horoscope");
    String job = profile.get("job");
    String userDetail = profile.get("user_detail");
    String roko = profile.get("merokok");
    String alkohol = profile.get("alkohol");
    String tps = profile.get("tipe_pasangan");
    String kgt = profile.get("kegiatan");
    String interest = profile.get("interest");
    String satnite = profile.get("satnite");

    deskripsi = (EditText) findViewById(R.id.deskripsi);
    tipe_pasangan = (EditText) findViewById(R.id.tipe_pasangan);
    kegiatan = (EditText) findViewById(R.id.kegiatan);
    halsuka = (EditText) findViewById(R.id.halsuka);
    malming = (EditText) findViewById(R.id.malming);
    tinggi = (EditText) findViewById(R.id.tinggi);
    txtReligion = (Spinner) findViewById(R.id.agama);
    txtRokok = (Spinner) findViewById(R.id.merokok);
    txtAlkohol = (Spinner) findViewById(R.id.alkohol);
    txtRace = (Spinner) findViewById(R.id.suku);
    txtLocation = (Spinner) findViewById(R.id.lokasi);
    txtHoroscope = (Spinner) findViewById(R.id.horoskop);
    txtJob = (Spinner) findViewById(R.id.pekerjaan);
    getSpinner("suku");
    getSpinner("pekerjaan");
    getSpinner("lokasi");
    tinggi.setText(height);
    deskripsi.setText(userDetail);
    tipe_pasangan.setText(tps);
    kegiatan.setText(kgt);
    halsuka.setText(interest);
    malming.setText(satnite);
    getIndex(txtRokok, roko);
    getIndex(txtAlkohol, alkohol);
    getIndex(txtRace, race);
    getIndex(txtLocation, location);
    getIndex(txtHoroscope, horoscope);
    getIndex(txtJob, job);
    getIndex(txtReligion, religion);
  }
Пример #25
0
 public static MovieDetailFragment newInstance(String jsonMovie) {
   Bundle args = new Bundle();
   args.putString("movie", jsonMovie);
   MovieDetailFragment fragment = new MovieDetailFragment();
   fragment.setArguments(args);
   return fragment;
 }
 /**
  * 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 onViewCreated(final View view, final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final Bundle args = getArguments();
    bucket = args.getString(BUNDLE_ARGS_S3_BUCKET);
    prefix = args.getString(BUNDLE_ARGS_S3_PREFIX);

    final ProgressDialog dialog =
        getProgressDialog(R.string.content_progress_dialog_message_load_local_content);

    // Create the User File Manager
    AWSMobileClient.defaultMobileClient()
        .createUserFileManager(
            bucket,
            prefix,
            new UserFileManager.BuilderResultHandler() {

              @Override
              public void onComplete(final UserFileManager userFileManager) {
                if (isAdded()) {
                  UserFilesBrowserFragment.this.userFileManager = userFileManager;
                  createContentList(getView(), userFileManager);
                  userFileManager.setContentRemovedListener(contentListItems);
                  dialog.dismiss();
                  refreshContent(currentPath);
                } else {
                  userFileManager.destroy();
                }
              }
            });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.panes_layout);

    panesLayout = (PanesLayout) findViewById(R.id.panes);
    panesLayout.setOnIndexChangedListener(this);

    if (savedInstanceState != null) {
      int[] panesType = savedInstanceState.getIntArray("PanesLayout_panesType");
      boolean[] panesFocused = savedInstanceState.getBooleanArray("PanesLayout_panesFocused");
      int currentIndex = savedInstanceState.getInt("PanesLayout_currentIndex");
      for (int i = 0; i < panesType.length; i++) {
        panesLayout.addPane(panesType[i], panesFocused[i]);
      }
      panesLayout.setIndex(currentIndex);
    }

    if (savedInstanceState != null) {
      FragmentManager fm = getSupportFragmentManager();

      for (int index = 0; index < panesLayout.getNumPanes(); index++) {
        int id = panesLayout.getPane(index).getInnerId();
        Fragment f = fm.findFragmentById(id);

        fragmentStack.add(f);
        updateFragment(f);
      }
    }
  }
Пример #29
0
  private void displayServiceProviderDetails() {
    // get from bundle
    Bundle b = getIntent().getExtras();
    int serviceProviderId = b.getInt("serviceProviderId", 0);

    ServiceProviderManager.getByID(
        serviceProviderId,
        new Callback.GetServiceProviderCallback() {
          @Override
          public void complete(ServiceProvider returnedServiceProvider) {
            if (returnedServiceProvider == null) {
              showErrorMessage();
            } else {
              tvUserId.setText(returnedServiceProvider.getUserId() + "");
              tvServiceProviderId.setText(returnedServiceProvider.getServiceProviderId() + "");
              tvServiceId.setText(returnedServiceProvider.getServiceId() + "");
              tvPhone.setText(returnedServiceProvider.getPhone());
              tvEmail.setText(returnedServiceProvider.getEmail() + "");
            }
          }

          @Override
          public void failure(String msg) {
            msg = ((Globals) getApplication()).translateErrorType(msg);
            showAlert(msg);
          }
        });
  }
Пример #30
0
 @Override
 public void handleMessage(Message message) {
   switch (message.what) {
     case ZXING_RESTART:
       restartPreviewAndDecode();
       break;
     case R.id.zxing_decode_succeeded:
       state = State.SUCCESS;
       Bundle bundle = message.getData();
       Bitmap barcode = null;
       if (bundle != null) {
         byte[] compressedBitmap = bundle.getByteArray(DecodeThread.BARCODE_BITMAP);
         if (compressedBitmap != null) {
           barcode =
               BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
           // Mutable copy:
           barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
         }
       }
       activity.handleDecode((Result) message.obj, barcode);
       break;
     case R.id.zxing_decode_failed:
       // We're decoding as fast as possible, so when one decode fails, start another.
       state = State.PREVIEW;
       cameraManager.requestPreviewFrame(decodeThread.getHandler(), R.id.zxing_decode);
       break;
   }
 }