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

Better UI

parent c291a9be
Branches
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ public class CustomListAdapter extends ArrayAdapter { ...@@ -23,7 +23,7 @@ public class CustomListAdapter extends ArrayAdapter {
static class DataHandler { static class DataHandler {
TextView tv, tv1; TextView tv, tv1, tv2, tv3, tv4;
} }
List list = new ArrayList(); List list = new ArrayList();
...@@ -65,7 +65,9 @@ public class CustomListAdapter extends ArrayAdapter { ...@@ -65,7 +65,9 @@ public class CustomListAdapter extends ArrayAdapter {
row = inflater.inflate(R.layout.list_item, parent, false); row = inflater.inflate(R.layout.list_item, parent, false);
handler = new DataHandler(); handler = new DataHandler();
handler.tv = (TextView)row.findViewById(R.id.listText); handler.tv = (TextView)row.findViewById(R.id.listText);
handler.tv1 = (TextView)row.findViewById(R.id.listTextEmail); handler.tv1 = (TextView)row.findViewById(R.id.listTextReason);
handler.tv2 = (TextView)row.findViewById(R.id.fromText);
handler.tv3 = (TextView)row.findViewById(R.id.toText);
row.setTag(handler); row.setTag(handler);
} }
else { else {
...@@ -76,8 +78,13 @@ public class CustomListAdapter extends ArrayAdapter { ...@@ -76,8 +78,13 @@ public class CustomListAdapter extends ArrayAdapter {
DataProvider provider = (DataProvider) this.getItem(position); DataProvider provider = (DataProvider) this.getItem(position);
handler.tv.setText(provider.getRollno()); handler.tv.setText(provider.getRollno());
handler.tv1.setText(provider.getReason()); handler.tv1.setText(provider.getReason());
handler.tv2.setText(provider.getFrom());
handler.tv3.setText(provider.getTo());
// handler.tv.setTypeface(one); // handler.tv.setTypeface(one);
handler.tv.setTextSize(20); handler.tv.setTextSize(30);
handler.tv1.setTextSize(20);
handler.tv2.setTextSize(20);
handler.tv3.setTextSize(20);
return row; return row;
} }
} }
...@@ -260,16 +260,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -260,16 +260,7 @@ public class MainActivity extends AppCompatActivity {
// recepient = list1.get(0); // recepient = list1.get(0);
// //
// Intent intent = new Intent(Intent.ACTION_SEND);
// intent.setData(Uri.parse("mailto:"));
//
// Log.e("Recepient", recepient);
// intent.putExtra(Intent.EXTRA_EMAIL, recepient);
// intent.putExtra(Intent.EXTRA_SUBJECT, "OD Request");
// intent.putExtra(Intent.EXTRA_TEXT, "Reason: " + reasonString + '\n' + "From: " + fromDate + '\n' + "To: " + toDate + '\n' + "Full day: " + full);
// intent.setType("message/rfc822");
// Intent chooser = Intent.createChooser(intent, "Send email");
// startActivity(chooser);
Log.e("DATA: ", reasonString + ", " + fromDate + ", " + toDate + ", " + full); Log.e("DATA: ", reasonString + ", " + fromDate + ", " + toDate + ", " + full);
......
...@@ -3,12 +3,15 @@ package com.darshanbshah.odsystem; ...@@ -3,12 +3,15 @@ package com.darshanbshah.odsystem;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseAuth;
...@@ -38,6 +41,7 @@ public class TeacherActivity extends AppCompatActivity { ...@@ -38,6 +41,7 @@ public class TeacherActivity extends AppCompatActivity {
} }
} }
String []recepients = {};
ODTable table; ODTable table;
int i = 0; int i = 0;
AlertDialog.Builder builder; AlertDialog.Builder builder;
...@@ -154,14 +158,17 @@ public class TeacherActivity extends AppCompatActivity { ...@@ -154,14 +158,17 @@ public class TeacherActivity extends AppCompatActivity {
} }
for (DataSnapshot data : dataSnapshot.getChildren()) { for (DataSnapshot data : dataSnapshot.getChildren()) {
for (DataSnapshot d : data.getChildren()) { for (DataSnapshot d : data.getChildren()) {
Log.e("DATA_KEY", dataSnapshot.getKey()); if (dataSnapshot.getKey().equals(adv_name)) {
if (dataSnapshot.getKey().equals(adv_name)) Log.e("D_VAL", d.getValue().toString());
random.add(d.getValue().toString()); random.add(d.getValue().toString());
} }
}
// for (int i = 0; i < random.size(); i++) { // for (int i = 0; i < random.size(); i++) {
// Log.e("RANDOM_VALS", data.getKey() + ' ' + random.get(i)); // Log.e("RANDOM_VALS", data.getKey() + ' ' + random.get(i));
// //
// } // }
for (int i = 0; i < random.size(); i++) {
if (random.size() != 0) { if (random.size() != 0) {
try { try {
flag = random.get(0); flag = random.get(0);
...@@ -171,13 +178,14 @@ public class TeacherActivity extends AppCompatActivity { ...@@ -171,13 +178,14 @@ public class TeacherActivity extends AppCompatActivity {
to = random.get(4); to = random.get(4);
table = new ODTable(flag, reason, from, to, fullday); table = new ODTable(flag, reason, from, to, fullday);
odtable.put(data.getKey(), table); odtable.put(data.getKey(), table);
random.clear();
} }
catch (Exception e) { catch (Exception e) {
} }
} }
}
random.clear();
} }
...@@ -269,6 +277,17 @@ public class TeacherActivity extends AppCompatActivity { ...@@ -269,6 +277,17 @@ public class TeacherActivity extends AppCompatActivity {
} }
}); });
TextView textView = (TextView)findViewById(R.id.listText);
textView.setTextColor(Color.parseColor("#12bfac"));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_EMAIL, recepients);
intent.putExtra(Intent.EXTRA_SUBJECT, "OD Request");
intent.putExtra(Intent.EXTRA_TEXT, "Reason: " + reason + '\n' + "From: " + from + '\n' + "To: " + to + '\n' + "Full day: " + fullday);
intent.setType("message/rfc822");
Intent chooser = Intent.createChooser(intent, "Send email");
startActivity(chooser);
} }
}); });
itemValue = (DataProvider) adapter.getItem(position); itemValue = (DataProvider) adapter.getItem(position);
......
...@@ -6,6 +6,26 @@ ...@@ -6,6 +6,26 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="com.darshanbshah.odsystem.TeacherActivity"> tools:context="com.darshanbshah.odsystem.TeacherActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:background="@color/colorPrimary"
android:id="@+id/topHolder"
android:layout_height="55dp">
<TextView
android:text="Pending ODs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:id="@+id/pendingTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignBottom="@+id/button2"
android:layout_alignParentStart="true"
android:layout_weight="1"
android:textColor="#FFF"
android:layout_gravity="center_vertical"/>
<Button <Button
android:text="Logout" android:text="Logout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -14,16 +34,20 @@ ...@@ -14,16 +34,20 @@
android:onClick="signOut" android:onClick="signOut"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
style="@style/Widget.AppCompat.Button.Borderless.Colored" /> style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_weight="1"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/button2"
android:layout_alignParentStart="true"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="41dp"> android:layout_below="@+id/topHolder"
android:layout_centerHorizontal="true">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -40,14 +64,4 @@ ...@@ -40,14 +64,4 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<TextView
android:text="Pending ODs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:id="@+id/pendingTitle"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignBottom="@+id/button2"
android:layout_alignParentStart="true" />
</RelativeLayout> </RelativeLayout>
...@@ -2,19 +2,82 @@ ...@@ -2,19 +2,82 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
android:id="@+id/list_item"> android:id="@+id/list_item">
<TextView <TextView
android:id="@+id/listText" android:id="@+id/listText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="wrap_content"
/> />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="Reason: "
android:layout_height="wrap_content"
android:id="@+id/reasonLabel"
android:layout_weight="1"
android:textStyle="normal|bold"
android:textSize="20dp"
android:layout_width="150dp"
android:textAlignment="textStart" />
<TextView <TextView
android:id="@+id/listTextEmail" android:id="@+id/listTextReason"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:layout_width="200dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content">
/>
<TextView
android:text="From: "
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="@+id/fromLabel"
android:textStyle="normal|bold"
android:textSize="20dp"
android:textAlignment="viewStart" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fromText"
android:layout_weight="1.82"
android:textAlignment="viewStart" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="To: "
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="@+id/toLabel"
android:textStyle="normal|bold"
android:textSize="20dp"
android:textAlignment="viewStart" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/toText"
android:layout_weight="1"
android:textAlignment="viewStart" />
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#3f51b5</color> <color name="colorPrimary">#393939</color>
<color name="colorPrimaryDark">#303F9F</color> <color name="colorPrimaryDark">#393939</color>
<color name="colorAccent">#ff4081</color> <color name="colorAccent">#12bfac</color>
</resources> </resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment