@Override public void onBackPressed() { // STOPPING IMAGE MANAGER THREADS try { if (adapter != null && adapter.getImageManager() != null) adapter.getImageManager().interrupThread(); if (imageManager != null) imageManager.interrupThread(); } catch (Exception e) { e.printStackTrace(); } super.onBackPressed(); }
private View setCurrentUserRow() { View header1 = getLayoutInflater().inflate(R.layout.leaderboarditem, null, false); header1 .findViewById(R.id.alliance) .setVisibility(View.GONE); // alliance in user not implemented now TextView p = (TextView) header1.findViewById(R.id.position); p.setTextColor(Color.WHITE); p.setText(currentUser.position); TextView nickname = (TextView) header1.findViewById(R.id.nickname); nickname.setText(currentUser.name); TextView score = (TextView) header1.findViewById(R.id.score); NumberFormat nf = NumberFormat.getInstance(Locale.getDefault()); String formattedScore = nf.format(Double.parseDouble(currentUser.score)); if (currentUser.feed == null) score.setText(currentContext.getString(R.string.leadScore) + "\n" + formattedScore); else score.setText(currentUser.feed + ":\n" + formattedScore); header1.findViewById(R.id.image).setVisibility(LinearLayout.GONE); header1.findViewById(R.id.whiteline).setVisibility(LinearLayout.GONE); try { if (currentUser.imageUrl != null) { ImageView imageView = new ImageView(currentContext); imageView.setTag(currentUser.imageUrl); int size = (int) (50 * currentContext.getResources().getDisplayMetrics().density + 0.5f); imageView.setLayoutParams(new LinearLayout.LayoutParams(size, size)); imageManager.displayImage(currentUser.imageUrl, currentContext, imageView); LinearLayout a = (LinearLayout) header1.findViewById(R.id.item); a.addView(imageView, 0); } else { header1 .findViewById(R.id.item) .setPadding((int) (ratio * 5), (int) (ratio * 5), 0, (int) (ratio * 5)); } } catch (Exception e) { } LinearLayout positionView = (LinearLayout) header1.findViewById(R.id.post); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, (int) (ratio * 35)); params.setMargins(0, 0, (int) (ratio * 10), 0); positionView.setLayoutParams(params); positionView.setPadding((int) (ratio * 5), 0, (int) (ratio * 5), 0); positionView.setMinimumHeight((int) (ratio * 35)); positionView.setMinimumWidth((int) (ratio * 35)); positionView.setBackgroundDrawable( new BDrawableGradient(0, (int) (ratio * 35), BDrawableGradient.HIGH_GRAY_GRADIENT)); header1 .findViewById(R.id.item) .setBackgroundDrawable( new BDrawableGradient(0, (int) (ratio * 60), BDrawableGradient.LIGHT_GRAY_GRADIENT)); LinearLayout spacer = (LinearLayout) header1.findViewById(R.id.space); spacer.setVisibility(LinearLayout.VISIBLE); return header1; }