Fix pixel sized layouts
- Move dp to px converter to moodlbox - Fix details activity icon size generation
This commit is contained in:
parent
122a487f29
commit
6a8ecfea74
@ -60,6 +60,7 @@ import com.nauk.moodl.DataManagers.PreferencesManager;
|
||||
import com.nauk.moodl.DetailsActivityPagerAdapter;
|
||||
import com.nauk.moodl.LayoutManagers.TradeListAdapter;
|
||||
import com.nauk.moodl.LayoutManagers.TransactionListAdapter;
|
||||
import com.nauk.moodl.MoodlBox;
|
||||
import com.nauk.moodl.PlaceholderManager;
|
||||
import com.nauk.moodl.R;
|
||||
|
||||
@ -188,7 +189,12 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
||||
canvas.drawCircle(result.getHeight()/2, result.getWidth()/2, 75, paint);
|
||||
canvas.drawBitmap(Bitmap.createScaledBitmap(currency.getIcon(), 100, 100, false), result.getHeight()/2 - 50, result.getWidth()/2 - 50, null);
|
||||
|
||||
getSupportActionBar().setIcon(new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(result, 120, 120, false)));
|
||||
getSupportActionBar()
|
||||
.setIcon(new BitmapDrawable(getResources(),
|
||||
Bitmap.createScaledBitmap(result
|
||||
, (int) MoodlBox.convertDpToPx(25, getResources())
|
||||
, (int) MoodlBox.convertDpToPx(25, getResources())
|
||||
, false)));
|
||||
}
|
||||
}
|
||||
/*for(int i = 0; i < dataChartList.size(); i++)
|
||||
|
@ -34,6 +34,7 @@ import com.nauk.moodl.DataManagers.CurrencyData.Currency;
|
||||
import com.nauk.moodl.DataManagers.CurrencyData.CurrencyDataChart;
|
||||
import com.nauk.moodl.DataManagers.PreferencesManager;
|
||||
import com.nauk.moodl.LayoutManagers.CustomViewPager;
|
||||
import com.nauk.moodl.MoodlBox;
|
||||
import com.nauk.moodl.PlaceholderManager;
|
||||
import com.nauk.moodl.R;
|
||||
|
||||
@ -170,7 +171,7 @@ public class Home extends Fragment {
|
||||
private void buttonEvent(View v)
|
||||
{
|
||||
v.setEnabled(false);
|
||||
v.setElevation(convertDpToPx(8));
|
||||
v.setElevation(MoodlBox.convertDpToPx(8, getResources()));
|
||||
|
||||
LinearLayout buttonLayout = (LinearLayout) v.getParent();
|
||||
|
||||
@ -181,7 +182,7 @@ public class Home extends Fragment {
|
||||
if(button != v)
|
||||
{
|
||||
button.setEnabled(true);
|
||||
button.setElevation(convertDpToPx(2));
|
||||
button.setElevation(MoodlBox.convertDpToPx(2, getResources()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,11 +320,6 @@ public class Home extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
private float convertDpToPx(float dp)
|
||||
{
|
||||
return dp * this.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
private void updateChartTab(int timeUnit, int amount)
|
||||
{
|
||||
updateChartsData(timeUnit, amount);
|
||||
|
@ -28,6 +28,7 @@ import com.nauk.moodl.Activities.CurrencyDetailsActivity;
|
||||
import com.nauk.moodl.Activities.HomeActivityFragments.Summary;
|
||||
import com.nauk.moodl.DataManagers.DatabaseManager;
|
||||
import com.nauk.moodl.DataManagers.PreferencesManager;
|
||||
import com.nauk.moodl.MoodlBox;
|
||||
import com.nauk.moodl.PlaceholderManager;
|
||||
import com.nauk.moodl.R;
|
||||
|
||||
@ -125,11 +126,6 @@ public class CurrencyCardview extends CardView {
|
||||
updateColor(currency);
|
||||
}
|
||||
|
||||
private float convertDpToPx(float dp)
|
||||
{
|
||||
return dp * this.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
public CurrencyCardview(@NonNull final Context context, final Currency currency, float totalValue, boolean isBalanceHidden)
|
||||
{
|
||||
super(context);
|
||||
@ -198,11 +194,11 @@ public class CurrencyCardview extends CardView {
|
||||
private void setupCardView(Context context)
|
||||
{
|
||||
ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams.MATCH_PARENT, ViewGroup.MarginLayoutParams.WRAP_CONTENT);
|
||||
layoutParams.setMargins((int) convertDpToPx(10), 0, (int) convertDpToPx(10), (int) convertDpToPx(10));
|
||||
layoutParams.setMargins((int) MoodlBox.convertDpToPx(10, getResources()), 0, (int) MoodlBox.convertDpToPx(10, getResources()), (int) MoodlBox.convertDpToPx(10, getResources()));
|
||||
|
||||
setLayoutParams(layoutParams);
|
||||
|
||||
setRadius(convertDpToPx(2));
|
||||
setRadius(MoodlBox.convertDpToPx(2, getResources()));
|
||||
|
||||
setClickable(false);
|
||||
setFocusable(false);
|
||||
|
@ -247,6 +247,11 @@ public class MoodlBox {
|
||||
return getIconUrl(symbol, 50, currencyDetailsList);
|
||||
}
|
||||
|
||||
public static float convertDpToPx(float dp, Resources resources)
|
||||
{
|
||||
return dp * resources.getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
public static String getIconUrl(String symbol, int size, CurrencyDetailsList currencyDetailsList)
|
||||
{
|
||||
String url;
|
||||
|
Loading…
Reference in New Issue
Block a user