Java 类com.facebook.react.views.imagehelper.ResourceDrawableIdHelper 实例源码

项目:Ironman    文件:XReactInstanceManagerImpl.java   
@Override
public void destroy() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport) {
    mDevSupportManager.setDevSupportEnabled(false);
  }

  moveToBeforeCreateLifecycleState();

  if (mReactContextInitAsyncTask != null) {
    mReactContextInitAsyncTask.cancel(true);
  }

  mMemoryPressureRouter.destroy(mApplicationContext);

  if (mCurrentReactContext != null) {
    mCurrentReactContext.destroy();
    mCurrentReactContext = null;
    mHasStartedCreatingInitialContext = false;
  }
  mCurrentActivity = null;

  ResourceDrawableIdHelper.getInstance().clear();
}
项目:react-native-svg    文件:ImageShadowNode.java   
@ReactProp(name = "src")
public void setSrc(@Nullable ReadableMap src) {
    if (src != null) {
        String uriString = src.getString("uri");

        if (uriString == null || uriString.isEmpty()) {
            //TODO: give warning about this
            return;
        }

        if (src.hasKey("width") && src.hasKey("height")) {
            mImageWidth = src.getInt("width");
            mImageHeight = src.getInt("height");
        } else {
            mImageWidth = 0;
            mImageHeight = 0;
        }
        mUri = Uri.parse(uriString);
        if (mUri.getScheme() == null) {
            mUri = ResourceDrawableIdHelper.getInstance().getResourceDrawableUri(getThemedContext(), uriString);
        }
    }
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
/**
 * Destroy this React instance and the attached JS context.
 */
public void destroy() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport) {
    mDevSupportManager.setDevSupportEnabled(false);
  }

  moveToBeforeCreateLifecycleState();

  if (mReactContextInitAsyncTask != null) {
    mReactContextInitAsyncTask.cancel(true);
  }

  if (mCreateReactContextThread != null) {
    mCreateReactContextThread.interrupt();
    mCreateReactContextThread = null;
  }

  mMemoryPressureRouter.destroy(mApplicationContext);

  if (mCurrentReactContext != null) {
    mCurrentReactContext.destroy();
    mCurrentReactContext = null;
    mHasStartedCreatingInitialContext = false;
  }
  mCurrentActivity = null;

  ResourceDrawableIdHelper.getInstance().clear();
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
/**
 * Destroy this React instance and the attached JS context.
 */
public void destroy() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport) {
    mDevSupportManager.setDevSupportEnabled(false);
  }

  moveToBeforeCreateLifecycleState();

  if (mReactContextInitAsyncTask != null) {
    mReactContextInitAsyncTask.cancel(true);
  }

  if (mCreateReactContextThread != null) {
    mCreateReactContextThread.interrupt();
    mCreateReactContextThread = null;
  }

  mMemoryPressureRouter.destroy(mApplicationContext);

  if (mCurrentReactContext != null) {
    mCurrentReactContext.destroy();
    mCurrentReactContext = null;
    mHasStartedCreatingInitialContext = false;
  }
  mCurrentActivity = null;

  ResourceDrawableIdHelper.getInstance().clear();
}
项目:react-native-music-control    文件:MusicControlModule.java   
private Bitmap loadArtwork(String url, boolean local) {
    Bitmap bitmap = null;

    try {
        // If we are running the app in debug mode, the "local" image will be served from htt://localhost:8080, so we need to check for this case and load those images from URL
        if(local && !url.startsWith("http")) {

            // Gets the drawable from the RN's helper for local resources
            ResourceDrawableIdHelper helper = ResourceDrawableIdHelper.getInstance();
            Drawable image = helper.getResourceDrawable(getReactApplicationContext(), url);

            if(image instanceof BitmapDrawable) {
                bitmap = ((BitmapDrawable)image).getBitmap();
            } else {
                bitmap = BitmapFactory.decodeFile(url);
            }

        } else {

            // Open connection to the URL and decodes the image
            URLConnection con = new URL(url).openConnection();
            con.connect();
            InputStream input = con.getInputStream();
            bitmap = BitmapFactory.decodeStream(input);
            input.close();

        }
    } catch(IOException ex) {
        Log.w("MusicControl", "Could not load the artwork", ex);
    }

    return bitmap;
}
项目:react-native-andorid-shadow    文件:ShadowParentView.java   
public void setShadowImageUri(String uriStr) {
    shadowDrawable = (NinePatchDrawable) ResourceDrawableIdHelper.getInstance().getResourceDrawable(getContext(),uriStr);
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@ReactProp(name = "inlineImageLeft")
public void setInlineImageLeft(ReactEditText view, @Nullable String resource) {
  int id = ResourceDrawableIdHelper.getInstance().getResourceDrawableId(view.getContext(), resource);
  view.setCompoundDrawablesWithIntrinsicBounds(id, 0, 0, 0);
}
项目:RNLearn_Project1    文件:ReactImageView.java   
public void setLoadingIndicatorSource(@Nullable String name) {
  Drawable drawable = ResourceDrawableIdHelper.getInstance().getResourceDrawable(getContext(), name);
  mLoadingImageDrawable =
      drawable != null ? (Drawable) new AutoRotateDrawable(drawable, 1000) : null;
  mIsDirty = true;
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@ReactProp(name = "inlineImageLeft")
public void setInlineImageLeft(ReactEditText view, @Nullable String resource) {
  int id = ResourceDrawableIdHelper.getInstance().getResourceDrawableId(view.getContext(), resource);
  view.setCompoundDrawablesWithIntrinsicBounds(id, 0, 0, 0);
}
项目:RNLearn_Project1    文件:ReactImageView.java   
public void setLoadingIndicatorSource(@Nullable String name) {
  Drawable drawable = ResourceDrawableIdHelper.getInstance().getResourceDrawable(getContext(), name);
  mLoadingImageDrawable =
      drawable != null ? (Drawable) new AutoRotateDrawable(drawable, 1000) : null;
  mIsDirty = true;
}
项目:Ironman    文件:ReactTextInputManager.java   
@ReactProp(name = "inlineImageLeft")
public void setInlineImageLeft(ReactEditText view, @Nullable String resource) {
  int id = ResourceDrawableIdHelper.getInstance().getResourceDrawableId(view.getContext(), resource);
  view.setCompoundDrawablesWithIntrinsicBounds(id, 0, 0, 0);
}
项目:Ironman    文件:ReactImageView.java   
public void setLoadingIndicatorSource(@Nullable String name) {
  Drawable drawable = ResourceDrawableIdHelper.getInstance().getResourceDrawable(getContext(), name);
  mLoadingImageDrawable =
      drawable != null ? (Drawable) new AutoRotateDrawable(drawable, 1000) : null;
  mIsDirty = true;
}