com.androidquery.AQuery Java Examples
The following examples show how to use
com.androidquery.AQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdpArtworks.java From freemp with Apache License 2.0 | 6 votes |
public AdpArtworks(Activity activity, ArrayList<ClsTrack> data) { this.data = data; this.activity = activity; listAq = new AQuery(activity); int iDisplayWidth = Math.max(320, PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getInt("screenWidth", 800)); int numColumns = (int) (iDisplayWidth / 310); if (numColumns == 0) numColumns = 1; width = (iDisplayWidth / numColumns); layoutParams = new AbsListView.LayoutParams(width, width); fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(300); fadeIn.setInterpolator(new DecelerateInterpolator()); }
Example #2
Source File: AdpArtists.java From freemp with Apache License 2.0 | 6 votes |
public AdpArtists(Activity activity, ArrayList<ClsTrack> data) { this.data = data; this.activity = activity; listAq = new AQuery(activity); int iDisplayWidth = Math.max(320, PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getInt("screenWidth", 800)); int numColumns = (int) (iDisplayWidth / 310); if (numColumns == 0) numColumns = 1; width = (iDisplayWidth / numColumns); layoutParams = new AbsListView.LayoutParams(width, width); fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(300); fadeIn.setInterpolator(new DecelerateInterpolator()); }
Example #3
Source File: AlbumsAdapter.java From IdealMedia with Apache License 2.0 | 5 votes |
public AlbumsAdapter(Activity activity, ArrayList<Track> data){ this.data = data; this.activity = activity; listAq = new AQuery(activity); fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(100); fadeIn.setInterpolator(new DecelerateInterpolator()); }
Example #4
Source File: AndroidQuerySampleActivity.java From android-opensource-library-56 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_android_query_sample); mAQuery = new AQuery(this); mAQuery.id(R.id.text).text("Hello AQuery").id(R.id.button) .clicked(this, "onClick"); }
Example #5
Source File: ImageLoadAsync.java From MediaChooser with Apache License 2.0 | 5 votes |
@Override protected void onPostExecute(String result) { AQuery aQuery = new AQuery(mContext); aQuery.id(mImageView); aQuery.image(new File(result),true, mWidth, new BitmapAjaxCallback()); }
Example #6
Source File: ImageLoadAsync.java From MediaChooser with Apache License 2.0 | 5 votes |
@Override protected void onPostExecute(String result) { AQuery aQuery = new AQuery(mContext); aQuery.id(mImageView); aQuery.image(new File(result),true, mWidth, new BitmapAjaxCallback()); }
Example #7
Source File: FragmentAlbums.java From freemp with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { activity = getActivity(); aq = new AQuery(activity); //UI final LinearLayout linearLayout = new LinearLayout(activity); linearLayout.setOrientation(LinearLayout.VERTICAL); //Progress progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleHorizontal); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); progressBar.setLayoutParams(layoutParams); progressBar.setVisibility(View.GONE); gridView = new GridView(activity); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (adapter == null) return; ClsTrack track = (ClsTrack) adapter.getItem(position); final String album = track.getAlbum(); final String artist = track.getArtist(); ArrayList<ClsTrack> tracks = (ArrayList<ClsTrack>) FileUtils.readObject("alltracksms", activity); ArrayList<ClsTrack> tracksFiltered = new ArrayList<ClsTrack>(); for (ClsTrack t : tracks) { if (t.getAlbum().equals(album) && t.getArtist().equals(artist)) { tracksFiltered.add(t); } } ((ActPlaylist) activity).close(tracksFiltered); } }); linearLayout.addView(progressBar); linearLayout.addView(gridView); return linearLayout; }
Example #8
Source File: FragmentArtists.java From freemp with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { activity = getActivity(); aq = new AQuery(activity); //UI final LinearLayout linearLayout = new LinearLayout(activity); linearLayout.setOrientation(LinearLayout.VERTICAL); //Progress progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleHorizontal); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); progressBar.setLayoutParams(layoutParams); progressBar.setVisibility(View.GONE); gridView = new GridView(activity); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (adapter == null) return; ClsTrack track = (ClsTrack) adapter.getItem(position); final String artist = track.getArtist(); ArrayList<ClsTrack> tracks = (ArrayList<ClsTrack>) FileUtils.readObject("alltracksms", activity); ArrayList<ClsTrack> tracksFiltered = new ArrayList<ClsTrack>(); for (ClsTrack t : tracks) { if (t.getArtist().equalsIgnoreCase(artist)) { tracksFiltered.add(t); } } ((ActPlaylist) activity).close(tracksFiltered); } }); linearLayout.addView(progressBar); linearLayout.addView(gridView); return linearLayout; }
Example #9
Source File: VlistViewHolder.java From android-Stupid-Adapter with Apache License 2.0 | 5 votes |
@Override public void onCreate(Context context) { title = (TextView) findViewById(R.id.title); vt = (TextView) findViewById(R.id.vt); imageView1 = (ImageView) findViewById(R.id.imageView1); q = new AQuery(imageView1); setOnClickListener(this); setOnLongClickListener(this); }
Example #10
Source File: AQueryHolder.java From fresco with MIT License | 5 votes |
public AQueryHolder( Context context, AQuery aQuery, View parentView, InstrumentedImageView instrumentedImageView, PerfListener perfListener) { super(context, parentView, instrumentedImageView, perfListener); mAQuery = aQuery; }
Example #11
Source File: VideoListAdapter.java From cast-videos-android with Apache License 2.0 | 5 votes |
private ViewHolder(View parent, ImageView imgView, View textContainer, TextView titleView, TextView descriptionView, AQuery aQuery) { super(parent); mParent = parent; mImgView = imgView; mTextContainer = textContainer; mTitleView = titleView; mDescriptionView = descriptionView; mAquery = aQuery; }
Example #12
Source File: VideoListAdapter.java From cast-videos-android with Apache License 2.0 | 5 votes |
public static ViewHolder newInstance(View parent) { ImageView imgView = (ImageView) parent.findViewById(R.id.imageView1); TextView titleView = (TextView) parent.findViewById(R.id.textView1); TextView descriptionView = (TextView) parent.findViewById(R.id.textView2); View textContainer = parent.findViewById(R.id.text_container); AQuery aQuery = new AQuery(parent); return new ViewHolder(parent, imgView, textContainer, titleView, descriptionView, aQuery); }
Example #13
Source File: VideoListAdapter.java From cast-videos-android with Apache License 2.0 | 5 votes |
private ViewHolder(View parent, ImageView imgView, View textContainer, TextView titleView, TextView descriptionView, AQuery aQuery) { super(parent); mParent = parent; mImgView = imgView; mTextContainer = textContainer; mTitleView = titleView; mDescriptionView = descriptionView; mAquery = aQuery; }
Example #14
Source File: VideoListAdapter.java From cast-videos-android with Apache License 2.0 | 5 votes |
public static ViewHolder newInstance(View parent) { ImageView imgView = (ImageView) parent.findViewById(R.id.imageView1); TextView titleView = (TextView) parent.findViewById(R.id.textView1); TextView descriptionView = (TextView) parent.findViewById(R.id.textView2); View textContainer = parent.findViewById(R.id.text_container); AQuery aQuery = new AQuery(parent); return new ViewHolder(parent, imgView, textContainer, titleView, descriptionView, aQuery); }
Example #15
Source File: LocalPlayerActivity.java From cast-videos-android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_activity); mAquery = new AQuery(this); loadViews(); setupControlsCallbacks(); // see what we need to play and where Bundle bundle = getIntent().getExtras(); if (bundle != null) { mSelectedMedia = MediaItem.fromBundle(getIntent().getBundleExtra("media")); setupActionBar(); boolean shouldStartPlayback = bundle.getBoolean("shouldStart"); int startPosition = bundle.getInt("startPosition", 0); mVideoView.setVideoURI(Uri.parse(mSelectedMedia.getUrl())); Log.d(TAG, "Setting url of the VideoView to: " + mSelectedMedia.getUrl()); if (shouldStartPlayback) { // this will be the case only if we are coming from the // CastControllerActivity by disconnecting from a device mPlaybackState = PlaybackState.PLAYING; updatePlaybackLocation(PlaybackLocation.LOCAL); updatePlayButton(mPlaybackState); if (startPosition > 0) { mVideoView.seekTo(startPosition); } mVideoView.start(); startControllersTimer(); } else { // we should load the video but pause it // and show the album art. updatePlaybackLocation(PlaybackLocation.LOCAL); mPlaybackState = PlaybackState.IDLE; updatePlayButton(mPlaybackState); } } if (mTitleView != null) { updateMetadata(true); } }
Example #16
Source File: ArtistsAdapter.java From IdealMedia with Apache License 2.0 | 5 votes |
public ArtistsAdapter(Activity activity, ArrayList<Track> data){ this.data = data; this.activity = activity; inflater = activity.getLayoutInflater(); listAq = new AQuery(activity); fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(100); fadeIn.setInterpolator(new DecelerateInterpolator()); }
Example #17
Source File: AQueryAdapter.java From fresco with MIT License | 4 votes |
public AQueryAdapter(Context context, PerfListener perfListener) { super(context, perfListener); mAQuery = new AQuery(context); }
Example #18
Source File: ActFreemporg.java From freemp with Apache License 2.0 | 4 votes |
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //устанавливаем кастомный бэкграунд акшенбара getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bgr)); //добавляем кнопку назад getSupportActionBar().setDisplayHomeAsUpEnabled(true); activity = this; aq = new AQuery(activity); Bundle extras = getIntent().getExtras(); if (extras == null) { return; } else { q = extras.getString("q"); } //UI final LinearLayout linearLayout = new LinearLayout(activity); linearLayout.setOrientation(LinearLayout.VERTICAL); //Progress progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleHorizontal); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); progressBar.setLayoutParams(layoutParams); progressBar.setVisibility(View.GONE); webView = new WebView(activity); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (Uri.parse(url).getHost().contains("freemp.org")) { // This is my web site, so do not override; let my WebView load the page return false; } // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } } ); ViewGroup.LayoutParams layoutParams2 = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); webView.setLayoutParams(layoutParams2); linearLayout.addView(progressBar); linearLayout.addView(webView); setContentView(linearLayout); }
Example #19
Source File: AdpArtists.java From freemp with Apache License 2.0 | 4 votes |
@Override public View getView(int position, View view, ViewGroup parent) { if (view == null) { final RelativeLayout rl = new RelativeLayout(activity); rl.setLayoutParams(layoutParams); final ImageView img = new ImageView(activity); RelativeLayout.LayoutParams imglp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT); img.setPadding(10, 10, 0, 0); img.setId(imgid); //img.setLayoutParams(layoutParams); rl.addView(img,imglp); TextView tv = new TextView(activity); //tv.setSingleLine(); tv.setPadding(16,0,40,0); RelativeLayout.LayoutParams lptv = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lptv.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, img.getId()); tv.setShadowLayer(1,-2,-2, Color.BLACK); tv.setId(tvid); rl.addView(tv,lptv); view = rl; } AQuery aq = listAq.recycle(view); final ClsTrack track = data.get(position); if (aq.shouldDelay(position, view, parent, "" + track.getArtist())) { aq.id(imgid).image(R.drawable.row_bgr); } else { aq.id(imgid).image(MediaUtils.getArtistQuick(activity, track, 300, 300)).animate(fadeIn); } aq.id(tvid).getTextView().setText((""+track.getArtist())); return view; }
Example #20
Source File: LocalPlayerActivity.java From cast-videos-android with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_activity); mAquery = new AQuery(this); loadViews(); setupControlsCallbacks(); setupCastListener(); mCastContext = CastContext.getSharedInstance(this); mCastContext.registerLifecycleCallbacksBeforeIceCreamSandwich(this, savedInstanceState); mCastSession = mCastContext.getSessionManager().getCurrentCastSession(); // see what we need to play and where Bundle bundle = getIntent().getExtras(); if (bundle != null) { mSelectedMedia = MediaItem.fromBundle(getIntent().getBundleExtra("media")); setupActionBar(); boolean shouldStartPlayback = bundle.getBoolean("shouldStart"); int startPosition = bundle.getInt("startPosition", 0); mVideoView.setVideoURI(Uri.parse(mSelectedMedia.getUrl())); Log.d(TAG, "Setting url of the VideoView to: " + mSelectedMedia.getUrl()); if (shouldStartPlayback) { // this will be the case only if we are coming from the // CastControllerActivity by disconnecting from a device mPlaybackState = PlaybackState.PLAYING; updatePlaybackLocation(PlaybackLocation.LOCAL); updatePlayButton(mPlaybackState); if (startPosition > 0) { mVideoView.seekTo(startPosition); } mVideoView.start(); startControllersTimer(); } else { // we should load the video but pause it // and show the album art. if (mCastSession != null && mCastSession.isConnected()) { updatePlaybackLocation(PlaybackLocation.REMOTE); } else { updatePlaybackLocation(PlaybackLocation.LOCAL); } mPlaybackState = PlaybackState.IDLE; updatePlayButton(mPlaybackState); } } if (mTitleView != null) { updateMetadata(true); } }
Example #21
Source File: AdpArtworks.java From freemp with Apache License 2.0 | 4 votes |
@Override public View getView(int position, View view, ViewGroup parent) { if (view == null) { final RelativeLayout rl = new RelativeLayout(activity); rl.setLayoutParams(layoutParams); final ImageView img = new ImageView(activity); RelativeLayout.LayoutParams imglp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT); img.setPadding(10, 10, 0, 0); img.setId(imgid); //img.setLayoutParams(layoutParams); rl.addView(img,imglp); TextView tv = new TextView(activity); //tv.setSingleLine(); tv.setPadding(16,0,40,0); RelativeLayout.LayoutParams lptv = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lptv.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, img.getId()); tv.setShadowLayer(1,-2,-2, Color.BLACK); tv.setId(tvid); rl.addView(tv,lptv); view = rl; } AQuery aq = listAq.recycle(view); final ClsTrack track = data.get(position); if (aq.shouldDelay(position, view, parent, "" + track.getAlbumId())) { aq.id(imgid).image(R.drawable.row_bgr); } else { aq.id(imgid).image(MediaUtils.getArtworkQuick(activity, track, 300, 300)).animate(fadeIn); } aq.id(tvid).getTextView().setText((""+track.getArtist())); return view; }
Example #22
Source File: AdpPlaylist.java From freemp with Apache License 2.0 | 4 votes |
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = activity.getLayoutInflater().inflate(R.layout.playlist_group_row, null); } AQuery listAq = new AQuery(convertView); final ClsArrTrack o = data.get(groupPosition); final String section = o.getArtists(); listAq.id(R.id.section).gone(); if (groupPosition == 0 && !TextUtils.equals(section, "")) { //recently added listAq.id(R.id.section).visible(); listAq.id(R.id.section).text(StringUtils.capitalizeFully(section)); } else { if (!TextUtils.equals(section, "") && (groupPosition > 0)) { if (!TextUtils.equals(section, data.get(groupPosition - 1).getArtists())) { listAq.id(R.id.section).visible(); listAq.id(R.id.section).text(StringUtils.capitalizeFully(section)); } } } listAq.id(R.id.section).text(StringUtils.capitalizeFully(o.getArtists())); listAq.id(R.id.textView).text(StringUtils.capitalizeFully(o.getDescription())); final CheckBox checkBox = listAq.id(R.id.checkBox).getCheckBox(); final int checkSelection = o.checkSelection(); checkBox.setChecked((checkSelection >= 0)); if (checkSelection == 1) { listAq.id(R.id.textView).textColor(Color.parseColor("#FDC332")); } else if (checkSelection == 0) { listAq.id(R.id.textView).textColor(Color.parseColor("#CC681F")); } else { listAq.id(R.id.textView).textColor(Color.parseColor("#F6FFFF")); } final int pos = groupPosition; listAq.id(R.id.relativeLayout).clicked(new View.OnClickListener() { @Override public void onClick(View v) { checkBox.setChecked(!(checkSelection >= 0)); ArrayList<ClsTrack> tracks = o.getPlaylists(); for (int i = 0; i < tracks.size(); i++) { ClsTrack t = tracks.get(i); t.setSelected(!(checkSelection >= 0)); tracks.set(i, t); } data.set(pos, o); invalidate(); } }); return convertView; }
Example #23
Source File: UpdateUtils.java From freemp with Apache License 2.0 | 4 votes |
public UpdateUtils(Activity activity) { activityContainer = new WeakReference<Activity>(activity); aq = new AQuery(activity); new Update().execute(); }
Example #24
Source File: TaskGetArtwork.java From IdealMedia with Apache License 2.0 | 4 votes |
public void getArtwork(Track track) { final String currentArtist = "" + track.getArtist(); if (currentArtist.equals("")) return; if (MediaUtils.getArtworkQuick(context, track, 300, 300) != null) return; if (activeTasks.size() > 2) return; if (activeTasks.containsKey(currentArtist)) return; activeTasks.put(currentArtist, this); AQuery aq = new AQuery(context); String url = String.format("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=683548928700d0cdc664691b862a8d21&artist=%s&format=json", Uri.encode(currentArtist)); AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>(); cb.url(url).type(JSONObject.class).fileCache(true).expire(3600 * 60 * 1000); aq.sync(cb); JSONObject result = cb.getResult(); if (result != null) { JSONObject jsonObject = null; String albumArtImageLink = null; try { if (!result.has("artist")) return; jsonObject = result.getJSONObject("artist"); JSONArray image = jsonObject.getJSONArray("image"); for (int i=0;i<image.length();i++) { jsonObject = image.getJSONObject(i); if (jsonObject.getString("size").equals("extralarge")) { albumArtImageLink = Uri.decode(jsonObject.getString("#text")); } } if (!(albumArtImageLink != null && albumArtImageLink.equals(""))) { String path = MediaUtils.getArtistPath(track); if (path != null) { File file = new File(path); AjaxCallback<File> cbFile = new AjaxCallback<File>(); cbFile.url(albumArtImageLink).type(File.class).targetFile(file); aq.sync(cbFile); AjaxStatus status = cbFile.getStatus(); if (status.getCode() == 200) { if (listener != null) listener.onNewArtwork(); } else { file.delete(); } } } } catch (Exception e) { e.printStackTrace(); } } activeTasks.remove(currentArtist); }