Skip to content

Commit 1eb0fb6

Browse files
committed
update readme
1 parent 37af04c commit 1eb0fb6

3 files changed

Lines changed: 53 additions & 41 deletions

File tree

README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ Initializing AQuery :
3939
// AQuery in Activity
4040
public class MainActivity extends AppCompatActivity{
4141

42-
private AQuery $;
42+
private AQuery aq;
4343

4444
@Override
4545
protected void onCreate(@Nullable Bundle savedInstanceState) {
4646
super.onCreate(savedInstanceState);
4747
setContentView(R.layout.activity_main);
48-
$ = new AQuery(this);
48+
aq = new AQuery(this);
4949
}
5050
}
5151

5252
// AQuery in Fragment
5353
public class MainFragment extends Fragment{
5454

55-
private AQuery $;
55+
private AQuery aq;
5656

5757
@Nullable
5858
@Override
@@ -65,89 +65,89 @@ public class MainFragment extends Fragment{
6565
@Override
6666
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
6767
super.onViewCreated(view, savedInstanceState);
68-
$ = new AQuery(getActivity());
68+
aq = new AQuery(getActivity());
6969
}
7070
}
7171

7272
// AQuery in ViewHolder
7373
public class ViewHolder extends RecyclerView.ViewHolder{
7474

75-
private AQuery $;
75+
private AQuery aq;
7676

7777
public ViewHolder(View itemView) {
7878
super(itemView);
79-
$ = new AQuery(itemView.getContext(), itemView);
79+
aq = new AQuery(itemView.getContext(), itemView);
8080
}
8181
}
8282
```
8383

8484
Query Activity :
8585
```java
8686
// Fast intent
87-
$.open(HomeActivity.class);
87+
aq.open(HomeActivity.class);
8888

8989
// Custom intent
9090
Intent intent = new Intent(this, HomeActivity.class);
9191
intent.putExtra("id",1);
92-
$.open(intent);
92+
aq.open(intent);
9393

9494
// Intent transition from left and right
95-
$.openFromRight(HomeActivity.class);
96-
$.openFromLeft(HomeActivity.class);
97-
$.openFromRight(intent);
98-
$.openFromLeft(intent);
95+
aq.openFromRight(HomeActivity.class);
96+
aq.openFromLeft(HomeActivity.class);
97+
aq.openFromRight(intent);
98+
aq.openFromLeft(intent);
9999

