import typing

import android.content
import android.graphics
import android.graphics.drawable
import android.os
import java
import java.chaquopy
import java.lang
import java.util
import org.osmdroid.tileprovider.constants
import org.osmdroid.tileprovider.modules
import org.osmdroid.tileprovider.tilesource
import org.osmdroid.views

class BitmapPool(java.lang.Object):
    def __init__(self) -> None: ...
    def applyReusableOptions(self, aBitmapOptions: android.graphics.BitmapFactory.Options, /) -> None: ...
    def clearBitmapPool(self) -> None: ...
    @staticmethod
    def getInstance() -> BitmapPool: ...
    def obtainBitmapFromPool(self) -> android.graphics.Bitmap: ...
    def obtainSizedBitmapFromPool(self, aWidth: int | java.jint | java.lang.Integer, aHeight: int | java.jint | java.lang.Integer, /) -> android.graphics.Bitmap: ...
    def returnDrawableToPool(self, drawable: ReusableBitmapDrawable, /) -> None: ...

class ExpirableBitmapDrawable(android.graphics.drawable.BitmapDrawable):
    EXPIRED: typing.ClassVar[int] = ...
    def __init__(self, pBitmap: android.graphics.Bitmap, /) -> None: ...
    def getState(self) -> java.chaquopy.JavaArrayJInt: ...
    @staticmethod
    def isDrawableExpired(pTile: android.graphics.drawable.Drawable, /) -> bool: ...
    def isStateful(self) -> bool: ...
    def setState(self, pStateSet: java.chaquopy.JavaArrayJInt, /) -> bool: ...

class IMapTileProviderCallback(java.lang.Object):
    def mapTileRequestCompleted(self, arg1: MapTileRequestState, arg2: android.graphics.drawable.Drawable, /) -> None: ...
    def mapTileRequestExpiredTile(self, arg1: MapTileRequestState, arg2: android.graphics.drawable.Drawable, /) -> None: ...
    def mapTileRequestFailed(self, arg1: MapTileRequestState, /) -> None: ...
    def useDataConnection(self) -> bool: ...

class IRegisterReceiver(java.lang.Object):
    def registerReceiver(self, arg1: android.content.BroadcastReceiver, arg2: android.content.IntentFilter, /) -> android.content.Intent: ...
    def unregisterReceiver(self, arg1: android.content.BroadcastReceiver, /) -> None: ...

class LRUMapTileCache(java.util.LinkedHashMap[MapTile, android.graphics.drawable.Drawable], org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants):
    def __init__(self, aCapacity: int | java.jint | java.lang.Integer, /) -> None: ...
    def clear(self) -> None: ...
    def ensureCapacity(self, aCapacity: int | java.jint | java.lang.Integer, /) -> None: ...
    def getTileRemovedListener(self) -> LRUMapTileCache.TileRemovedListener: ...
    def remove(self, aKey: java.lang.Object | int | bool | float | str, /) -> android.graphics.drawable.Drawable: ...
    def removeEldestEntry(self, aEldest: java.util.Map.Entry[MapTile, android.graphics.drawable.Drawable], /) -> bool: ...
    def setTileRemovedListener(self, tileRemovedListener: LRUMapTileCache.TileRemovedListener, /) -> None: ...

    class TileRemovedListener(java.lang.Object):
        def onTileRemoved(self, arg1: MapTile, /) -> None: ...

