Ejemplo n.º 1
0
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
          for (int i = 0; i < serviceTypeArrayList.size(); i++) {
            if (i != position) {
              serviceTypeArrayList.get(i).setSelected(false);
            }
          }
          ImageView imgChecked;
          for (int i = 0; i < adapterView.getAdapter().getCount(); i++) {
            View v1 = adapterView.getChildAt(i);
            if (v1 != null) {
              imgChecked = (ImageView) v1.findViewById(R.id.service_type_imageView);
              imgChecked.setVisibility(View.GONE);
            }
          }
          imgChecked = (ImageView) view.findViewById(R.id.service_type_imageView);
          ServiceType serviceType = serviceTypeArrayList.get(position);

          if (!serviceType.isSelected()) {
            imgChecked.setVisibility(View.VISIBLE);
            serviceType.setSelected(true);
            new SharedPreferencesManager(BookServiceActivity.this)
                .setValue(Constant.VALUE_CURRENT_KEY, serviceType.getName());
          } else {
            imgChecked.setVisibility(View.VISIBLE);
          }
        }
Ejemplo n.º 2
0
 public void onItemClick(AdapterView adapterview, View view, int i, long l)
 {
     adapterview = (PlaylistItem)((ListView)lv.getRefreshableView()).getItemAtPosition(i);
     if (!MixerBoxClient.isConnectingToInternet(getActivity()) && adapterview.getPlaylistType() != 8)
     {
         AlertDialogFactory.NoNetworkAlertDialog(getActivity()).show();
         return;
     }
     try
     {
         if (adapterview.getPlaylistId().equals("-999"))
         {
             (new LoginDialog(getActivity(), 3)).show();
             return;
         }
     }
     // Misplaced declaration of an exception variable
     catch (AdapterView adapterview)
     {
         return;
     }
     if (adapterview.getPlaylistType() == 8)
     {
         ((MainPage)getActivity()).setMP3();
         return;
     }
     if (adapterview.getPlaylistType() == 6)
     {
         ((MainPage)getActivity()).arraySong.clear();
         view = ((MainPage)getActivity()).setSong(adapterview.getPlaylistId());
         view.currentPlaylist = adapterview;
         MixerBoxUtils.loadDBSong(getActivity(), "PLAYLISTHISTORYID", false, view);
         return;
     }
     if (adapterview.getPlaylistType() == 5)
     {
         ((MainPage)getActivity()).arraySong.clear();
         view = ((MainPage)getActivity()).setSong(adapterview.getPlaylistId());
         view.currentPlaylist = adapterview;
         MixerBoxUtils.loadDBSong(getActivity(), adapterview.getPlaylistId(), false, view);
         return;
     }
     ((MainPage)getActivity()).arraySong.clear();
     view = ((MainPage)getActivity()).setSong(adapterview.getPlaylistId());
     view.currentPlaylist = adapterview;
     MixerBoxUtils.loadSong(getActivity(), adapterview.getPlaylistId(), false, 1, -1, view);
     return;
 }
Ejemplo n.º 3
0
  @Override
  public boolean onItemLongClick(final AdapterView<?> adapterView, View view, final int i, long l) {
    if (i == 0) {
      return false;
    }

    final ContactsSource.LocalContact contact =
        (ContactsSource.LocalContact) adapterView.getItemAtPosition(i);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(contact.displayName);

    if (contact.user != null) {
      builder.setItems(
          new CharSequence[] {
            getStringSafe(R.string.st_contacts_action_view),
            getStringSafe(R.string.st_contacts_action_share),
            getStringSafe(R.string.st_contacts_action_delete),
            getStringSafe(R.string.st_contacts_action_block),
            getStringSafe(R.string.st_contacts_action_block_and_delete)
          },
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
              if (i == 0) {
                viewInBookContact(contact);
              } else if (i == 1) {
                shareContact(contact);
              } else if (i == 2) {
                deleteContact(contact);
              } else if (i == 3) {
                blockContact(contact);
              } else if (i == 4) {
                blockDeleteContact(contact);
              }
            }
          });
    } else {
      builder.setItems(
          new CharSequence[] {
            getStringSafe(R.string.st_contacts_action_view),
            getStringSafe(R.string.st_contacts_action_delete),
          },
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
              if (i == 0) {
                viewInBookContact(contact);
              } else if (i == 1) {
                deleteContact(contact);
              }
            }
          });
    }
    AlertDialog contextMenu = builder.create();
    contextMenu.setCanceledOnTouchOutside(true);
    contextMenu.show();

    return true;
  }
