Example usage for android.widget AdapterView getAdapter

List of usage examples for android.widget AdapterView getAdapter

Introduction

In this page you can find the example usage for android.widget AdapterView getAdapter.

Prototype

public abstract T getAdapter();

Source Link

Document

Returns the adapter currently associated with this widget.

Usage

From source file:com.gh4a.fragment.FollowersFollowingListFragment.java

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    Gh4Application context = ((BaseSherlockFragmentActivity) getActivity()).getApplicationContext();
    User user = (User) adapterView.getAdapter().getItem(position);
    context.openUserInfoActivity(getActivity(), user.getLogin(), user.getName());
}

From source file:com.memetro.android.register.CredentialsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_register_credentials);
    context = getApplicationContext();//  w  w  w  .  j  av  a  2s.  co m
    OAuth = new OAuth(context);

    pdialog = new MemetroProgress(this);

    register = (Button) findViewById(R.id.register);
    usernameEt = (EditText) findViewById(R.id.username);
    passwordEt = (EditText) findViewById(R.id.password);
    repeatPasswordEt = (EditText) findViewById(R.id.repeat_password);
    spinnerCity = (Spinner) findViewById(R.id.spinnerCity);
    spinnerCountry = (Spinner) findViewById(R.id.spinnerCountry);

    List<Country> countries = DataUtils.getCountries();
    LayoutUtils.setDefaultSpinnerGrey(context, spinnerCountry, countries);

    spinnerCountry.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            Country country = (Country) adapterView.getAdapter().getItem(i);
            Log.d("PAIS", country.name);
            List<City> cities = DataUtils.getCities(country.countryId);
            LayoutUtils.setDefaultSpinnerGrey(context, spinnerCity, cities);
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        name = extras.getString("name");
        mail = extras.getString("mail");
        twitter = extras.getString("twitter");
        about = extras.getString("about");
    }

    register.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            username = usernameEt.getText().toString();
            password = passwordEt.getText().toString();
            repeatPassword = repeatPasswordEt.getText().toString();
            new AsyncRegister().execute();
        }
    });

}

From source file:org.dmfs.webcal.fragments.GenericListFragment.java

@Override
public void onItemClick(AdapterView<?> adpView, View view, int position, long id) {
    Cursor cursor = (Cursor) adpView.getAdapter().getItem(position);
    String itemType = cursor.getString(2);
    String itemTitle = cursor.getString(1);
    long itemIcon = cursor.getLong(cursor.getColumnIndex(ContentItem.ICON_ID));
    if (CalendarContentContract.ContentItem.TYPE_PAGE.equals(itemType)) {
        long selectedId = cursor.getLong(0);
        Activity activity = getActivity();
        if (activity instanceof CategoryNavigator) {
            ((CategoryNavigator) activity).openCategory(selectedId, itemTitle, itemIcon);
        }//  ww w.  j a  v  a2 s  . c o m

    } else if (CalendarContentContract.ContentItem.TYPE_CALENDAR.equals(itemType)) {
        long selectedId = cursor.getLong(0);
        if (cursor.getColumnIndex(CalendarContentContract.SubscribedCalendars.ITEM_ID) >= 0) {
            selectedId = cursor.getLong(cursor.getColumnIndex(SubscribedCalendars.ITEM_ID));
        }
        Activity activity = getActivity();
        if (activity instanceof CategoryNavigator) {
            ((CategoryNavigator) activity).openCalendar(selectedId, -1);
        }
    } else {
        Log.e(TAG, "Unknown type of entry");
    }
}

From source file:org.mifos.androidclient.main.LastRepaymentReportActivity.java

@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long rowId) {
    Object item = adapterView.getAdapter().getItem(position);
    if (item instanceof LastRepayment) {
        Intent intent = new Intent().setClass(this, CustomerDetailsActivity.class);
        LastRepayment lastRepayment = (LastRepayment) item;
        intent.putExtra(AbstractCustomer.BUNDLE_KEY, lastRepayment.getCustomer());
        if (lastRepayment.isGroup()) {
            intent.putExtra("isGroup", true);
        }//from w  ww. j a v  a2 s. co m
        startActivity(intent);
    }
    return true;
}

