-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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' | ||
} |
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()); | ||
} | ||
} |
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> |
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); | ||
} | ||
} |