android.app.NativeActivity Java Examples

The following examples show how to use android.app.NativeActivity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 6 votes vote down vote up
public View createWidget(String className, int id) {
    View view;
    try {
        String baseName = getClass().getName().substring(0,
                getClass().getName().lastIndexOf(".") + 1);
        @SuppressWarnings("rawtypes")
        Class cls = Class.forName(baseName + className);
        @SuppressWarnings("unchecked")
        Constructor<View> ctor = cls.getConstructor(NativeActivity.class);
        view = ctor.newInstance(activity_);
        view.setId(id);
    } catch (Exception e) {
        Log.e("NDKHelper", "Could not find the name");
        return null;
    }

    initializeWidget(view);
    return view;
}
 
Example #2
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 6 votes vote down vote up
public View createWidget(String className, int id, int param) {
    View view;
    try {
        String baseName = getClass().getName().substring(0,
                getClass().getName().lastIndexOf(".") + 1);
        @SuppressWarnings("rawtypes")
        Class cls = Class.forName(baseName + className);
        @SuppressWarnings("unchecked")
        Constructor<View> ctor = cls.getConstructor(NativeActivity.class,
                int.class);
        view = ctor.newInstance(activity_, param);
        view.setId(id);
    } catch (Exception e) {
        return null;
    }

    initializeWidget(view);
    return view;
}
 
Example #3
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 5 votes vote down vote up
public void resumePopupWindow(NativeActivity act, final PopupWindow p) {
    activity_ = act;
    if(p.isShowing()) {
        Log.i("JUIHelper::", "ResumePopupWindow is to about to show");
    }
    return;
}
 
Example #4
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 4 votes vote down vote up
public JUIHelper(NativeActivity act) {
    activity_ = act;
}
 
Example #5
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 4 votes vote down vote up
public PopupWindow createPopupWindow(final NativeActivity act) {
    // Check manifest settings if the activity wouldn't be destroyed when
    // the device orientation changes
    try {
        ActivityInfo info = act.getPackageManager().getActivityInfo(
                act.getComponentName(), 0);
        if ((info.configChanges & ActivityInfo.CONFIG_ORIENTATION) == 0
                || (info.configChanges & ActivityInfo.CONFIG_SCREEN_SIZE) == 0) {
            Log.i("NDKHelper",
                    "Activity does not have android:configChanges='orientation|screenSize' attributes in AndroidManifest.xml.");
        }
    } catch (NameNotFoundException e) {
      Log.e("NDKHelper", "Failed to find ActivityName");
    }

    activity_ = act;
    // activity.setTheme(android.R.style.Theme_DeviceDefault);

    final PopupWindow popupWindow = new PopupWindow(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    activity_.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Window window = activity_.getWindow();
            if( window != null )
            {
                View decorView = window.getDecorView();
                if( decorView == null )
                {
                    // Put dummy layout to NativeActivity
                    LinearLayout mainLayout = new LinearLayout(activity_);
                    MarginLayoutParams params = new MarginLayoutParams(
                            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                    params.setMargins(0, 0, 0, 0);
                    activity_.setContentView(mainLayout, params);
                    decorView = mainLayout;
                }

                // Setup relative layout
                JUIRelativeLayout_ = new RelativeLayout(activity_);
                popupWindow.setContentView(JUIRelativeLayout_);

                // Show our UI over NativeActivity window
                popupWindow.showAtLocation(decorView, Gravity.TOP
                        | Gravity.START, 0, 0);
                popupWindow.setTouchable(false);
                popupWindow.update();
            }
        }
    });
    return popupWindow;
}
 
Example #6
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 4 votes vote down vote up
public Object createDialog(final NativeActivity act) {
    JUIDialog dlg = new JUIDialog(act);
    dialog_ = dlg;

    return dlg;
}
 
Example #7
Source File: NDKHelper.java    From connectivity-samples with Apache License 2.0 4 votes vote down vote up
public NDKHelper(NativeActivity act) {
    activity = act;
}