List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:com.mercandalli.android.apps.files.file.local.FileLocalPagerFragment.java
private void initViews(@Nullable Bundle savedInstanceState) { mPagerAdapter = new FileManagerFragmentPagerAdapter(getChildFragmentManager(), isSdCardFragmentVisible()); mViewPager.setAdapter(mPagerAdapter); mViewPager.addOnPageChangeListener(this); if (savedInstanceState == null) { mViewPager.setOffscreenPageLimit(getCount() - 1); mViewPager.setCurrentItem(INIT_FRAGMENT); }//from w w w. java 2 s. c o m mTabLayout.setupWithViewPager(mViewPager); mTabLayout.setOnTabSelectedListener(this); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mTabLayout.setSelectedTabIndicatorColor(Color.TRANSPARENT); } syncTabLayout(); mFab1.setVisibility(View.GONE); mFab2.setVisibility(View.GONE); mFab1.setOnClickListener(this); mFab2.setOnClickListener(this); }
From source file:eu.faircode.netguard.AdapterRule.java
@Override public void onBindViewHolder(final ViewHolder holder, final int position) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); // Get rule// w w w .j a v a2s . c om final Rule rule = listFiltered.get(position); // Handle expanding/collapsing holder.llApplication.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { rule.expanded = !rule.expanded; notifyItemChanged(position); } }); // Show if non default rules holder.itemView.setBackgroundColor(rule.changed ? colorChanged : Color.TRANSPARENT); // Show expand/collapse indicator holder.ivExpander.setImageLevel(rule.expanded ? 1 : 0); // Show application icon if (rule.info.applicationInfo == null || rule.info.applicationInfo.icon == 0) Picasso.with(context).load(android.R.drawable.sym_def_app_icon).into(holder.ivIcon); else { Uri uri = Uri .parse("android.resource://" + rule.info.packageName + "/" + rule.info.applicationInfo.icon); Picasso.with(context).load(uri).resize(iconSize, iconSize).into(holder.ivIcon); } // Show application label holder.tvName.setText(rule.name); // Show application state int color = rule.system ? colorOff : colorText; if (!rule.internet || !rule.enabled) color = Color.argb(128, Color.red(color), Color.green(color), Color.blue(color)); holder.tvName.setTextColor(color); // Show rule count new AsyncTask<Object, Object, Long>() { @Override protected void onPreExecute() { holder.tvHosts.setVisibility(View.GONE); } @Override protected Long doInBackground(Object... objects) { return DatabaseHelper.getInstance(context).getRuleCount(rule.info.applicationInfo.uid); } @Override protected void onPostExecute(Long rules) { if (rules > 0) { holder.tvHosts.setVisibility(View.VISIBLE); holder.tvHosts.setText(Long.toString(rules)); } } }.execute(); // Wi-Fi settings holder.cbWifi.setEnabled(rule.apply); holder.cbWifi.setAlpha(wifiActive ? 1 : 0.5f); holder.cbWifi.setOnCheckedChangeListener(null); holder.cbWifi.setChecked(rule.wifi_blocked); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(CompoundButtonCompat.getButtonDrawable(holder.cbWifi)); DrawableCompat.setTint(wrap, rule.apply ? (rule.wifi_blocked ? colorOff : colorOn) : colorGrayed); } holder.cbWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.wifi_blocked = isChecked; updateRule(rule, true, listAll); } }); holder.ivScreenWifi.setEnabled(rule.apply); holder.ivScreenWifi.setAlpha(wifiActive ? 1 : 0.5f); holder.ivScreenWifi.setVisibility(rule.screen_wifi && rule.wifi_blocked ? View.VISIBLE : View.INVISIBLE); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivScreenWifi.getDrawable()); DrawableCompat.setTint(wrap, rule.apply ? colorOn : colorGrayed); } // Mobile settings holder.cbOther.setEnabled(rule.apply); holder.cbOther.setAlpha(otherActive ? 1 : 0.5f); holder.cbOther.setOnCheckedChangeListener(null); holder.cbOther.setChecked(rule.other_blocked); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(CompoundButtonCompat.getButtonDrawable(holder.cbOther)); DrawableCompat.setTint(wrap, rule.apply ? (rule.other_blocked ? colorOff : colorOn) : colorGrayed); } holder.cbOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.other_blocked = isChecked; updateRule(rule, true, listAll); } }); holder.ivScreenOther.setEnabled(rule.apply); holder.ivScreenOther.setAlpha(otherActive ? 1 : 0.5f); holder.ivScreenOther.setVisibility(rule.screen_other && rule.other_blocked ? View.VISIBLE : View.INVISIBLE); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivScreenOther.getDrawable()); DrawableCompat.setTint(wrap, rule.apply ? colorOn : colorGrayed); } holder.tvRoaming.setTextColor(rule.apply ? colorOff : colorGrayed); holder.tvRoaming.setAlpha(otherActive ? 1 : 0.5f); holder.tvRoaming.setVisibility( rule.roaming && (!rule.other_blocked || rule.screen_other) ? View.VISIBLE : View.INVISIBLE); // Expanded configuration section holder.llConfiguration.setVisibility(rule.expanded ? View.VISIBLE : View.GONE); // Show application details holder.tvUid .setText(rule.info.applicationInfo == null ? "?" : Integer.toString(rule.info.applicationInfo.uid)); holder.tvPackage.setText(rule.info.packageName); holder.tvVersion.setText(rule.info.versionName + '/' + rule.info.versionCode); holder.tvDescription.setVisibility(rule.description == null ? View.GONE : View.VISIBLE); holder.tvDescription.setText(rule.description); // Show application state holder.tvInternet.setVisibility(rule.internet ? View.GONE : View.VISIBLE); holder.tvDisabled.setVisibility(rule.enabled ? View.GONE : View.VISIBLE); // Show traffic statistics holder.tvStatistics.setText(context.getString(R.string.msg_mbday, rule.upspeed, rule.downspeed)); // Apply holder.cbApply.setEnabled(rule.pkg); holder.cbApply.setOnCheckedChangeListener(null); holder.cbApply.setChecked(rule.apply); holder.cbApply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.apply = isChecked; updateRule(rule, true, listAll); } }); // Show related holder.btnRelated.setVisibility(rule.relateduids ? View.VISIBLE : View.GONE); holder.btnRelated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent main = new Intent(context, ActivityMain.class); main.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(rule.info.applicationInfo.uid)); context.startActivity(main); } }); // Fetch settings holder.ibFetch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new AsyncTask<Object, Object, Object>() { @Override protected void onPreExecute() { holder.ibFetch.setEnabled(false); } @Override protected Object doInBackground(Object... args) { HttpsURLConnection urlConnection = null; try { JSONObject json = new JSONObject(); json.put("type", "fetch"); json.put("country", Locale.getDefault().getCountry()); json.put("netguard", Util.getSelfVersionCode(context)); json.put("fingerprint", Util.getFingerprint(context)); JSONObject pkg = new JSONObject(); pkg.put("name", rule.info.packageName); pkg.put("version_code", rule.info.versionCode); pkg.put("version_name", rule.info.versionName); JSONArray pkgs = new JSONArray(); pkgs.put(pkg); json.put("package", pkgs); urlConnection = (HttpsURLConnection) new URL(cUrl).openConnection(); urlConnection.setConnectTimeout(cTimeOutMs); urlConnection.setReadTimeout(cTimeOutMs); urlConnection.setRequestProperty("Accept", "application/json"); urlConnection.setRequestProperty("Content-type", "application/json"); urlConnection.setRequestMethod("POST"); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); Log.i(TAG, "Request=" + json.toString()); OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream()); out.write(json.toString().getBytes()); // UTF-8 out.flush(); int code = urlConnection.getResponseCode(); if (code != HttpsURLConnection.HTTP_OK) throw new IOException("HTTP " + code); InputStreamReader isr = new InputStreamReader(urlConnection.getInputStream()); String response = Util.readString(isr).toString(); Log.i(TAG, "Response=" + response); JSONObject jfetched = new JSONObject(response); JSONArray jpkgs = jfetched.getJSONArray("package"); for (int i = 0; i < jpkgs.length(); i++) { JSONObject jpkg = jpkgs.getJSONObject(i); String name = jpkg.getString("name"); int wifi = jpkg.getInt("wifi"); int wifi_screen = jpkg.getInt("wifi_screen"); int other = jpkg.getInt("other"); int other_screen = jpkg.getInt("other_screen"); int roaming = jpkg.getInt("roaming"); int devices = jpkg.getInt("devices"); double conf_wifi; boolean block_wifi; if (rule.wifi_default) { conf_wifi = confidence(devices - wifi, devices); block_wifi = !(devices - wifi > wifi && conf_wifi > cConfidence); } else { conf_wifi = confidence(wifi, devices); block_wifi = (wifi > devices - wifi && conf_wifi > cConfidence); } boolean allow_wifi_screen = rule.screen_wifi_default; if (block_wifi) allow_wifi_screen = (wifi_screen > wifi / 2); double conf_other; boolean block_other; if (rule.other_default) { conf_other = confidence(devices - other, devices); block_other = !(devices - other > other && conf_other > cConfidence); } else { conf_other = confidence(other, devices); block_other = (other > devices - other && conf_other > cConfidence); } boolean allow_other_screen = rule.screen_other_default; if (block_other) allow_other_screen = (other_screen > other / 2); boolean block_roaming = rule.roaming_default; if (!block_other || allow_other_screen) block_roaming = (roaming > (devices - other) / 2); Log.i(TAG, "pkg=" + name + " wifi=" + wifi + "/" + wifi_screen + "=" + block_wifi + "/" + allow_wifi_screen + " " + Math.round(100 * conf_wifi) + "%" + " other=" + other + "/" + other_screen + "/" + roaming + "=" + block_other + "/" + allow_other_screen + "/" + block_roaming + " " + Math.round(100 * conf_other) + "%" + " devices=" + devices); rule.wifi_blocked = block_wifi; rule.screen_wifi = allow_wifi_screen; rule.other_blocked = block_other; rule.screen_other = allow_other_screen; rule.roaming = block_roaming; } } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); return ex; } finally { if (urlConnection != null) urlConnection.disconnect(); } return null; } @Override protected void onPostExecute(Object result) { holder.ibFetch.setEnabled(true); updateRule(rule, true, listAll); } }.execute(rule); } }); // Launch application settings final Intent settings = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); settings.setData(Uri.parse("package:" + rule.info.packageName)); holder.ibSettings.setVisibility( settings.resolveActivity(context.getPackageManager()) == null ? View.GONE : View.VISIBLE); holder.ibSettings.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(settings); } }); // Launch application holder.ibLaunch.setVisibility(rule.intent == null ? View.GONE : View.VISIBLE); holder.ibLaunch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(rule.intent); } }); // Show Wi-Fi screen on condition holder.cbScreenWifi.setEnabled(rule.wifi_blocked && rule.apply); holder.cbScreenWifi.setOnCheckedChangeListener(null); holder.cbScreenWifi.setChecked(rule.screen_wifi); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivWifiLegend.getDrawable()); DrawableCompat.setTint(wrap, colorOn); } holder.cbScreenWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { rule.screen_wifi = isChecked; updateRule(rule, true, listAll); } }); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrap = DrawableCompat.wrap(holder.ivOtherLegend.getDrawable()); DrawableCompat.setTint(wrap, colorOn); } // Show mobile screen on condition holder.cbScreenOther.setEnabled(rule.other_blocked && rule.apply); holder.cbScreenOther.setOnCheckedChangeListener(null); holder.cbScreenOther.setChecked(rule.screen_other); holder.cbScreenOther.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { rule.screen_other = isChecked; updateRule(rule, true, listAll); } }); // Show roaming condition holder.cbRoaming.setEnabled((!rule.other_blocked || rule.screen_other) && rule.apply); holder.cbRoaming.setOnCheckedChangeListener(null); holder.cbRoaming.setChecked(rule.roaming); holder.cbRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { rule.roaming = isChecked; updateRule(rule, true, listAll); // Request permissions if (isChecked && !Util.hasPhoneStatePermission(context)) context.requestPermissions(new String[] { Manifest.permission.READ_PHONE_STATE }, ActivityMain.REQUEST_ROAMING); } }); // Reset rule holder.btnClear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Util.areYouSure(view.getContext(), R.string.msg_clear_rules, new Util.DoubtListener() { @Override public void onSure() { holder.cbApply.setChecked(true); holder.cbWifi.setChecked(rule.wifi_default); holder.cbOther.setChecked(rule.other_default); holder.cbScreenWifi.setChecked(rule.screen_wifi_default); holder.cbScreenOther.setChecked(rule.screen_other_default); holder.cbRoaming.setChecked(rule.roaming_default); } }); } }); // Show logging is disabled boolean log_app = prefs.getBoolean("log_app", false); holder.tvNoLog.setVisibility(log_app ? View.GONE : View.VISIBLE); holder.tvNoLog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(new Intent(context, ActivitySettings.class)); } }); // Show filtering is disabled boolean filter = prefs.getBoolean("filter", false); holder.tvNoFilter.setVisibility(filter ? View.GONE : View.VISIBLE); holder.tvNoFilter.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.startActivity(new Intent(context, ActivitySettings.class)); } }); // Show access rules if (rule.expanded) { // Access the database when expanded only final AdapterAccess badapter = new AdapterAccess(context, DatabaseHelper.getInstance(context).getAccess(rule.info.applicationInfo.uid)); holder.lvAccess.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, final int bposition, long bid) { PackageManager pm = context.getPackageManager(); Cursor cursor = (Cursor) badapter.getItem(bposition); final long id = cursor.getLong(cursor.getColumnIndex("ID")); final int version = cursor.getInt(cursor.getColumnIndex("version")); final int protocol = cursor.getInt(cursor.getColumnIndex("protocol")); final String daddr = cursor.getString(cursor.getColumnIndex("daddr")); final int dport = cursor.getInt(cursor.getColumnIndex("dport")); long time = cursor.getLong(cursor.getColumnIndex("time")); int block = cursor.getInt(cursor.getColumnIndex("block")); PopupMenu popup = new PopupMenu(context, context.findViewById(R.id.vwPopupAnchor)); popup.inflate(R.menu.access); popup.getMenu().findItem(R.id.menu_host).setTitle(Util.getProtocolName(protocol, version, false) + " " + daddr + (dport > 0 ? "/" + dport : "")); // Whois final Intent lookupIP = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.tcpiputils.com/whois-lookup/" + daddr)); if (pm.resolveActivity(lookupIP, 0) == null) popup.getMenu().removeItem(R.id.menu_whois); else popup.getMenu().findItem(R.id.menu_whois) .setTitle(context.getString(R.string.title_log_whois, daddr)); // Lookup port final Intent lookupPort = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.speedguide.net/port.php?port=" + dport)); if (dport <= 0 || pm.resolveActivity(lookupPort, 0) == null) popup.getMenu().removeItem(R.id.menu_port); else popup.getMenu().findItem(R.id.menu_port) .setTitle(context.getString(R.string.title_log_port, dport)); popup.getMenu().findItem(R.id.menu_time) .setTitle(SimpleDateFormat.getDateTimeInstance().format(time)); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.menu_whois: context.startActivity(lookupIP); return true; case R.id.menu_port: context.startActivity(lookupPort); return true; case R.id.menu_allow: if (IAB.isPurchased(ActivityPro.SKU_FILTER, context)) { DatabaseHelper.getInstance(context).setAccess(id, 0); ServiceSinkhole.reload("allow host", context); if (rule.submit) ServiceJob.submit(rule, version, protocol, daddr, dport, 0, context); } else context.startActivity(new Intent(context, ActivityPro.class)); return true; case R.id.menu_block: if (IAB.isPurchased(ActivityPro.SKU_FILTER, context)) { DatabaseHelper.getInstance(context).setAccess(id, 1); ServiceSinkhole.reload("block host", context); if (rule.submit) ServiceJob.submit(rule, version, protocol, daddr, dport, 1, context); } else context.startActivity(new Intent(context, ActivityPro.class)); return true; case R.id.menu_reset: DatabaseHelper.getInstance(context).setAccess(id, -1); ServiceSinkhole.reload("reset host", context); if (rule.submit) ServiceJob.submit(rule, version, protocol, daddr, dport, -1, context); return true; } return false; } }); if (block == 0) popup.getMenu().removeItem(R.id.menu_allow); else if (block == 1) popup.getMenu().removeItem(R.id.menu_block); popup.show(); } }); holder.lvAccess.setAdapter(badapter); } else { holder.lvAccess.setAdapter(null); holder.lvAccess.setOnItemClickListener(null); } // Clear access log holder.btnClearAccess.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Util.areYouSure(view.getContext(), R.string.msg_reset_access, new Util.DoubtListener() { @Override public void onSure() { DatabaseHelper.getInstance(context).clearAccess(rule.info.applicationInfo.uid, true); if (rv != null) rv.scrollToPosition(position); } }); } }); // Notify on access holder.cbNotify.setEnabled(prefs.getBoolean("notify_access", false) && rule.apply); holder.cbNotify.setOnCheckedChangeListener(null); holder.cbNotify.setChecked(rule.notify); holder.cbNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.notify = isChecked; updateRule(rule, true, listAll); } }); // Usage data sharing holder.cbSubmit .setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? View.VISIBLE : View.GONE); holder.cbSubmit.setOnCheckedChangeListener(null); holder.cbSubmit.setChecked(rule.submit); holder.cbSubmit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { rule.submit = isChecked; updateRule(rule, true, listAll); } }); }
From source file:com.s8launch.cheil.facetracker.MultiTrackerActivity.java
public Bitmap getBitmapFromView(View view) { view.setBackgroundColor(Color.TRANSPARENT); //Define a bitmap with the same size as the view Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); //Bind a canvas to it Canvas canvas = new Canvas(returnedBitmap); //Get the view's background Drawable bgDrawable = view.getBackground(); if (bgDrawable != null) //has background drawable, then draw it on the canvas bgDrawable.draw(canvas);/*from w w w . j a v a 2s .c o m*/ else //does not have background drawable, then draw white background on the canvas canvas.drawColor(Color.WHITE); // draw the view on the canvas view.draw(canvas); //return the bitmap return returnedBitmap; }
From source file:com.esri.arcgisruntime.sample.readsymbolsmobilestylefile.MainActivity.java
/** * Create a new multilayer point symbol based on selected symbol keys, size, and color. *//*from w w w. j a v a 2 s. c om*/ private void createSwatchAsync() { // get the Future to perform the generation of the multi layer symbol ListenableFuture<Symbol> symbolFuture = mEmojiStyle.getSymbolAsync(mKeys); symbolFuture.addDoneListener(() -> { try { // wait for the Future to complete and get the result MultilayerPointSymbol faceSymbol = (MultilayerPointSymbol) symbolFuture.get(); if (faceSymbol == null) { return; } // set size to current size as defined by seek bar faceSymbol.setSize(mSize); // lock the color on all symbol layers for (SymbolLayer symbolLayer : faceSymbol.getSymbolLayers()) { symbolLayer.setColorLocked(true); } // if the user has chosen a color other than "Select color..." (index 0) or "Default" (index 1) if (mColorSpinner.getSelectedItemPosition() > 1) { // unlock the first layer and set it to the selected color faceSymbol.getSymbolLayers().get(0).setColorLocked(false); faceSymbol.setColor(mColor); } // get the future to create the swatch of the multi layer symbol ListenableFuture<Bitmap> bitmapFuture = faceSymbol.createSwatchAsync(this, Color.TRANSPARENT); bitmapFuture.addDoneListener(() -> { try { Bitmap bitmap = bitmapFuture.get(); mPreviewView.setImageBitmap(bitmap); // set this field to enable us to add this symbol to the graphics overlay mCurrentMultilayerSymbol = faceSymbol; } catch (InterruptedException | ExecutionException e) { logErrorToUser(this, getString(R.string.error_loading_multilayer_bitmap_failed, e.getMessage())); } }); } catch (InterruptedException | ExecutionException e) { logErrorToUser(this, getString(R.string.error_loading_multilayer_symbol_failed, e.getMessage())); } }); }
From source file:babbq.com.searchplace.SearchActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); ButterKnife.bind(this); setupSearchView();//from ww w.j a va2s . com auto = TransitionInflater.from(this).inflateTransition(R.transition.auto); mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API) .addApi(Places.GEO_DATA_API).addConnectionCallbacks(this).addOnConnectionFailedListener(this) .build(); mAdapter = new TestAdapter(null, v -> { int position = results.getChildLayoutPosition(v); //Toast.makeText(getActivity(), "#" + position, Toast.LENGTH_SHORT).show(); PendingResult result = Places.GeoDataApi.getPlaceById(mGoogleApiClient, String.valueOf(mAdapter.getElementAt(position).placeId)); result.setResultCallback(mCoordinatePlaceDetailsCallback); }, mGoogleApiClient); dataManager = new SearchDataManager(mGoogleApiClient, mCoordinatePlaceDetailsCallback) { @Override public void onDataLoaded(List<? extends PlaceAutocomplete> data) { if (data != null && data.size() > 0) { if (results.getVisibility() != View.VISIBLE) { TransitionManager.beginDelayedTransition(container, auto); progress.setVisibility(View.GONE); results.setVisibility(View.VISIBLE); // fab.setVisibility(View.VISIBLE); fab.setAlpha(0.6f); fab.setScaleX(0f); fab.setScaleY(0f); fab.animate().alpha(1f).scaleX(1f).scaleY(1f).setStartDelay(800L).setDuration(300L) .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in)); } // mAdapter.addAndResort(data); mAdapter.setList(data); } else { TransitionManager.beginDelayedTransition(container, auto); progress.setVisibility(View.GONE); setNoResultsVisibility(View.VISIBLE); } } }; // mAdapter = new FeedAdapter(this, dataManager, columns); results.setAdapter(mAdapter); GridLayoutManager layoutManager = new GridLayoutManager(this, columns); // layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { // // @Override // public int getSpanSize(int position) { // return mAdapter.getItemColumnSpan(position); // } // }); results.setLayoutManager(layoutManager); results.addOnScrollListener(new InfiniteScrollListener(layoutManager, dataManager) { @Override public void onLoadMore() { dataManager.loadMore(); } }); results.setHasFixedSize(true); results.addOnScrollListener(gridScroll); // extract the search icon's location passed from the launching activity, minus 4dp to // compensate for different paddings in the views searchBackDistanceX = getIntent().getIntExtra(EXTRA_MENU_LEFT, 0) - (int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); searchIconCenterX = getIntent().getIntExtra(EXTRA_MENU_CENTER_X, 0); // translate icon to match the launching screen then animate back into position searchBackContainer.setTranslationX(searchBackDistanceX); searchBackContainer.animate().translationX(0f).setDuration(650L) .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in)); // transform from search icon to back icon AnimatedVectorDrawable searchToBack = (AnimatedVectorDrawable) ContextCompat.getDrawable(this, R.drawable.avd_search_to_back); searchBack.setImageDrawable(searchToBack); searchToBack.start(); // for some reason the animation doesn't always finish (leaving a part arrow!?) so after // the animation set a static drawable. Also animation callbacks weren't added until API23 // so using post delayed :( // TODO fix properly!! searchBack.postDelayed(new Runnable() { @Override public void run() { searchBack.setImageDrawable( ContextCompat.getDrawable(SearchActivity.this, R.drawable.ic_arrow_back_padded)); } }, 600); // fade in the other search chrome searchBackground.animate().alpha(1f).setDuration(300L) .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in)); searchView.animate().alpha(1f).setStartDelay(400L).setDuration(400L) .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in)) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { searchView.requestFocus(); ImeUtils.showIme(searchView); } }); // animate in a scrim over the content behind scrim.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { scrim.getViewTreeObserver().removeOnPreDrawListener(this); AnimatorSet showScrim = new AnimatorSet(); showScrim.playTogether( ViewAnimationUtils.createCircularReveal(scrim, searchIconCenterX, searchBackground.getBottom(), 0, (float) Math.hypot(searchBackDistanceX, scrim.getHeight() - searchBackground.getBottom())), ObjectAnimator.ofArgb(scrim, ViewUtils.BACKGROUND_COLOR, Color.TRANSPARENT, ContextCompat.getColor(SearchActivity.this, R.color.scrim))); showScrim.setDuration(400L); showScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in)); showScrim.start(); return false; } }); onNewIntent(getIntent()); }
From source file:com.google.samples.apps.topeka.widget.quiz.AbsQuizView.java
private void animateForegroundColor(@ColorInt final int targetColor) { ObjectAnimator animator = ObjectAnimator.ofInt(this, ViewUtils.FOREGROUND_COLOR, Color.TRANSPARENT, targetColor);/* ww w .java 2s .c o m*/ animator.setEvaluator(new ArgbEvaluator()); animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY); animator.start(); }
From source file:com.bf.zxd.zhuangxudai.my.fragment.CompanyApplyFragment.java
private void ChangeIcon() { //PopupWindow----START-----??PopupWindowPopupWindow??? backgroundAlpha(0.3f);//from ww w .ja v a 2 s . com View view = LayoutInflater.from(getActivity().getBaseContext()).inflate(R.layout.popu_window, null); final PopupWindow popupWindow = new PopupWindow(view, ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT, true); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); //?? DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); popupWindow.setWidth(dm.widthPixels); popupWindow.setAnimationStyle(R.style.popuwindow); //? popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0); popupWindow.setOnDismissListener(new poponDismissListener_CompanyApplyFragment()); //PopupWindow-----END //PopupWindow Button button = (Button) view.findViewById(R.id.take_photo);//?? Button button1 = (Button) view.findViewById(R.id.all_photo);//? Button button2 = (Button) view.findViewById(R.id.out);//? button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); } }); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); //,? Log.i("Daniel", "------"); allPhoto(); } }); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backgroundAlpha(1f); popupWindow.dismiss(); //,Intent???? Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //,?? File file = FileUitlity.getInstance(getActivity().getApplicationContext()).makeDir("head_image"); //?? path = file.getParent() + File.separatorChar + System.currentTimeMillis() + ".jpg"; //?IntentIntent? intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(path))); //? intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); //?Intent??RoundImageView startActivityForResult(intent, REQUEST_CODE); } }); }
From source file:com.little.pager.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundColor(Color.TRANSPARENT); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (colorArray == null || i > colorArray.length()) { tab.setTextColor(tabTextColor); } else { tab.setTextColor(colorArray.getColor(i, tabTextColor)); }/*from w w w. j a v a 2 s . c om*/ if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { // if (colorArray == null || i >= colorArray.length()) { //? if (hasFollowColor) { indicatorColor = selectedTabTextColor; } tab.setTextColor(selectedTabTextColor); } else { if (hasFollowColor) { indicatorColor = colorArray.getColor(i, selectedTabTextColor); } tab.setTextColor(colorArray.getColor(i, selectedTabTextColor)); } invalidate(); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize); } } } }
From source file:com.Duo.music.player.NowPlayingQueueActivity.NowPlayingQueueFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Inflate the correct layout based on the selected theme. mContext = getActivity().getApplicationContext(); mApp = (Common) mContext;/*from w w w. ja v a2 s .c o m*/ nowPlayingQueueFragment = this; sharedPreferences = mContext.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE); mCursor = mApp.getService().getCursor(); View rootView = (ViewGroup) inflater.inflate(R.layout.now_playing_queue_layout, container, false); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updateSongInfo(); } }; //Notify the application that this fragment is now visible. sharedPreferences.edit().putBoolean("NOW_PLAYING_QUEUE_VISIBLE", true).commit(); //Get the screen's parameters. displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); screenWidth = displayMetrics.widthPixels; screenHeight = displayMetrics.heightPixels; noMusicPlaying = (TextView) rootView.findViewById(R.id.now_playing_queue_no_music_playing); nowPlayingAlbumArt = (ImageView) rootView.findViewById(R.id.now_playing_queue_album_art); nowPlayingSongTitle = (TextView) rootView.findViewById(R.id.now_playing_queue_song_title); nowPlayingSongArtist = (TextView) rootView.findViewById(R.id.now_playing_queue_song_artist); nowPlayingSongContainer = (RelativeLayout) rootView .findViewById(R.id.now_playing_queue_current_song_container); noMusicPlaying.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingSongTitle.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingSongArtist.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingQueueListView = (DragSortListView) rootView.findViewById(R.id.now_playing_queue_list_view); progressBar = (ProgressBar) rootView.findViewById(R.id.now_playing_queue_progressbar); playPauseButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_play); nextButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_next); previousButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_previous); //Apply the card layout's background based on the color theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("LIGHT_CARDS_THEME")) { rootView.setBackgroundColor(0xFFEEEEEE); nowPlayingQueueListView.setDivider(getResources().getDrawable(R.drawable.transparent_drawable)); nowPlayingQueueListView.setDividerHeight(3); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(7, 3, 7, 3); nowPlayingQueueListView.setLayoutParams(layoutParams); } else if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { rootView.setBackgroundColor(0xFF000000); nowPlayingQueueListView.setDivider(getResources().getDrawable(R.drawable.transparent_drawable)); nowPlayingQueueListView.setDividerHeight(3); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(7, 3, 7, 3); nowPlayingQueueListView.setLayoutParams(layoutParams); } //Set the Now Playing container layout's background. nowPlayingSongContainer.setBackgroundColor(UIElementsHelper.getNowPlayingQueueBackground(mContext)); //Loop through the service's cursor and retrieve the current queue's information. if (sharedPreferences.getBoolean("SERVICE_RUNNING", false) == false || mApp.getService().getCurrentMediaPlayer() == null) { //No audio is currently playing. noMusicPlaying.setVisibility(View.VISIBLE); nowPlayingAlbumArt.setImageBitmap(mApp.decodeSampledBitmapFromResource(R.drawable.default_album_art, screenWidth / 3, screenWidth / 3)); nowPlayingQueueListView.setVisibility(View.GONE); nowPlayingSongTitle.setVisibility(View.GONE); nowPlayingSongArtist.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); } else { //Set the current play/pause conditions. try { //Hide the progressBar and display the controls. progressBar.setVisibility(View.GONE); playPauseButton.setVisibility(View.VISIBLE); nextButton.setVisibility(View.VISIBLE); previousButton.setVisibility(View.VISIBLE); if (mApp.getService().getCurrentMediaPlayer().isPlaying()) { playPauseButton.setImageResource(R.drawable.pause_holo_light); } else { playPauseButton.setImageResource(R.drawable.play_holo_light); } } catch (Exception e) { /* The mediaPlayer hasn't been initialized yet, so let's just keep the controls * hidden for now. Once the mediaPlayer is initialized and it starts playing, * updateSongInfo() will be called, and we can show the controls/hide the progressbar * there. For now though, we'll display the progressBar. */ progressBar.setVisibility(View.VISIBLE); playPauseButton.setVisibility(View.GONE); nextButton.setVisibility(View.GONE); previousButton.setVisibility(View.GONE); } //Retrieve and set the current title/artist/artwork. mCursor.moveToPosition( mApp.getService().getPlaybackIndecesList().get(mApp.getService().getCurrentSongIndex())); String currentTitle = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.SONG_TITLE)); String currentArtist = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)); nowPlayingSongTitle.setText(currentTitle); nowPlayingSongArtist.setText(currentArtist); File file = new File(mContext.getExternalCacheDir() + "/current_album_art.jpg"); Bitmap bm = null; if (file.exists()) { bm = mApp.decodeSampledBitmapFromFile(file, screenWidth, screenHeight); nowPlayingAlbumArt.setScaleX(1.0f); nowPlayingAlbumArt.setScaleY(1.0f); } else { int defaultResource = UIElementsHelper.getIcon(mContext, "default_album_art"); bm = mApp.decodeSampledBitmapFromResource(defaultResource, screenWidth, screenHeight); nowPlayingAlbumArt.setScaleX(0.5f); nowPlayingAlbumArt.setScaleY(0.5f); } nowPlayingAlbumArt.setImageBitmap(bm); noMusicPlaying.setPaintFlags( noMusicPlaying.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); nowPlayingSongTitle.setPaintFlags(nowPlayingSongTitle.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.SUBPIXEL_TEXT_FLAG); nowPlayingSongArtist.setPaintFlags( nowPlayingSongArtist.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); /* Set the adapter. We'll pass in playbackIndecesList as the adapter's data backend. * The array can then be manipulated (reordered, items removed, etc) with no restrictions. * Each integer element in the array will be used as a pointer to a specific cursor row, * so there's no need to fiddle around with the actual cursor itself. */ nowPlayingQueueListViewAdapter = new NowPlayingQueueListViewAdapter(getActivity(), mApp.getService().getPlaybackIndecesList()); nowPlayingQueueListView.setAdapter(nowPlayingQueueListViewAdapter); nowPlayingQueueListView.setFastScrollEnabled(true); nowPlayingQueueListView.setDropListener(onDrop); nowPlayingQueueListView.setRemoveListener(onRemove); SimpleFloatViewManager simpleFloatViewManager = new SimpleFloatViewManager(nowPlayingQueueListView); simpleFloatViewManager.setBackgroundColor(Color.TRANSPARENT); nowPlayingQueueListView.setFloatViewManager(simpleFloatViewManager); //Scroll down to the current song. nowPlayingQueueListView.setSelection(mApp.getService().getCurrentSongIndex()); nowPlayingQueueListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int index, long arg3) { mApp.getService().skipToTrack(index); } }); playPauseButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mApp.getService().togglePlaybackState(); } }); nextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mApp.getService().skipToNextTrack(); } }); previousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mApp.getService().skipToPreviousTrack(); } }); } return rootView; }
From source file:com.jelly.music.player.NowPlayingQueueActivity.NowPlayingQueueFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Inflate the correct layout based on the selected theme. mContext = getActivity().getApplicationContext(); mApp = (Common) mContext;/*from w w w.j a va2 s.c om*/ nowPlayingQueueFragment = this; sharedPreferences = mContext.getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE); mCursor = mApp.getService().getCursor(); View rootView = (ViewGroup) inflater.inflate(R.layout.now_playing_queue_layout, container, false); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { updateSongInfo(); } }; //Notify the application that this fragment is now visible. sharedPreferences.edit().putBoolean("NOW_PLAYING_QUEUE_VISIBLE", true).commit(); //Get the screen's parameters. displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); screenWidth = displayMetrics.widthPixels; screenHeight = displayMetrics.heightPixels; noMusicPlaying = (TextView) rootView.findViewById(R.id.now_playing_queue_no_music_playing); nowPlayingAlbumArt = (ImageView) rootView.findViewById(R.id.now_playing_queue_album_art); nowPlayingSongTitle = (TextView) rootView.findViewById(R.id.now_playing_queue_song_title); nowPlayingSongArtist = (TextView) rootView.findViewById(R.id.now_playing_queue_song_artist); nowPlayingSongContainer = (RelativeLayout) rootView .findViewById(R.id.now_playing_queue_current_song_container); noMusicPlaying.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingSongTitle.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingSongArtist.setTypeface(TypefaceHelper.getTypeface(mContext, "RobotoCondensed-Light")); nowPlayingQueueListView = (DragSortListView) rootView.findViewById(R.id.now_playing_queue_list_view); progressBar = (ProgressBar) rootView.findViewById(R.id.now_playing_queue_progressbar); playPauseButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_play); nextButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_next); previousButton = (ImageButton) rootView.findViewById(R.id.now_playing_queue_previous); //Apply the card layout's background based on the color theme. if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME").equals("LIGHT_CARDS_THEME")) { rootView.setBackgroundColor(0xFFEEEEEE); nowPlayingQueueListView.setDivider(getResources().getDrawable(R.drawable.transparent_drawable)); nowPlayingQueueListView.setDividerHeight(3); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(7, 3, 7, 3); nowPlayingQueueListView.setLayoutParams(layoutParams); } else if (sharedPreferences.getString(Common.CURRENT_THEME, "LIGHT_CARDS_THEME") .equals("DARK_CARDS_THEME")) { rootView.setBackgroundColor(0xFF000000); nowPlayingQueueListView.setDivider(getResources().getDrawable(R.drawable.transparent_drawable)); nowPlayingQueueListView.setDividerHeight(3); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(7, 3, 7, 3); nowPlayingQueueListView.setLayoutParams(layoutParams); } //Set the Now Playing container layout's background. nowPlayingSongContainer.setBackgroundColor(UIElementsHelper.getNowPlayingQueueBackground(mContext)); //Loop through the service's cursor and retrieve the current queue's information. if (sharedPreferences.getBoolean("SERVICE_RUNNING", false) == false || mApp.getService().getCurrentMediaPlayer() == null) { //No audio is currently playing. noMusicPlaying.setVisibility(View.VISIBLE); nowPlayingAlbumArt.setImageBitmap(mApp.decodeSampledBitmapFromResource(R.drawable.default_album_art, screenWidth / 3, screenWidth / 3)); nowPlayingQueueListView.setVisibility(View.GONE); nowPlayingSongTitle.setVisibility(View.GONE); nowPlayingSongArtist.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); } else { //Set the current play/pause conditions. try { //Hide the progressBar and display the controls. progressBar.setVisibility(View.GONE); playPauseButton.setVisibility(View.VISIBLE); nextButton.setVisibility(View.VISIBLE); previousButton.setVisibility(View.VISIBLE); if (mApp.getService().getCurrentMediaPlayer().isPlaying()) { playPauseButton.setImageResource(R.drawable.pause_holo_light); } else { playPauseButton.setImageResource(R.drawable.play_holo_light); } } catch (Exception e) { /* The mediaPlayer hasn't been initialized yet, so let's just keep the controls * hidden for now. Once the mediaPlayer is initialized and it starts playing, * updateSongInfo() will be called, and we can show the controls/hide the progressbar * there. For now though, we'll display the progressBar. */ progressBar.setVisibility(View.VISIBLE); playPauseButton.setVisibility(View.GONE); nextButton.setVisibility(View.GONE); previousButton.setVisibility(View.GONE); } //Retrieve and set the current title/artist/artwork. mCursor.moveToPosition( mApp.getService().getPlaybackIndecesList().get(mApp.getService().getCurrentSongIndex())); String currentTitle = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.SONG_TITLE)); String currentArtist = mCursor.getString(mCursor.getColumnIndex(DBAccessHelper.SONG_ARTIST)); nowPlayingSongTitle.setText(currentTitle); nowPlayingSongArtist.setText(currentArtist); File file = new File(mContext.getExternalCacheDir() + "/current_album_art.jpg"); Bitmap bm = null; if (file.exists()) { bm = mApp.decodeSampledBitmapFromFile(file, screenWidth, screenHeight); nowPlayingAlbumArt.setScaleX(1.0f); nowPlayingAlbumArt.setScaleY(1.0f); } else { int defaultResource = UIElementsHelper.getIcon(mContext, "default_album_art"); bm = mApp.decodeSampledBitmapFromResource(defaultResource, screenWidth, screenHeight); nowPlayingAlbumArt.setScaleX(0.5f); nowPlayingAlbumArt.setScaleY(0.5f); } nowPlayingAlbumArt.setImageBitmap(bm); noMusicPlaying.setPaintFlags( noMusicPlaying.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); nowPlayingSongTitle.setPaintFlags(nowPlayingSongTitle.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.FAKE_BOLD_TEXT_FLAG | Paint.SUBPIXEL_TEXT_FLAG); nowPlayingSongArtist.setPaintFlags( nowPlayingSongArtist.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); /* Set the adapter. We'll pass in playbackIndecesList as the adapter's data backend. * The array can then be manipulated (reordered, items removed, etc) with no restrictions. * Each integer element in the array will be used as a pointer to a specific cursor row, * so there's no need to fiddle around with the actual cursor itself. */ nowPlayingQueueListViewAdapter = new NowPlayingQueueListViewAdapter(getActivity(), mApp.getService().getPlaybackIndecesList()); nowPlayingQueueListView.setAdapter(nowPlayingQueueListViewAdapter); nowPlayingQueueListView.setFastScrollEnabled(true); nowPlayingQueueListView.setDropListener(onDrop); nowPlayingQueueListView.setRemoveListener(onRemove); SimpleFloatViewManager simpleFloatViewManager = new SimpleFloatViewManager(nowPlayingQueueListView); simpleFloatViewManager.setBackgroundColor(Color.TRANSPARENT); nowPlayingQueueListView.setFloatViewManager(simpleFloatViewManager); //Scroll down to the current song. nowPlayingQueueListView.setSelection(mApp.getService().getCurrentSongIndex()); nowPlayingQueueListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int index, long arg3) { mApp.getService().skipToTrack(index); } }); playPauseButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mApp.getService().togglePlaybackState(); } }); nextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mApp.getService().skipToNextTrack(); } }); previousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mApp.getService().skipToPreviousTrack(); } }); } return rootView; }