diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2b75303
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+*.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
diff --git a/.idea/dictionaries/eltamimy.xml b/.idea/dictionaries/eltamimy.xml
new file mode 100644
index 0000000..c5ac637
--- /dev/null
+++ b/.idea/dictionaries/eltamimy.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..2996d53
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..261489e
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..1151b05
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,46 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 28
+ defaultConfig {
+ applicationId "com.example.isca_app"
+ minSdkVersion 18
+ targetSdkVersion 28
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+
+ def lifecycle_version = "1.1.1"
+ def paging_version = "1.0.1"
+ implementation "android.arch.paging:runtime:$paging_version"
+ implementation "android.arch.lifecycle:extensions:$lifecycle_version"
+ annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
+ implementation "android.arch.persistence.room:runtime:1.1.1"
+ annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
+ implementation 'com.squareup.retrofit2:retrofit:2.4.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
+ implementation "com.android.support:recyclerview-v7:28.0.0"
+ implementation "com.android.support:cardview-v7:28.0.0"
+ implementation 'com.android.support:design:28.0.0'
+
+ implementation 'com.squareup.picasso:picasso:2.5.2'
+ implementation 'com.miguelcatalan:materialsearchview:1.4.0'
+
+ implementation 'com.victor:lib:1.0.4'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -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
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
new file mode 100644
index 0000000..e7f135c
Binary files /dev/null and b/app/release/app-release.apk differ
diff --git a/app/release/app-release.rar b/app/release/app-release.rar
new file mode 100644
index 0000000..f3cd03d
Binary files /dev/null and b/app/release/app-release.rar differ
diff --git a/app/release/output.json b/app/release/output.json
new file mode 100644
index 0000000..c429e31
--- /dev/null
+++ b/app/release/output.json
@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/example/isca_app/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/isca_app/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..d0c0740
--- /dev/null
+++ b/app/src/androidTest/java/com/example/isca_app/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.example.isca_app;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.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 Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.example.isca_app", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..e6a7241
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/isca_app/adapter/PhotoAdapter.java b/app/src/main/java/com/example/isca_app/adapter/PhotoAdapter.java
new file mode 100644
index 0000000..bf490f5
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/adapter/PhotoAdapter.java
@@ -0,0 +1,159 @@
+package com.example.isca_app.adapter;
+
+import android.app.Activity;
+import android.app.ActivityOptions;
+import android.app.Dialog;
+import android.arch.paging.PagedListAdapter;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Build;
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.Toolbar;
+import android.transition.Fade;
+import android.util.Pair;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.example.isca_app.R;
+import com.example.isca_app.model.Retrofit.PhotoModel;
+import com.example.isca_app.model.Room.entity.Photo;
+import com.example.isca_app.view.FullScreenPhotoActivity;
+import com.squareup.picasso.Picasso;
+import com.victor.loading.rotate.RotateLoading;
+
+public class PhotoAdapter extends PagedListAdapter {
+
+ Context mContext;
+ Activity mActivity;
+ public PhotoAdapter(Context context,Activity activity) {
+ super(PhotoModel.CALLBACK);
+ mContext=context;
+ mActivity=activity;
+ }
+
+ @NonNull
+ @Override
+ public PhotoHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
+ View layoutView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.photo_item, null); //client_recycleview
+ PhotoHolder photoHolder = new PhotoHolder(layoutView);
+ return photoHolder;
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull final PhotoHolder photoHolder, int potsition) {
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ Fade fade = new Fade();
+ View decor = mActivity.getWindow().getDecorView();
+ fade.excludeTarget(decor.findViewById(R.id.action_bar_container), true);
+ fade.excludeTarget(android.R.id.statusBarBackground, true);
+
+ fade.excludeTarget(android.R.id.navigationBarBackground, true);
+
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ mActivity.getWindow().setEnterTransition(fade);
+ mActivity.getWindow().setExitTransition(fade);
+ }
+ }
+
+ final PhotoModel model=getItem(potsition);
+
+
+ final RotateLoading rotateLoading=photoHolder.rotateLoading;
+ rotateLoading.start();
+
+ Picasso.with(mContext).load("https:\\/\\/live.staticflickr.com\\/"+model.getServer()+"\\/"+model.getId()+"_"+model.getSecret()+"_m.jpg").fit().centerInside()
+ .into(photoHolder.photoItem, new com.squareup.picasso.Callback() {
+ @Override
+ public void onSuccess() {
+ rotateLoading.stop();
+ }
+ @Override
+ public void onError() {
+ rotateLoading.stop();
+ photoHolder.photoItem.setImageResource(R.drawable.ic_action_navigation_arrow_back);
+ }
+ });
+ photoHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View view) {
+ MyCustomDualSimDialog(model);
+ return false;
+ }
+ });
+ photoHolder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Pair pair=new Pair(photoHolder.photoItem,"backgroundTransition");
+ ActivityOptions options= null;
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
+ options = ActivityOptions.makeSceneTransitionAnimation(mActivity,pair);
+ }
+ Intent intent=new Intent(mContext, FullScreenPhotoActivity.class);
+ intent.putExtra("URL","https:\\/\\/live.staticflickr.com\\/"+model.getServer()+"\\/"+model.getId()+"_"+model.getSecret()+"_z.jpg");
+ mActivity.startActivity(intent,options.toBundle());
+ }
+ });
+ }
+
+
+
+
+
+ public class PhotoHolder extends RecyclerView.ViewHolder {
+
+ ImageView photoItem;
+ RotateLoading rotateLoading;
+ public PhotoHolder(View itemView) {
+ super(itemView);
+
+ rotateLoading=itemView.findViewById(R.id.rotateloading);
+ photoItem=itemView.findViewById(R.id.photo_item);
+
+ }
+ }
+
+
+ Dialog MyDialogPhoto;
+
+ public void MyCustomDualSimDialog(PhotoModel photoModel) {
+ MyDialogPhoto = new Dialog(mContext);
+ MyDialogPhoto.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ MyDialogPhoto.setContentView(R.layout.dialog_photo);
+ Window window = MyDialogPhoto.getWindow();
+ window.setLayout(Toolbar.LayoutParams.WRAP_CONTENT, Toolbar.LayoutParams.WRAP_CONTENT);
+ MyDialogPhoto.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+
+ TextView id, owner, secret, server, farm, title, ispublic, isfriend, isfamily;
+
+ id=MyDialogPhoto.findViewById(R.id.Id_text);
+ owner=MyDialogPhoto.findViewById(R.id.owner_text);
+ secret=MyDialogPhoto.findViewById(R.id.secret_text);
+ server=MyDialogPhoto.findViewById(R.id.server_text);
+ farm=MyDialogPhoto.findViewById(R.id.farm_text);
+ title=MyDialogPhoto.findViewById(R.id.Photo_Title);
+ ispublic=MyDialogPhoto.findViewById(R.id.ispublic_text);
+ isfriend=MyDialogPhoto.findViewById(R.id.isfriend_text);
+ isfamily=MyDialogPhoto.findViewById(R.id.isfamily_text);
+
+ id.setText(photoModel.getId());
+ owner.setText(photoModel.getOwner());
+ secret.setText(photoModel.getSecret());
+ server.setText(photoModel.getServer());
+ farm.setText(String.valueOf(photoModel.getFarm()));
+ title.setText(photoModel.getTitle());
+ ispublic.setText(String.valueOf(photoModel.getIspublic()));
+ isfriend.setText(String.valueOf(photoModel.getIsfriend()));
+ isfamily.setText(String.valueOf(photoModel.getIsfamily()));
+
+ MyDialogPhoto.show();
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Retrofit/PhotoDataSource.java b/app/src/main/java/com/example/isca_app/model/Retrofit/PhotoDataSource.java
new file mode 100644
index 0000000..517a4e8
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Retrofit/PhotoDataSource.java
@@ -0,0 +1,237 @@
+package com.example.isca_app.model.Retrofit;
+
+import android.app.Application;
+import android.arch.paging.PageKeyedDataSource;
+import android.support.annotation.NonNull;
+
+import com.example.isca_app.model.Room.PhotoRepository;
+import com.example.isca_app.model.Room.entity.Page;
+import com.example.isca_app.model.Room.entity.Photo;
+import com.example.isca_app.model.Room.entity.SearchKeyword;
+import com.example.isca_app.service.CheckNetworkConnection;
+import com.example.isca_app.service.ConnectionDetector;
+import com.example.isca_app.service.PhotoDataService;
+import com.example.isca_app.service.RetrofitInstance;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+
+
+public class PhotoDataSource extends PageKeyedDataSource {
+ public final static String method = "flickr.Photos.search";
+ public final static String api_key = "d209679a09441c1be63a8489cfd4dadd";
+ public final static String format = "json";
+ public static String tags = "";
+ public final static String nojsoncallback = "1";
+
+
+ Application application;
+ PhotoRepository photoRepository;
+ public PhotoDataSource(Application application) {
+ this.application =application;
+ photoRepository = new PhotoRepository(application);
+ }
+
+
+ @Override
+ public void loadInitial(@NonNull LoadInitialParams params, @NonNull final LoadInitialCallback callback) {
+ if (CheckNetworkConnection.hasInternetConnection(application)) {
+ //Check internet Access
+ if (ConnectionDetector.hasInternetConnection(application)) {
+
+ PhotoDataService dataService = RetrofitInstance.getService();
+ Call call = dataService.getPhotosWithPage(method,api_key,format,tags,nojsoncallback,1);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ PhotoResponse photoResponse= response.body();
+ ArrayList photosList=(ArrayList) photoResponse.getPhotos().getPhoto();
+
+ savePage(response);
+ callback.onResult(photosList,null, 2);
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ }
+ });
+ }
+ else
+ {
+ getFirstPage(callback);
+ }
+ }
+ else
+ {
+ getFirstPage(callback);
+ }
+ }
+
+ @Override
+ public void loadBefore(@NonNull LoadParams params, @NonNull LoadCallback callback) {
+
+ }
+
+ @Override
+ public void loadAfter(@NonNull final LoadParams params, @NonNull final LoadCallback callback) {
+
+ if (CheckNetworkConnection.hasInternetConnection(application)) {
+ //Check internet Access
+ if (ConnectionDetector.hasInternetConnection(application)) {
+
+ PhotoDataService dataService = RetrofitInstance.getService();
+ Call call = dataService.getPhotosWithPage(method, api_key, format, tags, nojsoncallback, params.key);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ PhotoResponse photoResponse = response.body();
+ ArrayList photosList = (ArrayList) photoResponse.getPhotos().getPhoto();
+
+ savePage(response);
+ callback.onResult(photosList, params.key + 1);
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ }
+ });
+ }
+ else
+ {
+ getPage(params,callback);
+ }
+ }
+ else
+ {
+ getPage(params,callback);
+ }
+ }
+
+ public void getFirstPage(final LoadInitialCallback callback)
+ {
+ PhotoRepository photoRepository=new PhotoRepository(application);
+
+ SearchKeyword keyword= null;
+ try {
+ keyword = photoRepository.getKeyword(tags);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (keyword!=null)
+ {
+ try {
+
+ List pages=photoRepository.getPages(keyword.getId());
+ sortPages(pages);
+ List photos=photoRepository.getPhoto(pages.get(0).getId());
+
+ callback.onResult(CreatephotoModels(photos),null, 2);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void getPage(final LoadParams params, @NonNull final LoadCallback callback)
+ {
+ PhotoRepository photoRepository=new PhotoRepository(application);
+
+ SearchKeyword keyword= null;
+ try {
+ keyword = photoRepository.getKeyword(tags);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (keyword!=null)
+ {
+ try {
+
+ List pages=photoRepository.getPages(keyword.getId());
+ sortPages(pages);
+
+ if (params.key-1!=pages.size()) {
+ List photos = photoRepository.getPhoto(pages.get(params.key - 1).getId());
+
+ callback.onResult(CreatephotoModels(photos), params.key + 1);
+
+ }
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void savePage(Response response)
+ {
+ PhotoResponse photoResponse= response.body();
+ ArrayList photosList=(ArrayList) photoResponse.getPhotos().getPhoto();
+ Photos pageRetrofit=photoResponse.getPhotos();
+ SearchKeyword keyword= null;
+ try {
+ keyword = photoRepository.getKeyword(tags);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ Page pageRoom=new Page(pageRetrofit.getPage(),pageRetrofit.getPages(), pageRetrofit.getPerpage(),pageRetrofit.getTotal(), keyword.getId());
+ try {
+ long l=photoRepository.addPage(pageRoom);
+ pageRoom.setId((int) l);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+
+ for (int i=0;i sortPages(List pages){
+ Collections.sort(pages, new Comparator() {
+ @Override
+ public int compare(Page u1, Page u2) {
+ return u1.getPageNumber().compareTo(u2.getPageNumber());
+ }
+ });
+ return pages;
+ }
+
+ public List CreatephotoModels(List photos)
+ {
+ List photoModels = new ArrayList<>();
+ for (int i=0;i CALLBACK=new DiffUtil.ItemCallback() {
+ @Override
+ public boolean areItemsTheSame(PhotoModel oldItem, PhotoModel newItem) {
+ return oldItem.id == newItem.id;
+ }
+
+ @Override
+ public boolean areContentsTheSame(PhotoModel oldItem, PhotoModel newItem) {
+ return true;
+ }
+ };
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Retrofit/PhotoResponse.java b/app/src/main/java/com/example/isca_app/model/Retrofit/PhotoResponse.java
new file mode 100644
index 0000000..10fa65f
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Retrofit/PhotoResponse.java
@@ -0,0 +1,27 @@
+package com.example.isca_app.model.Retrofit;
+
+public class PhotoResponse {
+ Photos photos;
+ String stat;
+
+ public PhotoResponse(Photos photos, String stat) {
+ this.photos = photos;
+ this.stat = stat;
+ }
+
+ public Photos getPhotos() {
+ return photos;
+ }
+
+ public void setPhotos(Photos photos) {
+ this.photos = photos;
+ }
+
+ public String getStat() {
+ return stat;
+ }
+
+ public void setStat(String stat) {
+ this.stat = stat;
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Retrofit/Photos.java b/app/src/main/java/com/example/isca_app/model/Retrofit/Photos.java
new file mode 100644
index 0000000..0d5a087
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Retrofit/Photos.java
@@ -0,0 +1,61 @@
+package com.example.isca_app.model.Retrofit;
+
+import java.util.List;
+
+public class Photos {
+
+ int page;
+ int pages;
+ int perpage;
+ String total;
+ List photo;
+
+ public Photos(int page, int pages, int perpage, String total, List photo) {
+ this.page = page;
+ this.pages = pages;
+ this.perpage = perpage;
+ this.total = total;
+ this.photo = photo;
+ }
+
+
+ public int getPage() {
+ return page;
+ }
+
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+ public int getPages() {
+ return pages;
+ }
+
+ public void setPages(int pages) {
+ this.pages = pages;
+ }
+
+ public int getPerpage() {
+ return perpage;
+ }
+
+ public void setPerpage(int perpage) {
+ this.perpage = perpage;
+ }
+
+ public String getTotal() {
+ return total;
+ }
+
+ public void setTotal(String total) {
+ this.total = total;
+ }
+
+ public List getPhoto() {
+ return photo;
+ }
+
+ public void setPhoto(List photo) {
+ this.photo = photo;
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/DAO.java b/app/src/main/java/com/example/isca_app/model/Room/DAO.java
new file mode 100644
index 0000000..742460b
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/DAO.java
@@ -0,0 +1,35 @@
+package com.example.isca_app.model.Room;
+
+import android.arch.lifecycle.LiveData;
+import android.arch.persistence.room.Dao;
+import android.arch.persistence.room.Delete;
+import android.arch.persistence.room.Insert;
+import android.arch.persistence.room.Query;
+import android.arch.persistence.room.Update;
+
+import com.example.isca_app.model.Room.entity.SearchKeyword;
+
+import java.util.List;
+
+@Dao
+public interface DAO {
+ @Insert
+ public long addKeyord(SearchKeyword searchKeyword);
+
+ @Update
+ public void updateKeyord(SearchKeyword searchKeyword);
+
+ @Delete
+ public void deleteKeyord(SearchKeyword searchKeyword);
+
+ @Query("select * from SearchKeywords where keyWord == :searchkeyword")
+ public SearchKeyword getKeyword(String searchkeyword);
+
+ @Query("select * from SearchKeywords")
+ public LiveData> getSearchKeywords();
+
+ /*
+ @Query("select * from SearchKeywords where id ==:searchKeywordId")
+ public LiveData getSearchKeyword(long searchKeywordId);
+ */
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/PagesDAO.java b/app/src/main/java/com/example/isca_app/model/Room/PagesDAO.java
new file mode 100644
index 0000000..94e15b8
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/PagesDAO.java
@@ -0,0 +1,34 @@
+package com.example.isca_app.model.Room;
+
+import android.arch.lifecycle.LiveData;
+import android.arch.persistence.room.Dao;
+import android.arch.persistence.room.Delete;
+import android.arch.persistence.room.Insert;
+import android.arch.persistence.room.Query;
+import android.arch.persistence.room.Update;
+
+import com.example.isca_app.model.Room.entity.Page;
+import com.example.isca_app.model.Room.entity.Photo;
+import com.example.isca_app.model.Room.entity.SearchKeyword;
+
+import java.util.List;
+
+@Dao
+public interface PagesDAO {
+
+ @Insert
+ public long addPage(Page page);
+
+ @Update
+ public void updatePage(Page page);
+
+ @Delete
+ public void deletePage(Page page);
+
+ @Query("select * from Pages")
+ public LiveData> getAllPages();
+
+ @Query("select * from Pages where keywordId==:KeywordId")
+ public List getPages(int KeywordId);
+
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/PhotoRepository.java b/app/src/main/java/com/example/isca_app/model/Room/PhotoRepository.java
new file mode 100644
index 0000000..6da7815
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/PhotoRepository.java
@@ -0,0 +1,118 @@
+package com.example.isca_app.model.Room;
+
+import android.app.Application;
+import android.arch.lifecycle.LiveData;
+import android.os.AsyncTask;
+
+import com.example.isca_app.model.Room.entity.Page;
+import com.example.isca_app.model.Room.entity.Photo;
+import com.example.isca_app.model.Room.entity.SearchKeyword;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+public class PhotoRepository {
+
+ SearchKeywordsAppDatabase appDatabase;
+ DAO dao;
+ PagesDAO pagesDAO;
+ PhotosDAO photosDAO;
+ public PhotoRepository(Application application) {
+
+ appDatabase = SearchKeywordsAppDatabase.getInstance(application);
+ dao = appDatabase.getSearchKeywordDAO();
+ pagesDAO = appDatabase.getPageDAO();
+ photosDAO = appDatabase.getPhotoDAO();
+ }
+
+
+ public void addSearchKeyword(final String keyword)
+ {
+ Executor myExecutor = Executors.newSingleThreadExecutor();
+ myExecutor.execute(new Runnable() {
+ @Override
+ public void run() {
+ dao.addKeyord(new SearchKeyword(keyword));
+ }
+ });
+ //new addKeywordDataAsyncTask().execute(keyword);
+ }
+
+
+ public LiveData> getSearchKeywords()
+ {
+ return dao.getSearchKeywords();
+ }
+
+ public SearchKeyword getKeyword(String keyword) throws ExecutionException, InterruptedException {
+ return new getKeywordDataAsyncTask().execute(keyword).get();
+ }
+
+
+ private class getKeywordDataAsyncTask extends AsyncTask {
+
+
+ @Override
+ protected SearchKeyword doInBackground(String... strings) {
+ return dao.getKeyword(strings[0]);
+ }
+ }
+
+
+
+ public long addPage(final Page page) throws ExecutionException, InterruptedException {
+ return new addPageDataAsyncTask().execute(page).get();
+ }
+
+
+ public List getPages(int keywordId) throws ExecutionException, InterruptedException {
+ return new getPagesDataAsyncTask().execute(keywordId).get();
+ }
+
+
+
+ private class addPageDataAsyncTask extends AsyncTask {
+
+
+ @Override
+ protected Long doInBackground(Page... pages) {
+ return pagesDAO.addPage(pages[0]);
+ }
+ }
+ private class getPagesDataAsyncTask extends AsyncTask> {
+
+ @Override
+ protected List doInBackground(Integer... integers) {
+ return pagesDAO.getPages(integers[0]);
+ }
+ }
+
+
+ public void addPhoto(final Photo photo)
+ {
+ Executor myExecutor = Executors.newSingleThreadExecutor();
+ myExecutor.execute(new Runnable() {
+ @Override
+ public void run() {
+ photosDAO.addPhoto(photo);
+ }
+ });
+ //new addPhotoDataAsyncTask().execute(photo);
+ }
+
+
+ public List getPhoto(int pageId) throws ExecutionException, InterruptedException {
+ return new getPhotosDataAsyncTask().execute(pageId).get();
+ }
+
+
+ private class getPhotosDataAsyncTask extends AsyncTask> {
+
+ @Override
+ protected List doInBackground(Integer... integers) {
+ return photosDAO.getPhotos(integers[0]);
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/PhotosDAO.java b/app/src/main/java/com/example/isca_app/model/Room/PhotosDAO.java
new file mode 100644
index 0000000..0a07121
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/PhotosDAO.java
@@ -0,0 +1,35 @@
+package com.example.isca_app.model.Room;
+
+import android.arch.lifecycle.LiveData;
+import android.arch.persistence.room.Dao;
+import android.arch.persistence.room.Delete;
+import android.arch.persistence.room.Insert;
+import android.arch.persistence.room.Query;
+import android.arch.persistence.room.Update;
+
+import com.example.isca_app.model.Room.entity.Page;
+import com.example.isca_app.model.Room.entity.Photo;
+
+import java.util.List;
+
+@Dao
+public interface PhotosDAO {
+
+
+
+ @Insert
+ public long addPhoto(Photo photo);
+
+ @Update
+ public void updatePhoto(Photo photo);
+
+ @Delete
+ public void deletePhoto(Photo photo);
+
+ @Query("select * from Photos")
+ public LiveData> getPhotos();
+
+
+ @Query("select * from Photos where pageId==:PageId")
+ public List getPhotos(int PageId);
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/SearchKeywordsAppDatabase.java b/app/src/main/java/com/example/isca_app/model/Room/SearchKeywordsAppDatabase.java
new file mode 100644
index 0000000..d072ee6
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/SearchKeywordsAppDatabase.java
@@ -0,0 +1,31 @@
+package com.example.isca_app.model.Room;
+
+import android.arch.persistence.room.Database;
+import android.arch.persistence.room.Room;
+import android.arch.persistence.room.RoomDatabase;
+import android.content.Context;
+
+import com.example.isca_app.model.Room.entity.Page;
+import com.example.isca_app.model.Room.entity.Photo;
+import com.example.isca_app.model.Room.entity.SearchKeyword;
+
+@Database(entities = {SearchKeyword.class, Page.class, Photo.class},version = 1)
+public abstract class SearchKeywordsAppDatabase extends RoomDatabase {
+
+ public abstract DAO getSearchKeywordDAO();
+ public abstract PagesDAO getPageDAO();
+ public abstract PhotosDAO getPhotoDAO();
+
+ private static SearchKeywordsAppDatabase instance;
+
+ public static synchronized SearchKeywordsAppDatabase getInstance(Context context) {
+ if (instance == null) {
+ instance = Room.databaseBuilder(context.getApplicationContext(),
+ SearchKeywordsAppDatabase.class, "Search_database")
+ .fallbackToDestructiveMigration()
+ .build();
+ }
+ return instance;
+ }
+
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/entity/Page.java b/app/src/main/java/com/example/isca_app/model/Room/entity/Page.java
new file mode 100644
index 0000000..b607d94
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/entity/Page.java
@@ -0,0 +1,89 @@
+package com.example.isca_app.model.Room.entity;
+
+import android.arch.persistence.room.ColumnInfo;
+import android.arch.persistence.room.Entity;
+import android.arch.persistence.room.ForeignKey;
+import android.arch.persistence.room.PrimaryKey;
+
+import static android.arch.persistence.room.ForeignKey.CASCADE;
+
+@Entity(tableName = "Pages",foreignKeys = @ForeignKey(entity = SearchKeyword.class,
+ parentColumns = "id",childColumns = "keywordId",onDelete = CASCADE))
+public class Page {
+ @ColumnInfo(name = "pageNumber")
+ Integer pageNumber;
+ @ColumnInfo(name = "NumberOFpages")
+ int NumberOFpages;
+ @ColumnInfo(name = "perpage")
+ int perpage;
+ @ColumnInfo(name = "total")
+ String total;
+
+ @ColumnInfo(name = "id")
+ @PrimaryKey(autoGenerate = true)
+ int id;
+ @ColumnInfo(name = "keywordId")
+ int keywordId;
+
+ public Page()
+ {
+
+ }
+
+ public Page(int pageNumber, int numberOFpages, int perpage, String total, int keywordId) {
+ this.pageNumber = pageNumber;
+ NumberOFpages = numberOFpages;
+ this.perpage = perpage;
+ this.total = total;
+ this.id = id;
+ this.keywordId = keywordId;
+ }
+
+ public Integer getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(Integer pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+
+ public int getNumberOFpages() {
+ return NumberOFpages;
+ }
+
+ public void setNumberOFpages(int numberOFpages) {
+ NumberOFpages = numberOFpages;
+ }
+
+ public int getPerpage() {
+ return perpage;
+ }
+
+ public void setPerpage(int perpage) {
+ this.perpage = perpage;
+ }
+
+ public String getTotal() {
+ return total;
+ }
+
+ public void setTotal(String total) {
+ this.total = total;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getKeywordId() {
+ return keywordId;
+ }
+
+ public void setKeywordId(int keywordId) {
+ this.keywordId = keywordId;
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/entity/Photo.java b/app/src/main/java/com/example/isca_app/model/Room/entity/Photo.java
new file mode 100644
index 0000000..a2d54ee
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/entity/Photo.java
@@ -0,0 +1,153 @@
+package com.example.isca_app.model.Room.entity;
+
+import android.arch.persistence.room.ColumnInfo;
+import android.arch.persistence.room.Entity;
+import android.arch.persistence.room.ForeignKey;
+import android.arch.persistence.room.PrimaryKey;
+
+import static android.arch.persistence.room.ForeignKey.CASCADE;
+
+@Entity(tableName = "Photos",foreignKeys = {
+ @ForeignKey(entity = Page.class, parentColumns = "id",childColumns = "pageId",onDelete = CASCADE)
+})
+public class Photo {
+ @ColumnInfo(name = "owner")
+ String owner;
+ @ColumnInfo(name = "secret")
+ String secret;
+ @ColumnInfo(name = "server")
+ String server;
+ @ColumnInfo(name = "farm")
+ int farm;
+ @ColumnInfo(name = "title")
+ String title;
+ @ColumnInfo(name = "ispublic")
+ int ispublic;
+ @ColumnInfo(name = "isfriend")
+ int isfriend;
+ @ColumnInfo(name = "isfamily")
+ int isfamily;
+ @ColumnInfo(name = "photoid")
+ long id;
+
+ @ColumnInfo(name = "id")
+ @PrimaryKey(autoGenerate = true)
+ int idPrim;
+ @ColumnInfo(name = "pageId")
+ long PageId;
+ @ColumnInfo(name = "keywordId")
+ long KeywordId;
+
+ public Photo() {
+ }
+
+ public Photo(String owner, String secret, String server, int farm, String title, int ispublic, int isfriend, int isfamily, long id, long pageId, long keywordId) {
+ this.owner = owner;
+ this.secret = secret;
+ this.server = server;
+ this.farm = farm;
+ this.title = title;
+ this.ispublic = ispublic;
+ this.isfriend = isfriend;
+ this.isfamily = isfamily;
+ this.id = id;
+ PageId = pageId;
+ KeywordId = keywordId;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+ public String getServer() {
+ return server;
+ }
+
+ public void setServer(String server) {
+ this.server = server;
+ }
+
+ public int getFarm() {
+ return farm;
+ }
+
+ public void setFarm(int farm) {
+ this.farm = farm;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getIspublic() {
+ return ispublic;
+ }
+
+ public void setIspublic(int ispublic) {
+ this.ispublic = ispublic;
+ }
+
+ public int getIsfriend() {
+ return isfriend;
+ }
+
+ public void setIsfriend(int isfriend) {
+ this.isfriend = isfriend;
+ }
+
+ public int getIsfamily() {
+ return isfamily;
+ }
+
+ public void setIsfamily(int isfamily) {
+ this.isfamily = isfamily;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public long getPageId() {
+ return PageId;
+ }
+
+ public void setPageId(long pageId) {
+ PageId = pageId;
+ }
+
+ public long getKeywordId() {
+ return KeywordId;
+ }
+
+ public void setKeywordId(long keywordId) {
+ KeywordId = keywordId;
+ }
+
+ public int getIdPrim() {
+ return idPrim;
+ }
+
+ public void setIdPrim(int idPrim) {
+ this.idPrim = idPrim;
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/model/Room/entity/SearchKeyword.java b/app/src/main/java/com/example/isca_app/model/Room/entity/SearchKeyword.java
new file mode 100644
index 0000000..84714e8
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/model/Room/entity/SearchKeyword.java
@@ -0,0 +1,41 @@
+package com.example.isca_app.model.Room.entity;
+
+import android.arch.persistence.room.ColumnInfo;
+import android.arch.persistence.room.Entity;
+import android.arch.persistence.room.Ignore;
+import android.arch.persistence.room.PrimaryKey;
+
+@Entity(tableName = "SearchKeywords")
+public class SearchKeyword {
+
+ @ColumnInfo(name = "keyWord")
+ String keyWord;
+ @ColumnInfo(name = "id")
+ @PrimaryKey(autoGenerate = true)
+ int id;
+
+
+ @Ignore
+ public SearchKeyword() {
+ }
+
+ public SearchKeyword(String keyWord) {
+ this.keyWord = keyWord;
+ }
+
+ public String getKeyWord() {
+ return keyWord;
+ }
+
+ public void setKeyWord(String keyWord) {
+ this.keyWord = keyWord;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/service/CheckNetworkConnection.java b/app/src/main/java/com/example/isca_app/service/CheckNetworkConnection.java
new file mode 100644
index 0000000..73dd5fd
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/service/CheckNetworkConnection.java
@@ -0,0 +1,23 @@
+package com.example.isca_app.service;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+/**
+ * Created by khaled-pc on 10/28/2018.
+ */
+
+public class CheckNetworkConnection {
+
+ public static boolean hasInternetConnection(Context context) {
+ ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED ||
+ connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
+ return true;
+
+ }else{
+ return false;
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/service/ConnectionDetector.java b/app/src/main/java/com/example/isca_app/service/ConnectionDetector.java
new file mode 100644
index 0000000..b684299
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/service/ConnectionDetector.java
@@ -0,0 +1,41 @@
+package com.example.isca_app.service;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkCapabilities;
+import android.os.Build;
+
+import java.io.IOException;
+
+/**
+ * Created by khaled-pc on 10/28/2018.
+ */
+
+public class ConnectionDetector {
+
+ public static boolean hasInternetConnection(Context _context) {
+ Network network;
+ ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkCapabilities capabilities = null;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ network = connectivity.getActiveNetwork();
+ capabilities = connectivity.getNetworkCapabilities(network);
+ return capabilities != null && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
+ } else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M){
+ if (connectivity != null) {
+ final String command = "ping -c 1 google.com";
+ try {
+ return Runtime.getRuntime().exec(command).waitFor() == 0;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+
+}
diff --git a/app/src/main/java/com/example/isca_app/service/PhotoDataService.java b/app/src/main/java/com/example/isca_app/service/PhotoDataService.java
new file mode 100644
index 0000000..61c1ef8
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/service/PhotoDataService.java
@@ -0,0 +1,34 @@
+package com.example.isca_app.service;
+
+import com.example.isca_app.model.Retrofit.PhotoResponse;
+
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Query;
+
+/**
+ * Created by K. A. ANUSHKA MADUSANKA on 7/9/2018.
+ */
+public interface PhotoDataService {
+
+
+
+ @GET("rest/?")
+ Call getPhotos(
+ @Query("method") String method,
+ @Query("api_key") String api_key,
+ @Query("format") String format,
+ @Query("tags") String tags,
+ @Query("nojsoncallback") String nojsoncallback);
+
+
+ @GET("rest/?")
+ Call getPhotosWithPage(
+ @Query("method") String method,
+ @Query("api_key") String api_key,
+ @Query("format") String format,
+ @Query("tags") String tags,
+ @Query("nojsoncallback") String nojsoncallback,
+ @Query("page") long page);
+
+}
diff --git a/app/src/main/java/com/example/isca_app/service/RetrofitInstance.java b/app/src/main/java/com/example/isca_app/service/RetrofitInstance.java
new file mode 100644
index 0000000..e967fb9
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/service/RetrofitInstance.java
@@ -0,0 +1,31 @@
+package com.example.isca_app.service;
+
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+/**
+ * Created by K. A. ANUSHKA MADUSANKA on 7/9/2018.
+ */
+public class RetrofitInstance {
+
+ private static Retrofit retrofit = null;
+ private static String BASE_URL="https://api.flickr.com/services/";
+
+ public static PhotoDataService getService(){
+
+
+ if(retrofit==null){
+
+ retrofit=new Retrofit
+ .Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create())
+ .build();
+
+ }
+
+ return retrofit.create(PhotoDataService.class);
+
+ }
+
+}
diff --git a/app/src/main/java/com/example/isca_app/view/FullScreenPhotoActivity.java b/app/src/main/java/com/example/isca_app/view/FullScreenPhotoActivity.java
new file mode 100644
index 0000000..79dc862
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/view/FullScreenPhotoActivity.java
@@ -0,0 +1,63 @@
+package com.example.isca_app.view;
+
+import android.graphics.Bitmap;
+import android.os.Build;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.transition.Fade;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.example.isca_app.R;
+import com.squareup.picasso.Picasso;
+import com.squareup.picasso.Transformation;
+import com.victor.loading.rotate.RotateLoading;
+
+public class FullScreenPhotoActivity extends AppCompatActivity {
+
+ ImageView fullscreenImage;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_fullscreen_photo);
+
+ fullscreenImage=findViewById(R.id.fullscreenImage);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ Fade fade = new Fade();
+ View decor = getWindow().getDecorView();
+ fade.excludeTarget(decor.findViewById(R.id.action_bar_container), true);
+ fade.excludeTarget(android.R.id.statusBarBackground, true);
+
+ fade.excludeTarget(android.R.id.navigationBarBackground, true);
+
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ getWindow().setEnterTransition(fade);
+ getWindow().setExitTransition(fade);
+ }
+ }
+
+ final RotateLoading rotateLoading=findViewById(R.id.rotateloading);
+ rotateLoading.start();
+
+ Picasso.with(this).load(geturlData())
+ .fit().centerInside()
+ .into(fullscreenImage, new com.squareup.picasso.Callback() {
+ @Override
+ public void onSuccess() {
+ rotateLoading.stop();
+ }
+ @Override
+ public void onError() {
+ rotateLoading.stop();
+ fullscreenImage.setImageResource(R.drawable.ic_action_navigation_arrow_back);
+ }
+ });
+ }
+
+ public String geturlData()
+ {
+ return getIntent().getStringExtra("URL");
+ }
+}
diff --git a/app/src/main/java/com/example/isca_app/view/MainActivity.java b/app/src/main/java/com/example/isca_app/view/MainActivity.java
new file mode 100644
index 0000000..7b05b40
--- /dev/null
+++ b/app/src/main/java/com/example/isca_app/view/MainActivity.java
@@ -0,0 +1,219 @@
+package com.example.isca_app.view;
+
+import android.arch.lifecycle.LiveData;
+import android.arch.lifecycle.Observer;
+import android.arch.lifecycle.ViewModelProviders;
+import android.arch.paging.PagedList;
+import android.content.res.Configuration;
+import android.graphics.Color;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.support.v7.widget.DefaultItemAnimator;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.Toolbar;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Toast;
+
+import com.example.isca_app.R;
+import com.example.isca_app.adapter.PhotoAdapter;
+import com.example.isca_app.model.Retrofit.PhotoModel;
+import com.example.isca_app.model.Room.entity.SearchKeyword;
+import com.example.isca_app.service.CheckNetworkConnection;
+import com.example.isca_app.service.ConnectionDetector;
+import com.example.isca_app.viewmodel.MainAcivityViewModel;
+import com.miguelcatalan.materialsearchview.MaterialSearchView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.example.isca_app.model.Retrofit.PhotoDataSource.tags;
+
+public class MainActivity extends AppCompatActivity {
+
+ MaterialSearchView searchView;
+
+ public MainAcivityViewModel mainAcivityViewModel;
+ RecyclerView recyclerView;
+ PhotoAdapter pAdapter;
+
+ PagedList modelPagedList;
+
+ String[] keywords;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle(getResources().getString(R.string.app_name));
+
+ recyclerView=findViewById(R.id.Photo_recycleview);
+ searchView = (MaterialSearchView) findViewById(R.id.search_view);
+
+
+ pAdapter = new PhotoAdapter(this,this);
+ mainAcivityViewModel= ViewModelProviders.of(this).get(MainAcivityViewModel.class);
+
+
+ if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
+ recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
+ } else {
+ recyclerView.setLayoutManager(new GridLayoutManager(this, 6));
+ }
+ recyclerView.setItemAnimator(new DefaultItemAnimator());
+ recyclerView.setAdapter(pAdapter);
+
+ if (tags!="")
+ {
+ startCreatingSearch(tags);
+ }
+
+
+ LiveData> searchKeywords=mainAcivityViewModel.getSearchKeywords();
+ searchKeywords.observe(this, new Observer>() {
+ @Override
+ public void onChanged(@Nullable List searchKeywords) {
+ keywords=new String[searchKeywords.size()];
+ for (int i=0;i>() {
+ @Override
+ public void onChanged(@Nullable PagedList photoModels) {
+
+ modelPagedList=photoModels;
+
+ if (photoModels.size()==0)
+ {
+ Toast.makeText(getApplicationContext(),"please search with another word",Toast.LENGTH_LONG).show();
+ }
+ pAdapter.submitList(photoModels);
+
+ pAdapter.notifyDataSetChanged();
+
+ mainAcivityViewModel.getPhotosPagedList().removeObserver(this);
+ mainAcivityViewModel.createPagedList(getApplication());
+ }
+ });
+
+ }
+
+ public boolean keywordIsExist(String keyword)
+ {
+ for (int i=0;i photoDataSourceLiveData;
+ private Executor executor;
+ private LiveData> photosPagedList;
+ private PhotoDataSourceFactory factory;
+
+ private PhotoRepository photoRepository;
+
+ public MainAcivityViewModel(@NonNull Application application) {
+ super(application);
+ photoRepository = new PhotoRepository(application);
+
+ createPagedList(application);
+
+ }
+
+ public LiveData> getPhotosPagedList() {
+ return photosPagedList;
+ }
+
+ public PhotoDataSourceFactory getFactory() {
+ return factory;
+ }
+
+ public void createPagedList(Application application)
+ {
+ factory=new PhotoDataSourceFactory(application);
+ //photoDataSourceLiveData=factory.getMutableLiveData();
+
+ PagedList.Config config=(new PagedList.Config.Builder())
+ .setEnablePlaceholders(true)
+ .setInitialLoadSizeHint(10)
+ .setPageSize(20)
+ .setPrefetchDistance(4)
+ .build();
+
+
+ executor= Executors.newFixedThreadPool(5);
+
+ photosPagedList = (new LivePagedListBuilder(factory,config))
+ .setFetchExecutor(executor)
+ .build();
+ }
+
+
+
+
+ public void addSearchKeyword(String keyword)
+ {
+ photoRepository.addSearchKeyword(keyword);
+ }
+
+
+ public LiveData> getSearchKeywords()
+ {
+ return photoRepository.getSearchKeywords();
+ }
+
+
+ public void addPage(Page page) throws ExecutionException, InterruptedException {
+ photoRepository.addPage(page);
+ }
+
+
+ /*public LiveData> getPages()
+ {
+ return photoRepository.getPages();
+ }*/
+
+
+
+ public void addPhoto(Photo photo)
+ {
+ photoRepository.addPhoto(photo);
+ }
+
+
+ /*public LiveData> getPhotos()
+ {
+ return photoRepository.getPhotos();
+ }*/
+}
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..1f6bb29
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..0d025f9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_fullscreen_photo.xml b/app/src/main/res/layout/activity_fullscreen_photo.xml
new file mode 100644
index 0000000..4721ced
--- /dev/null
+++ b/app/src/main/res/layout/activity_fullscreen_photo.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..070058b
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_photo.xml b/app/src/main/res/layout/dialog_photo.xml
new file mode 100644
index 0000000..1e1d5b6
--- /dev/null
+++ b/app/src/main/res/layout/dialog_photo.xml
@@ -0,0 +1,313 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/photo_item.xml b/app/src/main/res/layout/photo_item.xml
new file mode 100644
index 0000000..22c1a72
--- /dev/null
+++ b/app/src/main/res/layout/photo_item.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/search_menu.xml b/app/src/main/res/menu/search_menu.xml
new file mode 100644
index 0000000..c20ee42
--- /dev/null
+++ b/app/src/main/res/menu/search_menu.xml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..d642503
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..cbfcfbd
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..0a1d1ad
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e0617dc
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..8c223ad
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..1f488fe
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..2297a81
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..bb9d3c5
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..851f824
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..ef1b41a
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..799a896
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #0EB4D5
+ #1A7EB4
+ #D81B60
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..fdc54ca
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ ISCA APP
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..4eff14d
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/com/example/isca_app/ExampleUnitTest.java b/app/src/test/java/com/example/isca_app/ExampleUnitTest.java
new file mode 100644
index 0000000..1eeeb8c
--- /dev/null
+++ b/app/src/test/java/com/example/isca_app/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.example.isca_app;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..fafc1b9
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,27 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.4.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..82618ce
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,15 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..aaa6aee
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sun Aug 04 02:31:27 EET 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/tamimy.jks b/tamimy.jks
new file mode 100644
index 0000000..3fdedd3
Binary files /dev/null and b/tamimy.jks differ