Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
HM committed May 13, 2022
0 parents commit 5d1d9bf
Show file tree
Hide file tree
Showing 46 changed files with 1,579 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
41 changes: 41 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 31
packagingOptions {
resources.excludes.add("META-INF/*")
}
defaultConfig {
applicationId "com.cub.librarymanagement"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.7.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.cub.librarymanagement;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.cub.librarymanagement", appContext.getPackageName());
}
}
31 changes: 31 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cub.librarymanagement">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LibraryManagement">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CreateEventActivity"
android:exported="true" />


</application>

</manifest>
143 changes: 143 additions & 0 deletions app/src/main/java/com/cub/librarymanagement/CreateEventActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
package com.cub.librarymanagement;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TimePicker;
import android.widget.Toast;

import java.util.regex.Pattern;

public class CreateEventActivity extends AppCompatActivity {
String need_time;
private Button btnCreate,cancel;
EditText name,place,capacity,budget,email,phone,detail;
RadioGroup radioGroup;
RadioButton type;
TimePicker timePicker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.event_information_layout);

Intent i =getIntent();
String key = i.getStringExtra("EVENT_ID");
if(key!=null && TextUtils.isEmpty(key)){
String value = Util.getInstance().getValueByKey(this,key);
String[] values = value.split("");
}

name = findViewById(R.id.etName);
place = findViewById(R.id.etPlace);
capacity = findViewById(R.id.etCapacity);
budget = findViewById(R.id.etBudget);
email = findViewById(R.id.etEmail);
phone = findViewById(R.id.etPhone);
detail = findViewById(R.id.etDescription);
btnCreate = findViewById(R.id.btnSave);
timePicker =findViewById(R.id.time);
timePicker.setIs24HourView(true);
radioGroup = findViewById(R.id.type);
btnCreate.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onClick(View v) {

need_time = timePicker.getHour() + ":" + timePicker.getMinute();

if (TextUtils.isEmpty(name.getText().toString())) {
name.setError("Name Required");

return;
}
if (TextUtils.isEmpty(place.getText().toString())) {
place.setError("place Required");

return;
}
if (TextUtils.isEmpty(capacity.getText().toString())) {
capacity.setError("Capacity Required");

return;
}
if (TextUtils.isEmpty(budget.getText().toString())) {
budget.setError("Budget Required");

return;
}
String email_1 = email.getText().toString().trim();
if (TextUtils.isEmpty(email_1)) {
email.setError("Valid Email Required");

return;
}
if (isValid(email_1)){
email.setError("Email Required");
return;
}
if (TextUtils.isEmpty(phone.getText().toString())) {
phone.setError("Phone Required");

return;
}
if (phone.getText().toString().length() < 11) {
phone.setError("Enter 11 digit number");
return;
}

save(name.getText().toString(),need_time);

Log.d("Name = ", name.getText().toString());
Log.d("Place = ", place.getText().toString());
Log.d("Capacity = ", capacity.getText().toString());
Log.d("Budget = ", budget.getText().toString());
Log.d("Email = ", email.getText().toString());
Log.d("Phone = ", phone.getText().toString());
Log.d("Detail = ", detail.getText().toString());
Log.d("Time = ", need_time);




Intent intent = new Intent(CreateEventActivity.this, MainActivity.class);
startActivity(intent);
}
});
cancel =findViewById(R.id.btnCancel) ;
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(CreateEventActivity.this, MainActivity.class);
startActivity(intent);
}
});
}

public boolean isValid(String email)
{
String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+
"[a-zA-Z0-9_+&*-]+)*@" +
"(?:[a-zA-Z0-9-]+\\.)+[a-z" +
"A-Z]{2,7}$";

Pattern pat = Pattern.compile(emailRegex);
if (email == null)
return false;
return pat.matcher(email).matches();
}
private void save(String a,String b){
String key =a;
String value =b;
Util.getInstance().setKeyValue(this,key,value);
}
}
Loading

0 comments on commit 5d1d9bf

Please sign in to comment.