Skip to content

Commit 45083d5

Browse files
committed
UI Fixes - Schedule, Login Screen
2 parents 5b994bf + 946a882 commit 45083d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1307
-162
lines changed

.idea/gradle.xml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ dependencies {
3131
implementation 'com.android.volley:volley:1.1.1'
3232
//image loading library
3333
implementation 'com.squareup.picasso:picasso:2.71828'
34+
implementation 'com.android.support:support-v4:28.0.0'
3435
testImplementation 'junit:junit:4.12'
3536
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3637
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
3738
//Butterknife dependencies
3839
implementation 'com.jakewharton:butterknife:8.8.1'
3940
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
41+
implementation 'com.google.firebase:firebase-core:16.0.1'
42+
implementation 'com.google.firebase:firebase-messaging:17.4.0'
4043
}
44+
45+
apply plugin: 'com.google.gms.google-services'

app/src/main/AndroidManifest.xml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,34 @@
33
package="dpi.ks19.participantapp">
44

55
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
77

88
<application
99
android:allowBackup="true"
10-
android:usesCleartextTraffic="true"
1110
android:icon="@mipmap/ks_icon"
1211
android:label="@string/app_name"
1312
android:roundIcon="@mipmap/ks_icon"
1413
android:supportsRtl="true"
15-
android:theme="@style/AppTheme">
14+
android:theme="@style/AppTheme"
15+
android:usesCleartextTraffic="true">
16+
17+
<service android:name=".NotificationService">
18+
<intent-filter>
19+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
20+
</intent-filter>
21+
</service>
22+
23+
<activity
24+
android:name=".Activities.ScheduleActivity"
25+
android:configChanges="orientation|keyboardHidden"
26+
android:screenOrientation="portrait"
27+
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar" />
1628

1729
<activity android:name=".Activities.SplashScreen"
1830
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar"
1931
android:screenOrientation="portrait"
2032
android:configChanges="orientation|keyboardHidden">
33+
2134
<intent-filter>
2235
<action android:name="android.intent.action.MAIN" />
2336

@@ -41,6 +54,7 @@
4154
<activity
4255
android:name=".LoginActivity"
4356
android:label="@string/app_name"
57+
android:windowSoftInputMode="stateHidden|adjustResize"
4458
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar"
4559
android:screenOrientation="portrait"
4660
android:configChanges="orientation|keyboardHidden">
@@ -72,9 +86,15 @@
7286
<activity
7387
android:name=".AboutUsApp"
7488
android:label="@string/app_name"
89+
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar" />
90+
91+
92+
<activity
93+
android:name=".sponsors"
7594
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar"
7695
android:screenOrientation="portrait"
7796
android:configChanges="orientation|keyboardHidden"/>
97+
7898
<activity android:name=".proshows"
7999
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar"
80100
android:screenOrientation="portrait"
@@ -85,11 +105,6 @@
85105
android:screenOrientation="portrait"
86106
android:configChanges="orientation|keyboardHidden"/>
87107

88-
<activity android:name=".sponsors"
89-
android:theme="@style/AppTheme.NoActionBarWithTranslucentStatusBar"
90-
android:screenOrientation="portrait"
91-
android:configChanges="orientation|keyboardHidden"/>
92-
93108
</application>
94109

