Search in sources :

Example 86 with AdapterView

use of android.widget.AdapterView in project JamsMusicPlayer by psaravan.

the class SettingsMusicFoldersDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle onSavedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    mContext = getActivity().getApplicationContext();
    mApp = (Common) mContext;
    View rootView = getActivity().getLayoutInflater().inflate(R.layout.fragment_folders_selection, null);
    mMusicFolders = new HashMap<String, Boolean>();
    mFoldersListView = (ListView) rootView.findViewById(R.id.folders_list_view);
    mFoldersListView.setFastScrollEnabled(true);
    mWelcomeSetup = getArguments().getBoolean("com.jams.music.player.WELCOME");
    mUpLayout = (RelativeLayout) rootView.findViewById(R.id.folders_up_layout);
    mUpIcon = (ImageView) rootView.findViewById(R.id.folders_up_icon);
    mUpText = (TextView) rootView.findViewById(R.id.folders_up_text);
    mCurrentFolderText = (TextView) rootView.findViewById(R.id.folders_current_directory_text);
    mUpText.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
    mCurrentFolderText.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
    mUpLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                getDir(new File(mCurrentDir).getParentFile().getCanonicalPath());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    if (mWelcomeSetup) {
        mFoldersListView.setDivider(getResources().getDrawable(R.drawable.icon_list_divider_light));
        mUpIcon.setImageResource(R.drawable.up);
    } else {
        mUpIcon.setImageResource(UIElementsHelper.getIcon(mContext, "up"));
        if (mApp.getCurrentTheme() == Common.DARK_THEME) {
            mUpIcon.setImageResource(R.drawable.icon_list_divider_light);
        } else {
            mUpIcon.setImageResource(R.drawable.icon_list_divider);
        }
    }
    mFoldersListView.setDividerHeight(1);
    mRootDir = Environment.getExternalStorageDirectory().getAbsolutePath().toString();
    mCurrentDir = mRootDir;
    //Get a mCursor with a list of all the current folder paths (will be empty if this is the first run).
    mCursor = mApp.getDBAccessHelper().getAllMusicFolderPaths();
    //Get a list of all the paths that are currently stored in the DB.
    for (int i = 0; i < mCursor.getCount(); i++) {
        mCursor.moveToPosition(i);
        //Filter out any double slashes.
        String path = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.FOLDER_PATH));
        if (path.contains("//")) {
            path.replace("//", "/");
        }
        mMusicFolders.put(path, true);
    }
    //Close the cursor.
    if (mCursor != null)
        mCursor.close();
    //Get the folder hierarchy of the selected folder.
    getDir(mRootDir);
    mFoldersListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
            String newPath = mFileFolderPathsList.get(index);
            getDir(newPath);
        }
    });
    builder.setTitle(R.string.select_music_folders);
    builder.setView(rootView);
    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            getActivity().finish();
            Intent intent = new Intent(mContext, WelcomeActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.putExtra("REFRESH_MUSIC_LIBRARY", true);
            mContext.startActivity(intent);
        }
    });
    builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) WelcomeActivity(com.jams.music.player.WelcomeActivity.WelcomeActivity) File(java.io.File)

Example 87 with AdapterView

use of android.widget.AdapterView in project JamsMusicPlayer by psaravan.

the class SongsPickerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mApp = (Common) getActivity().getApplicationContext();
    View rootView = inflater.inflate(R.layout.fragment_songs_music_library_editor, null);
    cursor = mApp.getDBAccessHelper().getAllSongs();
    listView = (ListView) rootView.findViewById(R.id.musicLibraryEditorSongsListView);
    listView.setFastScrollEnabled(true);
    listView.setAdapter(new PlaylistEditorSongsMultiselectAdapter(getActivity(), cursor));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int which, long dbID) {
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.songCheckboxMusicLibraryEditor);
            checkbox.performClick();
            /* Since we've performed a software-click (checkbox.performClick()), all we have 
				 * to do now is determine the *new* state of the checkbox. If the checkbox is checked, 
				 * that means that the user tapped on it when it was unchecked, and we should add 
				 * the song to the HashSet. If the checkbox is unchecked, that means the user 
				 * tapped on it when it was checked, so we should remove the song from the 
				 * HashSet.
				 */
            if (checkbox.isChecked()) {
                view.setBackgroundColor(0xCC0099CC);
                PlaylistEditorActivity.songDBIdsList.add((String) view.getTag(R.string.song_id));
            } else {
                view.setBackgroundColor(0x00000000);
                PlaylistEditorActivity.songDBIdsList.remove((String) view.getTag(R.string.song_id));
            }
        }
    });
    TextView instructions = (TextView) rootView.findViewById(R.id.songs_music_library_editor_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    return rootView;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Paint(android.graphics.Paint)

Example 88 with AdapterView

use of android.widget.AdapterView in project JamsMusicPlayer by psaravan.

the class AlbumsPickerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = getActivity().getApplicationContext();
    mApp = (Common) getActivity().getApplicationContext();
    View rootView = inflater.inflate(R.layout.fragment_albums_music_library_editor, null);
    cursor = mApp.getDBAccessHelper().getAllUniqueAlbums("");
    listView = (ListView) rootView.findViewById(R.id.musicLibraryEditorAlbumsListView);
    listView.setFastScrollEnabled(true);
    listView.setAdapter(new PlaylistEditorAlbumsMultiselectAdapter(getActivity(), cursor));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int which, long dbID) {
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.albumCheckboxMusicLibraryEditor);
            checkbox.performClick();
            /* Since we've performed a software-click (checkbox.performClick()), all we have 
				 * to do now is determine the *new* state of the checkbox. If the checkbox is checked, 
				 * that means that the user tapped on it when it was unchecked, and we should add 
				 * the album's songs to the HashSet. If the checkbox is unchecked, that means the user 
				 * tapped on it when it was checked, so we should remove the album's songs from the 
				 * HashSet.
				 */
            if (checkbox.isChecked()) {
                view.setBackgroundColor(0xCC0099CC);
                AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(mContext, (String) view.getTag(R.string.album), (String) view.getTag(R.string.artist));
                task.execute(new String[] { "ADD" });
            } else {
                view.setBackgroundColor(0x00000000);
                AsyncGetAlbumSongIds task = new AsyncGetAlbumSongIds(mContext, (String) view.getTag(R.string.album), (String) view.getTag(R.string.artist));
                task.execute(new String[] { "REMOVE" });
            }
        }
    });
    TextView instructions = (TextView) rootView.findViewById(R.id.albums_music_library_editor_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    return rootView;
}
Also used : AsyncGetAlbumSongIds(com.jams.music.player.PlaylistEditorActivity.PlaylistEditorAlbumsMultiselectAdapter.AsyncGetAlbumSongIds) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Paint(android.graphics.Paint)