class MapTile(java.lang.Object):
    MAPTILE_FAIL_ID: typing.ClassVar[int] = ...
    MAPTILE_SUCCESS_ID: typing.ClassVar[int] = ...
    def __init__(self, zoomLevel: int | java.jint | java.lang.Integer, tileX: int | java.jint | java.lang.Integer, tileY: int | java.jint | java.lang.Integer, /) -> None: ...
    def equals(self, obj: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getX(self) -> int: ...
    def getY(self) -> int: ...
    def getZoomLevel(self) -> int: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...

class MapTileCache(org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants):
    mCachedTiles: LRUMapTileCache = ...
    mCachedTilesLockObject: java.lang.Object = ...
    @typing.overload
    def __init__(self) -> None: ...
    @typing.overload
    def __init__(self, aMaximumCacheSize: int | java.jint | java.lang.Integer, /) -> None: ...
    def clear(self) -> None: ...
    def containsTile(self, aTile: MapTile, /) -> bool: ...
    def ensureCapacity(self, aCapacity: int | java.jint | java.lang.Integer, /) -> None: ...
    def getMapTile(self, aTile: MapTile, /) -> android.graphics.drawable.Drawable: ...
    def putTile(self, aTile: MapTile, aDrawable: android.graphics.drawable.Drawable, /) -> None: ...

class MapTileProviderArray(MapTileProviderBase):
    mTileProviderList: java.util.List[org.osmdroid.tileprovider.modules.MapTileModuleProviderBase] = ...
    mWorking: java.util.HashMap[MapTile, MapTileRequestState] = ...
    @typing.overload
    def __init__(self, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, pRegisterReceiver: IRegisterReceiver, /) -> None: ...
    @typing.overload
    def __init__(self, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, aRegisterReceiver: IRegisterReceiver, pTileProviderArray: java.chaquopy.JavaArray[org.osmdroid.tileprovider.modules.MapTileModuleProviderBase], /) -> None: ...
    def detach(self) -> None: ...
    def findNextAppropriateProvider(self, aState: MapTileRequestState, /) -> org.osmdroid.tileprovider.modules.MapTileModuleProviderBase: ...
    def getMapTile(self, pTile: MapTile, /) -> android.graphics.drawable.Drawable: ...
    def getMaximumZoomLevel(self) -> int: ...
    def getMinimumZoomLevel(self) -> int: ...
    def getProviderExists(self, provider: org.osmdroid.tileprovider.modules.MapTileModuleProviderBase, /) -> bool: ...
    def mapTileRequestCompleted(self, aState: MapTileRequestState, aDrawable: android.graphics.drawable.Drawable, /) -> None: ...
    def mapTileRequestExpiredTile(self, aState: MapTileRequestState, aDrawable: android.graphics.drawable.Drawable, /) -> None: ...
    def mapTileRequestFailed(self, aState: MapTileRequestState, /) -> None: ...
    def setTileSource(self, aTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, /) -> None: ...

class MapTileProviderBase(IMapTileProviderCallback, org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants):
    mTileCache: MapTileCache = ...
    mTileRequestCompleteHandler: android.os.Handler = ...
    mUseDataConnection: bool = ...
    @typing.overload
    def __init__(self, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, /) -> None: ...
    @typing.overload
    def __init__(self, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, pDownloadFinishedListener: android.os.Handler, /) -> None: ...
    def clearTileCache(self) -> None: ...
    def createTileCache(self) -> MapTileCache: ...
    def detach(self) -> None: ...
    def ensureCapacity(self, pCapacity: int | java.jint | java.lang.Integer, /) -> None: ...
    def getMapTile(self, arg1: MapTile, /) -> android.graphics.drawable.Drawable: ...
    def getMaximumZoomLevel(self) -> int: ...
    def getMinimumZoomLevel(self) -> int: ...
    def getTileSource(self) -> org.osmdroid.tileprovider.tilesource.ITileSource: ...
    def mapTileRequestCompleted(self, pState: MapTileRequestState, pDrawable: android.graphics.drawable.Drawable, /) -> None: ...
    def mapTileRequestExpiredTile(self, pState: MapTileRequestState, pDrawable: android.graphics.drawable.Drawable, /) -> None: ...
    def mapTileRequestFailed(self, pState: MapTileRequestState, /) -> None: ...
    def putExpiredTileIntoCache(self, pState: MapTileRequestState, pDrawable: android.graphics.drawable.Drawable, /) -> None: ...
    def putTileIntoCache(self, pState: MapTileRequestState, pDrawable: android.graphics.drawable.Drawable, /) -> None: ...
    def rescaleCache(self, pProjection: org.osmdroid.views.Projection, pNewZoomLevel: int | java.jint | java.lang.Integer, pOldZoomLevel: int | java.jint | java.lang.Integer, pViewPort: android.graphics.Rect, /) -> None: ...
    def setTileRequestCompleteHandler(self, handler: android.os.Handler, /) -> None: ...
    def setTileSource(self, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, /) -> None: ...
    def setUseDataConnection(self, pMode: bool | java.jboolean | java.lang.Boolean, /) -> None: ...
    def useDataConnection(self) -> bool: ...

class MapTileProviderBasic(MapTileProviderArray, IMapTileProviderCallback):
    @typing.overload
    def __init__(self, pContext: android.content.Context, /) -> None: ...
    @typing.overload
    def __init__(self, pContext: android.content.Context, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, /) -> None: ...
    @typing.overload
    def __init__(self, pRegisterReceiver: IRegisterReceiver, aNetworkAvailablityCheck: org.osmdroid.tileprovider.modules.INetworkAvailablityCheck, pTileSource: org.osmdroid.tileprovider.tilesource.ITileSource, /) -> None: ...

class MapTileRequestState(java.lang.Object):
    def __init__(self, mapTile: MapTile, providers: java.chaquopy.JavaArray[org.osmdroid.tileprovider.modules.MapTileModuleProviderBase], callback: IMapTileProviderCallback, /) -> None: ...
    def getCallback(self) -> IMapTileProviderCallback: ...
    def getCurrentProvider(self) -> org.osmdroid.tileprovider.modules.MapTileModuleProviderBase: ...
    def getMapTile(self) -> MapTile: ...
    def getNextProvider(self) -> org.osmdroid.tileprovider.modules.MapTileModuleProviderBase: ...
    def isEmpty(self) -> bool: ...

class ReusableBitmapDrawable(ExpirableBitmapDrawable):
    def __init__(self, pBitmap: android.graphics.Bitmap, /) -> None: ...
    def beginUsingDrawable(self) -> None: ...
    def finishUsingDrawable(self) -> None: ...
    def isBitmapValid(self) -> bool: ...
    def tryRecycle(self) -> android.graphics.Bitmap: ...
