Skip to content

Commit

Permalink
Link
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinavlamba committed Jan 15, 2019
1 parent 58a0cb5 commit 63145db
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
13 changes: 8 additions & 5 deletions app/src/main/java/com/foodx/nsh/activity/FirebaseLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class FirebaseLogin extends AppCompatActivity {
String number;
ImageView login_display;
private List<AuthUI.IdpConfig> providers;
SharedPreferences sharedPreferences;
// private SharedPref sharedPref;

@Override
Expand All @@ -55,11 +56,10 @@ protected void onCreate(Bundle savedInstanceState) {

providers = Arrays.asList(
new AuthUI.IdpConfig.PhoneBuilder().build());

final SharedPreferences sharedPreferences = getSharedPreferences("number", Context.MODE_PRIVATE);
sharedPreferences = getSharedPreferences("number", Context.MODE_PRIVATE);
String Login = sharedPreferences.getString("Login", "gsbs");

if (Login.equals("Complete")) {
// Log.v("ABSSSSDD",sharedPreferences.getString("phone",null));
startActivity(new Intent(this, MainActivity.class));
finish();
}
Expand All @@ -69,6 +69,7 @@ public void onLoginBtnClick(View v) {
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.setTheme(R.style.AppTheme)
.setLogo(R.drawable.ic_launcher_background)
.build(),
RC_SIGN_IN);
Expand All @@ -86,6 +87,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// Successfully signed in
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
Log.d("pno.: ", user.getPhoneNumber().substring(3));
SharedPreferences.Editor num = sharedPreferences.edit();
num.putString("mobile",user.getPhoneNumber().substring(3));
num.apply();
Log.d("uid: ", user.getUid());
checkUser(user.getPhoneNumber().substring(3));
// checkUser("");
Expand All @@ -112,17 +116,16 @@ private void checkUser(final String phone_no) {
} else {
SharedPreferences.Editor editor = getSharedPreferences("number", MODE_PRIVATE).edit();
editor.putString("phone", number);
// Log.v("KOOKO","ABSS"+number);
editor.apply();
saveLoginStatus();
Intent intent = new Intent(FirebaseLogin.this, MainActivity.class);
startActivity(intent);
}
}

private void saveLoginStatus() {
final SharedPreferences sharedPreferences = getSharedPreferences("number", Context.MODE_PRIVATE);
final SharedPreferences.Editor editor = sharedPreferences.edit();

editor.putString("Login", "Complete");
editor.commit();
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/foodx/nsh/dialog/OrderDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ protected void onCreate(Bundle savedInstanceState) {
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
SharedPreferences sharedPreferences1 = activity.getSharedPreferences("number", Context.MODE_PRIVATE);
totalB = findViewById(R.id.total);
// SharedPreferences prefs = getContext().getSharedPreferences("number", MODE_PRIVATE);
// SharedPreferences.Editor editor3 = prefs.edit();
// String restoredText = prefs.getString("phone", null);
// editor3.commit();
// Log.v("HALLO",restoredText);
SharedPreferences prefs = getContext().getSharedPreferences("number", MODE_PRIVATE);
SharedPreferences.Editor editor3 = prefs.edit();
String restoredText = prefs.getString("mobile", null);
editor3.commit();
// Log.v("HALLO","ABC" + restoredText);
totalB.setText("Total : "+String.valueOf(total));
editText = findViewById(R.id.name);
editText1 = findViewById(R.id.address);
editText2 = findViewById(R.id.mobile);

editText2.setText(restoredText);
button = findViewById(R.id.postorder);
button.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/layout/fragment_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
android:layout_marginRight="8dp"
android:text="We are bunch of computer science engineers trying simplify the procedure of food ordering in Hamirpur city and to provide you with the best delicacies available at your doorstep."
android:fontFamily="@font/psb"
android:textSize="20sp"/>
android:textSize="16sp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
Expand Down Expand Up @@ -72,9 +72,10 @@
android:textAlignment="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:singleLine="true"
android:text="[email protected]"
android:fontFamily="@font/psb"
android:textSize="20sp"/>
android:textSize="16sp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
Expand Down Expand Up @@ -105,9 +106,9 @@
android:textAlignment="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:text="The rates and variety of food is provided by all the restaurants available in the city. While we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the taste, quality, ingredients or availability of the food with respect to the app or the products or services contained on the app for any purpose. Any order you place based on this app is strictly at your own risk. We currently don't provide any home-delivery and therefore no such greviance will be encountered on our behalf."
android:text="The rates and variety of food is provided by all the restaurants available in the city. While we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the taste, quality, ingredients or availability of the food with respect to the app or the products or services contained on the app for any purpose. Home-delivery is provided by respective restaurant staff,no such greviance will be encountered on our behalf."
android:fontFamily="@font/psb"
android:textSize="20sp"/>
android:textSize="16sp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
Expand Down

0 comments on commit 63145db

Please sign in to comment.