text:
package kz.virtex.htc.tweaker.mods;

import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import kz.virtex.htc.tweaker.Const;
import kz.virtex.htc.tweaker.Misc;
import kz.virtex.htc.tweaker.R;
import kz.virtex.htc.tweaker.XMain;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.XModuleResources;
import android.content.res.XResources;
import android.graphics.drawable.Drawable;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;

public class Phone
{
	private static Object DualCallSettingsPreference;
	private static Object CallFeaturesSetting;

	public static void hookServiceState()
	{
		final Class<?> IccRecords = XposedHelpers.findClass("android.telephony.ServiceState", null);

		XposedHelpers.findAndHookConstructor(IccRecords, "android.os.Parcel", new XC_MethodHook()
		{
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable
			{
				//XposedBridge.log("--------------");
				//XposedBridge.log("mOperatorAlphaLong: " + XposedHelpers.getObjectField(param.thisObject, "mOperatorAlphaLong"));
				//XposedBridge.log("mOperatorAlphaShort: " + XposedHelpers.getObjectField(param.thisObject, "mOperatorAlphaShort"));
				//XposedBridge.log("mOperatorNumeric: " + XposedHelpers.getObjectField(param.thisObject, "mOperatorNumeric"));
				//XposedBridge.log("mPhoneType: " + XposedHelpers.getObjectField(param.thisObject, "mPhoneType"));

				//XposedHelpers.setObjectField(param.thisObject, "mOperatorAlphaLong", "Long " + XposedHelpers.getObjectField(param.thisObject, "mPhoneType"));
				//XposedHelpers.setObjectField(param.thisObject, "mOperatorAlphaShort", "Short " + XposedHelpers.getObjectField(param.thisObject, "mPhoneType"));
				//XposedHelpers.setObjectField(param.thisObject, "mOperatorNumeric", "Number " + XposedHelpers.getObjectField(param.thisObject, "mPhoneType"));
			}
		});
	}
	/*
	public static void hookServiceState2()
	{
		final Class<?> IccRecords = XposedHelpers.findClass("com.android.internal.telephony.cdma.HtcCdmaOperatorName", null);

		XposedHelpers.findAndHookMethod(IccRecords, "getOperatorInfo", new XC_MethodHook()
		{
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable
			{
				Object OperatorInfo = param.getResult();
				XposedHelpers.setObjectField(OperatorInfo, "showSpn", true);
				XposedHelpers.setObjectField(OperatorInfo, "showPlmn", false);
				XposedHelpers.setObjectField(OperatorInfo, "spn", XMain.pref.getString("spn_1_user_text", (String) XposedHelpers.getObjectField(OperatorInfo, "spn")));
			}
		});
	}
	*/
	public static void hookServiceProviderName()
	{
		final Class<?> IccRecords = XposedHelpers.findClass("com.android.internal.telephony.uicc.IccRecords", null);

		findAndHookMethod(IccRecords, "getServiceProviderName", new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
					int getIccPhoneSlot = (Integer) XposedHelpers.callMethod(param.thisObject, "getIccPhoneSlot");
					// int getIccPhoneType = (Integer)
					// XposedHelpers.callMethod(param.thisObject,
					// "getIccPhoneType");

					if (TelephonyManager.PHONE_SLOT1 == getIccPhoneSlot)
						return XMain.pref.getString("spn_1_user_text", (String) XposedHelpers.getObjectField(param.thisObject, "mSpn"));

					if (TelephonyManager.PHONE_SLOT2 == getIccPhoneSlot)
						return XMain.pref.getString("spn_2_user_text", (String) XposedHelpers.getObjectField(param.thisObject, "mSpn"));

					// XposedBridge.log("PhoneSlot: " + getIccPhoneSlot);
					// XposedBridge.log("PhoneType: " + getIccPhoneType);
					return "Unknown";

			}
		});
	}