100100
// Close activity transition
101-
$.closeToRight();
102-
$.closeToLeft();
101+
aq.closeToRight();
102+
aq.closeToLeft();
103103
```
104104

105105
Query View :
106106
```java
107107
// OnClickListener
108-
$.id(R.id.login).click(v -> {
108+
aq.id(R.id.login).click(v -> {
109109
// Do stuff
110110
});
111111

112112
// Check is text not empty
113-
boolean valid = $.id(R.id.input_email).isValid();
113+
boolean valid = aq.id(R.id.input_email).isValid();
114114

115115
// Get text value of view is avaliable
116-
String email = $.id(R.id.input_email).text();
116+
String email = aq.id(R.id.input_email).text();
117117

118118
// Set Visibilty Gone
119-
$.id(R.id.input_email).hide();
119+
aq.id(R.id.input_email).hide();
120120

121121
// Set Visibilty Visible
122-
$.id(R.id.input_email).show();
122+
aq.id(R.id.input_email).show();
123123

124124
// Cast view
125-
DefaultTextField defaultTextField = $.id(R.id.input_email).as(DefaultTextField.class);
125+
DefaultTextField defaultTextField = aq.id(R.id.input_email).as(DefaultTextField.class);
126126

127127
// Active state View
128-
$.id(R.id.input_email).active();
129-
$.id(R.id.input_email).inActive();
128+
aq.id(R.id.input_email).active();
129+
aq.id(R.id.input_email).inActive();
130130

131131
// If you want rounded image
132-
$.id(R.id.image).image(user.getAvatar_url()).rounded();
132+
aq.id(R.id.image).image(user.getAvatar_url()).rounded();
133133

134134
// If you want set from drawable
135-
$.id(R.id.image).image(R.drawable.profile);
135+
aq.id(R.id.image).image(R.drawable.profile);
136136
```
137137

138138
Query Toas :
139139
```java
140140
// Simple toas
141-
$.snack("Message");
142-
$.toast("Message");
141+
aq.snack("Message");
142+
aq.toast("Message");
143143

144144
```
145145

146146
Query Network :
147147

148148
```java
149149
// Ajax get
150-
$.ajax("https://api.github.com/users/ar-android")
150+
aq.ajax("https://api.github.com/users/ar-android")
151151
.get()
152152
.showLoading()
153153
.toObject(GithubUsers.class, (user, error) -> {
@@ -156,14 +156,14 @@ $.ajax("https://api.github.com/users/ar-android")
156156

157157
// Ajax POST form
158158
Map<String, String> params = new HashMap<>();
159-
params.put("email", $.id(R.id.email).text());
160-
params.put("password", $.id(R.id.password).text());
161-
$.ajax("https://ocit-tutorial.herokuapp.com/index.php")
159+
params.put("email", aq.id(R.id.email).text());
160+
params.put("password", aq.id(R.id.password).text());
161+
aq.ajax("https://ocit-tutorial.herokuapp.com/index.php")
162162
.postForm(params)
163163
.showLoading()
164164
.response((response, error) -> {
165165
if (response != null){
166-
$.openFromRight(MainActivity.class);
166+
aq.openFromRight(MainActivity.class);
167167
}
168168
});
169169

@@ -173,10 +173,10 @@ Query Shared Preferences :
173173

174174
```java
175175
// Save string to shared preferences
176-
$.saveString("token", response.getData().getToken());
176+
aq.saveString("token", response.getData().getToken());
177177

178178
// Grab string from shared preferences
179-
String token $.grabString("token");
179+
String token aq.grabString("token");
180180
```
181181

182182
Query SQLite :
@@ -186,28 +186,28 @@ Query SQLite :
186186
Map<String, Object> data = new HashMap<>();
187187
data.put("nama", "Putri Nuraini");
188188
data.put("email", "alahmadrosid@gmail.com");
189-
$.sql().table("user").insert(data);
189+
aq.sql().table("user").insert(data);
190190

191191
// Get All row from table
192-
List<Map<String, String>> user = $.sql().table("user").all();
192+
List<Map<String, String>> user = aq.sql().table("user").all();
193193

194194
// Update row from table by id
195-
boolean update = $.sql().table("user").update(3, data);
195+
boolean update = aq.sql().table("user").update(3, data);
196196

197197
// Get row table by id
198-
Map<String, String> user = $.sql().table("user").get(3);
198+
Map<String, String> user = aq.sql().table("user").get(3);
199199

200200
// Get table by first row
201-
Map<String, String> user = $.sql().table("user").first();
201+
Map<String, String> user = aq.sql().table("user").first();
202202

203203
// Get table by last row
204-
Map<String, String> user = $.sql().table("user").last();
204+
Map<String, String> user = aq.sql().table("user").last();
205205

206206
// Delete table by id
207-
boolean delete = $.sql().table("user").delete(2);
207+
boolean delete = aq.sql().table("user").delete(2);
208208

209209
// Clear database sqlite
210-
$.sql().clearDb();
210+
aq.sql().clearDb();
211211
```
212212
And AQuery have a lot of API check it on [Documentation](https://ar-android.github.io/AQuery)
213213

aquery/src/main/java/com/aquery/AQuery.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ public AQuery(Context context, View rootView) {
6969
.create();
7070
}
7171

72+
public long now(){
73+
return System.currentTimeMillis();
74+
}
75+
7276
public QueryView id(@IdRes int id) {
7377
View image = rootView.findViewById(id);
7478
return queryView.setView(image);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.aquery.query;
2+
3+
/**
4+
* Created by ocittwo on 11/13/17.
5+
*/
6+
7+
public class QueryDate {
8+
}

0 commit comments

Comments
 (0)