@Override
  /**
   * Initialize the {@link CordovaWebView} and load its start URL.
   *
   * <p>The fragment inflator needs to be cloned first to use an instance of {@link CordovaContext}
   * instead. This alternate context object implements the {@link CordovaInterface} as well and acts
   * as a proxy between the activity and fragment for the {@link CordovaWebView}. The actual {@link
   * CordovaWebView} is defined in the home_view_frag.xml layout and has an id of <b>aemWebView</b>.
   */
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutInflater localInflater = inflater.cloneInContext(new CordovaContext(getActivity(), this));
    View rootView = localInflater.inflate(R.layout.fragment_jingle, container, false);
    aemView = (CordovaWebView) rootView.findViewById(R.id.jingle_title);
    //      aemView.loadUrl("http://192.168.0.11:8080");
    //        aemView.setWebViewClient(new WebViewClient() {
    //        	public boolean shouldOverrideUrlLoading(WebView view, String url) {
    //        	          view.loadUrl(url);
    //        	          return true;
    //        	           }});
    Config.init(getActivity());
    Config.addWhiteListEntry("http://*", true);
    //      Config.addWhiteListEntry("http://192.168.0.11:8080", true);
    //        aemView.loadUrl("file:///android_asset/md/e/view/viewer.html");
    aemView.getSettings().setJavaScriptEnabled(true);
    aemView.loadUrl("file:///android_asset/demo/index.html");

    //        aemView.loadUrl("http://www.baidu.com");
    return rootView;
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   final Context context = new ContextThemeWrapper(getActivity(), R.style.ReferenceTheme);
   LayoutInflater localInflater = inflater.cloneInContext(context);
   return super.onCreateView(localInflater, container, savedInstanceState);
 }
  private View instantiate(String name, Context context, AttributeSet attrs) {
    try {
      Constructor<? extends View> constructor = CONSTRUCTOR_MAP.get(name);
      if (constructor == null) {
        Class<? extends View> clazz = null;
        if (name.indexOf('.') != -1) {
          clazz = context.getClassLoader().loadClass(name).asSubclass(View.class);
        } else {
          for (String prefix : CLASS_PREFIX_LIST) {
            try {
              clazz = context.getClassLoader().loadClass(prefix + name).asSubclass(View.class);
              break;
            } catch (ClassNotFoundException e) {
            }
          }
          if (clazz == null) throw new ClassNotFoundException("couldn't find class: " + name);
        }
        constructor = clazz.getConstructor(CONSTRUCTOR_SIGNATURE);
        CONSTRUCTOR_MAP.put(name, constructor);
      }

      Object[] args = constructorArgs;
      args[0] = context;
      args[1] = attrs;

      constructor.setAccessible(true);
      View view = constructor.newInstance(args);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && view instanceof ViewStub)
        CompatibilityImpl.setLayoutInflater((ViewStub) view, inflater.cloneInContext(context));
      return view;
    } catch (Exception e) {
      Logger.e(TAG, "couldn't instantiate class " + name, e);
      return null;
    }
  }
 private LayoutInflater getThemeInflater(LayoutInflater inflater) {
   if (mTheme == -1) {
     return inflater;
   } else {
     return inflater.cloneInContext(mThemeWrapper);
   }
 }
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      FragmentActivity activity = getActivity();
      Context themedContext = null;
      if (!isGuidedStepTheme(activity)) {
        // Look up the guidedStepTheme in the activity's currently specified theme.  If it
        // exists, replace the theme with its value.
        int resId = R.attr.guidedStepTheme;
        TypedValue typedValue = new TypedValue();
        boolean found = activity.getTheme().resolveAttribute(resId, typedValue, true);
        if (DEBUG) Log.v(TAG, "Found guided step theme reference? " + found);
        if (found) {
          ContextThemeWrapper themeWrapper =
              new ContextThemeWrapper(activity, typedValue.resourceId);
          if (isGuidedStepTheme(themeWrapper)) {
            themedContext = themeWrapper;
          }
        }
        if (!found) {
          Log.e(TAG, "GuidedStepSupportFragment does not have an appropriate theme set.");
        }
      }

      if (themedContext != null) {
        inflater = inflater.cloneInContext(themedContext);
      }

      return inflater.inflate(R.layout.lb_guidedstep_background, container, false);
    }
  /** Inflate and return the default layout requested by AppWidget provider. */
  protected View getDefaultView() {
    if (LOGD) {
      Log.d(TAG, "getDefaultView");
    }
    View defaultView = null;
    Exception exception = null;

    try {
      if (mInfo != null) {
        /// M: add for using customer view, migrated from GB to ICS to JB
        Context theirContext =
            AppWidgetContext.newWidgetContext(
                mContext, mInfo.provider.getPackageName(), mInfo.hasUsedCustomerView);
        mRemoteContext = theirContext;
        LayoutInflater inflater =
            (LayoutInflater) theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater = inflater.cloneInContext(theirContext);
        inflater.setFilter(sInflaterFilter);
        AppWidgetManager manager = AppWidgetManager.getInstance(mContext);
        Bundle options = manager.getAppWidgetOptions(mAppWidgetId);

        int layoutId = mInfo.initialLayout;
        if (options.containsKey(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY)) {
          int category = options.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY);
          if (category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) {
            int kgLayoutId = mInfo.initialKeyguardLayout;
            // If a default keyguard layout is not specified, use the standard
            // default layout.
            layoutId = kgLayoutId == 0 ? layoutId : kgLayoutId;
          }
        }
        defaultView = inflater.inflate(layoutId, this, false);
      } else {
        Log.w(TAG, "can't inflate defaultView because mInfo is missing");
      }
    } catch (PackageManager.NameNotFoundException e) {
      exception = e;
    } catch (RuntimeException e) {
      exception = e;
    }

    if (exception != null) {
      Log.w(TAG, "Error inflating AppWidget " + mInfo + ": " + exception.toString());
    }

    if (defaultView == null) {
      if (LOGD) Log.d(TAG, "getDefaultView couldn't find any view, so inflating error");
      defaultView = getErrorView();
    }

    return defaultView;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // create ContextThemeWrapper from the original Activity Context with the custom theme
    final Context contextThemeWrapper =
        new ContextThemeWrapper(getActivity(), R.style.wordlistsListViewTheme);

    // clone the inflater using the ContextThemeWrapper
    LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);

    // inflate the layout using the cloned inflater, not default inflater
    return localInflater.inflate(R.layout.fragment_tab_wordlists, container, false);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    final Context contextThemeWrapper =
        new ContextThemeWrapper(getActivity(), R.style.AppTheme_Nav);

    // clone the inflater using the ContextThemeWrapper
    LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
    View view = localInflater.inflate(R.layout.fragment_friends, container, false);
    initializeListView(view);
    setButtonListeners(view);
    return view;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView =
        inflater
            .cloneInContext(new ContextThemeWrapper(getContext(), getTheme()))
            .inflate(R.layout.fragment_side, container, false);
    final Bundle args = getArguments();
    if (args != null) {
      mRootView.addOnLayoutChangeListener(
          new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(
                View v,
                int left,
                int top,
                int right,
                int bottom,
                int oldLeft,
                int oldTop,
                int oldRight,
                int oldBottom) {
              v.removeOnLayoutChangeListener(this);
              int cx = args.getInt("cx");
              int cy = args.getInt("cy");
              // get the hypothenuse so the mRadius is from one corner to the other
              float radius = (float) Math.hypot(right, bottom);

              // Hardware-supported clipPath()
              // http://developer.android.com/guide/topics/graphics/hardware-accel.html
              if (Build.VERSION.SDK_INT >= 18) {
                Animator reveal =
                    createCheckoutRevealAnimator((ClipRevealFrame) v, cx, cy, 28f, radius);
                reveal.start();
              } else {
                removeOldSideFragment();
              }
            }
          });
    }

    ButterKnife.bind(this, mRootView);
    return mRootView;
  }