Ejemplo n.º 4
0
 @Override
 public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
   RosterItem item = (RosterItem) parent.getItemAtPosition(position);
   if (item.isGroup()) {
     String name = item.getName();
     if (!name.equals(getString(R.string.Nogroup))
         && !name.equals(getString(R.string.SelfGroup))
         && !name.equals(getString(R.string.MUC))
         && !name.equals(getString(R.string.Privates))
         && !name.equals(getString(R.string.ActiveChats)))
       RosterDialogs.renameGroupDialog(this, item.getAccount(), item.getName());
   } else if (item.isAccount()) {
     RosterDialogs.AccountMenuDialog(this, item);
   } else if (item.isEntry()) {
     String j = item.getEntry().getUser();
     if (!service.getPrivateMessages(item.getAccount()).contains(j))
       RosterDialogs.ContactMenuDialog(this, item);
     else RosterDialogs.PrivateMenuDialog(this, item);
   } else if (item.isSelf()) {
     RosterDialogs.SelfContactMenuDialog(this, item);
   } else if (item.isMuc()) {
     MucDialogs.roomMenu(this, item.getAccount(), item.getName());
   }
   return true;
 }
Ejemplo n.º 5
0
  @Override
  public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
    String name = item.getName();
    String account = item.getAccount();

    if (item.isGroup() || item.isAccount()) {
      if (item.isCollapsed()) {
        while (service.getCollapsedGroups().contains(name))
          service.getCollapsedGroups().remove(name);
        item.setCollapsed(false);
      } else {
        service.getCollapsedGroups().add(name);
        item.setCollapsed(true);
      }
      updateList();
    } else if (item.isEntry() || item.isSelf()) {
      RosterEntry re = item.getEntry();
      String jid = re.getUser();
      Intent i = new Intent(this, Chat.class);
      i.putExtra("account", account);
      i.putExtra("jid", jid);
      startActivity(i);
    } else if (item.isMuc()) {
      Intent i = new Intent(this, Chat.class);
      i.putExtra("account", account);
      i.putExtra("jid", item.getName());
      startActivity(i);
    }
  }
 @Override
 public void onItemClick(AdapterView<?> l, View v, int position, long id) {
   if (l.getId() == R.id.photosGridView) {
     String clickedItem = photosGridViewContents[position];
     Intent intent = new Intent(PhotoGridActivity.this, PhotoViewerActivity.class);
     intent.putExtra(
         "filename",
         clickedItem); // use putExtra method of Intent here for passing additional information to
                       // PhotoViewerActivity
     startActivity(intent);
   }
 }