/*
	public static void hookOperatorName()
	{
		final Class<?> TelephonyManagerClass = XposedHelpers.findClass("android.telephony.TelephonyManager", null);

		findAndHookMethod(TelephonyManagerClass, "getNetworkOperatorNameExt", int.class, new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				int PhoneType = (Integer) param.args[0];

				// XposedBridge.log("PhoneType = " + PhoneType);

				if (TelephonyManager.getMainPhoneType() == PhoneType)
					return "Sloooooooooot 1";
				else if (TelephonyManager.getSubPhoneType() == PhoneType)
					return "Sloooooooooot 2";
				else
					return "Wazzzzzzzzzzzup!";
			}
		});
	}
*/
	/*
	public static void hookOperatorName(final LoadPackageParam paramLoadPackageParam)
	{

		findAndHookMethod("com.android.phone.InCallScreen", paramLoadPackageParam.classLoader, "getOperatorName", int.class, new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				int PhoneType = (Integer) param.args[0];
				Class<?> PhoneUtils = XposedHelpers.findClass("com.android.phone.PhoneUtils", paramLoadPackageParam.classLoader);

				if (PhoneType == 0)
					PhoneType = (Integer) XposedHelpers.callStaticMethod(PhoneUtils, "getCurrPhoneType");

				int slot = (Integer) XposedHelpers.callStaticMethod(PhoneUtils, "getSimSlotTypeByPhoneType", PhoneType);
				ContentResolver cr = (ContentResolver) XposedHelpers.callMethod(param.thisObject, "getContentResolver");
				String operator;

				if (slot == 1)
					operator = Settings.System.getString(cr, "spn_1_user_text");
				else
					operator = Settings.System.getString(cr, "spn_2_user_text");

				return operator;
			}
		});
	}
*/
	public static void hookCopyDialExtra(final LoadPackageParam paramLoadPackageParam)
	{
		findAndHookMethod("com.android.phone.PhoneUtils", paramLoadPackageParam.classLoader, "copyDialExtra", Intent.class, Intent.class, new XC_MethodHook()
		{
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable
			{
				Intent paramIntent2 = (Intent) param.args[1];

				Class<?> PhoneGlobals = XposedHelpers.findClass("com.android.phone.PhoneGlobals", paramLoadPackageParam.classLoader);
				Object getInstance = XposedHelpers.callStaticMethod(PhoneGlobals, "getInstance");
				Context mContext = (Context) XposedHelpers.callMethod(getInstance, "getApplicationContext");

				int force = Misc.getSystemSettingsInt(mContext, Const.TWEAK_FORCE_DIAL, 0);

				Misc.x("Force dialing");

				if (force != 0) {
					Class<?> PhoneUtils = XposedHelpers.findClass("com.android.phone.PhoneUtils", paramLoadPackageParam.classLoader);

					int action = Misc.getSystemSettingsInt(mContext, Const.TWEAK_FORCE_DIAL_ACTION, 0);
					int phoneType;

					if (force == 1)
						phoneType = (Integer) XposedHelpers.callStaticMethod(PhoneUtils, "getSlot1PhoneType");
					else
						phoneType = (Integer) XposedHelpers.callStaticMethod(PhoneUtils, "getSlot2PhoneType");

					// dial through available
					if (action == 0) {
						Misc.x("Dialing through available slot is requested");
						// check if slot is available
						if ((Boolean) XposedHelpers.callStaticMethod(PhoneUtils, "isSimReady", phoneType)) {
							Misc.x("Desired slot is available");
							Misc.x(" - dialing will be through slot " + phoneType);
							// dial through desired slot
							paramIntent2.putExtra("phone_type", phoneType);
						} else {
							Misc.x("Desired slot NOT available");
							// slot not available, so lets get state of another
							// slot
							int anotherSlot;
							if (force == 1)
								anotherSlot = (Integer) XposedHelpers.callStaticMethod(PhoneUtils, "getSlot2PhoneType");
							else
								anotherSlot = (Integer) XposedHelpers.callStaticMethod(PhoneUtils, "getSlot1PhoneType");

							// If another slot is ready
							if ((Boolean) XposedHelpers.callStaticMethod(PhoneUtils, "isSimReady", anotherSlot)) {
								Misc.x("Another slot is available");
								Misc.x(" - dialing will be through slot " + anotherSlot);
								// then dial through another
								paramIntent2.putExtra("phone_type", anotherSlot);
							} else {
								Misc.x("Dialing through another slot is NOT available");
								Misc.x(" - fail massage should appear on screen");
								// otherwise get failed on desired slot
								paramIntent2.putExtra("phone_type", phoneType);
							}
						}
					} else {
						Misc.x("Messaging through selected slot only: " + phoneType);
						Misc.x(" - we do not care what next will happen");
						// Dial and we do not care
						paramIntent2.putExtra("phone_type", phoneType);
					}
				}
			}
		});
	}

	public static void handleSlotIndicator1(InitPackageResourcesParam resparam, String path, final int value)
	{
		final XModuleResources modRes = XModuleResources.createInstance(path, resparam.res);
		if (resparam.packageName.equals("com.htc.sense.mms")) {
			try {
				resparam.res.setReplacement(resparam.packageName, "drawable", "l_icon_indicator_slot1_s", new XResources.DrawableLoader()
				{
					public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
					{
						return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot1_s), Misc.getHueValue(value));
					}
				});
			} catch (Throwable t) {
			}

			try {
				resparam.res.setReplacement(resparam.packageName, "drawable", "l_icon_indicator_slot1", new XResources.DrawableLoader()
				{
					public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
					{
						return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot1), Misc.getHueValue(value));
					}
				});
			} catch (Throwable t) {
			}

		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot1", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot1), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {
			// XposedBridge.log(t);
		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot1_dark_s", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot1_s), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {

		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot1_light_s", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot1_s), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {

		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot1_s", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot1_s), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {

		}
	}

	public static void handleSlotIndicator2(InitPackageResourcesParam resparam, String path, final int value)
	{
		final XModuleResources modRes = XModuleResources.createInstance(path, resparam.res);
		if (resparam.packageName.equals("com.htc.sense.mms")) {
			try {
				resparam.res.setReplacement(resparam.packageName, "drawable", "l_icon_indicator_slot2_s", new XResources.DrawableLoader()
				{
					public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
					{
						return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot2_s), Misc.getHueValue(value));
					}
				});
			} catch (Throwable t) {
			}

			try {
				resparam.res.setReplacement(resparam.packageName, "drawable", "l_icon_indicator_slot2", new XResources.DrawableLoader()
				{
					public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
					{
						return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot2), Misc.getHueValue(value));
					}
				});
			} catch (Throwable t) {
			}
		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot2", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot2), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {
			// XposedBridge.log(t);
		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot2_dark_s", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot2_s), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {

		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot2_light_s", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot2_s), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {

		}
		try {
			resparam.res.setReplacement(resparam.packageName, "drawable", "icon_indicator_slot2_s", new XResources.DrawableLoader()
			{
				public Drawable newDrawable(XResources paramAnonymousXResources, int paramAnonymousInt) throws Throwable
				{
					return Misc.adjustHue(modRes.getDrawable(R.drawable.icon_indicator_slot2_s), Misc.getHueValue(value));
				}
			});
		} catch (Throwable t) {

		}
	}

	public static void hookShowDataDisconnectedRoaming(LoadPackageParam paramLoadPackageParam)
	{
		findAndHookMethod("com.android.phone.NotificationMgr", paramLoadPackageParam.classLoader, "showDataDisconnectedRoaming", new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				return null;
			}
		});
	}

	public static void disableNoiseSuppression(final LoadPackageParam paramLoadPackageParam)
	{
		findAndHookMethod("com.android.phone.PhoneUtils", paramLoadPackageParam.classLoader, "turnOnNoiseSuppression", Context.class, boolean.class, boolean.class, new XC_MethodHook()
		{
			@Override
			protected void beforeHookedMethod(MethodHookParam param) throws Throwable
			{
				param.args[1] = Boolean.valueOf(false);
				param.args[2] = Boolean.valueOf(true);
			}
		});
		findAndHookMethod("com.android.phone.PhoneUtils", paramLoadPackageParam.classLoader, "isNoiseSuppressionOn", Context.class, new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				return Boolean.valueOf(false);
			}
		});
	}

	public static void hookSIP(final LoadPackageParam paramLoadPackageParam)
	{
		findAndHookMethod("com.android.phone.PhoneUtils", paramLoadPackageParam.classLoader, "isVoipSupported", new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				return Boolean.valueOf(true);
			}
		});

		Class<?> Features = XposedHelpers.findClass("com.android.phone.HtcFeatureList", paramLoadPackageParam.classLoader);
		XposedHelpers.setStaticBooleanField(Features, "FEATURE_SUPPORT_SIP_CALL_SETTINGS", true);

		findAndHookMethod("com.android.phone.CallFeaturesSetting", paramLoadPackageParam.classLoader, "onCreate", "android.os.Bundle", new XC_MethodHook()
		{
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable
			{
				CallFeaturesSetting = param.thisObject;
				// XposedHelpers.callMethod(param.thisObject,
				// "createSipCallSettings");
			}
		});

		findAndHookMethod("com.android.phone.dualsim.DualCallSettingsPreference", paramLoadPackageParam.classLoader, "onCreate", "android.os.Bundle", new XC_MethodHook()
		{
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable
			{
				DualCallSettingsPreference = param.thisObject;
				XposedHelpers.callMethod(CallFeaturesSetting, "createSipCallSettings");
			}
		});

		findAndHookMethod("com.android.phone.CallFeaturesSetting", paramLoadPackageParam.classLoader, "createSipCallSettings", new XC_MethodHook()
		{
			@Override
			protected void afterHookedMethod(MethodHookParam param) throws Throwable
			{
				/*
				 *
				 * this.mSipManager = SipManager.newInstance(this);
				 * this.mSipSharedPreferences = new SipSharedPreferences(this);
				 * addPreferencesFromResource(2131034157);
				 * this.mButtonSipCallOptions = getSipCallOptionPreference();
				 * this.mButtonSipCallOptions
				 * .setOnPreferenceChangeListener(this);
				 * this.mButtonSipCallOptions
				 * .setValueIndex(this.mButtonSipCallOptions .findIndexOfValue
				 * (this.mSipSharedPreferences.getSipCallOption()));
				 * this.mButtonSipCallOptions.setSummary(this.
				 * mButtonSipCallOptions.getEntry());
				 */
				final Class<?> SipManager = XposedHelpers.findClass("android.net.sip.SipManager", paramLoadPackageParam.classLoader);
				Object mSipManager = XposedHelpers.callStaticMethod(SipManager, "newInstance", param.thisObject);
				XposedHelpers.setObjectField(param.thisObject, "mSipManager", mSipManager);

				final Class<?> SipSharedPreferences = XposedHelpers.findClass("com.android.phone.sip.SipSharedPreferences", paramLoadPackageParam.classLoader);
				Object mSipSharedPreferences = XposedHelpers.newInstance(SipSharedPreferences, param.thisObject);
				XposedHelpers.setObjectField(param.thisObject, "mSipSharedPreferences", mSipSharedPreferences);

				String package_path = (String) XposedHelpers.callMethod(param.thisObject, "getPackageResourcePath");
				XModuleResources phoneRes = XModuleResources.createInstance(package_path, null);
				int res_id = phoneRes.getIdentifier("sip_settings_category", "xml", "com.android.phone");

				XposedHelpers.callMethod(DualCallSettingsPreference, "addPreferencesFromResource", res_id);

				Object mButtonSipCallOptions;

				Object localHtcListPreference1 = XposedHelpers.callMethod(DualCallSettingsPreference, "findPreference", "sip_call_options_key");
				Object localHtcListPreference2 = XposedHelpers.callMethod(DualCallSettingsPreference, "findPreference", "sip_call_options_wifi_only_key");
				Object localHtcPreferenceGroup = XposedHelpers.callMethod(DualCallSettingsPreference, "findPreference", "sip_settings_category_key");
				Boolean isSipWifiOnly = (Boolean) XposedHelpers.callStaticMethod(SipManager, "isSipWifiOnly", param.thisObject);
				if (isSipWifiOnly) {
					XposedHelpers.callMethod(localHtcPreferenceGroup, "removePreference", localHtcListPreference1);

					mButtonSipCallOptions = localHtcListPreference2;
					XposedHelpers.setObjectField(param.thisObject, "mButtonSipCallOptions", localHtcListPreference2);
				} else {
					XposedHelpers.callMethod(localHtcPreferenceGroup, "removePreference", localHtcListPreference2);

					mButtonSipCallOptions = localHtcListPreference1;
					XposedHelpers.setObjectField(param.thisObject, "mButtonSipCallOptions", localHtcListPreference1);
				}
				/*
				 * private HtcListPreference getSipCallOptionPreference() {
				 * HtcListPreference localHtcListPreference1 =
				 * (HtcListPreference)findPreference ("sip_call_options_key");
				 * HtcListPreference localHtcListPreference2 =
				 * (HtcListPreference)findPreference
				 * ("sip_call_options_wifi_only_key"); HtcPreferenceGroup
				 * localHtcPreferenceGroup = (HtcPreferenceGroup
				 * )findPreference("sip_settings_category_key"); if
				 * (SipManager.isSipWifiOnly(this)) { localHtcPreferenceGroup
				 * .removePreference(localHtcListPreference1); return
				 * localHtcListPreference2; }
				 * localHtcPreferenceGroup.removePreference
				 * (localHtcListPreference2); return localHtcListPreference1; }
				 */

				XposedHelpers.callMethod(mButtonSipCallOptions, "setOnPreferenceChangeListener", param.thisObject);

				Object getSipCallOption = XposedHelpers.callMethod(mSipSharedPreferences, "getSipCallOption");
				Object findIndexOfValue = XposedHelpers.callMethod(mButtonSipCallOptions, "findIndexOfValue", getSipCallOption);
				XposedHelpers.callMethod(mButtonSipCallOptions, "setValueIndex", findIndexOfValue);

				Object getEntry = XposedHelpers.callMethod(mButtonSipCallOptions, "getEntry");
				XposedHelpers.callMethod(mButtonSipCallOptions, "setSummary", getEntry);
			}
		});
	}

	public static void hookSIP2(LoadPackageParam paramLoadPackageParam)
	{
		findAndHookMethod("android.net.sip.SipManager", paramLoadPackageParam.classLoader, "isVoipSupported", "android.content.Context", new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				Boolean ret = true;
				return ret;
			}
		});

		findAndHookMethod("android.net.sip.SipManager", paramLoadPackageParam.classLoader, "isApiSupported", "android.content.Context", new XC_MethodReplacement()
		{
			@Override
			protected Object replaceHookedMethod(MethodHookParam param) throws Throwable
			{
				Boolean ret = true;
				return ret;
			}
		});
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/demo_keyboard_view_background"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:layout_margin="8dp"
    android:orientation="vertical">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/keyboard_demo_shadow">

        <com.anysoftkeyboard.keyboards.views.DemoAnyKeyboardView
            android:id="@+id/demo_keyboard_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </FrameLayout>

