diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 8be108f..0229bdf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,11 +1,12 @@
apply plugin: 'com.android.application'
+apply plugin: 'realm-android'
android {
- compileSdkVersion 26
+ compileSdkVersion 27
defaultConfig {
applicationId "com.blink22.android.gitpop"
minSdkVersion 19
- targetSdkVersion 26
+ targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -19,10 +20,20 @@ android {
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:26.1.0'
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
+ implementation 'com.android.support:recyclerview-v7:27.1.1'
+ implementation 'com.android.support:cardview-v7:27.1.1'
+ implementation 'com.squareup.retrofit2:retrofit:2.4.0'
+ implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
+ implementation 'com.jakewharton:butterknife:8.8.1'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
+ implementation 'com.github.bumptech.glide:glide:4.7.1'
+ annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
+ implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
+ implementation 'de.hdodenhof:circleimageview:2.2.0'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0d00eba..06f1c7e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,6 +2,8 @@
+
+
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopAdapter.java b/app/src/main/java/com/blink22/android/gitpop/GitPopAdapter.java
new file mode 100644
index 0000000..ebb099c
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopAdapter.java
@@ -0,0 +1,41 @@
+package com.blink22.android.gitpop;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import java.util.List;
+
+/**
+ * Created by ahmedghazy on 7/17/18.
+ */
+
+public class GitPopAdapter extends RecyclerView.Adapter {
+ Context mContext;
+ List mRepos;
+
+ public GitPopAdapter(Context context) {
+ mContext = context;
+ }
+
+ @Override
+ public GitPopHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ LayoutInflater inflater = LayoutInflater.from(mContext);
+ return new GitPopHolder(inflater, parent, mContext);
+ }
+
+ public void setRepos(List repos) {
+ mRepos = repos;
+ }
+
+ @Override
+ public void onBindViewHolder(GitPopHolder holder, int position) {
+ holder.bind(mRepos.get(position));
+ }
+
+ @Override
+ public int getItemCount() {
+ return mRepos.size();
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopFetcher.java b/app/src/main/java/com/blink22/android/gitpop/GitPopFetcher.java
new file mode 100644
index 0000000..ae12655
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopFetcher.java
@@ -0,0 +1,68 @@
+package com.blink22.android.gitpop;
+
+import android.util.Log;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import okhttp3.Interceptor;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.logging.HttpLoggingInterceptor;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+/**
+ * Created by ahmedghazy on 7/18/18.
+ */
+
+public class GitPopFetcher {
+ private static final String TAG = "GitPopFetcher";
+
+ Retrofit mRetrofit;
+ GitPopService mGitPopService;
+ public GitPopFetcher() {
+// HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
+// logging.setLevel(HttpLoggingInterceptor.Level.BODY);
+// OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
+// httpClient.addInterceptor(logging);
+
+ mRetrofit = new Retrofit.Builder()
+ .baseUrl("https://api.github.com/")
+ .addConverterFactory(GsonConverterFactory.create())
+// .client(httpClient.build())
+ .build();
+ mGitPopService = mRetrofit.create(GitPopService.class);
+
+ }
+
+ public void getReposForUser(String user, Callback> callback) {
+ mGitPopService.listReposForUser(user).enqueue(callback);
+ }
+
+ public void getMostPopularReposForTheLastWeek(Callback> callback) {
+// Calendar cal = Calendar.getInstance();
+// cal.setTime(new Date());
+// cal.add(Calendar.DATE, -7);
+// Date dateBefore7Days = cal.getTime();
+// SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd");
+// Log.i(TAG, dt1.format(dateBefore7Days));
+ Map params = new HashMap();
+// params.put("sort", "stars");
+// params.put("order", "desc");
+// params.put("q", "created:>2018-07-01");
+ mGitPopService.listReposForMostPopularSince(params).enqueue(callback);
+ }
+
+ public void getContributers(String repo, Callback> callback) {
+ mGitPopService.listContributersFor(repo).enqueue(callback);
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopHolder.java b/app/src/main/java/com/blink22/android/gitpop/GitPopHolder.java
new file mode 100644
index 0000000..ed9b80f
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopHolder.java
@@ -0,0 +1,53 @@
+package com.blink22.android.gitpop;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.support.v7.widget.RecyclerView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+/**
+ * Created by ahmedghazy on 7/17/18.
+ */
+
+public class GitPopHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+ @BindView(R.id.list_item_title) TextView mTitle;
+ @BindView(R.id.list_item_technology) TextView mLanguage;
+ Context mContext;
+
+ private static final Map colors = new HashMap(){{
+ put("Java", Color.BLUE);
+ put("Ruby", Color.RED);
+ put("JavaScript", Color.YELLOW);
+ }};
+
+ public GitPopHolder(LayoutInflater inflater, ViewGroup parent, Context context) {
+ super(inflater.inflate(R.layout.list_item_git_pop, parent, false));
+ itemView.setOnClickListener(this);
+ ButterKnife.bind(this, itemView);
+ mContext = context;
+ }
+
+ public void bind(Repo repo) {
+ mTitle.setText(repo.getFull_name());
+ mLanguage.setText(repo.getLanguage());
+ if(colors.get(repo.getLanguage()) != null)
+ Log.i("GitPopHolder", colors.get(repo.getLanguage()).toString());
+ mLanguage.setTextColor(colors.get(repo.getLanguage()) != null ? colors.get(repo.getLanguage()) : Color.BLACK);
+ }
+
+ @Override
+ public void onClick(View view) {
+ mContext.startActivity(GitPopPageActivity.newIntent(mContext, mTitle.getText().toString()));
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopListActivity.java b/app/src/main/java/com/blink22/android/gitpop/GitPopListActivity.java
new file mode 100644
index 0000000..9e8ab4d
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopListActivity.java
@@ -0,0 +1,14 @@
+package com.blink22.android.gitpop;
+
+import android.support.v4.app.Fragment;
+
+/**
+ * Created by ahmedghazy on 7/17/18.
+ */
+
+public class GitPopListActivity extends SingleFragmentActivity {
+ @Override
+ protected Fragment createFragment() {
+ return GitPopListFragment.newInstance();
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopListFragment.java b/app/src/main/java/com/blink22/android/gitpop/GitPopListFragment.java
new file mode 100644
index 0000000..a6c488e
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopListFragment.java
@@ -0,0 +1,193 @@
+package com.blink22.android.gitpop;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.SearchView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import io.realm.Realm;
+import io.realm.RealmList;
+import io.realm.RealmResults;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+/**
+ * Created by ahmedghazy on 7/17/18.
+ */
+
+public class GitPopListFragment extends Fragment implements Callback> {
+ @BindView(R.id.git_pop_recycler_view) RecyclerView mGitPopRecyclerView;
+ @BindView(R.id.empty_view)
+ TextView mEmptyView;
+ GitPopAdapter mGitPopAdapter;
+ List mRepos;
+ Realm mRealm;
+ private static final String TAG = "GitPopListFragment";
+
+ public static GitPopListFragment newInstance() {
+
+ Bundle args = new Bundle();
+
+ GitPopListFragment fragment = new GitPopListFragment();
+
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setHasOptionsMenu(true);
+
+ Realm.init(getActivity());
+
+ mRepos = new ArrayList();
+
+ mRealm = Realm.getDefaultInstance();
+
+ RealmResults results = mRealm.where(SearchItem.class).findAll();
+
+ if(results != null && results.size() > 0) {
+ new GitPopFetcher().getReposForUser(results.get(0).getSearchString(), this);
+ }
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ View v = inflater.inflate(R.layout.fragment_git_pop_list, container, false);
+
+ ButterKnife.bind(this, v);
+
+ mGitPopRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
+
+ updateUI();
+
+ return v;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ }
+
+ private void updateUI() {
+ if(mGitPopAdapter == null) {
+ mGitPopAdapter = new GitPopAdapter(getActivity());
+ mGitPopRecyclerView.setAdapter(mGitPopAdapter);
+ }
+
+ if (mRepos != null && mRepos.size() > 0) {
+ mGitPopRecyclerView.setVisibility(View.VISIBLE);
+ mEmptyView.setVisibility(View.GONE);
+ mGitPopAdapter.setRepos(mRepos);
+ } else {
+ mGitPopRecyclerView.setVisibility(View.GONE);
+ mEmptyView.setVisibility(View.VISIBLE);
+ }
+
+ mGitPopAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void onResponse(Call> call, final Response> response) {
+
+ if(response.body() != null && response.body().size() > 0 && mRealm.where(Repo.class).equalTo("id", response.body().get(0).getId()).findAll().size() == 0) {
+ Log.i(TAG, "found new items");
+
+ mRealm.executeTransaction(new Realm.Transaction() {
+ public void execute(Realm realm) {
+ realm.delete(Repo.class);
+
+ for(Repo repo: response.body()){
+ realm.insert(repo);
+ }
+ }
+ });
+
+ }
+
+
+ mRepos = mRealm.where(Repo.class).findAll();
+
+ updateUI();
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ super.onCreateOptionsMenu(menu, inflater);
+ inflater.inflate(R.menu.fragment_git_pop_list, menu);
+
+ MenuItem searchItem = menu.findItem(R.id.menu_item_search);
+ final SearchView searchView = (SearchView) searchItem.getActionView();
+
+ searchView.setOnQueryTextListener(
+ new SearchView.OnQueryTextListener() {
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ final SearchItem searchItem = new SearchItem(query);
+ mRealm.executeTransaction(new Realm.Transaction() {
+
+ public void execute(Realm realm) {
+ realm.delete(SearchItem.class);
+
+ realm.insert(searchItem);
+ }
+ });
+
+ RealmResults results = mRealm.where(SearchItem.class).findAll();
+
+ if(results.size() > 0) {
+ new GitPopFetcher().getReposForUser(results.get(0).getSearchString(), GitPopListFragment.this);
+ }
+
+ updateUI();
+
+
+ return true;
+ }
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ return false;
+ }
+ }
+ );
+
+ searchView.setOnSearchClickListener(new SearchView.OnClickListener(){
+
+ @Override
+ public void onClick(View v) {
+ RealmResults results = mRealm.where(SearchItem.class).findAll();
+
+ if(results.size() > 0) {
+ searchView.setQuery(results.get(0).getSearchString(), false);
+ }
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopPageActivity.java b/app/src/main/java/com/blink22/android/gitpop/GitPopPageActivity.java
new file mode 100644
index 0000000..5434ebc
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopPageActivity.java
@@ -0,0 +1,27 @@
+package com.blink22.android.gitpop;
+
+import android.content.Context;
+import android.content.Intent;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+
+/**
+ * Created by ahmedghazy on 7/18/18.
+ */
+
+public class GitPopPageActivity extends SingleFragmentActivity {
+ private static final String EXTRA_LINK = "com.blink22.android.gitpop.link";
+
+ public static Intent newIntent(Context context, String link) {
+ Intent intent = new Intent(context, GitPopPageActivity.class);
+ intent.putExtra(EXTRA_LINK, link);
+ Log.i("GitPopPageActivity", link);
+ Log.i("GitPopPageActivity", context.toString());
+ return intent;
+ }
+
+ @Override
+ protected Fragment createFragment() {
+ return GitPopPageFragment.newInstance(getIntent().getStringExtra(EXTRA_LINK));
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopPageFragment.java b/app/src/main/java/com/blink22/android/gitpop/GitPopPageFragment.java
new file mode 100644
index 0000000..fd6e05a
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopPageFragment.java
@@ -0,0 +1,180 @@
+package com.blink22.android.gitpop;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import de.hdodenhof.circleimageview.CircleImageView;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+/**
+ * Created by ahmedghazy on 7/18/18.
+ */
+
+public class GitPopPageFragment extends Fragment implements Callback> {
+ private static final String TAG = "GitPopPageFragment";
+
+ private static final String ARG_LINK = "link";
+ private static final String ARG_CONTRIBUTERS = "contributers";
+ @BindView(R.id.contributers_recycler_view) RecyclerView mContributersRecyclerView;
+ ContributerAdapter mContributerAdapter;
+ List mUsers;
+
+ @BindView(R.id.page_title) TextView mTitle;
+
+ public static GitPopPageFragment newInstance(String link) {
+
+ Bundle args = new Bundle();
+ args.putString(ARG_LINK, link);
+
+ GitPopPageFragment fragment = new GitPopPageFragment();
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ new GitPopFetcher().getContributers(getArguments().getString(ARG_LINK), this);
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ View v = inflater.inflate(R.layout.fragment_git_pop_page, container, false);
+ ButterKnife.bind(this, v);
+ mTitle.setText(getArguments().getString(ARG_LINK));
+ mContributersRecyclerView = (RecyclerView) v.findViewById(R.id.contributers_recycler_view);
+ mContributersRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
+ Log.i(TAG, getArguments().getString(ARG_LINK));
+ AppCompatActivity activity = (AppCompatActivity) getActivity();
+ activity.getSupportActionBar().setSubtitle(getArguments().getString(ARG_LINK));
+ return v;
+ }
+
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ mUsers = response.body();
+ Log.i(TAG, response.body() + "");
+ updateUI();
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+
+ }
+
+ private void updateUI() {
+ if(mContributerAdapter == null) {
+ mContributerAdapter = new ContributerAdapter(getActivity(), "https://github.com/" + getArguments().getString(ARG_LINK));
+ mContributersRecyclerView.setAdapter(mContributerAdapter);
+ }
+
+ if (mUsers != null) {
+ mContributerAdapter.setUsers(mUsers);
+ }
+
+ mContributerAdapter.notifyDataSetChanged();
+ }
+
+ private class ContributerAdapter extends RecyclerView.Adapter {
+ List mUsers = new ArrayList<>();
+ Context mContext;
+ String mLink;
+
+ public ContributerAdapter(Context context, String link) {
+ mContext = context;
+ mLink = link;
+ }
+
+ public void setUsers(List users) {
+ mUsers = users;
+ }
+
+ @Override
+
+ public ContributerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ LayoutInflater inflater = LayoutInflater.from(mContext);
+ return new ContributerHolder(inflater, parent, mContext);
+ }
+
+ @Override
+ public void onBindViewHolder(ContributerHolder holder, int position) {
+ if(position == mUsers.size()) {
+ Log.i(TAG, "The repo link is : " + mLink);
+ holder.bind(null, mLink, "Find more about the repo.", null);
+ return;
+ }
+ User currentUser = mUsers.get(position);
+ holder.bind(currentUser.getAvatar_url(), currentUser.getHtml_url(), currentUser.getLogin(), currentUser.getContributions());
+ }
+
+ @Override
+ public int getItemCount() {
+ return mUsers.size() + 1;
+ }
+ }
+
+ public class ContributerHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
+
+ private final Context mContext;
+ @BindView(R.id.contributer_image)
+ CircleImageView mImageView;
+ @BindView(R.id.contributer_name)
+ TextView mName;
+ @BindView(R.id.contributer_number)
+ TextView mNumber;
+ String mHtmlUrl;
+
+ public ContributerHolder(LayoutInflater inflater, ViewGroup parent, Context context) {
+ super(inflater.inflate(R.layout.list_item_contributer, parent, false));
+ ButterKnife.bind(this, itemView);
+ mContext = context;
+ itemView.setOnClickListener(this);
+ }
+
+ public void bind(String url, String html_url, String name, String number) {
+ mName.setText(name);
+ mHtmlUrl = html_url;
+ if(url == null) {
+ mImageView.setImageDrawable(getResources().getDrawable( android.R.drawable.ic_menu_search));
+ return;
+ }
+ Glide.with(mContext)
+ .load(url)
+ .into(mImageView);
+ mNumber.setText("Contrib.: " + number);
+ }
+
+ @Override
+ public void onClick(View v) {
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mHtmlUrl));
+ Intent browserChooserIntent = Intent.createChooser(browserIntent , "Choose browser of your choice");
+ if(mContext != null) {
+ mContext.startActivity(browserChooserIntent);
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/GitPopService.java b/app/src/main/java/com/blink22/android/gitpop/GitPopService.java
new file mode 100644
index 0000000..1600ed8
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/GitPopService.java
@@ -0,0 +1,27 @@
+package com.blink22.android.gitpop;
+
+import java.util.List;
+import java.util.Map;
+
+import retrofit2.Call;
+import retrofit2.http.FormUrlEncoded;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Path;
+import retrofit2.http.Query;
+import retrofit2.http.QueryMap;
+
+/**
+ * Created by ahmedghazy on 7/18/18.
+ */
+
+public interface GitPopService {
+ @GET("users/{user}/repos")
+ Call> listReposForUser(@Path("user") String user);
+
+ @GET("/search/repositories?q=language:java")
+ Call> listReposForMostPopularSince(@QueryMap Map params);
+
+ @GET("/repos/{repo}/contributors")
+ Call> listContributersFor(@Path(value = "repo", encoded = true) String repo);
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/Repo.java b/app/src/main/java/com/blink22/android/gitpop/Repo.java
new file mode 100644
index 0000000..81b9cfb
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/Repo.java
@@ -0,0 +1,57 @@
+package com.blink22.android.gitpop;
+
+import io.realm.RealmObject;
+
+/**
+ * Created by ahmedghazy on 7/18/18.
+ */
+
+public class Repo extends RealmObject {
+ private String html_url;
+ private String language;
+ private String id;
+ private String full_name;
+
+ public String getContributors_url() {
+ return contributors_url;
+ }
+
+ public void setContributors_url(String contributors_url) {
+ this.contributors_url = contributors_url;
+ }
+
+ private String contributors_url;
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getFull_name() {
+ return full_name;
+ }
+
+ public void setFull_name(String full_name) {
+ this.full_name = full_name;
+ }
+
+ public String getHtml_url() {
+ return html_url;
+ }
+
+ public void setHtml_url(String html_url) {
+ this.html_url = html_url;
+ }
+}
+
diff --git a/app/src/main/java/com/blink22/android/gitpop/SearchItem.java b/app/src/main/java/com/blink22/android/gitpop/SearchItem.java
new file mode 100644
index 0000000..8da81d7
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/SearchItem.java
@@ -0,0 +1,29 @@
+package com.blink22.android.gitpop;
+
+import io.realm.RealmObject;
+
+/**
+ * Created by ahmedghazy on 7/19/18.
+ */
+
+public class SearchItem extends RealmObject {
+ private String searchString;
+
+ public SearchItem() {}
+
+ public SearchItem(String searchString) {
+ this.searchString = searchString;
+ }
+
+ public String getSearchString() {
+ return searchString;
+ }
+
+ public void setSearchString(String searchString) {
+ this.searchString = searchString;
+ }
+
+
+
+
+}
diff --git a/app/src/main/java/com/blink22/android/gitpop/User.java b/app/src/main/java/com/blink22/android/gitpop/User.java
new file mode 100644
index 0000000..b9b7264
--- /dev/null
+++ b/app/src/main/java/com/blink22/android/gitpop/User.java
@@ -0,0 +1,46 @@
+package com.blink22.android.gitpop;
+
+import io.realm.RealmObject;
+
+/**
+ * Created by ahmedghazy on 7/18/18.
+ */
+
+public class User extends RealmObject {
+ private String avatar_url;
+ private String html_url;
+ private String contributions;
+ private String login;
+
+ public String getContributions() {
+ return contributions;
+ }
+
+ public void setContributions(String contributions) {
+ this.contributions = contributions;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ public void setLogin(String login) {
+ this.login = login;
+ }
+
+ public String getHtml_url() {
+ return html_url;
+ }
+
+ public void setHtml_url(String html_url) {
+ this.html_url = html_url;
+ }
+
+ public String getAvatar_url() {
+ return avatar_url;
+ }
+
+ public void setAvatar_url(String avatar_url) {
+ this.avatar_url = avatar_url;
+ }
+}
diff --git a/app/src/main/res/drawable/background_card.xml b/app/src/main/res/drawable/background_card.xml
new file mode 100644
index 0000000..40f9e14
--- /dev/null
+++ b/app/src/main/res/drawable/background_card.xml
@@ -0,0 +1,24 @@
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_search_black_24dp.xml b/app/src/main/res/drawable/ic_search_black_24dp.xml
new file mode 100644
index 0000000..affc7ba
--- /dev/null
+++ b/app/src/main/res/drawable/ic_search_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_single_fragment.xml b/app/src/main/res/layout/activity_single_fragment.xml
index de048e5..4704536 100644
--- a/app/src/main/res/layout/activity_single_fragment.xml
+++ b/app/src/main/res/layout/activity_single_fragment.xml
@@ -3,5 +3,4 @@
android:id="@+id/fragment_container"
android:layout_height="match_parent"
android:layout_width="match_parent"
-
/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_git_pop_list.xml b/app/src/main/res/layout/fragment_git_pop_list.xml
new file mode 100644
index 0000000..d9ae74d
--- /dev/null
+++ b/app/src/main/res/layout/fragment_git_pop_list.xml
@@ -0,0 +1,19 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_git_pop_page.xml b/app/src/main/res/layout/fragment_git_pop_page.xml
new file mode 100644
index 0000000..b82ef27
--- /dev/null
+++ b/app/src/main/res/layout/fragment_git_pop_page.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_contributer.xml b/app/src/main/res/layout/list_item_contributer.xml
new file mode 100644
index 0000000..7b3e6a4
--- /dev/null
+++ b/app/src/main/res/layout/list_item_contributer.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_git_pop.xml b/app/src/main/res/layout/list_item_git_pop.xml
new file mode 100644
index 0000000..c85ed86
--- /dev/null
+++ b/app/src/main/res/layout/list_item_git_pop.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/fragment_git_pop_list.xml b/app/src/main/res/menu/fragment_git_pop_list.xml
new file mode 100644
index 0000000..42557be
--- /dev/null
+++ b/app/src/main/res/menu/fragment_git_pop_list.xml
@@ -0,0 +1,8 @@
+
+
\ 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 deeed68..6245a50 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,5 @@
GitPop
+ Search User
+ Oops! No data available
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5885930..e5448bf 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -7,5 +7,4 @@
- @color/colorPrimaryDark
- @color/colorAccent
-
diff --git a/build.gradle b/build.gradle
index e6b32bc..27c52bc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,6 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
+ classpath "io.realm:realm-gradle-plugin:5.3.1"
// NOTE: Do not place your application dependencies here; they belong