Ejemplo n.º 7
0
  public final void onItemClick(AdapterView adapterview, View view, int i, long l) {
    b.dismiss();
    Cursor cursor = (Cursor) adapterview.getItemAtPosition(i);
    if (c != 1) {
      HotelSearchActivity.e(a, cursor.getString(2));
      HotelSearchActivity.n(a).setText(HotelSearchActivity.o(a));
      HotelSearchActivity.f(a, cursor.getString(1));
      ((MyApplication) a.getApplication()).p(com.ll.ctirp.ui.HotelSearchActivity.p(a));
      ((MyApplication) a.getApplication()).m(HotelSearchActivity.o(a));
      HotelSearchActivity.q(a);
    } else {
      HotelSearchActivity hotelsearchactivity = a;
      String s = cursor.getString(1);
      if (hotelsearchactivity.b != null) {
        hotelsearchactivity.b.close();
        hotelsearchactivity.b = null;
      }
      if (hotelsearchactivity.c != null) {
        hotelsearchactivity.c.close();
        hotelsearchactivity.c = null;
      }
      Object obj = LayoutInflater.from(hotelsearchactivity).inflate(0x7f03000d, null);
      ((View) (obj)).findViewById(0x7f080058);
      Object obj1 = (EditText) ((View) (obj)).findViewById(0x7f080059);
      ListView listview = (ListView) ((View) (obj)).findViewById(0x7f08005a);
      TextView textview1 = (TextView) ((View) (obj)).findViewById(0x7f08005d);
      TextView textview = (TextView) ((View) (obj)).findViewById(0x7f08005b);
      ListView listview1 = (ListView) ((View) (obj)).findViewById(0x7f08005c);
      obj =
          (new android.app.AlertDialog.Builder(hotelsearchactivity))
              .setTitle("选择入住的城市")
              .setView(((View) (obj)))
              .create();
      ((AlertDialog) (obj)).show();
      ((EditText) (obj1)).setVisibility(8);
      textview1.setVisibility(8);
      textview.setVisibility(8);
      listview1.setVisibility(8);
      obj1 = new ArrayList();
      int j = ((MyApplication) hotelsearchactivity.getApplication()).d().size();
      for (int k = 0; k < j; k++)
        if (((HashMap) ((MyApplication) hotelsearchactivity.getApplication()).d().get(k))
            .containsValue(s))
          ((ArrayList) (obj1))
              .add((HashMap) ((MyApplication) hotelsearchactivity.getApplication()).d().get(k));

      listview.setAdapter(new p(hotelsearchactivity, ((ArrayList) (obj1))));
      listview.setOnItemClickListener(
          new r(hotelsearchactivity, ((ArrayList) (obj1)), ((AlertDialog) (obj))));
    }
    cursor.close();
  }
    @Override
    public void onRestoreInstanceState(Parcelable state) {
        SavedState ss = (SavedState) state;
        super.onRestoreInstanceState(ss.getSuperState());

        // Here we set mWhichChild in addition to setDisplayedChild
        // We do the former in case mAdapter is null, and hence setDisplayedChild won't
        // set mWhichChild
        mWhichChild = ss.whichChild;

        // When using RemoteAdapters, the async connection process can lead to
        // onRestoreInstanceState to be called before setAdapter(), so we need to save the previous
        // values to restore the list position after we connect, and can skip setting the displayed
        // child until then.
        if (mRemoteViewsAdapter != null && mAdapter == null) {
            mRestoreWhichChild = mWhichChild;
        } else {
            setDisplayedChild(mWhichChild, false);
        }
    }
Ejemplo n.º 9
0
 public void onItemClick(AdapterView<?> a, View v, int position, long id) {
   System.out.println("Position..." + position);
   String ans = (String) a.getItemAtPosition(position);
   System.out.println("Value is " + ans);
   s = ans.split(" ");
   System.out.println("Split Value is: " + s[0]);
   System.out.println("Split Value is: " + s[1]);
   lv1.clearChoices();
   data.deletecallist(id2);
   /*AlertDialog.Builder adb=new AlertDialog.Builder(DeleteList.this);
   adb.setTitle("Delete?");
   adb.setMessage("Are you sure you want to delete " + position);
   final int positionToRemove = position;
   adb.setNegativeButton("Cancel", null);
   adb.setPositiveButton("Ok", new AlertDialog.OnClickListener() {
       public void onClick(DialogInterface dialog, int which)
       {
       	data.deletecallist(s[0]);
       	lv1.remove(positionToRemove);
           results.notifyDataSetChanged();
       }});
   adb.show();*/
   Toast.makeText(DeleteList.this, "Contacts Deleted Successfully", Toast.LENGTH_SHORT).show();
 }