Beispiel #10
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutInflater localInflater = inflater.cloneInContext(new CordovaContext(getActivity(), this));
    View rootView = localInflater.inflate(R.layout.fragment_cordova, container, false);
    myWebView = (CordovaWebView) rootView.findViewById(R.id.myWebView);
    myWebView.setBackgroundColor(Color.argb(1, 0, 0, 0));

    // fixes a bug in android 3.0 - 4.0.3 that causes an issue with transparent webviews.
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB
        && android.os.Build.VERSION.SDK_INT
            <= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
      myWebView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
    }

    Config.init(getActivity());
    myWebView.loadUrl(Config.getStartUrl());
    return rootView;
  }
Beispiel #11
0
  public static void owlBeforeCreate(Activity activity) {
    Window window = activity.getWindow();
    LayoutInflater layoutInflater = window.getLayoutInflater();

    // replace the inflater in window
    LayoutInflater injectLayoutInflater1 =
        Factory4InjectedInflater.newInstance(layoutInflater, activity);
    injectLayoutInflater(
        injectLayoutInflater1,
        activity.getWindow(),
        activity.getWindow().getClass(),
        WINDOW_INFLATER);

    // replace the inflater in current ContextThemeWrapper
    LayoutInflater injectLayoutInflater2 = injectLayoutInflater1.cloneInContext(activity);
    injectLayoutInflater(
        injectLayoutInflater2, activity, ContextThemeWrapper.class, THEME_INFLATER);

    // insert owlViewContext into root view.
    View v = activity.getWindow().getDecorView();
    OwlViewContext owlObservable = new OwlViewContext();
    insertViewContext(v, owlObservable);
  }
 private LayoutInflater getLayoutInflater(Context context, int themeResource) {
   Context wrapped = new ContextThemeWrapper(context, themeResource);
   LayoutInflater inflater =
       (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   return inflater.cloneInContext(wrapped);
 }
 public static LayoutInflater getThemeLayoutInflater(Context context, LayoutInflater inflater) {
   return inflater.cloneInContext(getContextThemeWrapper(context));
 }