正在查看: St.John's v1.0.9 应用的 Theme2HomeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: St.John's v1.0.9 应用的 Theme2HomeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mcb.stjohnsemschool.activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mcb.stjohnsemschool.fragment.ManageSiblingsFragment;
import com.mcb.stjohnsemschool.fragment.McbLiveWebinorsFragment;
import com.mcb.stjohnsemschool.fragment.NotificationsFragment;
import com.mcb.stjohnsemschool.model.StudentInActiveMenusModel;
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 Theme2HomeActivity extends AppCompatActivity {
public static final String TAG = "com.mcb.stjohnsemschool.activity.Theme2HomeActivity";
public static AppCompatActivity mActivityObj;
private Context context;
private ImageButton home_nav;
private ImageButton live_nav;
private String mBranchName;
private SharedPreferences.Editor mEditor;
private String mOrganisationName;
private TransparentProgressDialog mProgressbar;
private SharedPreferences mSharedPref;
private ImageButton manage_nav;
private ImageButton notification_nav;
private String orgId;
private String notiType = "";
private String ServiceURL = "";
private Dialog mAppBackDialog = null;
private String live_classes_url = "";
protected void onCreate(Bundle bundle) {
String str;
super.onCreate(bundle);
setContentView(R.layout.activity_theme2_home);
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
firebaseAnalytics.setCurrentScreen(this, "Profile Screen", null);
firebaseAnalytics.setAnalyticsCollectionEnabled(true);
mActivityObj = this;
this.context = getApplicationContext();
this.mProgressbar = new TransparentProgressDialog(mActivityObj, R.drawable.spinner_loading_imag);
if (getIntent().hasExtra("type")) {
this.notiType = getIntent().getStringExtra("type");
}
if (!getIntent().hasExtra("ToActivity")) {
str = "";
} else {
str = getIntent().getStringExtra("ToActivity");
}
initializations();
if (str.equalsIgnoreCase("Notifications")) {
this.notification_nav.performClick();
} else if (str.equalsIgnoreCase("Mcb Live")) {
this.live_nav.performClick();
} else {
this.manage_nav.performClick();
}
}
private void createBackDialog() {
Dialog dialog = new Dialog(this);
this.mAppBackDialog = dialog;
dialog.setContentView(R.layout.dialog_close_app);
this.mAppBackDialog.setCancelable(false);
Button button = (Button) this.mAppBackDialog.findViewById(R.id.btn_no);
Button button2 = (Button) this.mAppBackDialog.findViewById(R.id.btn_yes);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Theme2HomeActivity.this.mAppBackDialog == null || !Theme2HomeActivity.this.mAppBackDialog.isShowing()) {
return;
}
Theme2HomeActivity.this.mAppBackDialog.dismiss();
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Theme2HomeActivity.this.mAppBackDialog != null && Theme2HomeActivity.this.mAppBackDialog.isShowing()) {
Theme2HomeActivity.this.mAppBackDialog.dismiss();
}
Theme2HomeActivity.this.finish();
}
});
}
private void initializations() {
SharedPreferences sharedPreferences = getSharedPreferences("", 0);
this.mSharedPref = sharedPreferences;
this.mEditor = sharedPreferences.edit();
createBackDialog();
this.ServiceURL = this.mSharedPref.getString("schoolNameURLkey", this.ServiceURL);
this.live_classes_url = this.mSharedPref.getString("StudentGUID", this.live_classes_url);
this.mBranchName = this.mSharedPref.getString("branchnameKey", this.mBranchName);
this.mOrganisationName = this.mSharedPref.getString("OrganisationNameKey", this.mOrganisationName);
this.orgId = this.mSharedPref.getString("orgnizationIdKey", this.orgId);
final String string = this.mSharedPref.getString("OrganisationNameKey", getResources().getString(2131886124));
getSupportActionBar().setTitle(string);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
Window window = mActivityObj.getWindow();
window.clearFlags(67108864);
window.addFlags(Integer.MIN_VALUE);
window.setStatusBarColor(ContextCompat.getColor(mActivityObj, R.color.ColorPrimary_New_New));
ImageButton imageButton = (ImageButton) findViewById(R.id.home_nav1);
this.home_nav = imageButton;
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Theme2HomeActivity.this.live_nav.clearColorFilter();
Theme2HomeActivity.this.notification_nav.clearColorFilter();
Theme2HomeActivity.this.manage_nav.clearColorFilter();
Theme2HomeActivity.this.home_nav.setColorFilter(Theme2HomeActivity.this.getResources().getColor(R.color.backgroundTint));
Theme2HomeActivity.this.getInActiveMenus(Theme2HomeActivity.this.mSharedPref.getString("studentEnrollmentIdKey", "0"), Theme2HomeActivity.this.mSharedPref.getBoolean("IsAllMenus", true));
}
});
ImageButton imageButton2 = (ImageButton) findViewById(R.id.users_nav);
this.manage_nav = imageButton2;
imageButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Theme2HomeActivity.this.home_nav.clearColorFilter();
Theme2HomeActivity.this.live_nav.clearColorFilter();
Theme2HomeActivity.this.notification_nav.clearColorFilter();
Theme2HomeActivity.this.manage_nav.setColorFilter(Theme2HomeActivity.this.getResources().getColor(R.color.backgroundTint));
Theme2HomeActivity.this.replaceFragment(new ManageSiblingsFragment(), string);
}
});
ImageButton imageButton3 = (ImageButton) findViewById(R.id.noti_nav);
this.notification_nav = imageButton3;
imageButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Theme2HomeActivity.this.home_nav.clearColorFilter();
Theme2HomeActivity.this.manage_nav.clearColorFilter();
Theme2HomeActivity.this.live_nav.clearColorFilter();
Theme2HomeActivity.this.notification_nav.setColorFilter(Theme2HomeActivity.this.getResources().getColor(R.color.backgroundTint));
Theme2HomeActivity.this.replaceFragment(new NotificationsFragment(), "Notifications");
}
});
ImageButton imageButton4 = (ImageButton) findViewById(R.id.live_nav);
this.live_nav = imageButton4;
imageButton4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Theme2HomeActivity.this.home_nav.clearColorFilter();
Theme2HomeActivity.this.manage_nav.clearColorFilter();
Theme2HomeActivity.this.notification_nav.clearColorFilter();
Theme2HomeActivity.this.live_nav.clearColorFilter();
Theme2HomeActivity.this.live_nav.setColorFilter(Theme2HomeActivity.this.getResources().getColor(R.color.backgroundTint));
Theme2HomeActivity.this.replaceFragment(new McbLiveWebinorsFragment(), "MCB Live");
}
});
}
public void replaceFragment(Fragment fragment, String str) {
if (fragment != null) {
setTitle(str);
getSupportActionBar().setTitle(str);
getSupportFragmentManager().beginTransaction().replace(R.id.view_container, fragment).commit();
}
}
protected void onResume() {
String string = this.mSharedPref.getString("usernamekey", "");
Bundle bundle = new Bundle();
bundle.putString("user_name", string);
FirebaseAnalytics.getInstance(this).logEvent("PAGE_SIBLING_LIST", bundle);
super.onResume();
}
public void onBackPressed() {
backPress();
}
private void backPress() {
Dialog dialog = this.mAppBackDialog;
if (dialog == null || dialog.isShowing()) {
return;
}
this.mAppBackDialog.show();
}
protected void onDestroy() {
mActivityObj = null;
super.onDestroy();
}
public void getInActiveMenus(String str, boolean z) {
ConnectivityManager connectivityManager = (ConnectivityManager) this.context.getSystemService("connectivity");
if (connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isAvailable() && connectivityManager.getActiveNetworkInfo().isConnected()) {
getStudentInActiveMenus(str, z);
} else {
Toast.makeText(this.context, "Check your Network Connection", 0).show();
}
}
private void getStudentInActiveMenus(String str, final boolean z) {
try {
String string = this.mSharedPref.getString("UseridKey", "0");
String str2 = Build.MODEL;
String str3 = Build.MANUFACTURER;
String string2 = this.mSharedPref.getString("usernamekey", "");
String str4 = "Android," + str3 + "," + str2;
String deviceId = Utility.getDeviceId(mActivityObj);
TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
this.mProgressbar.show();
}
((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetStudentInActiveMenusNew(Integer.parseInt(str), string, str4, deviceId, "Android", string2, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<StudentInActiveMenusModel>>() {
public void onResponse(Call<ArrayList<StudentInActiveMenusModel>> call, Response<ArrayList<StudentInActiveMenusModel>> response) {
if (Theme2HomeActivity.this.mProgressbar != null && Theme2HomeActivity.this.mProgressbar.isShowing()) {
Theme2HomeActivity.this.mProgressbar.dismiss();
}
if (response != null && response.body() != null) {
new ArrayList();
Theme2HomeActivity.this.mEditor.putString("InActiveMenus", new Gson().toJson((ArrayList) response.body(), new TypeToken<ArrayList<StudentInActiveMenusModel>>() {
}.getType()));
Theme2HomeActivity.this.mEditor.commit();
Theme2HomeActivity.this.pageNavigation(z);
return;
}
Utility.showAlertDialog(Theme2HomeActivity.mActivityObj);
}
public void onFailure(Call<ArrayList<StudentInActiveMenusModel>> call, Throwable th) {
if (Theme2HomeActivity.this.mProgressbar != null && Theme2HomeActivity.this.mProgressbar.isShowing()) {
Theme2HomeActivity.this.mProgressbar.dismiss();
}
Utility.showAlertDialog(Theme2HomeActivity.mActivityObj);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
public void pageNavigation(boolean z) {
if (z) {
startActivity(new Intent(this.context, (Class<?>) NavigationActivity.class));
finish();
} else {
startActivity(new Intent(this.context, (Class<?>) FeeActivity.class));
}
}
}