From source file:com.gh4a.BlogListActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(Gh4Application.THEME);//w w w.j  ava  2s . c o  m
    super.onCreate(savedInstanceState);

    setContentView(R.layout.generic_list);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(R.string.blog);
    actionBar.setSubtitle(R.string.explore);
    actionBar.setDisplayHomeAsUpEnabled(true);

    mListView = (ListView) findViewById(R.id.list_view);
    CommonFeedAdapter adapter = new CommonFeedAdapter(this, new ArrayList<Feed>());
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            Feed blog = (Feed) adapterView.getAdapter().getItem(position);
            Intent intent = new Intent().setClass(BlogListActivity.this, BlogActivity.class);
            intent.putExtra(Constants.Blog.TITLE, blog.getTitle());
            intent.putExtra(Constants.Blog.CONTENT, blog.getContent());
            intent.putExtra(Constants.Blog.LINK, blog.getLink());
            startActivity(intent);
        }
    });

    new LoadBlogsTask(this).execute();
}

From source file:com.gh4a.fragment.ForkListFragment.java

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    Gh4Application context = ((BaseSherlockFragmentActivity) getActivity()).getApplicationContext();
    Repository repo = (Repository) adapterView.getAdapter().getItem(position);
    context.openRepositoryInfoActivity(getActivity(), repo.getOwner().getLogin(), repo.getName(), 0);
}

From source file:org.mifos.androidclient.main.CentersListActivity.java

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long rowId) {
    Center center = (Center) adapterView.getAdapter().getItem(position);
    Intent intent = new Intent().setClass(this, CustomersListActivity.class);
    intent.putExtra(Group.BUNDLE_KEY, new ArrayList<Group>(center.getGroups()));
    startActivity(intent);/*from ww w.  j a v a 2  s . c  om*/
}

From source file:org.mifos.androidclient.main.OverdueBorrowersListActivity.java

@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long rowId) {
    Object item = adapterView.getAdapter().getItem(position);
    if (item instanceof OverdueCustomer) {
        Intent intent = new Intent().setClass(this, CustomerDetailsActivity.class);
        intent.putExtra(AbstractCustomer.BUNDLE_KEY, (OverdueCustomer) item);
        if (((OverdueCustomer) item).isGroup()) {
            intent.putExtra("isGroup", true);
        }/* w w w  .j  ava2 s  .co  m*/
        startActivity(intent);
    }
    return true;
}

From source file:com.robwilliamson.healthyesther.fragment.dialog.AbstractAddNamedDialogFragment.java

@Override
public void onResume() {
    super.onResume();

    View view = Utils.checkNotNull(getView());
    Context context = Utils.checkNotNull(view.getContext());
    getNameTitle().setText(context.getText(valueNameId()));

    AutoCompleteTextView name = getNameTextView();
    name.setCompletionHint(getView().getContext().getText(valueCompletionHintId()));
    name.addTextChangedListener(new TextWatcher() {
        @Override// w ww.  j ava2s.c  o m
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            String text = s.toString();
            AbstractAddNamedDialogFragment.this.newNameEntered(text);
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    name.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String suggestion = (String) parent.getAdapter().getItem(position);
            AbstractAddNamedDialogFragment.this.suggestionSelected(suggestion, mSuggestions.get(suggestion));
        }
    });
    getOkButton().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onOk();
            dismiss();
        }
    });

    if (contentLayoutId() != null && !mInflatedContent) {
        View.inflate(getView().getContext(), contentLayoutId(), getContentArea());
        mInflatedContent = true;
    }

    updateSuggestionAdapter();
}

From source file:org.mifos.androidclient.main.CentersListActivity.java

@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long rowId) {
    Center center = (Center) adapterView.getAdapter().getItem(position);
    if (!center.getId().equals(ApplicationConstants.DUMMY_IDENTIFIER)) {
        Intent intent = new Intent().setClass(this, CustomerDetailsActivity.class);
        intent.putExtra(AbstractCustomer.BUNDLE_KEY, center);
        startActivity(intent);/*from  w  w  w  . ja v a 2s.c o  m*/
    }
    return true;
}