forked from organicmaps/organicmaps
[android] Added toast after downloading category completion
This commit is contained in:
parent
68d2ece342
commit
b51f2046c0
1 changed files with 49 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.mapswithme.maps.bookmarks;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -12,9 +13,11 @@ import android.webkit.WebResourceRequest;
|
|||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.auth.BaseWebViewMwmFragment;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -43,11 +46,30 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
|
|||
@NonNull
|
||||
private View mProgressView;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private ImportCategoryListener mImportCategoryListener;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
mCatalogUrl = getCatalogUrlOrThrow();
|
||||
mImportCategoryListener = new ImportCategoryListener(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
BookmarkManager.INSTANCE.addCatalogListener(mImportCategoryListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
BookmarkManager.INSTANCE.removeCatalogListener(mImportCategoryListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,4 +199,31 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
|
|||
mReference.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private static class ImportCategoryListener implements BookmarkManager.BookmarksCatalogListener
|
||||
{
|
||||
@NonNull
|
||||
private final Context mContext;
|
||||
|
||||
ImportCategoryListener(@NonNull Context context)
|
||||
{
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImportStarted(@NonNull String serverId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImportFinished(@NonNull String serverId, boolean successful)
|
||||
{
|
||||
if (successful)
|
||||
{
|
||||
Toast.makeText(mContext,
|
||||
R.string.bookmarks_webview_success_toast , Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue