Thank you for having interest in this library!
In this section, I'll show some quick instructions for introducing this library into your app.
This library is published to the Jitpack package repository, so you can use it through Gradle/Maven.
You can use it in Eclipse, but Android Studio (or Gradle) is recommended.In Quick start guide, we assume you're using Android Studio.
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Enable java 8 compiler to activate lambada expression for this we recomend to use android studio 3.0 :
android {
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation 'com.github.ar-android:AQuery:v1.0.0'
}
Now let's use AQuery in our Activity. In this example we would like to create simple apps that have a login functionality.
So, let's create a class LoginActivity :
public class ApaActivity extends AppCompatActivity{
private AQuery aq;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
aq = new AQuery(this);
}
}
Now this is example of how we write less code and do more with business logic :
aq.id(R.id.login).click(v -> {
if (aq.id(R.id.input_email).isValid() && aq.id(R.id.input_password).isValid()){
Map<String, String> params = new HashMap<>();
params.put("email", aq.id(R.id.input_email).text());
params.put("password", aq.id(R.id.input_password).text());
aq.ajax("https://ocit-tutorial.herokuapp.com/index.php")
.post(params)
.showLoading()
.response((response, error) -> {
if (response != null){
aq.openFromRight(HomeActivity.class);
}
});
}
});