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.wiz.dev.wiztalk.fragment.AudioFragment.java

private void setAdapter() {
    int count = mCursor.getCount();
    if (count > 0) {
        // MediaStore.Video.Media.TITLE
        mCursor.moveToFirst();//from   w w w  . j a v a2 s . co m
        mGalleryModelList = new ArrayList<MediaModel>();
        for (int i = 0; i < count; i++) {
            mCursor.moveToPosition(i);
            String url = mCursor.getString(mCursor.getColumnIndex(MediaStore.Audio.Media.DATA));
            String name = mCursor.getString(mCursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
            String size = mCursor.getString(mCursor.getColumnIndex(MediaStore.Audio.Media.SIZE));
            long addTime = mCursor.getLong(mCursor.getColumnIndex(MediaStore.Audio.Media.DATE_ADDED));
            mGalleryModelList.add(new MediaModel(url, name, Integer.valueOf(size), addTime, false));
        }
        mVideoAdapter = new MediaSelectAdapter(getActivity(), mGalleryModelList);
        mVideoGridView.setAdapter(mVideoAdapter);
        mVideoGridView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                MediaSelectAdapter adapter = (MediaSelectAdapter) parent.getAdapter();
                MediaModel galleryModel = (MediaModel) adapter.getItem(position);
                adapter.addSelect(position, galleryModel);
            }
        });
    }
}

From source file:at.bitfire.davdroid.ui.setup.LoginURLFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.setup_login_url, container, false);

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    spnrScheme = (Spinner) v.findViewById(R.id.login_scheme);
    spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override/*from   w w  w.ja v  a  2  s  .  c  o  m*/
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String scheme = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    spnrScheme.setSelection(1); // HTTPS

    // other input fields
    editBaseURI = (EditText) v.findViewById(R.id.login_host_path);
    editBaseURI.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);

    // hook into action bar
    setHasOptionsMenu(true);

    return v;
}

From source file:at.bitfire.davdroid.syncadapter.LoginURLFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.login_url, container, false);

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    spnrScheme = (Spinner) v.findViewById(R.id.login_scheme);
    spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override/*from  w  w  w  . j a  v  a  2  s. c  om*/
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String scheme = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    spnrScheme.setSelection(1); // HTTPS

    // other input fields
    editBaseURI = (EditText) v.findViewById(R.id.login_host_path);
    editBaseURI.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);

    // hook into action bar
    setHasOptionsMenu(true);

    return v;
}

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

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) {
    TransactionHistoryEntry entry = (TransactionHistoryEntry) adapterView.getAdapter().getItem(pos);
    Intent intent = new Intent().setClass(this, TransactionHistoryItemDetailsActivity.class);
    intent.putExtra(TransactionHistoryEntry.BUNDLE_KEY, entry);
    startActivity(intent);//from ww  w  .j a v  a 2s  .  c om
}

From source file:at.bitfire.davdroid.mirakel.syncadapter.EnterCredentialsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.enter_credentials, container, false);

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    Spinner spnrProtocol = (Spinner) v.findViewById(R.id.select_protocol);
    spnrProtocol.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override/*from  ww w  . ja  v a 2  s .  c om*/
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            protocol = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(protocol.equals("https://") ? View.GONE : View.VISIBLE);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
            protocol = null;
        }
    });
    spnrProtocol.setSelection(1); // HTTPS

    // other input fields
    editBaseURL = (EditText) v.findViewById(R.id.baseURL);
    editBaseURL.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);

    // hook into action bar
    setHasOptionsMenu(true);

    return v;
}

From source file:com.wiz.dev.wiztalk.fragment.VideoFragment.java

private void setAdapter() {
    int count = mCursor.getCount();
    if (count > 0) {
        mCursor.moveToFirst();/*from  w  ww  . j ava  2s . c  om*/
        mGalleryModelList = new ArrayList<MediaModel>();
        for (int i = 0; i < count; i++) {
            mCursor.moveToPosition(i);
            String url = mCursor.getString(mCursor.getColumnIndex(MediaStore.Video.Media.DATA));
            String name = mCursor.getString(mCursor.getColumnIndex(MediaStore.Video.Media.DISPLAY_NAME));
            String size = mCursor.getString(mCursor.getColumnIndex(MediaStore.Video.Media.SIZE));
            long addTime = mCursor.getLong(mCursor.getColumnIndex(MediaStore.Video.Media.DATE_ADDED));
            mGalleryModelList.add(new MediaModel(url, name, Integer.valueOf(size), addTime, true));
        }
        mVideoAdapter = new MediaSelectAdapter(getActivity(), mGalleryModelList);
        mVideoGridView.setAdapter(mVideoAdapter);
        mVideoGridView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                MediaSelectAdapter adapter = (MediaSelectAdapter) parent.getAdapter();
                MediaModel galleryModel = (MediaModel) adapter.getItem(position);
                adapter.addSelect(position, galleryModel);
            }
        });
    }
}