</LinearLayout>

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0"?>
<!--

  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

-->
<project name="examples" default="main" basedir=".">

  <target name="main" depends="clean,compile" description="Clean build of all examples"/>

  <target name="compile" description="Compile examples">
    <ant dir="${basedir}/vf2js_SimpleTest"/>
    <ant dir="${basedir}/vf2js_DatabindingTest"/>
  </target>

  <target name="clean" description="Cleans all examples">
    <ant dir="${basedir}/vf2js_SimpleTest" target="clean"/>
    <ant dir="${basedir}/vf2js_DatabindingTest" target="clean"/>
  </target>

</project>


text:
package org.docksidestage.sqlserver.dbflute.vendor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.UUID;

import org.dbflute.exception.EntityAlreadyDeletedException;
import org.dbflute.util.DfTypeUtil;
import org.docksidestage.sqlserver.dbflute.cbean.MemberCB;
import org.docksidestage.sqlserver.dbflute.cbean.VendorCheckCB;
import org.docksidestage.sqlserver.dbflute.exbhv.MemberBhv;
import org.docksidestage.sqlserver.dbflute.exbhv.VendorCheckBhv;
import org.docksidestage.sqlserver.dbflute.exentity.Member;
import org.docksidestage.sqlserver.dbflute.exentity.VendorCheck;
import org.docksidestage.sqlserver.dbflute.exentity.customize.VendorCheckDecimalSum;
import org.docksidestage.sqlserver.dbflute.exentity.customize.VendorCheckIntegerSum;
import org.docksidestage.sqlserver.unit.UnitContainerTestCase;

