Skip to content

Commit

Permalink
Make master branch more stable (#234)
Browse files Browse the repository at this point in the history
* Change profile photo update progress bar

* Added Label for Edittext

* added margin

* Cache skip in Glide

* Edit Profile back button handled

* feat: Implement group notificatio

* feat: Implement change password api

* Added Utils class

* reformat lines spacing

* typo fix

* Removed unnecessary toast

* feat: Implement resend OTP API

* feat: Refactor logout, unsubscribe notification

* reformat spacing

* Added back button in otp activity

* Removed back button in Login page

* feat: Handle offline mode in login signup

* Handled empty edittext

* fix: Display employment type

* changed some fields

* View fullscreen gallery image

* Add signup error dialog

* empty edittext

* Fixed Nav issue on back pressed

* Handle back from profile page

* Add scrollview

* Handled Orientation Change in Fragments

* Updated Retrofit link (#202)

* Added Videos Fragment (#203)

* feat: Implement forgot password feature (#206)

* Enhance UI of event details page (#208)

* Visibility in View Profile incase of empty fields (#209)

* feat: Add videos of saar (#211)

* remove toast (#215)

* Added Square Logo (#216)

* fix: skip press issue in login page (#218)

* Enhance ui of video fragment (#219)

* Revert "fix: skip press issue in login page (#218)" (#220)

This reverts commit 88f8666.

* fix: Few UI improvements (#222)

* UI fix in Change password

* Improved login UI

* Otp pin (#223)

* Clear otp pinview

* Fix errors

* remove log messages (#225)

* remove log statements

* fix team fragment

* Update changes

* Update changes

* Mainactivity as opening screen (#230)

* patch: CircleImageView issue  (#231)

* Encoded Bitmap

* Improved Homepage and nav header

* fix: Check Permission properly (#227)

* Check Permission properly

* recheck permission

* feat: Implement skip login feature (#233)
  • Loading branch information
atm1504 authored Jun 20, 2019
1 parent 5146737 commit 75376bf
Show file tree
Hide file tree
Showing 64 changed files with 2,214 additions and 1,004 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added app/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ dependencies {
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.jakewharton.timber:timber:4.7.0'
implementation 'com.github.GoodieBag:Pinview:v1.3'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
}
15 changes: 10 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,25 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".Login_SignUp.LoginSignupActivity"
android:windowSoftInputMode="adjustPan">
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Gallery.FullScreenImageActivity"
android:label="@string/photo" />
<activity
android:name=".Login_SignUp.LoginSignupActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".Profile.ProfileActivity"
android:parentActivityName=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ChangeCredentials.ChangeCredentialsActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ protected void onCreate(Bundle savedInstanceState) {
}else if (getIntent().getStringExtra("EXTRA").equals("openChangeEmail")){
ft.replace(R.id.fragment_credentials_container, new ChangeEmailFragment());
ft.commit();
} else if (getIntent().getStringExtra("EXTRA").equals("openChangePassword")){
ft.replace(R.id.fragment_credentials_container, new ChangePasswordFragment());
ft.commit();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -25,6 +24,7 @@
import com.example.saar.Constant;
import com.example.saar.OtpActivity;
import com.example.saar.R;
import com.example.saar.Utils.Utils;

import org.json.JSONArray;
import org.json.JSONException;
Expand All @@ -46,11 +46,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_change_email, container, false);
old_email=rootView.findViewById(R.id.old_email_text);
new_email=rootView.findViewById(R.id.new_email_text);
password=rootView.findViewById(R.id.password_text);
rollno=rootView.findViewById(R.id.roll_text);
emailChangeButton=rootView.findViewById(R.id.email_change_button);
old_email = rootView.findViewById(R.id.old_email_text);
new_email = rootView.findViewById(R.id.new_email_text);
password = rootView.findViewById(R.id.password_text);
rollno = rootView.findViewById(R.id.roll_text);
emailChangeButton = rootView.findViewById(R.id.email_change_button);
return rootView;
}

Expand All @@ -62,12 +62,24 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
emailChangeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
requestEmailChange();
String old_email_text = old_email.getText().toString();
String new_email_text = new_email.getText().toString();
String password_text = password.getText().toString();
String roll_text = rollno.getText().toString();

if (old_email_text.isEmpty() || new_email_text.isEmpty() || password_text.isEmpty() || roll_text.isEmpty())
Toast.makeText(getContext(), getResources().getString(R.string.enter_all_fields), Toast.LENGTH_LONG).show();
else if (Utils.isNetworkConnected(getContext())) {
requestEmailChange();
} else {
Toast.makeText(getContext(), getString(R.string.no_internet), Toast.LENGTH_LONG).show();
}
}
});
}

private void requestEmailChange() {
Utils.closeKeyboard(getView(), getContext());
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Sending request....");
progressDialog.show();
Expand All @@ -77,7 +89,6 @@ private void requestEmailChange() {
public void onResponse(String response) {
progressDialog.dismiss();
Timber.d(response);
Log.d("KHANKI","Response - " +response);
try {
JSONObject jsonObject = new JSONObject(response);
int status = Integer.parseInt(jsonObject.getString("status"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,162 @@
package com.example.saar.ChangeCredentials;

import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.saar.Constant;
import com.example.saar.Login_SignUp.LoginSignupActivity;
import com.example.saar.R;
import com.example.saar.Utils.Utils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

import timber.log.Timber;

public class ChangePasswordFragment extends Fragment {

EditText old_password, new_password, confirm_new_password;
Button reset_password;
ProgressDialog progressDialog;
SharedPreferences preferences;
SharedPreferences.Editor editor;
Boolean forgot_password = false;
String rollno;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_change_password, container, false);
View rootView = inflater.inflate(R.layout.fragment_change_password, container, false);
old_password = rootView.findViewById(R.id.chng_old_password);
new_password = rootView.findViewById(R.id.chng_new_password);
confirm_new_password = rootView.findViewById(R.id.chng_confirm_new_password);
reset_password = rootView.findViewById(R.id.password_reset_button);
preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
return rootView;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle(R.string.change_password_fragment);

if(getActivity().getIntent().hasExtra("rollno")){
forgot_password=true;
old_password.setText("Dummy");
view.findViewById(R.id.oldPasswordInputLayout).setVisibility(View.GONE);
rollno=getActivity().getIntent().getStringExtra("rollno");
}

reset_password.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String old_password_text = old_password.getText().toString();
String new_password_text = new_password.getText().toString();
String confirm_new_password_text = confirm_new_password.getText().toString();

if (old_password_text.isEmpty() || new_password_text.isEmpty() || confirm_new_password_text.isEmpty())
Toast.makeText(getContext(), getResources().getString(R.string.enter_all_fields), Toast.LENGTH_LONG).show();
else if (!(new_password_text.equals(confirm_new_password_text)))
Toast.makeText(getContext(), getResources().getString(R.string.password_mismatch), Toast.LENGTH_LONG).show();
else if (Utils.isNetworkConnected(getContext())) {
resetPassword();
} else {
Toast.makeText(getContext(), getString(R.string.no_internet), Toast.LENGTH_LONG).show();
}
}
});
}

private void resetPassword() {
Utils.closeKeyboard(getView(), getContext());
progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage("Resetting....");
progressDialog.show();
StringRequest stringRequest = new StringRequest(Request.Method.POST, Constant.CHANGE_PASSWORD_URL, new Response.Listener<String>() {

@Override
public void onResponse(String response) {
Timber.d(response);
progressDialog.dismiss();
try {
JSONObject jsonObject = new JSONObject(response);
int status = Integer.parseInt(jsonObject.getString("status"));
if (status == 207) {
Toast.makeText(getContext(), getString(R.string.change_password_succesfull), Toast.LENGTH_LONG).show();
if(preferences.getBoolean(Constant.LOGIN_STATUS,false)){
Utils.unsuscribeFromNotification(preferences.getString(Constant.ROLLNO, ""));
Utils.logout(editor, getContext());
}else{
Intent intent = new Intent(getContext(), LoginSignupActivity.class);
startActivity(intent);
}

} else {

JSONArray jsonArray = jsonObject.getJSONArray("messages");
Toast.makeText(getActivity(), jsonArray.toString(), Toast.LENGTH_LONG).show();
Timber.d(jsonArray.toString());
}

} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Timber.d(error.toString());
}

}) {
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();

params.put("old_password", old_password.getText().toString());
params.put("new_password", new_password.getText().toString());
params.put("confirm_password", confirm_new_password.getText().toString());
if(forgot_password){
params.put("forgot_password","forgot_password");
params.put("rollno",rollno);
}else{
params.put("rollno", preferences.getString(Constant.ROLLNO, ""));
}
return params;
}
};
stringRequest.setRetryPolicy(new DefaultRetryPolicy(
10000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

RequestQueue requestQueue = Volley.newRequestQueue(getContext());
Request<String> data = requestQueue.add(stringRequest);
}
}
Loading

0 comments on commit 75376bf

Please sign in to comment.