Removed deprecations
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package de.sebse.fuplanner.services.KVV;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -113,7 +115,7 @@ class KVVModuleList extends HTTPService {
|
||||
}
|
||||
String type = site.getJSONObject("props").getString("kvv_coursetype");
|
||||
String description = site.getString("description");
|
||||
description = String.valueOf(Html.fromHtml(description));
|
||||
description = String.valueOf(fromHtml(description));
|
||||
String id = site.getString("id");
|
||||
modules.addModule(semester, lvNumbers, title, lecturers, type, description, id);
|
||||
}
|
||||
@@ -231,7 +233,7 @@ class KVVModuleList extends HTTPService {
|
||||
String id = site.getString("announcementId");
|
||||
String title = site.getString("title");
|
||||
String text = site.getString("body");
|
||||
text = String.valueOf(Html.fromHtml(text));
|
||||
text = String.valueOf(fromHtml(text));
|
||||
String createdBy = site.getString("createdByDisplayName");
|
||||
long createdOn = site.getLong("createdOn");
|
||||
|
||||
@@ -300,7 +302,7 @@ class KVVModuleList extends HTTPService {
|
||||
String id = site.getString("id");
|
||||
String title = site.getString("title");
|
||||
String instructions = site.getString("instructions");
|
||||
instructions = String.valueOf(Html.fromHtml(instructions));
|
||||
instructions = String.valueOf(fromHtml(instructions));
|
||||
long dueTime = site.getJSONObject("dueTime").getLong("time");
|
||||
String gradebookItemName = site.optString("gradebookItemName", null);
|
||||
String gradeScale = site.getString("gradeScale");
|
||||
@@ -624,5 +626,14 @@ class KVVModuleList extends HTTPService {
|
||||
return path;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Spanned fromHtml(String html){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY);
|
||||
} else {
|
||||
return Html.fromHtml(html);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.widget.ImageButton;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import de.sebse.fuplanner.R;
|
||||
import de.sebse.fuplanner.tools.UtilsUi;
|
||||
import de.sebse.fuplanner.tools.logging.Logger;
|
||||
@@ -92,7 +93,7 @@ public class ExpandableCardView extends CardView {
|
||||
private void initView(Context context){
|
||||
//Inflating View
|
||||
imageButton = new ImageButton(context);
|
||||
imageButton.setImageDrawable(getResources().getDrawable(R.drawable.arrow_down));
|
||||
imageButton.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.arrow_down));
|
||||
imageButton.setPadding(
|
||||
(int) UtilsUi.convertDpToPixels(getContext(), 10),
|
||||
(int) UtilsUi.convertDpToPixels(getContext(), 10),
|
||||
|
||||
Reference in New Issue
Block a user