@@ -39,20 +39,20 @@ Initializing AQuery :
3939// AQuery in Activity
4040public 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
5353public 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
7373public 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
8484Query Activity :
8585``` java
8686// Fast intent
87- $ . open(HomeActivity . class);
87+ aq . open(HomeActivity . class);
8888
8989// Custom intent
9090Intent intent = new Intent (this , HomeActivity . class);
9191intent. 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
105105Query 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
138138Query Toas :
139139``` java
140140// Simple toas
141- $ . snack(" Message" );
142- $ . toast(" Message" );
141+ aq . snack(" Message" );
142+ aq . toast(" Message" );
143143
144144```
145145
146146Query 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
158158Map<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
182182Query SQLite :
@@ -186,28 +186,28 @@ Query SQLite :
186186Map<String , Object > data = new HashMap<> ();
187187data. put(" nama" , " Putri Nuraini" );
188188data. 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```
212212And AQuery have a lot of API check it on [ Documentation] ( https://ar-android.github.io/AQuery )
213213
0 commit comments