95110
</manifest>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package dpi.ks19.participantapp.Activities;
2+
3+
import android.content.Context;
4+
import android.content.DialogInterface;
5+
import android.content.Intent;
6+
import android.net.ConnectivityManager;
7+
import android.net.NetworkInfo;
8+
import android.os.Bundle;
9+
import android.provider.Settings;
10+
import android.support.design.widget.TabLayout;
11+
import android.support.v4.view.ViewPager;
12+
import android.support.v7.app.AlertDialog;
13+
import android.support.v7.app.AppCompatActivity;
14+
15+
import dpi.ks19.participantapp.Adapter.DayAdapter;
16+
import dpi.ks19.participantapp.R;
17+
18+
public class ScheduleActivity extends AppCompatActivity {
19+
20+
ViewPager viewPager;
21+
TabLayout tabLayout;
22+
AlertDialog alertDialog;
23+
AlertDialog.Builder builder;
24+
25+
26+
@Override
27+
protected void onCreate(Bundle savedInstanceState) {
28+
super.onCreate(savedInstanceState);
29+
setContentView(R.layout.activity_schedule);
30+
31+
builder = new AlertDialog.Builder(this); //Builder to display AlertDialog.
32+
builder.setTitle("WARNING! No Internet Connection");
33+
builder.setIcon(R.drawable.no_internet_icon);
34+
builder.setMessage("Please check your internet connection!");
35+
builder.setNegativeButton("SETTINGS", new DialogInterface.OnClickListener() {
36+
@Override
37+
public void onClick(DialogInterface dialog, int which) {
38+
dialog.dismiss();
39+
ScheduleActivity.this.startActivity(new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS));
40+
}
41+
});
42+
43+
CheckNetworkConnection(); //To check for internet connection and display an AlertDialog.
44+
createFragment(); //To create fragments with view pager.
45+
}
46+
47+
public void CheckNetworkConnection() { //Checks for internet connectivity and displays an AlertDialog if not connected.
48+
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
49+
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
50+
boolean isConnected = activeNetwork != null && activeNetwork.isConnected();
51+
if (!isConnected) {
52+
alertDialog = builder.create();
53+
alertDialog.show();
54+
}
55+
}
56+
57+
@Override
58+
protected void onResume() {
59+
super.onResume();
60+
CheckNetworkConnection(); //To check again for internet connection.
61+
createFragment(); //To create fragment with view pager on resuming the activity.
62+
}
63+
64+
65+
public void createFragment() { //Creates tabLayout with vew pager for fragment.
66+
viewPager = findViewById(R.id.day_view_pager);
67+
DayAdapter adapter = new DayAdapter(getSupportFragmentManager());
68+
viewPager.setAdapter(adapter);
69+
70+
tabLayout = findViewById(R.id.day_tab_layout);
71+
tabLayout.setupWithViewPager(viewPager);
72+
}
73+
}
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
package dpi.ks19.participantapp.Adapter;
2+
3+
import android.app.ProgressDialog;
4+
import android.content.Context;
5+
import android.graphics.Color;
6+
import android.graphics.drawable.ColorDrawable;
7+
import android.graphics.drawable.Drawable;
8+
import android.support.annotation.NonNull;
9+
import android.support.constraint.ConstraintLayout;
10+
import android.support.v7.widget.LinearLayoutManager;
11+
import android.support.v7.widget.RecyclerView;
12+
import android.view.LayoutInflater;
13+
import android.view.View;
14+
import android.view.ViewGroup;
15+
import android.widget.ImageView;
16+
import android.widget.TextView;
17+
import android.widget.Toast;
18+
19+
import java.util.ArrayList;
20+
21+
import dpi.ks19.participantapp.CallbackInterface.ScheduleInterface;
22+
import dpi.ks19.participantapp.Fragments.DayOneFrag;
23+
import dpi.ks19.participantapp.Fragments.DayThreeFrag;
24+
import dpi.ks19.participantapp.Fragments.DayTwoFrag;
25+
import dpi.ks19.participantapp.Model.EventClass;
26+
import dpi.ks19.participantapp.R;
27+
28+
public class ClusterAdapter extends RecyclerView.Adapter<ClusterAdapter.ClusterHolder> implements ScheduleInterface {
29+
//Cluster Adapter for Cluster RecyclerView.
30+
ArrayList<Drawable> clusterIcon = new ArrayList<>();
31+
Context mContext;
32+
ProgressDialog progressDialog;
33+
int day;
34+
private ClusterAdapter callback;
35+
private String cluster[];
36+
37+
public ClusterAdapter(Context mContext, int d) { //Constructor initializes mContext, callback and data for clusters as it is Static.
38+
this.mContext = mContext;
39+
this.callback = this;
40+
cluster = mContext.getResources().getStringArray(R.array.cluster_list);
41+
day = d;
42+
43+
progressDialog = new ProgressDialog(mContext); //Initializes progress Dialog When loading for data.
44+
progressDialog.setTitle("Loading...");
45+
progressDialog.setMessage("Downloading Data.....Please Wait");
46+
progressDialog.setCancelable(false);
47+
progressDialog.setCanceledOnTouchOutside(false);
48+
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
49+
progressDialog.setIndeterminate(true);
50+
51+
clusterIcon.add(new ColorDrawable(Color.parseColor("#ffffff")));
52+
clusterIcon.add(new ColorDrawable(Color.parseColor("#ffff00")));
53+
clusterIcon.add(new ColorDrawable(Color.parseColor("#ff00ff")));
54+
clusterIcon.add(new ColorDrawable(Color.parseColor("#00ffff")));
55+
clusterIcon.add(new ColorDrawable(Color.parseColor("#ff0000")));
56+
clusterIcon.add(new ColorDrawable(Color.parseColor("#00ff00")));
57+
clusterIcon.add(new ColorDrawable(Color.parseColor("#0000ff")));
58+
clusterIcon.add(new ColorDrawable(Color.parseColor("#ccccff")));
59+
clusterIcon.add(new ColorDrawable(Color.parseColor("#000000")));
60+
clusterIcon.add(new ColorDrawable(Color.parseColor("#2cd84a")));
61+
clusterIcon.add(new ColorDrawable(Color.parseColor("#c34af7")));
62+
}
63+
64+
@NonNull
65+
@Override
66+
public ClusterHolder onCreateViewHolder(ViewGroup parent, int viewType) {
67+
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.cluster_card_schedule, parent, false);
68+
return new ClusterHolder(view);
69+
}
70+
71+
@Override
72+
public void onBindViewHolder(@NonNull final ClusterHolder holder, final int listPosition) {
73+
final String clusterName = cluster[listPosition];
74+
75+
holder.clusterName.setText(clusterName);
76+
holder.clusterIcon.setImageDrawable(clusterIcon.get(listPosition));
77+
holder.rootLayout.setOnClickListener(new View.OnClickListener() {
78+
@Override
79+
public void onClick(View v) {
80+
progressDialog.show();
81+
if (day == 22)
82+
DayOneFrag.getInstance().getSchedule(getQueryWord(clusterName), callback, holder);
83+
else if (day == 23)
84+
DayTwoFrag.getInstance().getSchedule(getQueryWord(clusterName), callback, holder);
85+
else
86+
DayThreeFrag.getInstance().getSchedule(getQueryWord(clusterName), callback, holder);
87+
}
88+
});
89+
}
90+
91+
@Override
92+
public void onViewDetachedFromWindow(@NonNull ClusterHolder holder) {
93+
super.onViewDetachedFromWindow(holder); //Hides the Schedule if the item is detached.
94+
holder.hideRecyclerView();
95+
}
96+
97+
private String getQueryWord(String clusterName) {
98+
//Returns the query word.
99+
if (clusterName.equals(cluster[0])) {
100+
return cluster[0];
101+
} else if (clusterName.equals(cluster[1])) {
102+
return cluster[1];
103+
} else if (clusterName.equals(cluster[2])) {
104+
return cluster[2];
105+
} else if (clusterName.equals(cluster[3])) {
106+
return cluster[3];
107+
} else if (clusterName.equals(cluster[4])) {
108+
return cluster[4];
109+
} else if (clusterName.equals(cluster[5])) {
110+
return cluster[5];
111+
} else if (clusterName.equals(cluster[6])) {
112+
return cluster[6];
113+
} else if (clusterName.equals(cluster[7])) {
114+
return cluster[7];
115+
} else if (clusterName.equals(cluster[8])) {
116+
return cluster[8];
117+
} else if (clusterName.equals(cluster[9])) {
118+
return cluster[9];
119+
} else if (clusterName.equals(cluster[10])) {
120+
return cluster[10];
121+
} else if (clusterName.equals(cluster[11])) {
122+
return cluster[11];
123+
} else {
124+
return clusterName;
125+
}
126+
}
127+
128+
129+
@Override
130+
public int getItemCount() {
131+
return clusterIcon.size();
132+
} //Gets the total number of items.
133+
134+
@Override
135+
public void callback(String querySchedule) {
136+
137+
}
138+
139+
@Override
140+
public void setScheduleData(ArrayList<EventClass> data, ClusterHolder clusterHolder, boolean isEmpty) { //To set Schedule data
141+
if (isEmpty) {
142+
progressDialog.dismiss();
143+
Toast.makeText(mContext, "Sorry! Unfortunate Error occurred.", Toast.LENGTH_SHORT).show();
144+
} else {
145+
clusterHolder.setRecyclerView(data); //To set recycler view for schedule.
146+
}
147+
}
148+
149+
public class ClusterHolder extends RecyclerView.ViewHolder {
150+
ConstraintLayout rootLayout;
151+
TextView clusterName;
152+
ImageView clusterIcon;
153+
RecyclerView scheduleRecyclerView;
154+
ScheduleAdapter adapter;
155+
156+
public ClusterHolder(@NonNull View itemView) { //Holder for cluster item which holds the current recycler view in use.
157+
super(itemView);
158+
rootLayout = itemView.findViewById(R.id.root_layout);
159+
clusterName = itemView.findViewById(R.id.clusterName);
160+
clusterIcon = itemView.findViewById(R.id.clusterIcon);
161+
scheduleRecyclerView = itemView.findViewById(R.id.ScheduleRecyclerView);
162+
adapter = new ScheduleAdapter(mContext);
163+
scheduleRecyclerView.setLayoutManager(new LinearLayoutManager(itemView.getContext()));
164+
scheduleRecyclerView.setAdapter(adapter);
165+
}
166+
167+
public void setRecyclerView(ArrayList<EventClass> data) { //Sets the data, make the schedules visible and dismisses the AlertDialog.
168+
scheduleRecyclerView.setVisibility(View.VISIBLE);
169+
adapter.setData(data);
170+
progressDialog.dismiss();
171+
}
172+
173+
public void hideRecyclerView() { //Hides the recyclerView.
174+
scheduleRecyclerView.setVisibility(View.GONE);
175+
}
176+
177+
}
178+
}
179+

app/src/main/java/dpi/ks19/participantapp/Adapter/CollegeListAdapter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.content.Context;
55
import android.support.annotation.NonNull;
66
import android.support.v7.widget.RecyclerView;
7-
import android.util.Log;
87
import android.view.LayoutInflater;
98
import android.view.View;
109
import android.view.ViewGroup;
@@ -30,7 +29,7 @@ public CollegeListAdapter(Context ctx){
3029
progressDialog.show();
3130

3231
ApiHelper.getInstance(ctx).getColleges(this);
33-
callback = (RecyclerViewCallback)ctx;
32+
callback = (RecyclerViewCallback) ctx;
3433
}
3534

3635
@NonNull

0 commit comments

Comments
 (0)