/**
 * @author jflute
 * @since 0.6.1 (2008/01/23 Wednesday)
 */
public class VendorDataTypeTest extends UnitContainerTestCase {

    // ===================================================================================
    //                                                                           Attribute
    //                                                                           =========
    private MemberBhv memberBhv;
    private VendorCheckBhv vendorCheckBhv;

    // ===================================================================================
    //                                                                         Number Type
    //                                                                         ===========

    // ===================================================================================
    //                                                                           Date Type
    //                                                                           =========
    public void test_typeHadling_datetime_millisecondMagic() throws Exception {
        // ## Arrange ##
        Timestamp datetimeNonMillis = DfTypeUtil.toTimestamp("2009/12/24 00:00:00.000");
        Timestamp datetimeFullMillis = DfTypeUtil.toTimestamp("2009/12/23 23:59:59.999");
        VendorCheck vendorCheck = new VendorCheck();
        vendorCheck.setVendorCheckId(99999L);
        vendorCheck.setTypeOfDatetime(datetimeNonMillis);

        // ## Act ##
        vendorCheckBhv.insert(vendorCheck);

        // ## Assert ##
        VendorCheckCB cb = new VendorCheckCB();
        cb.query().setVendorCheckId_Equal(99999L);
        cb.query().setTypeOfDatetime_LessEqual(datetimeFullMillis);
        try {
            vendorCheckBhv.selectEntityWithDeletedCheck(cb);
            fail();
        } catch (EntityAlreadyDeletedException e) {
            log(e.getMessage());
        }
        // changed by new JDBC driveer
        // becomes '2009/12/24 00:00:00.000' by SQLServer
        //VendorCheck actual = vendorCheckBhv.selectEntityWithDeletedCheck(cb);
        //assertEquals(datetimeNonMillis, actual.getTypeOfDatetime());
    }

