正在查看: St.John's v1.0.9 应用的 WizenozeChildrenActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: St.John's v1.0.9 应用的 WizenozeChildrenActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mcb.stjohnsemschool.activity;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.mcb.stjohnsemschool.adapter.WizenozeChildrensAdapter;
import com.mcb.stjohnsemschool.model.WizenozeChildrenModelClass;
import com.mcb.stjohnsemschool.services.ApiClient;
import com.mcb.stjohnsemschool.services.ApiInterface;
import com.mcb.stjohnsemschool.utils.TransparentProgressDialog;
import com.mcb.stjohnsemschool.utils.Utility;
import java.util.ArrayList;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class WizenozeChildrenActivity extends AppCompatActivity {
private static final String TAG = "com.mcb.stjohnsemschool.activity.WizenozeChildrenActivity";
public static Activity activity;
private Context context;
private SharedPreferences.Editor mEditor;
private FirebaseAnalytics mFirebaseAnalytics;
private TextView mNoData;
private TransparentProgressDialog mProgressbar;
private String serverApi;
private SharedPreferences sharedPreferences;
private String subjectGUID;
private String subjectId;
private String subjectName;
private ListView topicslv;
private String unitID;
private String unitName;
private String branchId = "0";
private String studentEnrollmentId = "0";
private String academicYearId = "0";
private String chapterJson = "";
private ArrayList<WizenozeChildrenModelClass> childrenList = new ArrayList<>();
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_wizenoze_clidrens);
this.mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
activity = this;
this.context = getApplicationContext();
getSupportActionBar();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Bundle extras = getIntent().getExtras();
this.unitID = extras.getString("UnitID", this.unitID);
this.serverApi = extras.getString("ServerApi", this.serverApi);
this.subjectId = extras.getString("SubjectId", this.subjectId);
this.unitName = extras.getString("UnitName", this.unitName);
getSupportActionBar().setTitle(this.unitName);
SharedPreferences sharedPreferences = this.context.getSharedPreferences("", 0);
this.studentEnrollmentId = sharedPreferences.getString("studentEnrollmentIdKey", this.studentEnrollmentId);
this.branchId = sharedPreferences.getString("BranchIdKey", this.branchId);
this.academicYearId = sharedPreferences.getString("academicyearIdKey", this.academicYearId);
this.mProgressbar = new TransparentProgressDialog(activity, R.drawable.spinner_loading_imag);
initializations();
}
private void initializations() {
SharedPreferences sharedPreferences = getSharedPreferences("", 0);
this.sharedPreferences = sharedPreferences;
SharedPreferences.Editor edit = sharedPreferences.edit();
this.mEditor = edit;
edit.putString("ServerApi", this.serverApi);
this.mEditor.commit();
this.mNoData = (TextView) findViewById(R.id.txv_no_data);
ListView listView = (ListView) findViewById(R.id.lst_wizenoze_children);
this.topicslv = listView;
listView.setDividerHeight(0);
this.mNoData.setVisibility(8);
this.topicslv.setVisibility(8);
getContent();
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
super.onBackPressed();
return true;
}
return super.onOptionsItemSelected(menuItem);
}
private void getContent() {
if (Utility.hasNetworkConnection(this.context)) {
getTopics();
} else {
Toast.makeText(this.context, "Check your Network Connection", 0).show();
}
}
private void getTopics() {
TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
this.mProgressbar.show();
}
((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).getWizeNozeLibraryUnitsNew(Integer.parseInt(this.subjectId), Integer.parseInt(this.unitID), Integer.parseInt(this.studentEnrollmentId), this.serverApi, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<WizenozeChildrenModelClass>>() {
public void onResponse(Call<ArrayList<WizenozeChildrenModelClass>> call, Response<ArrayList<WizenozeChildrenModelClass>> response) {
if (WizenozeChildrenActivity.this.mProgressbar != null && WizenozeChildrenActivity.this.mProgressbar.isShowing()) {
WizenozeChildrenActivity.this.mProgressbar.dismiss();
}
if (response != null && response.body() != null) {
WizenozeChildrenActivity.this.childrenList.clear();
WizenozeChildrenActivity.this.childrenList = (ArrayList) response.body();
WizenozeChildrenActivity.this.topicslv.setAdapter(new WizenozeChildrensAdapter(WizenozeChildrenActivity.this.context, WizenozeChildrenActivity.activity, WizenozeChildrenActivity.this.childrenList));
if (WizenozeChildrenActivity.this.childrenList.size() > 0) {
WizenozeChildrenActivity.this.mNoData.setVisibility(8);
WizenozeChildrenActivity.this.topicslv.setVisibility(0);
return;
} else {
WizenozeChildrenActivity.this.mNoData.setVisibility(0);
WizenozeChildrenActivity.this.topicslv.setVisibility(8);
return;
}
}
Utility.showAlertDialog(WizenozeChildrenActivity.activity);
}
public void onFailure(Call<ArrayList<WizenozeChildrenModelClass>> call, Throwable th) {
if (WizenozeChildrenActivity.this.mProgressbar != null && WizenozeChildrenActivity.this.mProgressbar.isShowing()) {
WizenozeChildrenActivity.this.mProgressbar.dismiss();
}
Utility.showAlertDialog(WizenozeChildrenActivity.activity);
}
});
}
protected void onResume() {
super.onResume();
getContent();
}
protected void onStop() {
TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
if (transparentProgressDialog != null && transparentProgressDialog.isShowing()) {
this.mProgressbar.dismiss();
}
super.onStop();
}
}