Many moons ago, I was the Technical Product Manager for MKS Internet Anywhere...
Thanks Sean!
Project |--build.gradle |--settings.gradle |--Dependency | |--build.gradleNow in most of my cases, I have my libraries as separate projects that I DO NOT want located under the app's root. So today, I finally got off my ass to figure out how to do that. (Yes, I've been very lazy about this)
Project |--build.gradle |--settings.gradle Dependency |--build.gradle
include ':Dependency' project(':Dependency').projectDir = new File(settingsDir, '../Dependency/module_build_gradle_location')If you've just finished an import, you can now manually delete the imported module and rebuild the project.
android.support.v4.app.FragmentActivity
/**
* Modifies the standard behavior to allow results to be delivered to fragments.
* This imposes a restriction that requestCode be <= 0xffff.
*/
@Override
public void startActivityForResult(Intent intent, int requestCode) {
if (requestCode != -1 && (requestCode&0xffff0000) != 0) {
throw new IllegalArgumentException("Can only use lower 16 bits for requestCode");
}
super.startActivityForResult(intent, requestCode);
}
@Override
public final void validateRequestPermissionsRequestCode(int requestCode) {
// We use 8 bits of the request code to encode the fragment id when
// requesting permissions from a fragment. Hence, requestPermissions()
// should validate the code against that but we cannot override it as
// we can not then call super and also the ActivityCompat would call
// back to this override. To handle this we use dependency inversion
// where we are the validator of request codes when requesting
// permissions in ActivityCompat.
if (mRequestedPermissionsFromFragment) {
mRequestedPermissionsFromFragment = false;
} else if ((requestCode & 0xffffff00) != 0) {
throw new IllegalArgumentException("Can only use lower 8 bits for requestCode");
}
}
startActivityForResult()
in FragmentActivity
requires the requestCode to be of 16 bits, meaning the range is from 0 to 65535.validateRequestPermissionsRequestCode
in FragmentActivity
requires requestCode to be of 8 bits, meaning the range is from 0 to 255.this.datePicker = (DatePicker) view.findViewById(R.id.datePicker); // hack also added to styleif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Calendar calendar1 = Calendar.getInstance(); calendar1.set(1900, Calendar.JANUARY, 1, 0, 0, 0); datePicker.setMinDate(calendar1.getTimeInMillis()); }
Unfortunately, the DatePicker.setMinDate is not exposed pre HONEYCOMB so to fix those apps, you can try adding this to your base application style
<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="android:startYear">1900</item> </style>
@Override
protected void showDialog(Bundle state) { super.showDialog(state); final AlertDialog dialog = (AlertDialog) getDialog(); Button button = dialog.getButton(DialogInterface.BUTTON_POSITIVE); button.setOnClickListener(new View.OnClickListener() { @Overridepublic void onClick(View view) { // Validation if (mNameEditText.getText().toString().isEmpty()) { mNameEditText.setError(getContext().getString(R.string.pref_error_empty)); return; } PersonPreference.super.onClick(dialog, DialogInterface.BUTTON_POSITIVE); dialog.dismiss(); } } ); }
sourceCompatibility = 1.7
targetCompatibility = 1.7
after inclusion, it should look something like this:
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'junit:junit:4.12'
}