    // -----------------------------------------------------
    //                                               DATE BC
    //                                               -------
    public void test_DATE_BC_date() {
        // ## Arrange ##
        MemberCB cb = new MemberCB();
        cb.query().setBirthdate_IsNotNull();
        cb.fetchFirst(1);
        cb.addOrderBy_PK_Asc();
        Member member = memberBhv.selectEntity(cb);
        member.setBirthdate(DfTypeUtil.toTimestamp("-2009/12/25"));

        // ## Act ##
        memberBhv.update(member);

        // ## Assert ##
        Member actual = memberBhv.selectByPKValue(member.getMemberId());
        DateFormat df = new SimpleDateFormat("Gyyyy/MM/dd");
        log(df.format(actual.getBirthdate()));
        assertFalse(DfTypeUtil.isDateBC(actual.getBirthdate())); // cannot handle BC date
        assertTrue(df.format(actual.getBirthdate()).contains("2010/12/25")); // Oops?
    }

    public void test_DATE_BC_datetime() {
        // ## Arrange ##
        MemberCB cb = new MemberCB();
        cb.query().setFormalizedDatetime_IsNotNull();
        cb.fetchFirst(1);
        cb.addOrderBy_PK_Asc();
        Member member = memberBhv.selectEntity(cb);
        member.setFormalizedDatetime(DfTypeUtil.toTimestamp("-2009/12/25 12:34:56.147"));

        // ## Act ##
        memberBhv.update(member);

        // ## Assert ##
        Member actual = memberBhv.selectByPKValue(member.getMemberId());
        DateFormat df = new SimpleDateFormat("Gyyyy/MM/dd HH:mm:dd.SSS");
        log(df.format(actual.getFormalizedDatetime()));
        assertFalse(DfTypeUtil.isDateBC(actual.getFormalizedDatetime())); // cannot handle BC date
        assertTrue(df.format(actual.getFormalizedDatetime()).contains("2010/12/25")); // Oops?
    }

