Skip to content

Commit d99f67e

Browse files
committed
Mainly added a Splash Screen and lot's of more UI changes to get a better look and feel.
1 parent bf32ae1 commit d99f67e

25 files changed

+206
-92
lines changed

.idea/assetWizardSettings.xml

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

.idea/vcs.xml

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

app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ dependencies {
3838

3939
// recycler view
4040
implementation 'com.android.support:recyclerview-v7:27.1.1'
41+
42+
compile 'com.android.support:design:27.1.1'
4143
}
4244

4345
apply plugin: 'com.google.gms.google-services'

app/src/main/AndroidManifest.xml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,40 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.example.ali.gailqms">
44

5+
6+
57
<application
68
android:allowBackup="true"
7-
android:icon="@mipmap/ic_launcher"
9+
android:icon="@drawable/logo_copy"
810
android:label="@string/app_name"
911
android:roundIcon="@drawable/logo"
1012
android:supportsRtl="true"
1113
android:theme="@style/AppTheme">
12-
<activity android:name=".MainActivity">
13-
<intent-filter>
14-
<action android:name="android.intent.action.MAIN" />
1514

16-
<category android:name="android.intent.category.LAUNCHER" />
17-
</intent-filter>
15+
<activity android:name=".ActivitySplash"
16+
android:theme="@style/AppTheme">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
23+
</activity>
24+
25+
<activity android:name=".MainActivity"
26+
android:theme="@style/AppTheme">
1827
</activity>
19-
<activity android:name=".FirebaseActivity" />
20-
<activity android:name=".MailSend" />
28+
29+
<activity
30+
android:name=".FirebaseActivity"
31+
android:label="@string/app_name"
32+
android:theme="@style/AppTheme.NoActionBar">
33+
</activity>
34+
35+
36+
37+
<activity android:name=".MailSend"
38+
android:theme="@style/AppTheme"/>
2139
<activity android:name=".Authorised" />
2240
<activity android:name=".Staff"></activity>
2341
</application>

