Compatibility for api level 19
This commit is contained in:
parent
6433e841f3
commit
86cf510bca
@ -3,12 +3,12 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId "de.jg_cody.Teraplex"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
|
@ -24,6 +24,7 @@ import android.os.Vibrator;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -57,7 +58,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -85,14 +85,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
Map<String, MenuItem> tabitems = new HashMap<>();
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||
getWindow().setNavigationBarColor(Color.BLUE);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
getWindow().setStatusBarContrastEnforced(false);
|
||||
}
|
||||
@ -477,7 +478,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@ -505,7 +505,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
Background.close();
|
||||
SharedPreferences p = getSharedPreferences("appsettings", Context.MODE_PRIVATE);
|
||||
p.edit().putString("Background", Base64.getEncoder().encodeToString(bOut.toByteArray())).apply();
|
||||
p.edit().putString("Background", Base64.encodeToString(bOut.toByteArray(), Base64.DEFAULT)).apply();
|
||||
loadBackground();
|
||||
startActivity(getIntent());
|
||||
finish();
|
||||
@ -517,12 +517,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
private void loadBackground() {
|
||||
SharedPreferences p = getSharedPreferences("appsettings", Activity.MODE_PRIVATE);
|
||||
String Background = p.getString("Background", null);
|
||||
ImageView I = findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageBitmap(BitmapFactory.decodeByteArray(BA, 0, BA.length));
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -16,8 +17,6 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
import de.jg_cody.Teraplex.MainActivity;
|
||||
import de.jg_cody.Teraplex.R;
|
||||
|
||||
@ -25,7 +24,6 @@ public class CreditsFragment extends Fragment {
|
||||
|
||||
private CreditsViewModel creditsViewModel;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
creditsViewModel =
|
||||
@ -35,7 +33,7 @@ public class CreditsFragment extends Fragment {
|
||||
String Background = p.getString("Background", null);
|
||||
if (Background != null) {
|
||||
ImageView I = root.findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import android.media.MediaPlayer;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -24,7 +25,6 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -37,7 +37,6 @@ public class EinstellungenFragment extends Fragment {
|
||||
|
||||
private EinstellungenViewModel einstellungenViewModel;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
einstellungenViewModel =
|
||||
@ -47,7 +46,7 @@ public class EinstellungenFragment extends Fragment {
|
||||
String Background = p.getString("Background", null);
|
||||
if (Background != null) {
|
||||
ImageView I = root.findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import android.media.MediaPlayer;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -24,7 +25,6 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Objects;
|
||||
|
||||
import de.jg_cody.Teraplex.MainActivity;
|
||||
@ -46,7 +46,6 @@ public class KonsoleFragment extends Fragment {
|
||||
|
||||
private KonsoleViewModel konsoleViewModel;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
konsoleViewModel =
|
||||
@ -56,7 +55,7 @@ public class KonsoleFragment extends Fragment {
|
||||
String Background = p.getString("Background", null);
|
||||
if (Background != null) {
|
||||
ImageView I = root.findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -29,7 +30,6 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Objects;
|
||||
|
||||
import de.jg_cody.Teraplex.AddButtonDialogSingle;
|
||||
@ -69,7 +69,6 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
this.tabname = tabname;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
tabsViewModel =
|
||||
@ -79,7 +78,7 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
String Background = p.getString("Background", null);
|
||||
if (Background != null) {
|
||||
ImageView I = root.findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
@ -264,7 +263,6 @@ public class TabsFragment extends Fragment implements AddButtonDialogSingle.AddB
|
||||
;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
public void save() throws JSONException {
|
||||
JSONArray listItems2 = new JSONArray();
|
||||
for (ListItem Item : listAdapter.getObjects()) {
|
||||
|
@ -10,6 +10,7 @@ import android.media.MediaPlayer;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -24,7 +25,6 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Objects;
|
||||
|
||||
import de.jg_cody.Teraplex.MainActivity;
|
||||
@ -48,7 +48,6 @@ public class HomeFragment extends Fragment {
|
||||
|
||||
private HomeViewModel homeViewModel;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
SharedPreferences prefs = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE);
|
||||
@ -63,7 +62,7 @@ public class HomeFragment extends Fragment {
|
||||
String Background = p.getString("Background", null);
|
||||
if (Background != null) {
|
||||
ImageView I = root.findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
|
@ -15,11 +15,14 @@ public abstract class ListItem {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
public JSONObject toJson() throws JSONException {
|
||||
JSONObject toJson = new JSONObject();
|
||||
toJson.put("type", type);
|
||||
toJson.put("strings", new JSONArray(getStrings()));
|
||||
JSONArray a = new JSONArray();
|
||||
for(String s : getStrings()) {
|
||||
a.put(s);
|
||||
}
|
||||
toJson.put("strings", a);
|
||||
return toJson;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -17,7 +18,6 @@ import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Objects;
|
||||
|
||||
import de.jg_cody.Teraplex.MainActivity;
|
||||
@ -28,7 +28,6 @@ public class ZeitsteuerungFragment extends Fragment {
|
||||
private ZeitsteuerungViewModel zeitsteuerungViewModel;
|
||||
TimePicker timePicker;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
zeitsteuerungViewModel =
|
||||
@ -38,7 +37,7 @@ public class ZeitsteuerungFragment extends Fragment {
|
||||
String Background = p.getString("Background", null);
|
||||
if (Background != null) {
|
||||
ImageView I = root.findViewById(R.id.Background);
|
||||
byte[] BA = Base64.getDecoder().decode(Background);
|
||||
byte[] BA = Base64.decode(Background, Base64.DEFAULT);
|
||||
I.setImageDrawable(new BitmapDrawable(getResources(), MainActivity.scaleCenterCrop(BitmapFactory.decodeByteArray(BA, 0, BA.length), MainActivity.getScreenHeight(), MainActivity.getScreenWidth())));
|
||||
I.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
|
25
app/src/main/res/values-night/colors.xml
Normal file
25
app/src/main/res/values-night/colors.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#EE0000</color>
|
||||
<color name="purple_500">#EE0000</color>
|
||||
<color name="red_dark">#B30000</color>
|
||||
<color name="red">#DA0303</color>
|
||||
<color name="blue">#FF0088FF</color>
|
||||
<color name="yellow">#FFE500</color>
|
||||
<color name="turquoise">#00FFF7</color>
|
||||
<color name="orange">#FF7700</color>
|
||||
<color name="pink">#D900FF</color>
|
||||
<color name="green">#00FF0A</color>
|
||||
<color name="teal_700">#870101</color>
|
||||
<color name="colorOnBackgroundNight">#000000</color>
|
||||
<color name="colorOnBackgroundDay">#FFFFFF</color>
|
||||
|
||||
<color name="black">#000000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
|
||||
<color name="green_200">#00EE00</color>
|
||||
<color name="green_500">#00EE00</color>
|
||||
<color name="green_700">#00B300</color>
|
||||
<color name="green_100">#03DA03</color>
|
||||
<color name="green_600">#018701</color>
|
||||
</resources>
|
@ -22,5 +22,4 @@
|
||||
<color name="green_700">#00B300</color>
|
||||
<color name="green_100">#03DA03</color>
|
||||
<color name="green_600">#018701</color>
|
||||
|
||||
</resources>
|
@ -6,7 +6,7 @@ buildscript {
|
||||
maven { url 'https://maven.google.com/' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
Loading…
Reference in New Issue
Block a user