    // ===================================================================================
    //                                                                        Boolean Type
    //                                                                        ============
    // -----------------------------------------------------
    //                                                   BIT
    //                                                   ---
    public void test_BIT_insert_select() throws Exception {
        // ## Arrange ##
        boolean expected = true;
        vendorCheckBhv.varyingQueryDelete(new VendorCheckCB(), op -> op.allowNonQueryDelete());
        VendorCheck vendorCheck = new VendorCheck();
        vendorCheck.setVendorCheckId(99999L);
        vendorCheck.setTypeOfBit(expected);

        // ## Act ##
        vendorCheckBhv.insert(vendorCheck);
        VendorCheckCB cb = new VendorCheckCB();
        cb.query().setTypeOfBit_Equal(expected);
        VendorCheck selected = vendorCheckBhv.selectEntityWithDeletedCheck(cb);

        // ## Assert ##
        assertEquals(expected, selected.getTypeOfBit().booleanValue());
    }

    // ===================================================================================
    //                                                                         Binary Type
    //                                                                         ===========
    // -----------------------------------------------------
    //                                                BINARY
    //                                                ------
    public void test_BINARY_insert_select() {
        // ## Arrange ##
        String expected = "foo";
        Member member = memberBhv.selectByPKValue(3);
        member.setMemberName(expected);
        VendorCheck vendorCheck = createVendorCheck();
        vendorCheck.setTypeOfBinary(serialize(member));

        // ## Act ##
        vendorCheckBhv.insert(vendorCheck);
        VendorCheckCB cb = new VendorCheckCB();
        cb.query().setVendorCheckId_Equal(vendorCheck.getVendorCheckId());
        VendorCheck selected = vendorCheckBhv.selectEntityWithDeletedCheck(cb);

        // ## Assert ##
        byte[] bytes = selected.getTypeOfBinary();
        assertNotNull(bytes);
        Member deserialized = (Member) deserialize(bytes);
        log("deserialized=" + deserialized);
        assertEquals(expected, deserialized.getMemberName());
    }

