Skip to content
Snippets Groups Projects
Commit aa953759 authored by darshanxyz's avatar darshanxyz
Browse files

RollNumber activity is no longer an issue!

parent 5fd7e589
No related branches found
No related tags found
No related merge requests found
......@@ -261,7 +261,7 @@ public class MainActivity extends AppCompatActivity {
// recepient = list1.get(0);
//
Toast.makeText(this, "OD has been requested", Toast.LENGTH_SHORT).show();
Log.e("DATA: ", reasonString + ", " + fromDate + ", " + toDate + ", " + full);
}
......
package com.darshanbshah.odsystem;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
......@@ -51,6 +52,7 @@ public class RollNumber extends AppCompatActivity implements AdapterView.OnItemS
DatabaseReference advisor;
HashMap <String,String> adv_map = new HashMap <String, String>();
ProgressDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -93,6 +95,10 @@ public class RollNumber extends AppCompatActivity implements AdapterView.OnItemS
advisors.setAdapter(adapter);
advisors.setOnItemSelectedListener(this);
dialog = new ProgressDialog(this);
dialog.setMessage("Please Wait");
dialog.show();
adv.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
......@@ -100,6 +106,24 @@ public class RollNumber extends AppCompatActivity implements AdapterView.OnItemS
lst.add(String.valueOf(dsp.getValue()));
Log.e("EMAILS: ", String.valueOf(dsp.getValue()));
}
if (lst.contains(mAuth.getCurrentUser().getEmail())) {
startActivity(new Intent(getApplicationContext(), TeacherActivity.class));
}
else {
SharedPreferences preferences = getSharedPreferences("ActivityPREF", Context.MODE_PRIVATE);
if(preferences.getBoolean("activity_executed", false)){
Intent intent = new Intent(RollNumber.this, MainActivity.class);
startActivity(intent);
finish();
dialog.hide();
}
else {
SharedPreferences.Editor edit = preferences.edit();
edit.putBoolean("activity_executed", true);
edit.commit();
}
}
}
@Override
......@@ -123,18 +147,7 @@ public class RollNumber extends AppCompatActivity implements AdapterView.OnItemS
}
});
// SharedPreferences preferences = getSharedPreferences("ActivityPREF", Context.MODE_PRIVATE);
//
// if(preferences.getBoolean("activity_executed", false)){
// Intent intent = new Intent(this, MainActivity.class);
// startActivity(intent);
// finish();
// }
// else {
// SharedPreferences.Editor edit = preferences.edit();
// edit.putBoolean("activity_executed", true);
// edit.commit();
// }
}
......
......@@ -61,7 +61,8 @@
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
<TextView
android:text="To: "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment