· 6 years ago · Feb 04, 2020, 08:40 AM
1package com.qqltech.ktk.JadwalKuliah;
2
3import android.app.DatePickerDialog;
4import android.app.ProgressDialog;
5import android.content.DialogInterface;
6import android.content.Intent;
7import android.graphics.Color;
8import android.graphics.drawable.Icon;
9import android.os.Bundle;
10import android.text.InputType;
11import android.util.Log;
12import android.view.Menu;
13import android.view.MenuItem;
14import android.view.View;
15import android.widget.AdapterView;
16import android.widget.DatePicker;
17import android.widget.ListView;
18import android.widget.RelativeLayout;
19import android.widget.SimpleAdapter;
20import android.widget.TextView;
21import android.widget.Toast;
22
23import androidx.appcompat.app.AlertDialog;
24import androidx.appcompat.app.AppCompatActivity;
25import androidx.appcompat.widget.Toolbar;
26import androidx.recyclerview.widget.GridLayoutManager;
27import androidx.recyclerview.widget.RecyclerView;
28import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
29
30import com.android.volley.AuthFailureError;
31import com.android.volley.NetworkError;
32import com.android.volley.ParseError;
33import com.android.volley.Request;
34import com.android.volley.RequestQueue;
35import com.android.volley.Response;
36import com.android.volley.ServerError;
37import com.android.volley.VolleyError;
38import com.android.volley.toolbox.JsonObjectRequest;
39import com.android.volley.toolbox.StringRequest;
40import com.android.volley.toolbox.Volley;
41import com.google.android.material.appbar.AppBarLayout;
42import com.qqltech.ktk.API.APIClient;
43import com.qqltech.ktk.API.APIInterface;
44import com.qqltech.ktk.AbsensiOnline.CheckInActivity;
45import com.qqltech.ktk.JadwalKuliah.Adapter.JancokAdapter;
46import com.qqltech.ktk.JadwalKuliah.Adapter.adapter_jadwal_kuliah;
47import com.qqltech.ktk.LoginActivity;
48import com.qqltech.ktk.MainActivity;
49import com.qqltech.ktk.R;
50import com.qqltech.ktk.helper.Htpp;
51import com.qqltech.ktk.helper.SessionManager;
52
53import org.json.JSONArray;
54import org.json.JSONException;
55import org.json.JSONObject;
56
57import java.nio.charset.StandardCharsets;
58import java.text.SimpleDateFormat;
59import java.util.ArrayList;
60import java.util.Calendar;
61import java.util.HashMap;
62import java.util.List;
63import java.util.Locale;
64import java.util.Map;
65
66import butterknife.BindView;
67import butterknife.ButterKnife;
68
69public class JadwalKuliahActivity extends AppCompatActivity {
70 private static final String TAG = JadwalKuliahActivity.class.getSimpleName();
71 @BindView(R.id.tvTitle)
72 TextView tvTitle;
73 @BindView(R.id.toolbar)
74 Toolbar toolbar;
75 @BindView(R.id.appBarLayout)
76 AppBarLayout appBarLayout;
77 // @BindView(R.id.recyclerViewJadwalKuliah)
78// RecyclerView recyclerViewJadwalKuliah;
79 @BindView(R.id.tanggal)
80 RelativeLayout tanggal;
81 @BindView(R.id.tanggal_masuk)
82 TextView tanggal_masuk;
83
84 adapter_jadwal_kuliah adapterJadwalKuliah;
85 @BindView(R.id.swipejadwalkuliah)
86 SwipeRefreshLayout swipejadwalkuliah;
87 SimpleAdapter simpleAdapter;
88 ProgressDialog dialog;
89 RecyclerView.LayoutManager layoutManager;
90 SessionManager sessionManager;
91 ListView listJadwalMengajar;
92 ListView listJadwal;
93 ArrayList<HashMap<String, String>> jancok = new ArrayList<HashMap<String, String>>();
94 private RequestQueue mRequestQueue;
95 private StringRequest mStringRequest;
96 // @BindView(R.id.btn_tambah)
97// Button btnTambah;
98// @BindView(R.id.btn_hapus)
99// Button btnHapus;
100 private DatePickerDialog picker;
101 private Intent intent;
102 private RecyclerView.Adapter adapter;
103 private GridLayoutManager gridLayoutManager;
104 private APIInterface apiInterface;
105 private APIClient ApiClient;
106 private List<Icon> iconList;
107 private int spanCount = 1;
108
109 public void Home(MenuItem item) {
110 Intent starter = new Intent(getApplicationContext(), MainActivity.class);
111// starter.putExtra();
112 startActivity(starter);
113 }
114
115 @Override
116 public boolean onCreateOptionsMenu(Menu menu) {
117 // Membaca file menu dan menambahkan isinya ke action bar jika ada.
118 getMenuInflater().inflate(R.menu.menumain, menu);
119 return true;
120 }
121
122 public void logOut(MenuItem item) {
123 sessionManager.destroySession();
124// if (!sessionManager.isLoggedIn()) {
125 Intent intent = new Intent(JadwalKuliahActivity.this, LoginActivity.class);
126 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
127 startActivity(intent);
128// }
129 }
130
131 @Override
132 protected void onCreate(Bundle savedInstanceState) {
133 super.onCreate(savedInstanceState);
134 setContentView(R.layout.activity_jadwal_kuliah);
135 ButterKnife.bind(this);
136
137 listJadwal = findViewById(R.id.listJadwal);
138 sessionManager = new SessionManager(JadwalKuliahActivity.this);
139// ListJadwalKuliah();
140
141
142 Calendar calendar = Calendar.getInstance();
143 String currentDate = new SimpleDateFormat("dd/MM/yyyy").format(calendar.getTime());
144 TextView textViewDate = findViewById(R.id.tanggal_masuk);
145 textViewDate.setText(currentDate);
146
147 tanggal.setOnClickListener(new View.OnClickListener() {
148 @Override
149 public void onClick(View v) {
150 tanggal_masuk.setInputType(InputType.TYPE_NULL);
151 final Calendar cldr = Calendar.getInstance();
152 int day = cldr.get(Calendar.DAY_OF_MONTH);
153 int month = cldr.get(Calendar.MONTH);
154 int year = cldr.get(Calendar.YEAR);
155 picker = new DatePickerDialog(v.getContext(),
156 new DatePickerDialog.OnDateSetListener() {
157 @Override
158 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
159 Calendar newDate = Calendar.getInstance();
160 newDate.set(year, monthOfYear, dayOfMonth);
161 SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
162 String formatted = dateFormat.format(newDate.getTime());
163 tanggal_masuk.setText(formatted);
164 }
165 }, year, month, day);
166 picker.show();
167 }
168 });
169
170 setSupportActionBar(toolbar);
171 toolbar.getContext().setTheme(R.style.AppTheme);
172 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
173 getSupportActionBar().setDisplayShowTitleEnabled(false);
174
175
176 toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_back));
177 toolbar.setNavigationOnClickListener(new View.OnClickListener() {
178 @Override
179 public void onClick(View v) {
180 finish();
181 }
182 });
183
184 listJadwal.setOnItemClickListener(new AdapterView.OnItemClickListener() {
185 @Override
186 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
187 TextView MenuJudul = view.findViewById(R.id.MenuJudul);
188 TextView jadwal_id = view.findViewById(R.id.jadwal_id);
189 TextView MenuNama = view.findViewById(R.id.MenuNama);
190 TextView MenuSemester = view.findViewById(R.id.MenuSemester);
191 TextView MenuRuang = view.findViewById(R.id.MenuRuang);
192 TextView MenuHari = view.findViewById(R.id.MenuHari);
193 TextView MenuTahunPelajaran = view.findViewById(R.id.MenuTahunPelajaran);
194 TextView MenuWaktuMulai = view.findViewById(R.id.MenuWaktuMulai);
195 TextView MenuWaktuSelesai = view.findViewById(R.id.MenuWaktuSelesai);
196 TextView MenuStatus = view.findViewById(R.id.MenuStatus);
197
198 Intent intent = new Intent(JadwalKuliahActivity.this, CheckInActivity.class);
199 intent.putExtra("idJadwal", "1");
200 intent.putExtra("mataKuliah", MenuJudul.getText().toString());
201 startActivity(intent);
202 }
203 });
204 ListJancok();
205 swipejadwalkuliah.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
206 @Override
207 public void onRefresh() {
208 ListJancok();
209 swipejadwalkuliah.setRefreshing(false);
210 }
211 });
212
213 }
214
215
216 private void ListJancok() {
217
218 final ProgressDialog progressDialog = ProgressDialog.show(JadwalKuliahActivity.this, "Tunggu...", "Please Wait....");
219 progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
220
221// final ProgressDialog dialog1 = new ProgressDialog(JadwalKuliahActivity.this);
222// dialog1.setCancelable(false);
223// dialog1.setCanceledOnTouchOutside(false);
224// dialog1.setMessage("Sedang Menyimpan...");
225// dialog1.show();
226
227
228 RequestQueue mQueue = Volley.newRequestQueue(getApplicationContext());
229 JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, Htpp.getUrl() + "scheduler",
230 new Response.Listener<JSONObject>() {
231 @Override
232 public void onResponse(JSONObject response) {
233 progressDialog.dismiss();
234 try {
235 int sieze = response.getJSONArray("data").length();
236 if (sieze > 0) {
237 jancok.clear();
238
239 Log.e(TAG, "onResponse: " + response.toString());
240 JSONArray jsonArray = response.getJSONArray("data");
241 for (int i = 0; i < jsonArray.length(); i++) {
242 JSONObject jsonObject1 = jsonArray.getJSONObject(i);
243 String id = jsonObject1.getString("id");
244 String code = jsonObject1.getString("code");
245 String mata_kuliah_id = jsonObject1.getString("mata_kuliah_id");
246 String dosen_id = jsonObject1.getString("dosen_id");
247 String semester_id = jsonObject1.getString("semester_id");
248 String kelas_id = jsonObject1.getString("kelas_id");
249 String mata_kuliah = jsonObject1.getString("mata_kuliah");
250 String kelas = jsonObject1.getString("kelas");
251 String dosen = jsonObject1.getString("dosen");
252 String semester = jsonObject1.getString("semester");
253 String tahun_ajaran = jsonObject1.getString("tahun_ajaran");
254 String hari = jsonObject1.getString("hari");
255 String tanggal = jsonObject1.getString("tanggal");
256 String jam_mulai = jsonObject1.getString("jam_mulai");
257 String jam_selesai = jsonObject1.getString("jam_selesai");
258 String status = jsonObject1.getString("status");
259 String created_at = jsonObject1.getString("created_at");
260 String updated_at = jsonObject1.getString("updated_at");
261 String latitude = jsonObject1.getString("latitude");
262 String longitude = jsonObject1.getString("longitude");
263
264 HashMap<String, String> hashMap = new HashMap<>();//create a hashmap to store the data in key value pair
265 hashMap.put("id", id);
266 hashMap.put("code", code);
267 hashMap.put("mata_kuliah_id", mata_kuliah_id);
268 hashMap.put("dosen_id", dosen_id);
269 hashMap.put("semester_id", semester_id);
270 hashMap.put("kelas_id", kelas_id);
271 hashMap.put("mata_kuliah", mata_kuliah);
272 hashMap.put("kelas", kelas);
273 hashMap.put("dosen", dosen);
274 hashMap.put("semester", semester);
275 hashMap.put("tahun_ajaran", tahun_ajaran);
276 hashMap.put("hari", hari);
277 hashMap.put("tanggal", tanggal);
278 hashMap.put("jam_mulai", jam_mulai);
279 hashMap.put("jam_selesai", jam_selesai);
280 hashMap.put("status", status);
281 hashMap.put("created_at", created_at);
282 hashMap.put("updated_at", updated_at);
283 hashMap.put("latitude", latitude);
284 hashMap.put("longitude", longitude);
285 jancok.add(hashMap);
286
287 JancokAdapter simpleAdapter = new JancokAdapter(JadwalKuliahActivity.this,
288 jancok, R.layout.adapter_jadwal_kuliah,
289 new String[]{"mata_kuliah", "id", "dosen", "semester", "kelas", "hari", "tanggal", "jam_mulai", "jam_selesai"},
290 new int[]{R.id.MenuJudul, R.id.jadwal_id, R.id.MenuNama, R.id.MenuSemester, R.id.MenuRuang, R.id.MenuHari, R.id.tanggal, R.id.MenuWaktuMulai, R.id.MenuWaktuSelesai}
291 );
292 listJadwal.setAdapter(simpleAdapter);
293 simpleAdapter.notifyDataSetChanged();
294 }
295 } else {
296 Toast.makeText(JadwalKuliahActivity.this, "Jadwal Kosong", Toast.LENGTH_SHORT).show();
297 }
298
299
300 } catch (JSONException e) {
301 e.printStackTrace();
302// progressDialog.dismiss();
303// sessionManager.destroySession();
304// Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
305// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
306// startActivity(intent);
307// finish();
308 }
309 progressDialog.dismiss();
310 }
311 }, new Response.ErrorListener() {
312 @Override
313 public void onErrorResponse(VolleyError error) {
314 Log.e("onResponse", error.getMessage(), error);
315 progressDialog.dismiss();
316 String responseBody = null;
317 responseBody = new String(error.networkResponse.data, StandardCharsets.UTF_8);
318 if (error instanceof AuthFailureError) {
319 Toast.makeText(JadwalKuliahActivity.this, "Session anda telah berakhir silahkan login kembali", Toast.LENGTH_SHORT).show();
320 sessionManager.destroySession();
321 Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
322 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
323 startActivity(intent);
324 Log.d(TAG, "onErrorResponse() called with: error = [" + responseBody + "]");
325// Toast.makeText(JadwalKuliahActivity.this, responseBody, Toast.LENGTH_SHORT).show();
326
327 } else if (error instanceof ServerError) {
328 // Snack("Something Wrongs");
329 Log.d(TAG, "onErrorResponse() called with: error = [" + responseBody + "]");
330// Toast.makeText(JadwalKuliahActivity.this, responseBody, Toast.LENGTH_SHORT).show();
331 } else if (error instanceof NetworkError) {
332 Log.d(TAG, "onErrorResponse() called with: error = [" + responseBody + "]");
333
334 AlertDialog.Builder builder1 = new AlertDialog.Builder(JadwalKuliahActivity.this);
335 builder1.setTitle("");
336 builder1.setMessage("");
337 builder1.setCancelable(false);
338 builder1.setPositiveButton(
339 "Ya",
340 new DialogInterface.OnClickListener() {
341 public void onClick(DialogInterface dialog, int id) {
342
343 }
344 });
345 builder1.setNegativeButton(
346 "Tidak",
347 new DialogInterface.OnClickListener() {
348 public void onClick(DialogInterface dialog, int id) {
349
350 }
351 });
352 final AlertDialog alert11 = builder1.create();
353 alert11.setOnShowListener(new DialogInterface.OnShowListener() {
354 @Override
355 public void onShow(DialogInterface dialogInterface) {
356 alert11.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.BLACK);
357 alert11.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.BLACK);
358 }
359 });
360 alert11.show();
361 } else if (error instanceof ParseError) {
362 // Snack(error.getMessage());
363 Log.e(TAG, "onErrorResponse: ERROR PARSE ");
364 } else {
365 }
366
367 }
368 }) { //no semicolon or coma
369 @Override
370 public Map<String, String> getHeaders() throws AuthFailureError {
371 Map<String, String> params = new HashMap<String, String>();
372 params.put("Authorization", "Bearer " + sessionManager.getKeyToken());
373 return params;
374 }
375 };
376 mQueue.add(jsonObjectRequest);
377
378
379// //RequestQueue initialized
380// mRequestQueue = Volley.newRequestQueue(this);
381//
382// //String Request initialized
383// mStringRequest = new StringRequest(Request.Method.GET, Htpp.getUrl()+"scheduler", new com.android.volley.Response.Listener<String>() {
384// @Override
385// public void onResponse(String response) {
386// Log.e("onResponse: ", response);
387// try {
388// JSONObject jsonObject = new JSONObject(response);
389// JSONArray jsonArray = jsonObject.getJSONArray("data");
390// for (int i = 0; i < jsonArray.length(); i++) {
391// JSONObject jsonObject1 = jsonArray.getJSONObject(i);
392// String id = jsonObject1.getString("id");
393// String code = jsonObject1.getString("code");
394// String mata_kuliah_id = jsonObject1.getString("mata_kuliah_id");
395// String dosen_id = jsonObject1.getString("dosen_id");
396// String semester_id = jsonObject1.getString("semester_id");
397// String kelas_id = jsonObject1.getString("kelas_id");
398// String mata_kuliah = jsonObject1.getString("mata_kuliah");
399// String kelas = jsonObject1.getString("kelas");
400// String dosen = jsonObject1.getString("dosen");
401// String semester = jsonObject1.getString("semester");
402// String tahun_ajaran = jsonObject1.getString("tahun_ajaran");
403// String jam_mulai = jsonObject1.getString("jam_mulai");
404// String jam_selesai = jsonObject1.getString("jam_selesai");
405// String status = jsonObject1.getString("status");
406// String created_at = jsonObject1.getString("created_at");
407// String updated_at = jsonObject1.getString("updated_at");
408//
409// HashMap<String, String> hashMap = new HashMap<>();//create a hashmap to store the data in key value pair
410// hashMap.put("id", id);
411// hashMap.put("code", code);
412// hashMap.put("mata_kuliah_id", mata_kuliah_id);
413// hashMap.put("dosen_id", dosen_id);
414// hashMap.put("semester_id", semester_id);
415// hashMap.put("kelas_id", kelas_id);
416// hashMap.put("mata_kuliah", mata_kuliah);
417// hashMap.put("kelas", kelas);
418// hashMap.put("dosen", dosen);
419// hashMap.put("semester", semester);
420// hashMap.put("tahun_ajaran", tahun_ajaran);
421// hashMap.put("jam_mulai", jam_mulai);
422// hashMap.put("jam_selesai", jam_selesai);
423// hashMap.put("status", status);
424// hashMap.put("created_at", created_at);
425// hashMap.put("updated_at", updated_at);
426// jancok.add(hashMap);
427//
428// simpleAdapter = new SimpleAdapter(JadwalKuliahActivity.this,
429// jancok , R.layout.adapter_jadwal_kuliah,
430// new String[]{"mata_kuliah", "id", "dosen", "semester", "kelas", "jam_mulai", "jam_selesai"},
431// new int[]{R.id.MenuJudul, R.id.jadwal_id, R.id.MenuNama, R.id.MenuSemester, R.id.MenuRuang, R.id.MenuWaktuMulai, R.id.MenuWaktuSelesai}
432// );
433// listJadwal.setAdapter(simpleAdapter);
434// simpleAdapter.notifyDataSetChanged();
435// }
436//
437// } catch (JSONException e) {
438// e.printStackTrace();
439// }
440// //Toast.makeText(getApplicationContext(), "Response :" + response, Toast.LENGTH_LONG).show();//display the response on screen
441//// dialog.dismiss();
442// }
443// }, new com.android.volley.Response.ErrorListener() {
444// @Override
445// public void onErrorResponse(VolleyError error) {
446//// dialog.dismiss();
447//
448// Log.e("Error API", "Error :" + error.toString());
449// }
450// });
451// mStringRequest.setRetryPolicy(new DefaultRetryPolicy(
452// 10000,
453// DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
454// DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
455// mRequestQueue.add(mStringRequest);
456 }
457
458// private void ListJadwalKuliah() {
459// Log.e("ListJadwalKuliah: ", sessionManager.getKeyToken());
460// gridLayoutManager = new GridLayoutManager(getApplicationContext(), 1, LinearLayoutManager.VERTICAL, false);
461// recyclerViewJadwalKuliah.setHasFixedSize(true);
462// recyclerViewJadwalKuliah.setLayoutManager(new LinearLayoutManager(this));
463// recyclerViewJadwalKuliah.setNestedScrollingEnabled(false);
464//
465// final ProgressDialog progressDialog = ProgressDialog.show(JadwalKuliahActivity.this, "Tunggu...", "Please Wait....");
466// progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
467// apiInterface = APIClient.getClient(Htpp.getUrl()).create(APIInterface.class);
468// Call<ModelJadwalKuliah> call = apiInterface.doGetAPIJadwal("Bearer "+sessionManager.getKeyToken());
469// call.enqueue(new Callback<ModelJadwalKuliah>() {
470// @Override
471// public void onResponse(Call<ModelJadwalKuliah> call, Response<ModelJadwalKuliah> response) {
472//
473// Log.e("onResponse: ", String.valueOf(response));
474// try {
475// progressDialog.dismiss();
476// List<ModelJadwalKuliah.DataBean> datalist = response.body().getData();
477// adapterJadwalKuliah = new adapter_jadwal_kuliah(datalist, getApplicationContext(), 0);
478// recyclerViewJadwalKuliah.setAdapter(adapterJadwalKuliah);
479//// if (response.body().toString() != "[]" && response.isSuccessful()) {
480//// progressDialog.dismiss();
481//// ModelJadwalKuliah items = response.body();
482//// ModelJadwalKuliah.DataBean _userID = items.getData();
483//// if (_userID.getStatus().equals("active")) {
484////// sessionManagerLogin.setLogin(true, _userID.getName(), _userID.getEmail(), _userID.getUsername(), _userID.getAuth());
485////// intent = new Intent(getApplicationContext(), MainActivity.class);
486////// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
487////// startActivity(intent);
488////
489//// if (_userID.getAuth().equals("mahasiswa")) {
490//// sessionManagerLogin.setLogin(true, _userID.getUsername(), _userID.getName(), _userID.getAuth(), _userID.getEmail());
491////// sessionManagerLogin.setLogin(true, _userID.getName(), _userID.getEmail(), _userID.getUsername(), _userID.getAuth());
492//// intent = new Intent(getApplicationContext(), MainActivity.class);
493//// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
494//// startActivity(intent);
495//// }
496////// else if (_userID.getAuth().equals("dosen")) {
497////// sessionManagerLogin.setLogin(true, _userID.getUsername(), _userID.getName(), _userID.getAuth(), _userID.getEmail());
498//////// sessionManagerLogin.setLogin(true, _userID.getName(), _userID.getEmail(), _userID.getUsername(), _userID.getAuth());
499////// intent = new Intent(getApplicationContext(), DosenActivity.class);
500////// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
501////// startActivity(intent);
502////// }
503//// else {
504//// Toast.makeText(getApplicationContext(), "Anda tidak mempunyai hak akeses.", Toast.LENGTH_SHORT).show();
505//// }
506//// } else {
507//// Toast.makeText(getApplicationContext(), "User Tidak ACTIVE.", Toast.LENGTH_SHORT).show();
508//// }
509//// }
510// } catch (Exception e) {
511// progressDialog.dismiss();
512// Toast.makeText(getApplicationContext(), "Password Salah.", Toast.LENGTH_SHORT).show();
513// }
514// }
515//
516// @Override
517// public void onFailure(Call<ModelJadwalKuliah> call, Throwable t) {
518// progressDialog.dismiss();
519// t.getMessage();
520// Toast.makeText(getApplicationContext(), "Gagal Terhubung Dengan API", Toast.LENGTH_SHORT).show();
521// }
522// });
523//
524//
525//// apiInterface = APIClient.getClient(Htpp.getUrl()).create(APIInterface.class);
526//// Call<List<ModelJadwalKuliah>> call = apiInterface.doGetAPIJadwal();
527//// call.enqueue(new Callback<List<ModelJadwalKuliah>>() {
528//// @Override
529//// public void onResponse(Call<List<ModelJadwalKuliah>> call, Response<List<ModelJadwalKuliah>> response) {
530//// if (response.isSuccessful() && response.body() != null) {
531//// Log.e(TAG, "onResponse: " + response.toString());
532////// ModelJadwalKuliah listMenu = response.body();
533//// List<ModelJadwalKuliah> ListMenu = response.body();
534//// adapter_jadwal_kuliah adapter_jadwal_kuliah2 = new adapter_jadwal_kuliah(ListMenu, getApplicationContext(), 0);
535//// recyclerViewJadwalKuliah.setAdapter(adapter_jadwal_kuliah2);
536//// }
537//// }
538////
539//// @Override
540//// public void onFailure(Call<List<ModelJadwalKuliah>> call, Throwable t) {
541//// Log.e(TAG, "onFailure: " + t.getMessage());
542//// }
543//// });
544//// Call<List<ModelDaftarPinjaman>> call = apiInterface.doGetAPIDaftarPinjamanSearch("KSP11", toString);
545//// ArrayList<Model_Jadwal_Kuliah> items = new ArrayList<>();
546//// recyclerViewJadwalKuliah.setLayoutManager(new GridLayoutManager(this, spanCount));
547//// recyclerViewJadwalKuliah.setHasFixedSize(false);
548//// recyclerViewJadwalKuliah.setNestedScrollingEnabled(true);
549//// adapter = new adapter_jadwal_kuliah(this, items);
550//// recyclerViewJadwalKuliah.setAdapter(adapter);
551//// items.add(new Model_Jadwal_Kuliah("Matematika Dasar", "Nadila Cindi Wantari", "Kelas C3030", "09.45-11.00", 1));
552//// items.add(new Model_Jadwal_Kuliah("Formasi Pertumbuhan Rohani", "Mega Adira Pratiwi ", "kelas C450", "11.00.45-11.40", 2));
553//// items.add(new Model_Jadwal_Kuliah("Psikologi Umum", "Aninditha Rahma Cahyadi", "Kelas C673", "13.00.45-13.30", 3));
554//// items.add(new Model_Jadwal_Kuliah("Sejarah Gereja", "Zeus Xaverius", "Kelas Keagamaan", "13.30-15.00", 4));
555// }
556}