    public void test_VARBINARY_insert_select() {
        // ## Arrange ##
        String expected = "foo";
        Member member = memberBhv.selectByPKValue(3);
        member.setMemberName(expected);
        VendorCheck vendorCheck = createVendorCheck();
        vendorCheck.setTypeOfVarbinary(serialize(member));

        // ## Act ##
        vendorCheckBhv.insert(vendorCheck);
        VendorCheckCB cb = new VendorCheckCB();
        cb.query().setVendorCheckId_Equal(vendorCheck.getVendorCheckId());
        VendorCheck selected = vendorCheckBhv.selectEntityWithDeletedCheck(cb);

        // ## Assert ##
        byte[] bytes = selected.getTypeOfVarbinary();
        assertNotNull(bytes);
        Member deserialized = (Member) deserialize(bytes);
        log("deserialized=" + deserialized);
        assertEquals(expected, deserialized.getMemberName());
    }

    // ===================================================================================
    //                                                                        Various Type
    //                                                                        ============
    // -----------------------------------------------------
    //                                                  UUID
    //                                                  ----
    public void test_UniqueIdentifier_insert_select() throws Exception {
        // ## Arrange ##
        UUID expected = UUID.fromString("FD8C7155-3A0A-DB11-BAC4-0011F5099158");
        VendorCheck vendorCheck = createVendorCheck();
        vendorCheck.setTypeOfUniqueidentifier(expected);

        // ## Act ##
        vendorCheckBhv.insert(vendorCheck);
        VendorCheckCB cb = new VendorCheckCB();
        cb.query().setTypeOfUniqueidentifier_Equal(expected);
        VendorCheck selected = vendorCheckBhv.selectEntityWithDeletedCheck(cb);

        // ## Assert ##
        assertEquals(expected, selected.getTypeOfUniqueidentifier());
    }

    // -----------------------------------------------------
    //                                                   XML
    //                                                   ---
    public void test_XML_insert_select() {
        // ## Arrange ##
        String expected = "<foo/>";
        VendorCheck vendorCheck = createVendorCheck();
        vendorCheck.setTypeOfXml(expected);

        // ## Act ##
        vendorCheckBhv.insert(vendorCheck);
        VendorCheckCB cb = new VendorCheckCB();
        cb.query().setVendorCheckId_Equal(vendorCheck.getVendorCheckId());
        VendorCheck selected = vendorCheckBhv.selectEntityWithDeletedCheck(cb);

        // ## Assert ##
        String actual = selected.getTypeOfXml();
        assertNotNull(actual);
        log("actual=" + actual);
        assertEquals(expected, actual);
    }

    // -----------------------------------------------------
    //                                         SUM(function)
    //                                         -------------
    @SuppressWarnings("unused")
    public void test_SUM_of_function() throws Exception {
        {
            VendorCheckDecimalSum vendorCheck = new VendorCheckDecimalSum();
            BigDecimal integerNonDigit = vendorCheck.getDecimalDigitSum();
        }
        {
            VendorCheckIntegerSum vendorCheck = new VendorCheckIntegerSum();
            BigDecimal integerNonDigit = vendorCheck.getIntegerNonDigitSum();
        }
    }

    // ===================================================================================
    //                                                                       Assist Helper
    //                                                                       =============
    protected VendorCheck createVendorCheck() {
        VendorCheck vendorCheck = new VendorCheck();
        vendorCheck.setVendorCheckId(new Long(99999));
        return vendorCheck;
    }

    protected VendorCheck createVendorCheck(Integer id) {
        VendorCheck vendorCheck = new VendorCheck();
        vendorCheck.setVendorCheckId(new Long(id));
        return vendorCheck;
    }

