Fix deprecated methods
This commit is contained in:
parent
418debc44f
commit
122a487f29
@ -65,6 +65,7 @@ import com.nauk.moodl.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.nauk.moodl.MoodlBox.numberConformer;
|
||||
import static com.nauk.moodl.MoodlBox.getDateFromTimestamp;
|
||||
@ -130,7 +131,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_currency_details);
|
||||
|
||||
currency = getIntent().getParcelableExtra("currency");
|
||||
currency = getIntent().getParcelableExtra(getBaseContext().getString(R.string.currency));
|
||||
viewPager = findViewById(R.id.vfCurrencyDetails);
|
||||
final DetailsActivityPagerAdapter adapter = new DetailsActivityPagerAdapter(getSupportFragmentManager(), 3);
|
||||
|
||||
@ -174,7 +175,7 @@ public class CurrencyDetailsActivity extends AppCompatActivity {
|
||||
setTitle(" " + currency.getName() + " | " + numberConformer(currency.getBalance()));
|
||||
}
|
||||
|
||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME |
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME |
|
||||
ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
|
||||
|
||||
Bitmap result = Bitmap.createBitmap(150, 150, currency.getIcon().getConfig());
|
||||
@ -187,7 +188,7 @@ 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(Bitmap.createScaledBitmap(result, 120, 120, false)));
|
||||
getSupportActionBar().setIcon(new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(result, 120, 120, false)));
|
||||
}
|
||||
}
|
||||
/*for(int i = 0; i < dataChartList.size(); i++)
|
||||
|
@ -9,6 +9,7 @@ import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@ -186,7 +187,7 @@ public class CurrencyCardview extends CardView {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(context.getApplicationContext(), CurrencyDetailsActivity.class);
|
||||
intent.putExtra("currency", currency);
|
||||
intent.putExtra(getContext().getString(R.string.currency), currency);
|
||||
context.getApplicationContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
@ -321,7 +322,7 @@ public class CurrencyCardview extends CardView {
|
||||
values.add(new Entry(i, (float) dataChartList.get(i).getOpen()));
|
||||
}
|
||||
|
||||
dataSet = new LineDataSet(values, "History");
|
||||
dataSet = new LineDataSet(values, "");
|
||||
dataSet.setDrawIcons(false);
|
||||
dataSet.setColor(currency.getChartColor());
|
||||
dataSet.setLineWidth(1);
|
||||
@ -341,16 +342,16 @@ public class CurrencyCardview extends CardView {
|
||||
if(currency.getDayFluctuationPercentage() >= 0)
|
||||
{
|
||||
((TextView) findViewById(R.id.currencyFluctuationPercentageTextView))
|
||||
.setTextColor(getResources().getColor(R.color.increase));
|
||||
.setTextColor(ContextCompat.getColor(getContext(), R.color.increase));
|
||||
((TextView) findViewById(R.id.currencyFluctuationTextView))
|
||||
.setTextColor(getResources().getColor(R.color.increase));
|
||||
.setTextColor(ContextCompat.getColor(getContext(), R.color.increase));
|
||||
}
|
||||
else
|
||||
{
|
||||
((TextView) findViewById(R.id.currencyFluctuationPercentageTextView))
|
||||
.setTextColor(getResources().getColor(R.color.decrease));
|
||||
.setTextColor(ContextCompat.getColor(getContext(), R.color.decrease));
|
||||
((TextView) findViewById(R.id.currencyFluctuationTextView))
|
||||
.setTextColor(getResources().getColor(R.color.decrease));
|
||||
.setTextColor(ContextCompat.getColor(getContext(), R.color.decrease));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<string name="debug_volley" translatable="false">Moodl_debugVolley</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
|
||||
<!-- Strings related to Settings -->
|
||||
<string name="currency">currency</string>
|
||||
|
||||
<!-- Example General settings -->
|
||||
<string name="pref_header_general">General</string>
|
||||
|
Loading…
Reference in New Issue
Block a user