Example 89 with AdapterView

use of android.widget.AdapterView in project JamsMusicPlayer by psaravan.

the class ArtistsPickerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = getActivity().getApplicationContext();
    mApp = (Common) getActivity().getApplicationContext();
    View rootView = inflater.inflate(R.layout.fragment_artists_music_library_editor, null);
    cursor = mApp.getDBAccessHelper().getAllUniqueArtists("");
    listView = (ListView) rootView.findViewById(R.id.musicLibraryEditorArtistsListView);
    listView.setFastScrollEnabled(true);
    listView.setAdapter(new PlaylistEditorArtistsMultiselectAdapter(getActivity(), cursor));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int which, long dbID) {
            CheckBox checkbox = (CheckBox) view.findViewById(R.id.artistCheckboxMusicLibraryEditor);
            checkbox.performClick();
            /* Since we've performed a software-click (checkbox.performClick()), all we have 
				 * to do now is determine the *new* state of the checkbox. If the checkbox is checked, 
				 * that means that the user tapped on it when it was unchecked, and we should add 
				 * the artist's songs to the HashSet. If the checkbox is unchecked, that means the user 
				 * tapped on it when it was checked, so we should remove the artist's songs from the 
				 * HashSet.
				 */
            if (checkbox.isChecked()) {
                view.setBackgroundColor(0xCC0099CC);
                AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(mContext, (String) view.getTag(R.string.artist));
                task.execute(new String[] { "ADD" });
            } else {
                view.setBackgroundColor(0x00000000);
                AsyncGetArtistSongIds task = new AsyncGetArtistSongIds(mContext, (String) view.getTag(R.string.artist));
                task.execute(new String[] { "REMOVE" });
            }
        }
    });
    instructions = (TextView) rootView.findViewById(R.id.artists_music_library_editor_instructions);
    instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light"));
    instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    return rootView;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) CheckBox(android.widget.CheckBox) AsyncGetArtistSongIds(com.jams.music.player.PlaylistEditorActivity.PlaylistEditorArtistsMultiselectAdapter.AsyncGetArtistSongIds) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Paint(android.graphics.Paint)

Example 90 with AdapterView

use of android.widget.AdapterView in project weiciyuan by qii.

the class DMSelectUserActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dmselectuseractivity_layout);
    getActionBar().setTitle(R.string.select_dm_receiver);
    getActionBar().setDisplayShowHomeEnabled(false);
    getActionBar().setDisplayShowTitleEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    View title = getLayoutInflater().inflate(R.layout.dmselectuseractivity_title_layout, null);
    suggestProgressBar = (ProgressBar) title.findViewById(R.id.have_suggest_progressbar);
    getActionBar().setCustomView(title, new ActionBar.LayoutParams(Gravity.RIGHT));
    getActionBar().setDisplayShowCustomEnabled(true);
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction().replace(R.id.list_content, SelectFriendsListFragment.newInstance(GlobalContext.getInstance().getAccountBean().getInfo())).commit();
    }
    AutoCompleteTextView search = (AutoCompleteTextView) findViewById(R.id.search);
    AutoCompleteAdapter adapter = new AutoCompleteAdapter(this, android.R.layout.simple_dropdown_item_1line);
    search.setAdapter(adapter);
    search.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent();
            intent.putExtra("user", data.get(position));
            setResult(0, intent);
            finish();
        }
    });
}
Also used : AdapterView(android.widget.AdapterView) Intent(android.content.Intent) PerformanceImageView(org.qii.weiciyuan.support.lib.PerformanceImageView) View(android.view.View) AdapterView(android.widget.AdapterView) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) ActionBar(android.app.ActionBar) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Aggregations

AdapterView (android.widget.AdapterView)677 View (android.view.View)653 ListView (android.widget.ListView)412 TextView (android.widget.TextView)342 Intent (android.content.Intent)177 ImageView (android.widget.ImageView)174 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)142 ArrayAdapter (android.widget.ArrayAdapter)75 ArrayList (java.util.ArrayList)71 ViewGroup (android.view.ViewGroup)63 AbsListView (android.widget.AbsListView)59 GridView (android.widget.GridView)58 Bundle (android.os.Bundle)53 Spinner (android.widget.Spinner)50 LinearLayout (android.widget.LinearLayout)49 OnClickListener (android.view.View.OnClickListener)46 RecyclerView (android.support.v7.widget.RecyclerView)42 DialogInterface (android.content.DialogInterface)41 SuppressLint (android.annotation.SuppressLint)38 LayoutInflater (android.view.LayoutInflater)34