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();
}
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;
}
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;
}
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;
}
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();
}
});
}
Aggregations