use of com.example.clown.utilities.PreferenceManager in project Skool by NhatTruongK15.
the class BaseActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceManager preferenceManager = new PreferenceManager(getApplicationContext());
FirebaseFirestore database = FirebaseFirestore.getInstance();
documentReference = database.collection(Constants.KEY_COLLECTION_USERS).document(preferenceManager.getString(Constants.KEY_DOCUMENT_REFERENCE_ID));
}
use of com.example.clown.utilities.PreferenceManager in project Skool by NhatTruongK15.
the class GroupChatActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_group_chat);
binding = ActivityGroupChatBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
preferenceManager = new PreferenceManager(getApplicationContext());
getUsers();
setListener();
}
use of com.example.clown.utilities.PreferenceManager in project Skool by NhatTruongK15.
the class ResetPasswordActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityResetPasswordBinding.inflate(getLayoutInflater());
preferenceManager = new PreferenceManager(getApplicationContext());
// set up progressdialog
pd = new ProgressDialog(this);
pd.setTitle("Please wait...");
pd.setCanceledOnTouchOutside(false);
final String TAG = "onCodeSent";
// set up ui
binding.waitForEnteringPhoneNumberLayout.setVisibility(View.VISIBLE);
binding.verificationLayout.setVisibility(View.GONE);
setContentView(binding.getRoot());
mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
// This callback will be invoked in two situations:
// 1 - Instant verification. In some cases the phone number can be instantly
// verified without needing to send or enter a verification code.
// 2 - Auto-retrieval. On some devices Google Play services can automatically
// detect the incoming verification SMS and perform verification without
// user action.
Log.d(TAG, "onVerificationCompleted:" + credential);
ResetPhoneAuthCredential(credential);
}
@Override
public void onVerificationFailed(FirebaseException e) {
// This callback is invoked in an invalid request for verification is made,
// for instance if the the phone number format is not valid.
Log.w(TAG, "onVerificationFailed", e);
if (e instanceof FirebaseAuthInvalidCredentialsException) {
// Invalid request
} else if (e instanceof FirebaseTooManyRequestsException) {
// The SMS quota for the project has been exceeded
}
// Show a message and update the UI
}
@Override
public void onCodeSent(@NonNull String verificationId, @NonNull PhoneAuthProvider.ForceResendingToken token) {
// The SMS verification code has been sent to the provided phone number, we
// now need to ask the user to enter the code and then construct a credential
// by combining the code with a verification ID.
Log.d(TAG, "onCodeSent:" + verificationId);
// Save verification ID and resending token so we can use them later
mVerificationId = verificationId;
mResendToken = token;
pd.dismiss();
binding.verificationLayout.setVisibility(View.VISIBLE);
binding.waitForEnteringPhoneNumberLayout.setVisibility(View.GONE);
}
};
setListener();
}
use of com.example.clown.utilities.PreferenceManager in project Skool by NhatTruongK15.
the class UsersActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityUsersBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
preferenceManager = new PreferenceManager(getApplicationContext());
setListener();
getUsers();
}
Aggregations