Fix activity not found

This commit is contained in:
PavelRatushny 2017-11-08 18:36:21 +02:00
parent aaf4d7ad8c
commit e462afc10e
3 changed files with 10 additions and 4 deletions

View file

@ -8,6 +8,7 @@ import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
@ -535,7 +536,9 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
}
private void importFavourites() {
((FavoritesActivity) getActivity()).importFavourites();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
((FavoritesActivity) getActivity()).importFavourites();
}
}
public void shareFavorites(final FavoriteGroup group) {

View file

@ -529,7 +529,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
private void addTrack() {
((FavoritesActivity) getActivity()).addTrack();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
((FavoritesActivity) getActivity()).addTrack();
}
}
public void showProgressBar() {

View file

@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.SearchView;
@ -83,14 +84,14 @@ public class FavoritesActivity extends TabActivity {
}
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@RequiresApi(Build.VERSION_CODES.KITKAT)
public void addTrack() {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.setType("*/*");
startActivityForResult(intent, OPEN_GPX_DOCUMENT_REQUEST);
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@RequiresApi(Build.VERSION_CODES.KITKAT)
public void importFavourites() {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.setType("*/*");