app/src/main/java/com/example/ali/gailqms/Authorised.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void onClick(View v) {
4848
if(pass.equals("QMS@1234"))
4949
{
5050
Intent intent = new Intent(Authorised.this,Staff.class);
51+
passCode.setText("");
5152
startActivity(intent);
5253

5354
}

app/src/main/java/com/example/ali/gailqms/FirebaseActivity.java

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
package com.example.ali.gailqms;
22

3+
import android.app.SearchManager;
4+
import android.content.Context;
35
import android.content.Intent;
6+
import android.graphics.Color;
7+
import android.os.Build;
48
import android.support.v7.app.AppCompatActivity;
59
import android.os.Bundle;
10+
import android.support.v7.widget.DefaultItemAnimator;
11+
import android.support.v7.widget.DividerItemDecoration;
612
import android.support.v7.widget.LinearLayoutManager;
713
import android.support.v7.widget.RecyclerView;
14+
import android.support.v7.widget.Toolbar;
15+
import android.view.Menu;
16+
import android.view.MenuItem;
17+
import android.view.View;
818
import android.widget.Filterable;
919
import android.widget.SearchView;
1020
import android.widget.Toast;
@@ -25,23 +35,43 @@ public class FirebaseActivity extends AppCompatActivity implements CustomAdapter
2535
public static final String DEPT_DESC = "desc";
2636

2737

38+
2839
private CustomAdapter adapter;
2940

3041
private List<Department> deptList;
3142
private RecyclerView recyclerView;
43+
private android.support.v7.widget.SearchView searchView;
44+
3245
DatabaseReference ref;
3346

3447
@Override
3548
protected void onCreate(Bundle savedInstanceState) {
3649
super.onCreate(savedInstanceState);
3750
setContentView(R.layout.activity_firebase);
51+
//To set toolbar
52+
Toolbar toolbar = findViewById(R.id.toolbar);
53+
setSupportActionBar(toolbar);
3854

55+
//database reference
3956
ref = FirebaseDatabase.getInstance().getReference("Departments");
57+
4058
recyclerView = findViewById(R.id.listViewDepartments);
4159
deptList = new ArrayList<>();
42-
4360
adapter = new CustomAdapter(FirebaseActivity.this,deptList,this);
4461

62+
// white background notification bar
63+
whiteNotificationBar(recyclerView);
64+
65+
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
66+
recyclerView.setLayoutManager(mLayoutManager);
67+
recyclerView.setItemAnimator(new DefaultItemAnimator());
68+
recyclerView.addItemDecoration(new MyDividerItemDecoration(this, DividerItemDecoration.VERTICAL, 36));
69+
recyclerView.setAdapter(adapter);
70+
71+
fetchValues();
72+
}
73+
74+
private void fetchValues(){
4575

4676
ref.addValueEventListener(new ValueEventListener() {
4777
@Override
@@ -66,13 +96,20 @@ public void onCancelled(DatabaseError databaseError) {
6696

6797
}
6898
});
99+
}
69100

101+
@Override
102+
public boolean onCreateOptionsMenu(Menu menu) {
103+
getMenuInflater().inflate(R.menu.menu_main, menu);
70104

105+
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
106+
searchView = (android.support.v7.widget.SearchView) menu.findItem(R.id.action_search).getActionView();
107+
searchView.setSearchableInfo(searchManager
108+
.getSearchableInfo(getComponentName()));
109+
searchView.setMaxWidth(Integer.MAX_VALUE);
110+
searchView.setQueryHint("Search");
71111

72-
SearchView searchView = findViewById(R.id.search_View);
73-
74-
75-
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
112+
searchView.setOnQueryTextListener(new android.support.v7.widget.SearchView.OnQueryTextListener() {
76113
@Override
77114
public boolean onQueryTextSubmit(String query) {
78115
return false;
@@ -81,12 +118,47 @@ public boolean onQueryTextSubmit(String query) {
81118
@Override
82119
public boolean onQueryTextChange(String newText) {
83120
adapter.getFilter().filter(newText);
84-
recyclerView.setAdapter(adapter);
85-
86121
return false;
87122
}
88123
});
124+
return true;
125+
}
126+
127+
@Override
128+
public boolean onOptionsItemSelected(MenuItem item) {
129+
// Handle action bar item clicks here. The action bar will
130+
// automatically handle clicks on the Home/Up button, so long
131+
// as you specify a parent activity in AndroidManifest.xml.
132+
int id = item.getItemId();
133+
134+
//noinspection SimplifiableIfStatement
135+
if (id == R.id.action_search) {
136+
return true;
137+
}
138+
139+
return super.onOptionsItemSelected(item);
140+
}
141+
142+
@Override
143+
public void onBackPressed() {
144+
// close search view on back button pressed
145+
if (!searchView.isIconified()) {
146+
searchView.setIconified(true);
147+
return;
148+
}
149+
super.onBackPressed();
150+
}
151+
152+
153+
89154

155+
private void whiteNotificationBar(View view) {
156+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
157+
int flags = view.getSystemUiVisibility();
158+
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
159+
view.setSystemUiVisibility(flags);
160+
getWindow().setStatusBarColor(Color.WHITE);
161+
}
90162
}
91163

92164
@Override

app/src/main/java/com/example/ali/gailqms/MailSend.java

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ protected void onCreate(Bundle savedInstanceState) {
2626
super.onCreate(savedInstanceState);
2727
setContentView(R.layout.activity_mail_send);
2828

29-
3029
//Initializing the views
3130
nameOfDept = findViewById(R.id.deptName);
3231
editTextSubject = (EditText) findViewById(R.id.editTextSubject);
3332
editTextMessage = (EditText) findViewById(R.id.editTextMessage);
3433
infoDialog = findViewById(R.id.moreinfo);
3534

35+
Intent intent = getIntent();
36+
37+
String deptName = intent.getStringExtra(FirebaseActivity.DEPT_NAME);
38+
39+
nameOfDept.setText(deptName);
40+
3641
buttonSend = (Button) findViewById(R.id.buttonSend);
3742

3843
//Adding click listener
@@ -56,16 +61,12 @@ private void sendEmail() {
5661

5762
Intent intent = getIntent();
5863

59-
String deptName = intent.getStringExtra(FirebaseActivity.DEPT_NAME);
60-
61-
nameOfDept.setText(deptName);
62-
6364
String email = intent.getStringExtra(FirebaseActivity.DEPT_EMAIL);
6465
String subject = editTextSubject.getText().toString().trim();
6566
String message = editTextMessage.getText().toString().trim();
6667

6768
//Creating SendMail object
68-
SendMail sm = new SendMail(this, email, subject, message);
69+
SendMail sm = new SendMail(this, email, subject, message+"\n\n\nSend from QMS Application");
6970

7071
//Executing sendmail to send email
7172
sm.execute();
@@ -99,15 +100,4 @@ private void showDialog(String desc){
99100
public void onClick(View v) {
100101
sendEmail();
101102
}
102-
103-
private void hideNavigationBar()
104-
{
105-
this.getWindow().getDecorView().setSystemUiVisibility(
106-
View.SYSTEM_UI_FLAG_FULLSCREEN|
107-
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|
108-
View.SYSTEM_UI_FLAG_IMMERSIVE|
109-
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY|
110-
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|
111-
View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
112-
}
113103
}

app/src/main/java/com/example/ali/gailqms/MainActivity.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
import android.view.View;
88
import android.widget.EditText;
99
import android.widget.TextView;
10+
import android.widget.Toast;
1011

1112
public class MainActivity extends AppCompatActivity {
1213

1314
CardView loginButton;
1415
EditText userName;
1516
EditText password;
16-
CardView authorised;
17+
TextView authorised;
1718

1819
@Override
1920
protected void onCreate(Bundle savedInstanceState) {
@@ -31,11 +32,21 @@ protected void onCreate(Bundle savedInstanceState) {
3132
loginButton.setOnClickListener(new View.OnClickListener() {
3233
@Override
3334
public void onClick(View v) {
34-
Intent intent = new Intent(MainActivity.this,FirebaseActivity.class);
3535

36-
Config config = new Config(userName.getText().toString().trim(),password.getText().toString().trim());
36+
if(userName.getText().toString().length() < 1 || password.getText().toString().length() < 1)
37+
{
38+
Toast.makeText(MainActivity.this,"** No blanks **",Toast.LENGTH_LONG).show();
39+
}
40+
else
41+
{
42+
Intent intent = new Intent(MainActivity.this,FirebaseActivity.class);
43+
Config config = new Config(userName.getText().toString().trim(),password.getText().toString().trim());
44+
userName.setText("");
45+
password.setText("");
46+
startActivity(intent);
47+
}
48+
3749

38-
startActivity(intent);
3950
}
4051
});
4152

55 Bytes
Loading

0 commit comments

Comments
 (0)