From source file:org.exfio.csyncdroid.syncadapter.ExfioPeerEnterCredentialsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.enter_credentials_exfiopeer, container, false);

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    spnrProtocol = (Spinner) v.findViewById(R.id.exfiopeer_account_server_protocol);
    spnrProtocol.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            protocol = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(protocol.equals("https://") ? View.GONE : View.VISIBLE);
        }//from  w ww.  j ava 2  s  . com

        public void onNothingSelected(AdapterView<?> parent) {
            protocol = null;
        }
    });

    spnrProtocol.setSelection(1); // HTTPS

    // other input fields
    editBaseURL = (EditText) v.findViewById(R.id.exfiopeer_account_server_url);
    editBaseURL.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    // hook into action bar
    setHasOptionsMenu(true);

    //ownCloud environment
    spnrProtocol.setSelection(1);
    editBaseURL.setText("cucumbersync.com/cloud/remote.php/mozilla_sync/");

    return v;
}

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

@Override
public void onItemClick(AdapterView<?> adapterView, View arg1, int position, long id) {
    RepositoryIssue issue = (RepositoryIssue) adapterView.getAdapter().getItem(position);
    Intent intent = new Intent().setClass(getSherlockActivity(), IssueActivity.class);
    intent.putExtra(Constants.Repository.REPO_OWNER, issue.getRepository().getOwner().getLogin());
    intent.putExtra(Constants.Repository.REPO_NAME, issue.getRepository().getName());
    intent.putExtra(Constants.Issue.ISSUE_NUMBER, issue.getNumber());
    intent.putExtra(Constants.Issue.ISSUE_STATE, issue.getState());
    startActivity(intent);//from  w w  w  . ja v  a 2s  . com
}

From source file:com.achep.base.ui.fragments.dialogs.PermissionsDialog.java

@NonNull
@Override/* ww w  .j a  va 2s.  c  o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getActivity();
    assert context != null;

    MaterialDialog md = new MaterialDialog.Builder(context).title(R.string.permissions_dialog_title)
            .items(new CharSequence[] { "", "" }).negativeText(R.string.later).build();

    // Make title more red
    TextView title = md.getTitleView();
    title.setTextColor(title.getCurrentTextColor() & 0xFFFF3333 | 0xFF << 16);

    ListView listView = md.getListView();
    assert listView != null;
    mAdapter = new PermissionAdapter(context, new ArrayList<Permission>());
    listView.setAdapter(mAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            PermissionAdapter adapter = (PermissionAdapter) parent.getAdapter();
            Permission item = adapter.getItem(position);

            try {
                startActivity(item.getIntentSettings());
            } catch (ActivityNotFoundException e) {
                int msg = item.getErrorResource();
                if (msg != 0)
                    ToastUtils.showLong(getActivity(), msg);
            }
        }
    });

    return md;
}

From source file:org.exfio.csyncdroid.syncadapter.LegacyV5EnterCredentialsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.enter_credentials_legacyv5, container, false);

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    spnrProtocol = (Spinner) v.findViewById(R.id.legacyv5_account_server_protocol);
    spnrProtocol.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            protocol = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(protocol.equals("https://") ? View.GONE : View.VISIBLE);
        }//w  w  w  .  j  a  v  a  2 s .c  o  m

        public void onNothingSelected(AdapterView<?> parent) {
            protocol = null;
        }
    });

    spnrProtocol.setSelection(1); // HTTPS

    // other input fields
    editBaseURL = (EditText) v.findViewById(R.id.legacyv5_account_server_url);
    editBaseURL.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    labelSyncKey = (TextView) v.findViewById(R.id.synckeylabel);
    editSyncKey = (EditText) v.findViewById(R.id.synckey);
    editSyncKey.addTextChangedListener(this);

    // hook into action bar
    setHasOptionsMenu(true);

    //ownCloud environment
    spnrProtocol.setSelection(1);
    editBaseURL.setText("cucumbersync.com/cloud/remote.php/mozilla_sync/");

    return v;
}