Skip to content

Commit aee9c8d

Browse files
committed
13th class added
1 parent ce93cc1 commit aee9c8d

71 files changed

Lines changed: 2024 additions & 19 deletions

File tree

Some content is hidden

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

12-TwelfthClass/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
12-
<activity android:name="com.hellohasan.twelfthclass.StudentCreate.StudentCreateActivity"
13-
android:screenOrientation="portrait">
12+
<activity android:name="com.hellohasan.twelfthclass.StudentCreate.StudentCreateActivity">
1413
<intent-filter>
1514
<action android:name="android.intent.action.MAIN" />
1615

12-TwelfthClass/app/src/main/java/com/hellohasan/twelfthclass/Database/DatabaseQuery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public void getStudentByRegistrationNo(long registrationNo, Context context, Dat
101101
Cursor cursor = null;
102102

103103
try {
104+
104105
cursor = sqLiteDatabase.query(Config.TABLE_STUDENT, //table name
105106
new String[] {Config.COLUMN_STUDENT_NAME, Config.COLUMN_STUDENT_REGISTRATION, Config.COLUMN_STUDENT_PHONE, Config.COLUMN_STUDENT_EMAIL}, //desired column names
106107
Config.COLUMN_STUDENT_REGISTRATION + " = ? ", //column name of `where` clause

12-TwelfthClass/app/src/main/java/com/hellohasan/twelfthclass/StudentCreate/StudentCreateActivity.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package com.hellohasan.twelfthclass.StudentCreate;
22

3+
import android.content.Context;
34
import android.os.Bundle;
45
import android.support.v7.app.AppCompatActivity;
56
import android.view.View;
7+
import android.view.inputmethod.InputMethodManager;
68
import android.widget.EditText;
79
import android.widget.TextView;
810
import android.widget.Toast;
@@ -74,8 +76,10 @@ public void onErrorQuery(Throwable throwable) {
7476

7577

7678
@OnClick(R.id.addStudentButton)
77-
public void createStudent() {
79+
public void createStudent(View view) {
80+
hideKeyboard(view);
7881
studentCreateErrorMessage.setVisibility(View.GONE);
82+
searchErrorTextView.setVisibility(View.GONE);
7983

8084
String name = nameEditText.getText().toString();
8185
long registrationNo = Integer.parseInt(registrationEditText.getText().toString());
@@ -129,7 +133,9 @@ public void onErrorQuery(Throwable throwable) {
129133

130134

131135
@OnClick(R.id.searchButton)
132-
public void searchStudentByRegNo(){
136+
public void searchStudentByRegNo(View view){
137+
hideKeyboard(view);
138+
studentCreateErrorMessage.setVisibility(View.GONE);
133139
searchErrorTextView.setVisibility(View.GONE);
134140
long registrationNo = Integer.parseInt(searchEditText.getText().toString());
135141
databaseQueryInterface.getStudentByRegistrationNo(registrationNo, this, new DatabaseQueryCallback<Student>() {
@@ -153,4 +159,9 @@ public void onErrorQuery(Throwable throwable) {
153159
}
154160
});
155161
}
162+
163+
private void hideKeyboard(View view){
164+
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
165+
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
166+
}
156167
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:padding="4dp"
6+
xmlns:app="http://schemas.android.com/apk/res-auto">
7+
8+
<include
9+
layout="@layout/student_create_layout"
10+
android:id="@+id/createLayout"
11+
android:layout_width="0dp"
12+
android:layout_height="wrap_content"
13+
app:layout_constraintTop_toTopOf="parent"
14+
app:layout_constraintLeft_toLeftOf="parent"
15+
app:layout_constraintRight_toLeftOf="@+id/view"/>
16+
17+
<View
18+
android:id="@+id/view"
19+
android:layout_width="2dp"
20+
android:layout_height="0dp"
21+
app:layout_constraintTop_toTopOf="parent"
22+
app:layout_constraintBottom_toBottomOf="parent"
23+
app:layout_constraintLeft_toRightOf="@id/createLayout"
24+
app:layout_constraintRight_toLeftOf="@+id/searchLayout"
25+
android:background="@color/divider_color"
26+
android:layout_marginLeft="4dp"
27+
android:layout_marginStart="4dp"
28+
android:layout_marginRight="4dp"
29+
android:layout_marginEnd="4dp"/>
30+
31+
<include
32+
android:id="@+id/searchLayout"
33+
android:layout_width="0dp"
34+
android:layout_height="wrap_content"
35+
layout="@layout/search_layout"
36+
app:layout_constraintTop_toTopOf="parent"
37+
app:layout_constraintRight_toRightOf="parent"
38+
app:layout_constraintLeft_toRightOf="@id/view"/>
39+
40+
41+
</android.support.constraint.ConstraintLayout>

12-TwelfthClass/app/src/main/res/layout/activity_student_create.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,21 @@
1111
layout="@layout/student_create_layout"
1212
android:id="@+id/studentCreateLayout"/>
1313

14+
<View
15+
android:id="@+id/dividerView"
16+
android:layout_width="0dp"
17+
android:layout_height="2dp"
18+
android:background="@color/divider_color"
19+
app:layout_constraintTop_toBottomOf="@id/studentCreateLayout"
20+
app:layout_constraintLeft_toLeftOf="parent"
21+
app:layout_constraintRight_toRightOf="parent"
22+
android:layout_marginTop="8dp"/>
23+
1424
<include
1525
layout="@layout/search_layout"
1626
android:layout_width="0dp"
1727
android:layout_height="wrap_content"
18-
app:layout_constraintTop_toBottomOf="@id/studentCreateLayout"
28+
app:layout_constraintTop_toBottomOf="@id/dividerView"
1929
app:layout_constraintLeft_toLeftOf="parent"
2030
app:layout_constraintRight_toRightOf="parent"
2131
android:layout_marginTop="16dp" />

12-TwelfthClass/app/src/main/res/layout/search_layout.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
android:layout_height="wrap_content"
1212
android:layout_marginTop="8dp"
1313
android:hint="@string/registration"
14+
android:inputType="number"
1415
app:layout_constraintLeft_toLeftOf="parent"
1516
app:layout_constraintRight_toRightOf="@+id/searchButton"
1617
app:layout_constraintTop_toTopOf="parent" />

12-TwelfthClass/app/src/main/res/layout/student_create_layout.xml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
android:hint="@string/name"
1313
app:layout_constraintTop_toTopOf="parent"
1414
app:layout_constraintLeft_toLeftOf="parent"
15-
app:layout_constraintRight_toRightOf="parent"/>
15+
app:layout_constraintRight_toRightOf="parent"
16+
/>
1617

1718
<EditText
1819
android:id="@+id/registrationEditText"
@@ -62,7 +63,7 @@
6263
app:layout_constraintRight_toLeftOf="@+id/studentCountTextView"
6364
android:text="@string/number_of_student"
6465
android:textStyle="bold"
65-
android:textSize="20sp"
66+
android:textSize="16sp"
6667
app:layout_constraintHorizontal_chainStyle="packed" />
6768

6869
<TextView
@@ -72,7 +73,9 @@
7273
app:layout_constraintTop_toBottomOf="@+id/addStudentButton"
7374
app:layout_constraintLeft_toRightOf="@+id/studentCountTitle"
7475
app:layout_constraintRight_toRightOf="parent"
75-
android:textSize="20sp"
76+
android:textSize="16sp"
77+
android:layout_marginStart="4dp"
78+
android:layout_marginLeft="4dp"
7679
tools:text="12"/>
7780

7881
<TextView
@@ -85,16 +88,7 @@
8588
app:layout_constraintLeft_toLeftOf="parent"
8689
app:layout_constraintRight_toRightOf="parent"
8790
tools:text="Student cannot be created"
88-
android:textColor="@color/error_message_color"
89-
android:layout_marginTop="16dp"/>
91+
android:textColor="@color/error_message_color" />
9092

91-
<View
92-
android:layout_width="0dp"
93-
android:layout_height="2dp"
94-
android:background="@color/colorAccent"
95-
app:layout_constraintTop_toBottomOf="@id/studentCreateErrorMessageTextView"
96-
app:layout_constraintLeft_toLeftOf="parent"
97-
app:layout_constraintRight_toRightOf="parent"
98-
android:layout_marginTop="8dp"/>
9993

10094
</android.support.constraint.ConstraintLayout>

12-TwelfthClass/app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
<color name="colorPrimaryDark">#303F9F</color>
55
<color name="colorAccent">#FF4081</color>
66
<color name="error_message_color">#da1c29</color>
7+
<color name="divider_color">#040030</color>
78
</resources>

13-thirteenthClass/.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/gradle.xml
8+
/.idea/vcs.xml
9+
/.idea/misc.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild

13-thirteenthClass/.idea/compiler.xml

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

0 commit comments

Comments
 (0)