Skip to content

Commit

Permalink
Update min sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Nov 13, 2023
1 parent 857c24f commit fc28be3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 61 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android {

defaultConfig {
applicationId "org.billthefarmer.editor"
minSdkVersion 14
minSdkVersion 21
targetSdkVersion 28
versionName "1.89"
versionCode 189
Expand Down
28 changes: 8 additions & 20 deletions src/main/java/org/billthefarmer/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,7 @@ public boolean onPrepareOptionsMenu(Menu menu)

menu.findItem(R.id.edit).setVisible(!edit);
menu.findItem(R.id.view).setVisible(edit);

menu.findItem(R.id.save).setVisible(changed);
menu.findItem(R.id.print)
.setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);

menu.findItem(R.id.viewFile).setChecked(view);
menu.findItem(R.id.openLast).setChecked(last);
Expand Down Expand Up @@ -1604,14 +1601,11 @@ private void saveAs()
break;

case DialogInterface.BUTTON_NEUTRAL:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.setType(TEXT_WILD);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_TITLE, uri.getLastPathSegment());
startActivityForResult(intent, CREATE_DOCUMENT);
}
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.setType(TEXT_WILD);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_TITLE, uri.getLastPathSegment());
startActivityForResult(intent, CREATE_DOCUMENT);
break;
}
});
Expand All @@ -1628,8 +1622,7 @@ private static void saveAsDialog(Context context, String path,
// Add the buttons
builder.setPositiveButton(R.string.save, listener);
builder.setNegativeButton(R.string.cancel, listener);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
builder.setNeutralButton(R.string.storage, listener);
builder.setNeutralButton(R.string.storage, listener);

// Create edit text
LayoutInflater inflater = (LayoutInflater) builder.getContext()
Expand Down Expand Up @@ -1741,9 +1734,6 @@ public boolean shouldOverrideUrlLoading(WebView view, String url)
@Override
public void onPageFinished(WebView view, String url)
{
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
return;

// Get a PrintManager instance
PrintManager printManager = (PrintManager)
getSystemService(PRINT_SERVICE);
Expand Down Expand Up @@ -2089,8 +2079,7 @@ private void getFile(File dir)
// Pop up dialog
openDialog(this, dirList, fileList, (dialog, which) ->
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
DialogInterface.BUTTON_NEUTRAL == which)
if (DialogInterface.BUTTON_NEUTRAL == which)
{
// Use storage
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
Expand Down Expand Up @@ -2169,8 +2158,7 @@ public static void openDialog(Context context, List<String> dirList,
builder.setAdapter(adapter, listener);

// Add storage button
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
builder.setNeutralButton(R.string.storage, listener);
builder.setNeutralButton(R.string.storage, listener);
// Add cancel button
builder.setNegativeButton(R.string.cancel, null);

Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/billthefarmer/editor/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.billthefarmer.editor;

import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
Expand Down Expand Up @@ -452,7 +451,6 @@ public static String getDataColumn(Context context, Uri uri,
* @see #isLocal(String)
* @see #getFile(Context, Uri)
*/
@TargetApi(19)
public static String getPath(final Context context, final Uri uri)
{

Expand All @@ -468,8 +466,7 @@ public static String getPath(final Context context, final Uri uri)
);

// DocumentProvider
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
DocumentsContract.isDocumentUri(context, uri))
if (DocumentsContract.isDocumentUri(context, uri))
{
// ExternalStorageProvider
if (isExternalStorageDocument(uri))
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/billthefarmer/editor/OpenFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ private void getFile(File dir)
// Pop up dialog
Editor.openDialog(this, dirList, fileList, (dialog, which) ->
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
DialogInterface.BUTTON_NEUTRAL == which)
if (DialogInterface.BUTTON_NEUTRAL == which)
{
// Use storage
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
Expand Down
29 changes: 0 additions & 29 deletions src/main/res/values-v21/styles.xml

This file was deleted.

10 changes: 5 additions & 5 deletions src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
replaced by AppBaseTheme from res/values-vXX/styles.xml on newer
devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<style name="AppBaseTheme" parent="android:Theme.Material.Light.DarkActionBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<style name="AppDarkBaseTheme" parent="android:Theme.Holo">
<style name="AppDarkBaseTheme" parent="android:Theme.Material">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<style name="AppLightBaseTheme" parent="android:Theme.Holo.Light">
<style name="AppLightBaseTheme" parent="android:Theme.Material.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
Expand Down Expand Up @@ -166,15 +166,15 @@

</style>

<style name="DialogBaseTheme" parent="android:Theme.Holo.Light.Dialog">
<style name="DialogBaseTheme" parent="android:Theme.Material.Light.Dialog">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<style name="DialogDarkBaseTheme" parent="android:Theme.Holo.Dialog">
<style name="DialogDarkBaseTheme" parent="android:Theme.Material.Dialog">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
Expand Down

0 comments on commit fc28be3

Please sign in to comment.