Beispiel #1
0
 @Override
 public void handleAddressBookSelection(int id, String name, String value) {
   if (id == R.id.upstream_sender_id) {
     Sender sender = mSenders.getSender(value);
     if (sender != null && sender.getGcmDemoAppToken() != null) {
       setValue(R.id.upstream_sender_id, name, value);
       mFragmentState.putStringArray(SENDER_ID, new String[] {name, value});
     } else {
       Toast.makeText(
               getActivity(), R.string.upstream_sender_id_not_registered, Toast.LENGTH_SHORT)
           .show();
     }
   }
 }
Beispiel #2
0
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
    View view = inflater.inflate(R.layout.fragment_upstream, container, false);
    view.findViewById(R.id.upstream_send_button).setOnClickListener(this);
    view.findViewById(R.id.upstream_sender_id).setOnClickListener(this);
    view.findViewById(R.id.upstream_sender_id).setOnLongClickListener(this);
    setHtmlMode(view, R.id.upstream_description);

    mLogger = new LoggingService.Logger(getActivity());
    mSenders = SenderCollection.getInstance(getActivity());

    loadSavedState(savedState);
    setValueFromFragmentState(view.findViewById(R.id.upstream_sender_id), SENDER_ID);

    return view;
  }