diff --git a/.idea/gradle.xml b/.idea/gradle.xml index cb441a3..43a1c92 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -8,6 +8,7 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml index bdd9278..8a567c4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,10 @@ - + + + + diff --git a/app/build.gradle b/app/build.gradle index 43c84c1..44f8409 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,6 +32,7 @@ android { } } + dependencies { implementation 'androidx.appcompat:appcompat:1.5.1' @@ -40,6 +41,7 @@ dependencies { implementation 'androidx.annotation:annotation:1.3.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' @@ -53,4 +55,13 @@ dependencies { //Glide 가져오기 implementation 'com.github.bumptech.glide:glide:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' + + //volley + implementation 'com.android.volley:volley:1.2.1' + + //OCR + implementation 'com.rmtheis:tess-two:5.4.1' + + //firebase Storage + implementation 'com.google.firebase:firebase-storage' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ca711a2..5952446 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,13 @@ - - + + + + + + + + + + + + android:grantUriPermissions="true"> + + + + + + + + + + + + + + diff --git a/app/src/main/java/org/techtown/bookshelf/Book.java b/app/src/main/java/org/techtown/bookshelf/Book.java deleted file mode 100644 index 9d78dc6..0000000 --- a/app/src/main/java/org/techtown/bookshelf/Book.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.techtown.bookshelf; - -public class Book{ - private String push; - private String title; - private String author; - private String publisher; - private String genre; - private String bookimage_address=""; - - public Book(String push, String title, String author, String publisher, String genre, String bookimage_address) { - this.push = push; - this.title = title; - this.author = author; - this.publisher = publisher; - this.genre = genre; - this.bookimage_address = bookimage_address; - } - - public String getBookimage_address() { - return bookimage_address; - } - - public void setBookimage_address(String bookimage_address) { - this.bookimage_address = bookimage_address; - } - - - public String getPush() { - return push; - } - - public void setPush(String push) { - this.push = push; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getPublisher() { - return publisher; - } - - public void setPublisher(String publisher) { - this.publisher = publisher; - } - - public String getGenre() { - return genre; - } - - public void setGenre(String genre) { - this.genre = genre; - } -} diff --git a/app/src/main/java/org/techtown/bookshelf/BookAdapter.java b/app/src/main/java/org/techtown/bookshelf/BookAdapter.java deleted file mode 100644 index f06ab7d..0000000 --- a/app/src/main/java/org/techtown/bookshelf/BookAdapter.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.techtown.bookshelf; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.TextView; - -import com.bumptech.glide.Glide; -import com.google.firebase.database.DatabaseReference; -import com.google.firebase.database.FirebaseDatabase; - -import java.io.Serializable; -import java.util.ArrayList; - -public class BookAdapter extends BaseAdapter { - ArrayList items = new ArrayList(); - private Context context; - - - - //파이어베이스 가져오기 - DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("book");; - - @Override - public int getCount() { - return items.size(); - } - - @Override - public Object getItem(int position) { - return items.get(position); - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - context = parent.getContext(); - Book book = items.get(position); - - if(convertView == null){ - LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = inflater.inflate(R.layout.item_book, parent, false); - } - - //리스트뷰에 데이터 뿌리는 작업 :ㅇ - ImageView bookimage = convertView.findViewById(R.id.bookimage); - TextView title = convertView.findViewById(R.id.title); - TextView author = convertView.findViewById(R.id.author); - TextView publisher = convertView.findViewById(R.id.publisher); - TextView genre = convertView.findViewById(R.id.genre); - Button choice_btn=convertView.findViewById(R.id.choice_btn); - - if(book.getBookimage_address()!="") { - Glide.with(convertView) - .load(book.getBookimage_address()) - .placeholder(R.drawable.icon_search) - .error(R.drawable.ic_launcher_foreground) - .into(bookimage); - } - - title.setText(book.getTitle()); - author.setText(book.getAuthor()); - publisher.setText(book.getPublisher()); - genre.setText(book.getGenre()); - //유저가 선택 버튼을 누르면 transmit_push_to_main() - choice_btn.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - ((BookSearchActivity)BookSearchActivity.mContext).transmit_push_to_main(position); - } - }); - - return convertView; - } - - public void addItem(Book item){ - items.add(item); - } -} diff --git a/app/src/main/java/org/techtown/bookshelf/BookSearchActivity.java b/app/src/main/java/org/techtown/bookshelf/BookSearchActivity.java deleted file mode 100644 index 4475cae..0000000 --- a/app/src/main/java/org/techtown/bookshelf/BookSearchActivity.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.techtown.bookshelf; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.widget.ListView; -import android.widget.Toast; - -import com.google.android.gms.tasks.OnFailureListener; -import com.google.android.gms.tasks.OnSuccessListener; -import com.google.firebase.database.DataSnapshot; -import com.google.firebase.database.DatabaseError; -import com.google.firebase.database.DatabaseReference; -import com.google.firebase.database.FirebaseDatabase; -import com.google.firebase.database.ValueEventListener; - -public class BookSearchActivity extends AppCompatActivity { - //Firebase DB 가져오기 - private DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("book"); - - public static Context mContext; - public String a; - - ListView bookListView; - BookAdapter bookAdapter; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_book_search); - - /* - writeBookData("데일 카네기 인간관계론", "데일 카네기", "현대지성", "자기계발", "http://image.yes24.com/goods/79297023/L"); - writeBookData("아몬드", "손원평", "창비", "소설", "https://image.yes24.com/goods/37300128/L"); - writeBookData("언어의 온도", "이기주", "말글터", "에세이", "http://image.yes24.com/goods/30387696/L"); - */ - bookListView=findViewById(R.id.bookListView); - bookAdapter=new BookAdapter(); - bookListView.setAdapter(bookAdapter); - - readBookData(); - - mContext=this; - - - Intent intent_position = getIntent(); - if(intent_position.getStringExtra("book_position") != null) { - int book_position = Integer.valueOf(intent_position.getStringExtra("book_position")); - Book book = (Book) bookAdapter.getItem(book_position); - Log.e("bookdata", "데이터를 받아와써용"+book_position); - } - - - } - - - //DB에 데이터 쓰기(클래스로 저장되는게 아니라 String으로 저장됨!!) - private void writeBookData(String title, String author, String publisher, String genre, String bookimage_address) { - String push = databaseReference.push().getKey(); - Book book = new Book(push, title, author, publisher, genre, bookimage_address); - databaseReference.child(push).setValue(book) - .addOnSuccessListener(new OnSuccessListener() { - @Override - public void onSuccess(Void aVoid) { - // Write was successful - //bread.setBread_push(bread_push); - Toast.makeText(BookSearchActivity.this, "저장을 완료했습니다. push:"+push, Toast.LENGTH_SHORT).show(); - } - }) - .addOnFailureListener(new OnFailureListener() { - @Override - public void onFailure(@NonNull Exception e) { - // Write failed - Toast.makeText(BookSearchActivity.this, "저장을 실패했습니다.", Toast.LENGTH_SHORT).show(); - } - }); - } - - //DB에서 getValue()로 데이터 받아오기 - private void readBookData(){ - databaseReference.addValueEventListener(new ValueEventListener() { - @Override - public void onDataChange(@NonNull DataSnapshot snapshot) { - bookAdapter.items.clear(); - for (DataSnapshot dataSnapshot : snapshot.getChildren()) { - String push = dataSnapshot.getKey(); - String title = dataSnapshot.child("title").getValue().toString(); - String author = dataSnapshot.child("author").getValue().toString(); - String publisher = dataSnapshot.child("publisher").getValue().toString(); - String genre = dataSnapshot.child("genre").getValue().toString(); - String image_address = dataSnapshot.child("bookimage_address").getValue().toString(); - - Book book = new Book(push, title, author, publisher, genre, image_address); - bookAdapter.addItem(book); - } - bookAdapter.notifyDataSetChanged(); - } - @Override - public void onCancelled(@NonNull DatabaseError error) { - Log.e("Warning!! : ", "데이터를 받아오는 데에 실패했습니다!"); - } - }); - } - - //Main액티비티로 책 푸시값 넘겨주고 BookSerach액티비티 종료하기 - public void transmit_push_to_main(int position){ - //mainactivity로 전환(책푸시값 넘겨주기) - String book_push = ((Book)bookAdapter.getItem(position)).getPush(); - Intent intent = new Intent(); - intent.putExtra("book_push", book_push); - setResult(RESULT_OK, intent); - - finish(); - } - -} \ No newline at end of file diff --git a/app/src/main/java/org/techtown/bookshelf/MainActivity.java b/app/src/main/java/org/techtown/bookshelf/MainActivity.java deleted file mode 100644 index efbae8f..0000000 --- a/app/src/main/java/org/techtown/bookshelf/MainActivity.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.techtown.bookshelf; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Toast; - -import com.google.firebase.database.DatabaseReference; -import com.google.firebase.database.FirebaseDatabase; - -public class MainActivity extends AppCompatActivity { - //Firebase DB 가져오기 - private DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference(); - - EditText book_search_et; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - book_search_et = (EditText)findViewById(R.id.book_search); - book_search_et.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(getApplicationContext(), BookSearchActivity.class); - startActivityForResult(intent, 0); - - - } - }); - - - - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - //data.getStringExtra("email") - //requestCode : activity 식별값 - - if(requestCode==0 && resultCode==RESULT_OK){ - Toast.makeText(MainActivity.this, data.getStringExtra("book_push"), Toast.LENGTH_SHORT).show(); - }else{ - Toast.makeText(MainActivity.this, "result cancle!", Toast.LENGTH_SHORT).show(); - } - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable/book2.png b/app/src/main/res/drawable/book2.png index f843b01..6c1eeae 100644 Binary files a/app/src/main/res/drawable/book2.png and b/app/src/main/res/drawable/book2.png differ diff --git a/app/src/main/res/drawable/layout_background.xml b/app/src/main/res/drawable/layout_background.xml index f101380..82b4c3c 100644 --- a/app/src/main/res/drawable/layout_background.xml +++ b/app/src/main/res/drawable/layout_background.xml @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_book_search.xml b/app/src/main/res/layout/activity_book_search.xml index af9f38b..f13b254 100644 --- a/app/src/main/res/layout/activity_book_search.xml +++ b/app/src/main/res/layout/activity_book_search.xml @@ -2,28 +2,54 @@ + tools:context=".book.search.BookSearchActivity"> + + + + + + + app:layout_constraintTop_toBottomOf="@+id/book_search2" /> - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index f43cfc2..ec7f18f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,64 +1,109 @@ - - - - - - - + android:orientation="vertical" + tools:context=".user.MainActivity"> + + + + + android:layout_gravity="top" + android:fontFamily="@font/jejudoldam" + android:text="BOOKSHELF" + android:textColor="#486047" + android:textSize="25dp" /> + + - - - - \ No newline at end of file + android:id="@+id/add_book" + android:layout_width="40dp" + android:layout_height="match_parent" + android:layout_gravity="center|right" + android:layout_marginRight="10dp" + app:srcCompat="@drawable/add_book" /> + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_book.xml b/app/src/main/res/layout/item_book.xml deleted file mode 100644 index 981fc2a..0000000 --- a/app/src/main/res/layout/item_book.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index e929c02..01d35de 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,16 +1,18 @@ - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 153165d..0ebde37 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -5,8 +5,10 @@ Password Sign in or register Sign in - "Welcome !" + "Welcome" Not a valid username Password must be >5 characters "Login failed" + + Hello blank fragment \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index e99f88b..01d35de 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,10 +1,10 @@ - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8c75629..451addf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ buildscript { dependencies { + classpath 'com.google.gms:google-services:4.3.14' } }// Top-level build file where you can add configuration options common to all sub-projects/modules. diff --git a/settings.gradle b/settings.gradle index 84653ba..a85c56d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,6 +3,7 @@ pluginManagement { gradlePluginPortal() google() mavenCentral() + maven { url 'https://jitpack.io'} } } dependencyResolutionManagement {