    protected byte[] serialize(Serializable obj) {
        return DfTypeUtil.toBinary(obj);
    }

    protected Serializable deserialize(byte[] bytes) {
        return DfTypeUtil.toSerializable(bytes);
    }
}


text:
        <link href="style.css" rel="stylesheet" />

        6 th-level necromancy

        Casting Time:  1 action

        Range:  60 feet

        Components:  V, S

        Duration:  Instantaneous

            You unleash a virulent disease on a creature that
            you can see within range. The target must make a
            Constitution saving throw. On a failed save, it takes
            14d6 necrotic damage, or half as much damage on a
            successful save. The damage can't reduce the target's
            hit points below 1. If the target fails the saving throw,
            its hit point maximum is reduced for 1 hour by an
            amount equal to the necrotic damage it took. Any effect
            that removes a disease allows a creature's hit point
            maximum to return to normal before that time passes.


text:
package uk.nhs.careconnect.ri.database.entity.location;

import uk.nhs.careconnect.ri.database.entity.BaseContactPoint;

import javax.persistence.*;

@Entity
@Table(name="LocationTelecom",
		uniqueConstraints= @UniqueConstraint(name="PK_LOCATION_TELECOM", columnNames={"LOCATION_TELECOM_ID"})
		,indexes =
		{
				@Index(name = "IDX_LOCATION_TELECOM_LOCATION_ID", columnList="LOCATION_ID")
		})
public class LocationTelecom extends BaseContactPoint {

	public LocationTelecom() {

	}

	public LocationTelecom(LocationEntity locationEntity) {
		this.locationEntity = locationEntity;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name= "LOCATION_TELECOM_ID")
	private Long identifierId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn (name = "LOCATION_ID",foreignKey= @ForeignKey(name="FK_LOCATION_LOCATION_TELECOM"))
	private LocationEntity locationEntity;

    public Long getTelecomId() { return identifierId; }
	public void setTelecomId(Long identifierId) { this.identifierId = identifierId; }

	public LocationEntity getLocation() {
	        return this.locationEntity;
	}
	public void setLocation(LocationEntity locationEntity) {
	        this.locationEntity = locationEntity;
	}

}


text:
public abstract class Foo {
  static Foo anonymous = new Foo() {
    @Override
    void fooMethod() {
      foo2Method(th<caret>is);
    }
  };

  protected Foo() {
    IBar bar = anonymou<caret>s;
  }
}


text:
class IFileSystem;

abstract_class IBSPPack
{
public:
	virtual void LoadBSPFile( IFileSystem *pFileSystem, char *filename ) = 0;
	virtual void WriteBSPFile( char *filename ) = 0;
	virtual void ClearPackFile( void ) = 0;
	virtual void AddFileToPack( const char *relativename, const char *fullpath ) = 0;
	virtual void AddBufferToPack( const char *relativename, void *data, int length, bool bTextMode ) = 0;
	virtual void SetHDRMode( bool bHDR ) = 0;
	virtual bool SwapBSPFile( IFileSystem *pFileSystem, const char *filename, const char *swapFilename, bool bSwapOnLoad, VTFConvertFunc_t pVTFConvertFunc, VHVFixupFunc_t pVHVFixupFunc, CompressFunc_t pCompressFunc ) = 0;

	// used to get/set the pak file from a BSP
	virtual bool GetPakFileLump( IFileSystem *pFileSystem, const char *pBSPFilename, void **pPakData, int *pPakSize ) = 0;
	virtual bool SetPakFileLump( IFileSystem *pFileSystem, const char *pBSPFilename, const char *pNewFilename, void *pPakData, int pakSize ) = 0;

	// populates list of files that bsp owns, i.e. world/cubmap materials, statis props, etc
	virtual bool GetBSPDependants( IFileSystem *pFileSystem, const char *pBSPFilename, CUtlVector< CUtlString > *pList ) = 0;

	// This is here to avoid having things like the runtime engine.dll have to statically link to LZMA for the encoder!!!
	virtual void AddBufferToPackAndLZMACompress( const char *relativename, void *data, int length ) = 0;
	virtual void RemoveFileFromPack( char const *relativename ) = 0;
};

#define IBSPPACK_VERSION_STRING "IBSPPACK003"

#endif // IBSPPACK_H