Ejemplo n.º 10
0
  @Override
  public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
    if (i == 0) {
      Intent shareIntent = new Intent(Intent.ACTION_SEND);
      shareIntent.setType("text/plain");
      shareIntent.putExtra(
          android.content.Intent.EXTRA_TEXT, getStringSafe(R.string.st_invite_short));

      PickIntentItem[] pickIntentItems = createPickIntents(shareIntent);
      PickIntentDialog dialog =
          new PickIntentDialog(
              getActivity(),
              pickIntentItems,
              new PickIntentClickListener() {
                @Override
                public void onItemClicked(int index, PickIntentItem item) {
                  sendEvent("share_pressed", item.getIntent().getComponent().getPackageName());
                  startActivity(item.getIntent());
                }
              });
      dialog.setTitle("Share by...");
      dialog.show();
    } else {
      final ContactsSource.LocalContact contact =
          (ContactsSource.LocalContact) adapterView.getItemAtPosition(i);
      Contact[] contacts =
          application.getEngine().getUsersEngine().getContactsForLocalId(contact.contactId);
      if (contacts.length > 0) {
        getRootController().openUser(contacts[0].getUid());
      } else {
        AlertDialog dialog =
            new AlertDialog.Builder(getActivity())
                .setTitle(R.string.st_contacts_not_registered_title)
                .setMessage(
                    getStringSafe(R.string.st_contacts_not_registered_message)
                        .replace("{0}", contact.displayName))
                .setPositiveButton(
                    R.string.st_yes,
                    new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialogInterface, int i) {
                        try {
                          Cursor pCur =
                              application
                                  .getContentResolver()
                                  .query(
                                      ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                                      null,
                                      ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
                                      new String[] {contact.contactId + ""},
                                      null);

                          if (pCur.moveToFirst()) {
                            String phoneNo =
                                pCur.getString(
                                    pCur.getColumnIndex(
                                        ContactsContract.CommonDataKinds.Phone.NUMBER));
                            Intent sendSms =
                                new Intent(Intent.ACTION_VIEW, Uri.parse("tel:" + phoneNo));
                            sendSms.putExtra("address", phoneNo);
                            sendSms.putExtra("sms_body", getStringSafe(R.string.st_invite_short));
                            sendSms.setType("vnd.android-dir/mms-sms");
                            startActivity(sendSms);
                          } else {
                            Context context1 = getActivity();
                            if (context1 != null) {
                              Toast.makeText(
                                      context1, R.string.st_error_unable_sms, Toast.LENGTH_SHORT)
                                  .show();
                            }
                          }
                        } catch (Exception e) {
                          Context context1 = getActivity();
                          if (context1 != null) {
                            Toast.makeText(
                                    context1, R.string.st_error_unable_sms, Toast.LENGTH_SHORT)
                                .show();
                          }
                        }
                      }
                    })
                .setNegativeButton(R.string.st_no, null)
                .create();
        dialog.setCanceledOnTouchOutside(true);
        dialog.show();
      }
    }
  }
Ejemplo n.º 11
0
 public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
   // Cuando se seleccione la unidad, cambiar el radio en funcion de lo que se elija
   if (parent.getItemAtPosition(pos).toString().equals("m.")) radio = 1;
   else if (parent.getItemAtPosition(pos).toString().equals("Km.")) radio = 1000;
 }
Ejemplo n.º 12
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   DrawerListAdapter.DrawerItem drawerItem =
       (DrawerListAdapter.DrawerItem) parent.getAdapter().getItem(position);
   selectItem(drawerItem);
 }
Ejemplo n.º 13
0
 @Override
 public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
   beds = (Integer) adapterView.getItemAtPosition(i);
   triggerSynchronization();
 }