diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5edb4ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.iml +.gradle +/local.properties +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000..34b4040 Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..7ac24c7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..37a7509 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ 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/.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/.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..8766de4 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 27 + defaultConfig { + applicationId "com.example.android.mygithubclient" + minSdkVersion 15 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + dataBinding { + enabled true + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support.constraint:constraint-layout:1.1.0' + 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:support-v4:27.1.1' + implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0' + implementation 'com.squareup.picasso:picasso:2.71828' +} 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/src/androidTest/java/com/example/android/mygithubclient/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/android/mygithubclient/ExampleInstrumentedTest.java new file mode 100644 index 0000000..06ad538 --- /dev/null +++ b/app/src/androidTest/java/com/example/android/mygithubclient/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.android.mygithubclient; + +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.android.mygithubclient", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..1053e58 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/android/mygithubclient/DetailsFragment.java b/app/src/main/java/com/example/android/mygithubclient/DetailsFragment.java new file mode 100644 index 0000000..1e14a8d --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/DetailsFragment.java @@ -0,0 +1,86 @@ +package com.example.android.mygithubclient; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import com.squareup.picasso.Picasso; + +import java.util.ArrayList; +import java.util.List; + +import static com.example.android.mygithubclient.util.DateUtils.isoDateToNormal; +import static com.example.android.mygithubclient.util.FileUtils.getFileSize; + +public class DetailsFragment extends Fragment { + + public DetailsFragment() {} + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.detail_layout, container, false); + List sections = new ArrayList<>(); + + Repository currentRepository = getArguments().getParcelable("object"); + + ImageView imageView = rootView.findViewById(R.id.avatarImage); + Picasso.get().load(currentRepository.getAvatar()).into(imageView); + + TextView ownerLogin = rootView.findViewById(R.id.ownerLogin); + ownerLogin.setText(currentRepository.getUserLogin()); + sections.add(ownerLogin); + + TextView repositoryName = rootView.findViewById(R.id.repositoryName); + repositoryName.setText(currentRepository.getName()); + sections.add(repositoryName); + + TextView starsCount = rootView.findViewById(R.id.starsNumber); + starsCount.setText(currentRepository.getStarsGiven()); + + TextView watchersCount = rootView.findViewById(R.id.watchersNumber); + watchersCount.setText(currentRepository.getWatchersCount()); + + TextView forksCount = rootView.findViewById(R.id.forksNumber); + forksCount.setText(currentRepository.getForksCount()); + + TextView privacy = rootView.findViewById(R.id.typeOfRepo); + privacy.setText(toRepositoryType(currentRepository.isOpenSource())); + + TextView language = rootView.findViewById(R.id.programmingDescription); + language.setText(currentRepository.getProgrammingLanguage()); + sections.add(language); + + TextView issuesCount = rootView.findViewById(R.id.issuesNumber); + issuesCount.setText(currentRepository.getIssuesCount()); + + TextView branchType = rootView.findViewById(R.id.branchType); + branchType.setText(currentRepository.getBranchesType()); + sections.add(branchType); + + TextView createdDate = rootView.findViewById(R.id.createDate); + createdDate.setText(isoDateToNormal((currentRepository.getCreatedDate()))); + + TextView sizeNumber = rootView.findViewById(R.id.sizeNumber); + sizeNumber.setText(getFileSize(currentRepository.getSizeRepo())); + + TextView updatedDate = rootView.findViewById(R.id.updatedDate); + updatedDate.setText(isoDateToNormal((currentRepository.getUpdateDate()))); + + String defaultStatement = getString(R.string.no_info); + for (int i = 0; i < sections.size(); i++) { + TextView currentTextView = sections.get(i); + if(currentTextView.getText().equals(getString(R.string.only_null))){ + currentTextView.setText(defaultStatement); + } + } + return rootView; + } + + private String toRepositoryType(boolean isOpenSource){ + return isOpenSource ? getString(R.string.privates) : getString(R.string.publics); + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/JsonRepositoryParser.java b/app/src/main/java/com/example/android/mygithubclient/JsonRepositoryParser.java new file mode 100644 index 0000000..04e4eb0 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/JsonRepositoryParser.java @@ -0,0 +1,34 @@ +package com.example.android.mygithubclient; + +import org.json.JSONException; +import org.json.JSONObject; + +public class JsonRepositoryParser { + + public JsonRepositoryParser(){} + + public static Repository parseRepository(JSONObject jsonRepository) throws JSONException { + String fullName = jsonRepository.getString("full_name"); + String starsGiven = jsonRepository.getString("stargazers_count"); + String watchersCount = jsonRepository.getString("watchers_count"); + String forksCount = jsonRepository.getString("forks_count"); + boolean openSource = jsonRepository.getBoolean("private"); + String programmingLanguage = jsonRepository.getString("language"); + String issuesCount = jsonRepository.getString("open_issues_count"); + String branchesType = jsonRepository.getString("default_branch"); + String createdDate = jsonRepository.getString("created_at"); + String updatedDate = jsonRepository.getString("updated_at"); + long sizeRepo = jsonRepository.getLong("size"); + String name = jsonRepository.getString("name"); + JSONObject owner = jsonRepository.getJSONObject("owner"); + String avatar = owner.getString("avatar_url"); + String userLogin = owner.getString("login"); + return new RepositoryBuilder().setFullName(fullName).setStarsGiven(starsGiven) + .setAvatar(avatar).setUserLogin(userLogin).setWatchersCount(watchersCount) + .setForksCount(forksCount).setOpenSource(openSource) + .setProgrammingLanguage(programmingLanguage).setIssuesCount(issuesCount) + .setBranchesType(branchesType).setCreatedDate(createdDate) + .setUpdatedDate(updatedDate).setSizeRepo(sizeRepo).setName(name) + .createRepository(); + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/MainActivity.java b/app/src/main/java/com/example/android/mygithubclient/MainActivity.java new file mode 100644 index 0000000..f3d53b7 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/MainActivity.java @@ -0,0 +1,18 @@ +package com.example.android.mygithubclient; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity { + + public static final String LOG = MainActivity.class.getName(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + SearchFragment fragment = new SearchFragment(); + android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager(); + fragmentManager.beginTransaction().replace(R.id.view_pager,fragment).commit(); + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/Networking.java b/app/src/main/java/com/example/android/mygithubclient/Networking.java new file mode 100644 index 0000000..55aee8e --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/Networking.java @@ -0,0 +1,114 @@ +package com.example.android.mygithubclient; + +import android.text.TextUtils; +import android.util.Log; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import static com.example.android.mygithubclient.MainActivity.LOG; + +public class Networking { + + private Networking() {} + + private static final int READ_TIMEOUT = 10000; + private static final int CONNECT_TIMEOUT = 15000; + private static final int SUCCESS_CODE = 200; + + private static URL createUrl(String stringUrl) { + URL url = null; + try { + url = new URL(stringUrl); + } catch (MalformedURLException e) { + Log.e(LOG, "Malformed url: " + stringUrl, e); + } + return url; + } + + private static String makeHttpRequest(URL url) throws IOException { + String jsonResponse = ""; + if (url == null) { + return null; + } + + HttpURLConnection urlConnection = null; + InputStream inputStream = null; + try { + urlConnection = (HttpURLConnection) url.openConnection(); + urlConnection.setReadTimeout(READ_TIMEOUT); + urlConnection.setConnectTimeout(CONNECT_TIMEOUT); + urlConnection.connect(); + if (urlConnection.getResponseCode() == SUCCESS_CODE) { + inputStream = urlConnection.getInputStream(); + jsonResponse = readFromStream(inputStream); + } else { + Log.e(LOG, "ERROR response code " + urlConnection.getResponseCode()); + } + } catch (IOException e) { + Log.e(LOG, "ERROR with marketRecords JSON", e); + } finally { + if (urlConnection != null) { + urlConnection.disconnect(); + } + if (inputStream != null) { + inputStream.close(); + } + } + return jsonResponse; + } + + private static String readFromStream(InputStream inputStream) throws IOException { + StringBuilder output = new StringBuilder(); + if (inputStream != null) { + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + String line = bufferedReader.readLine(); + while (line != null) { + output.append(line); + line = bufferedReader.readLine(); + } + } + return output.toString(); + } + + private static List extractFeatureFromJson(String repositoryJson) { + if (TextUtils.isEmpty(repositoryJson)) { + return null; + } + + List repositories = new ArrayList<>(); + + try { + JSONArray repositoryJsonArray = new JSONArray(repositoryJson); + for (int i = 0; i < repositoryJsonArray.length(); i++) { + JSONObject currentRepository = repositoryJsonArray.getJSONObject(i); + Repository repository = JsonRepositoryParser.parseRepository(currentRepository); + repositories.add(repository); + } + } catch (JSONException e) { + Log.e("QueryUtils", "Error parsing JSON", e); + } + return repositories; + } + + public static List fetchMarketRecordData(String requestUrl) { + URL url = createUrl(requestUrl); + String jsonResponse = null; + try { + jsonResponse = makeHttpRequest(url); + } catch (IOException e) { + Log.e(LOG, "Error with HTTP request", e); + } + return extractFeatureFromJson(jsonResponse); + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/Repository.java b/app/src/main/java/com/example/android/mygithubclient/Repository.java new file mode 100644 index 0000000..644025e --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/Repository.java @@ -0,0 +1,164 @@ +package com.example.android.mygithubclient; + +import android.os.Parcel; +import android.os.Parcelable; + +public class Repository implements Parcelable { + + private String fullName; + + private String starsGiven; + + private String avatar; + + private String userLogin; + + private String watchersCount; + + private String forksCount; + + private boolean openSource; + + private String programmingLanguage; + + private String issuesCount; + + private String branchesType; + + private String createdDate; + + private String updatedDate; + + private long sizeRepo; + + private String name; + + Repository(String fullName, String starsGiven, String avatar, String userLogin, + String watchersCount, String forksCount, boolean openSource, + String programmingLanguage, String issuesCount, String branchesType, + String createdDate, String updatedDate, long sizeRepo, String name){ + + this.fullName = fullName; + this.starsGiven = starsGiven; + this.avatar = avatar; + this.userLogin = userLogin; + this.watchersCount = watchersCount; + this.forksCount = forksCount; + this.openSource = openSource; + this.programmingLanguage = programmingLanguage; + this.issuesCount = issuesCount; + this.branchesType = branchesType; + this.createdDate = createdDate; + this.updatedDate = updatedDate; + this.sizeRepo = sizeRepo; + this.name = name; + } + + public String getFullName() { + return fullName; + } + + public String getStarsGiven() { + return starsGiven; + } + + public String getAvatar() { + return avatar; + } + + public String getUserLogin() { + return userLogin; + } + + public String getWatchersCount(){ + return watchersCount; + } + + public String getForksCount() { + return forksCount; + } + + public boolean isOpenSource() { + return openSource; + } + + public String getProgrammingLanguage() { + return programmingLanguage; + } + + public String getIssuesCount() { + return issuesCount; + } + + public String getBranchesType() { + return branchesType; + } + + public String getCreatedDate() { + return createdDate; + } + + public String getUpdateDate() { + return updatedDate; + } + + public long getSizeRepo() { + return sizeRepo; + } + + public String getName() { + return name; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(this.fullName); + dest.writeString(this.starsGiven); + dest.writeString(this.avatar); + dest.writeString(this.userLogin); + dest.writeString(this.watchersCount); + dest.writeString(this.forksCount); + dest.writeByte(this.openSource ? (byte) 1 : (byte) 0); + dest.writeString(this.programmingLanguage); + dest.writeString(this.issuesCount); + dest.writeString(this.branchesType); + dest.writeString(this.createdDate); + dest.writeString(this.updatedDate); + dest.writeLong(this.sizeRepo); + dest.writeString(this.name); + } + + private Repository(Parcel in) { + this.fullName = in.readString(); + this.starsGiven = in.readString(); + this.avatar = in.readString(); + this.userLogin = in.readString(); + this.watchersCount = in.readString(); + this.forksCount = in.readString(); + this.openSource = in.readByte() != 0; + this.programmingLanguage = in.readString(); + this.issuesCount = in.readString(); + this.branchesType = in.readString(); + this.createdDate = in.readString(); + this.updatedDate = in.readString(); + this.sizeRepo = in.readLong(); + this.name = in.readString(); + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public Repository createFromParcel(Parcel source) { + return new RepositoryBuilder().setIn(source).createRepository(); + } + + @Override + public Repository[] newArray(int size) { + return new Repository[size]; + } + }; +} diff --git a/app/src/main/java/com/example/android/mygithubclient/RepositoryAdapter.java b/app/src/main/java/com/example/android/mygithubclient/RepositoryAdapter.java new file mode 100644 index 0000000..2faad18 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/RepositoryAdapter.java @@ -0,0 +1,36 @@ +package com.example.android.mygithubclient; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.TextView; +import com.squareup.picasso.Picasso; +import java.util.ArrayList; + +public class RepositoryAdapter extends ArrayAdapter { + + public RepositoryAdapter(Context context, ArrayList repositories){ + super(context,0,repositories); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + View listItemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false); + Repository currentRepository = getItem(position); + + TextView repositoryName = listItemView.findViewById(R.id.textView5); + repositoryName.setText(currentRepository.getFullName()); + + TextView starNumber = listItemView.findViewById(R.id.textView6); + starNumber.setText(currentRepository.getStarsGiven()); + + ImageView repositoryImage = listItemView.findViewById(R.id.repositoryImage); + Picasso.get().load(currentRepository.getAvatar()).into(repositoryImage); + + return listItemView; + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/RepositoryBuilder.java b/app/src/main/java/com/example/android/mygithubclient/RepositoryBuilder.java new file mode 100644 index 0000000..bd2a397 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/RepositoryBuilder.java @@ -0,0 +1,102 @@ +package com.example.android.mygithubclient; + +import android.os.Parcel; + +public class RepositoryBuilder { + private String fullName; + private String starsGiven; + private String avatar; + private String userLogin; + private String watchersCount; + private String forksCount; + private boolean openSource; + private String programmingLanguage; + private String issuesCount; + private String branchesType; + private String createdDate; + private String updatedDate; + private long sizeRepo; + private String name; + private Parcel in; + + public RepositoryBuilder setFullName(String fullName) { + this.fullName = fullName; + return this; + } + + public RepositoryBuilder setStarsGiven(String starsGiven) { + this.starsGiven = starsGiven; + return this; + } + + public RepositoryBuilder setAvatar(String avatar) { + this.avatar = avatar; + return this; + } + + public RepositoryBuilder setUserLogin(String userLogin) { + this.userLogin = userLogin; + return this; + } + + public RepositoryBuilder setWatchersCount(String watchersCount) { + this.watchersCount = watchersCount; + return this; + } + + public RepositoryBuilder setForksCount(String forksCount) { + this.forksCount = forksCount; + return this; + } + + public RepositoryBuilder setOpenSource(boolean openSource) { + this.openSource = openSource; + return this; + } + + public RepositoryBuilder setProgrammingLanguage(String programmingLanguage) { + this.programmingLanguage = programmingLanguage; + return this; + } + + public RepositoryBuilder setIssuesCount(String issuesCount) { + this.issuesCount = issuesCount; + return this; + } + + public RepositoryBuilder setBranchesType(String branchesType) { + this.branchesType = branchesType; + return this; + } + + public RepositoryBuilder setCreatedDate(String createdDate) { + this.createdDate = createdDate; + return this; + } + + public RepositoryBuilder setUpdatedDate(String updatedDate) { + this.updatedDate = updatedDate; + return this; + } + + public RepositoryBuilder setSizeRepo(long sizeRepo) { + this.sizeRepo = sizeRepo; + return this; + } + + public RepositoryBuilder setName(String name) { + this.name = name; + return this; + } + + public RepositoryBuilder setIn(Parcel in) { + this.in = in; + return this; + } + + public Repository createRepository() { + return new Repository(fullName, starsGiven, avatar, userLogin, watchersCount, forksCount, + openSource, programmingLanguage, issuesCount, branchesType, createdDate, + updatedDate, sizeRepo, name); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/android/mygithubclient/RepositoryFragment.java b/app/src/main/java/com/example/android/mygithubclient/RepositoryFragment.java new file mode 100644 index 0000000..dddebeb --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/RepositoryFragment.java @@ -0,0 +1,115 @@ +package com.example.android.mygithubclient; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.LoaderManager; +import android.support.v4.content.Loader; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class RepositoryFragment extends Fragment implements LoaderManager.LoaderCallbacks> { + + private RepositoryAdapter newAdapter; + private View rootView; + private ArrayList repositories; + + public RepositoryFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + rootView = inflater.inflate(R.layout.item_list,container,false); + ListView listView = rootView.findViewById(R.id.listView); + repositories = new ArrayList<>(); + newAdapter = new RepositoryAdapter(getActivity(), repositories); + listView.setAdapter(newAdapter); + LoaderManager loaderManager = getLoaderManager(); + int loaderId = 0; + loaderManager.initLoader(loaderId, null, this); + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int position, long l) { + Repository currentRepository = repositories.get(position); + DetailsFragment detailsFragment= new DetailsFragment(); + detailsFragment.setArguments(buildBundle(currentRepository)); + android.support.v4.app.FragmentManager manager = getFragmentManager(); + manager.beginTransaction().replace(R.id.view_pager, detailsFragment,detailsFragment.getTag()).addToBackStack(null).commit(); + } + }); + return rootView; + } + + private Bundle buildBundle(Repository repository){ + Bundle bundle = new Bundle(); + bundle.putParcelable("object",repository); + return bundle; + } + + private void alertDialog(){ + String user = getArguments().getString("userName"); + String[] answers = {user + getString(R.string.not_a_user), getString(R.string.likes) + user + getString(R.string.forbidden), + user + getString(R.string.wrong), getString(R.string.spoon) + user + getString(R.string.dot)}; + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(R.string.error); + Random random = new Random(); + int shot = random.nextInt(4); + builder.setMessage(answers[shot]); + builder.setPositiveButton(R.string.search, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + SearchFragment searchFragment= new SearchFragment(); + android.support.v4.app.FragmentManager manager = getFragmentManager(); + assert manager != null; + manager.beginTransaction().replace(R.id.view_pager, searchFragment,searchFragment.getTag()).commit(); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + @Override + public Loader> onCreateLoader(int id, Bundle args) { + String urlLink = getArguments().getString("urlLink"); + return new RepositoryLoader(getActivity(), urlLink); + } + + @Override + public void onLoadFinished(Loader> loader, List data) { + newAdapter.clear(); + if(data != null && !data.isEmpty()){ + repositoryFullfill(data); + + } else { + TextView owner = rootView.findViewById(R.id.repository_owner); + owner.setText(R.string.long_face); + alertDialog(); + } + } + + private void repositoryFullfill(List data) { + String userName = getArguments().getString("userName"); + TextView owner = rootView.findViewById(R.id.repository_owner); + owner.setText(userName + getString(R.string.reposs)); + View progressBar = rootView.findViewById(R.id.progressBar); + progressBar.setVisibility(View.GONE); + newAdapter.addAll(data); + } + + @Override + public void onLoaderReset(Loader> loader) { + newAdapter.clear(); + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/RepositoryLoader.java b/app/src/main/java/com/example/android/mygithubclient/RepositoryLoader.java new file mode 100644 index 0000000..d177594 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/RepositoryLoader.java @@ -0,0 +1,34 @@ +package com.example.android.mygithubclient; + +import android.content.Context; +import android.util.Log; +import java.util.List; + +public class RepositoryLoader extends android.support.v4.content.AsyncTaskLoader> { + + private static final String LOG = RepositoryLoader.class.getName(); + + private String repositoryUrl; + + public RepositoryLoader(Context context, String url){ + super(context); + repositoryUrl = url; + } + + @Override + protected void onStartLoading() { + Log.e(LOG, "Loader started"); + forceLoad(); + } + + @Override + public List loadInBackground() { + Log.e(LOG, "Loader inBackground"); + if(repositoryUrl == null){ + return null; + } + Log.e(LOG, "Loader fetching"); + List marketRecords = Networking.fetchMarketRecordData(repositoryUrl); + return marketRecords; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/android/mygithubclient/SearchFragment.java b/app/src/main/java/com/example/android/mygithubclient/SearchFragment.java new file mode 100644 index 0000000..ed58872 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/SearchFragment.java @@ -0,0 +1,67 @@ +package com.example.android.mygithubclient; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; +import net.yslibrary.android.keyboardvisibilityevent.util.UIUtil; + +public class SearchFragment extends Fragment { + + private String userInput; + private EditText editText; + private String outputLink; + + public SearchFragment() {} + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.search_layout,container,false); + editText = rootView.findViewById(R.id.editText); + Button searchButton = rootView.findViewById(R.id.button_search); + searchButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + UIUtil.hideKeyboard(getActivity()); + ConnectivityManager connectionPossible = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo networkInfo = connectionPossible.getActiveNetworkInfo(); + if (networkInfo != null && networkInfo.isConnected()) { + userInput = editText.getText().toString().trim(); + if(userInput.isEmpty()){ + Toast toast = Toast.makeText(getActivity(), R.string.nothing_there,Toast.LENGTH_SHORT); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.show(); + } else{ + String url_link = getString(R.string.url); + outputLink = url_link.replace("{user}", userInput); + RepositoryFragment repositoryFragment= new RepositoryFragment(); + repositoryFragment.setArguments(buildBundle(outputLink, userInput)); + android.support.v4.app.FragmentManager manager = getFragmentManager(); + manager.beginTransaction().replace(R.id.view_pager, repositoryFragment,repositoryFragment.getTag()).addToBackStack(null).commit(); + } + } else { + Toast toast = Toast.makeText(getActivity(), R.string.no_connection,Toast.LENGTH_SHORT); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.show(); + } + } + }); + return rootView; + } + + private Bundle buildBundle(String urlLink, String userName) { + Bundle bundle = new Bundle(); + bundle.putString("urlLink", urlLink); + bundle.putString("userName",userName); + return bundle; + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/util/DateUtils.java b/app/src/main/java/com/example/android/mygithubclient/util/DateUtils.java new file mode 100644 index 0000000..a42942e --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/util/DateUtils.java @@ -0,0 +1,22 @@ +package com.example.android.mygithubclient.util; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class DateUtils { + + private DateUtils(){} + + public static String isoDateToNormal(String isoDate){ + SimpleDateFormat sd1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + Date date = new Date(); + try{ + date = sd1.parse(isoDate.replaceAll("Z$", "+0000")); + } catch(Exception e){ + System.out.println(e.getMessage()); + return "Non-accessible"; + } + SimpleDateFormat sd2 = new SimpleDateFormat("dd-MM-yyyy"); + return sd2.format(date); + } +} diff --git a/app/src/main/java/com/example/android/mygithubclient/util/FileUtils.java b/app/src/main/java/com/example/android/mygithubclient/util/FileUtils.java new file mode 100644 index 0000000..10d64a5 --- /dev/null +++ b/app/src/main/java/com/example/android/mygithubclient/util/FileUtils.java @@ -0,0 +1,17 @@ +package com.example.android.mygithubclient.util; + +import java.text.DecimalFormat; + +public class FileUtils { + + private FileUtils(){} + + public static String getFileSize(long size) { + if (size <= 0){ + return "0"; + } + String[] units = new String[] { "b", "kb", "mb", "gb", "tb" }; + int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); + return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; + } +} diff --git a/app/src/main/res/drawable-hdpi/book.png b/app/src/main/res/drawable-hdpi/book.png new file mode 100644 index 0000000..04a943c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/book.png differ diff --git a/app/src/main/res/drawable-hdpi/branch.png b/app/src/main/res/drawable-hdpi/branch.png new file mode 100644 index 0000000..87d7fec Binary files /dev/null and b/app/src/main/res/drawable-hdpi/branch.png differ diff --git a/app/src/main/res/drawable-hdpi/calendar.png b/app/src/main/res/drawable-hdpi/calendar.png new file mode 100644 index 0000000..6fecb61 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/calendar.png differ diff --git a/app/src/main/res/drawable-hdpi/chevron.png b/app/src/main/res/drawable-hdpi/chevron.png new file mode 100644 index 0000000..e38665f Binary files /dev/null and b/app/src/main/res/drawable-hdpi/chevron.png differ diff --git a/app/src/main/res/drawable-hdpi/commit.png b/app/src/main/res/drawable-hdpi/commit.png new file mode 100644 index 0000000..84fbf19 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/commit.png differ diff --git a/app/src/main/res/drawable-hdpi/database.png b/app/src/main/res/drawable-hdpi/database.png new file mode 100644 index 0000000..3fe0b2c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/database.png differ diff --git a/app/src/main/res/drawable-hdpi/githubgreylogo.png b/app/src/main/res/drawable-hdpi/githubgreylogo.png new file mode 100644 index 0000000..e466a2a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/githubgreylogo.png differ diff --git a/app/src/main/res/drawable-hdpi/githublogo2.png b/app/src/main/res/drawable-hdpi/githublogo2.png new file mode 100644 index 0000000..9fdb6e0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/githublogo2.png differ diff --git a/app/src/main/res/drawable-hdpi/issue.png b/app/src/main/res/drawable-hdpi/issue.png new file mode 100644 index 0000000..1460a3d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/issue.png differ diff --git a/app/src/main/res/drawable-hdpi/lock.png b/app/src/main/res/drawable-hdpi/lock.png new file mode 100644 index 0000000..493d995 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/lock.png differ diff --git a/app/src/main/res/drawable-hdpi/programming.png b/app/src/main/res/drawable-hdpi/programming.png new file mode 100644 index 0000000..4ff593d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/programming.png differ diff --git a/app/src/main/res/drawable-hdpi/repoicon.png b/app/src/main/res/drawable-hdpi/repoicon.png new file mode 100644 index 0000000..8298e08 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/repoicon.png differ diff --git a/app/src/main/res/drawable-hdpi/rss.png b/app/src/main/res/drawable-hdpi/rss.png new file mode 100644 index 0000000..b93da7d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/rss.png differ diff --git a/app/src/main/res/drawable-hdpi/staricon.png b/app/src/main/res/drawable-hdpi/staricon.png new file mode 100644 index 0000000..59a97ff Binary files /dev/null and b/app/src/main/res/drawable-hdpi/staricon.png differ diff --git a/app/src/main/res/drawable-hdpi/update.png b/app/src/main/res/drawable-hdpi/update.png new file mode 100644 index 0000000..2d43f2e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/update.png differ diff --git a/app/src/main/res/drawable-ldpi/book.png b/app/src/main/res/drawable-ldpi/book.png new file mode 100644 index 0000000..9c030d2 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/book.png differ diff --git a/app/src/main/res/drawable-ldpi/branch.png b/app/src/main/res/drawable-ldpi/branch.png new file mode 100644 index 0000000..3a74959 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/branch.png differ diff --git a/app/src/main/res/drawable-ldpi/calendar.png b/app/src/main/res/drawable-ldpi/calendar.png new file mode 100644 index 0000000..708abac Binary files /dev/null and b/app/src/main/res/drawable-ldpi/calendar.png differ diff --git a/app/src/main/res/drawable-ldpi/chevron.png b/app/src/main/res/drawable-ldpi/chevron.png new file mode 100644 index 0000000..cfe5f94 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/chevron.png differ diff --git a/app/src/main/res/drawable-ldpi/commit.png b/app/src/main/res/drawable-ldpi/commit.png new file mode 100644 index 0000000..63fbcbe Binary files /dev/null and b/app/src/main/res/drawable-ldpi/commit.png differ diff --git a/app/src/main/res/drawable-ldpi/database.png b/app/src/main/res/drawable-ldpi/database.png new file mode 100644 index 0000000..f84388b Binary files /dev/null and b/app/src/main/res/drawable-ldpi/database.png differ diff --git a/app/src/main/res/drawable-ldpi/githubgreylogo.png b/app/src/main/res/drawable-ldpi/githubgreylogo.png new file mode 100644 index 0000000..36a5ffa Binary files /dev/null and b/app/src/main/res/drawable-ldpi/githubgreylogo.png differ diff --git a/app/src/main/res/drawable-ldpi/githublogo2.png b/app/src/main/res/drawable-ldpi/githublogo2.png new file mode 100644 index 0000000..467a9cc Binary files /dev/null and b/app/src/main/res/drawable-ldpi/githublogo2.png differ diff --git a/app/src/main/res/drawable-ldpi/issue.png b/app/src/main/res/drawable-ldpi/issue.png new file mode 100644 index 0000000..b6afd7f Binary files /dev/null and b/app/src/main/res/drawable-ldpi/issue.png differ diff --git a/app/src/main/res/drawable-ldpi/lock.png b/app/src/main/res/drawable-ldpi/lock.png new file mode 100644 index 0000000..c6a03f8 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/lock.png differ diff --git a/app/src/main/res/drawable-ldpi/programming.png b/app/src/main/res/drawable-ldpi/programming.png new file mode 100644 index 0000000..02cffd2 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/programming.png differ diff --git a/app/src/main/res/drawable-ldpi/repoicon.png b/app/src/main/res/drawable-ldpi/repoicon.png new file mode 100644 index 0000000..906b094 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/repoicon.png differ diff --git a/app/src/main/res/drawable-ldpi/rss.png b/app/src/main/res/drawable-ldpi/rss.png new file mode 100644 index 0000000..5de28c8 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/rss.png differ diff --git a/app/src/main/res/drawable-ldpi/staricon.png b/app/src/main/res/drawable-ldpi/staricon.png new file mode 100644 index 0000000..dc77f19 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/staricon.png differ diff --git a/app/src/main/res/drawable-ldpi/update.png b/app/src/main/res/drawable-ldpi/update.png new file mode 100644 index 0000000..9eb83b5 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/update.png differ diff --git a/app/src/main/res/drawable-mdpi/book.png b/app/src/main/res/drawable-mdpi/book.png new file mode 100644 index 0000000..428312b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/book.png differ diff --git a/app/src/main/res/drawable-mdpi/branch.png b/app/src/main/res/drawable-mdpi/branch.png new file mode 100644 index 0000000..0c9ff51 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/branch.png differ diff --git a/app/src/main/res/drawable-mdpi/calendar.png b/app/src/main/res/drawable-mdpi/calendar.png new file mode 100644 index 0000000..6454d2d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/calendar.png differ diff --git a/app/src/main/res/drawable-mdpi/chevron.png b/app/src/main/res/drawable-mdpi/chevron.png new file mode 100644 index 0000000..a29ab5d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/chevron.png differ diff --git a/app/src/main/res/drawable-mdpi/commit.png b/app/src/main/res/drawable-mdpi/commit.png new file mode 100644 index 0000000..5e3a20e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/commit.png differ diff --git a/app/src/main/res/drawable-mdpi/database.png b/app/src/main/res/drawable-mdpi/database.png new file mode 100644 index 0000000..b6a0ab0 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/database.png differ diff --git a/app/src/main/res/drawable-mdpi/githubgreylogo.png b/app/src/main/res/drawable-mdpi/githubgreylogo.png new file mode 100644 index 0000000..72613b5 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/githubgreylogo.png differ diff --git a/app/src/main/res/drawable-mdpi/githublogo2.png b/app/src/main/res/drawable-mdpi/githublogo2.png new file mode 100644 index 0000000..b28f1b4 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/githublogo2.png differ diff --git a/app/src/main/res/drawable-mdpi/issue.png b/app/src/main/res/drawable-mdpi/issue.png new file mode 100644 index 0000000..68035af Binary files /dev/null and b/app/src/main/res/drawable-mdpi/issue.png differ diff --git a/app/src/main/res/drawable-mdpi/lock.png b/app/src/main/res/drawable-mdpi/lock.png new file mode 100644 index 0000000..5dc12e0 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/lock.png differ diff --git a/app/src/main/res/drawable-mdpi/programming.png b/app/src/main/res/drawable-mdpi/programming.png new file mode 100644 index 0000000..7008088 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/programming.png differ diff --git a/app/src/main/res/drawable-mdpi/repoicon.png b/app/src/main/res/drawable-mdpi/repoicon.png new file mode 100644 index 0000000..7b54660 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/repoicon.png differ diff --git a/app/src/main/res/drawable-mdpi/rss.png b/app/src/main/res/drawable-mdpi/rss.png new file mode 100644 index 0000000..e2bd57f Binary files /dev/null and b/app/src/main/res/drawable-mdpi/rss.png differ diff --git a/app/src/main/res/drawable-mdpi/staricon.png b/app/src/main/res/drawable-mdpi/staricon.png new file mode 100644 index 0000000..1d42f72 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/staricon.png differ diff --git a/app/src/main/res/drawable-mdpi/update.png b/app/src/main/res/drawable-mdpi/update.png new file mode 100644 index 0000000..d8dc006 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/update.png differ 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..c7bd21d --- /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-xhdpi/book.png b/app/src/main/res/drawable-xhdpi/book.png new file mode 100644 index 0000000..d0b5c41 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/book.png differ diff --git a/app/src/main/res/drawable-xhdpi/branch.png b/app/src/main/res/drawable-xhdpi/branch.png new file mode 100644 index 0000000..18ecdfe Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/branch.png differ diff --git a/app/src/main/res/drawable-xhdpi/calendar.png b/app/src/main/res/drawable-xhdpi/calendar.png new file mode 100644 index 0000000..d5c9eaa Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/calendar.png differ diff --git a/app/src/main/res/drawable-xhdpi/chevron.png b/app/src/main/res/drawable-xhdpi/chevron.png new file mode 100644 index 0000000..4802be1 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/chevron.png differ diff --git a/app/src/main/res/drawable-xhdpi/commit.png b/app/src/main/res/drawable-xhdpi/commit.png new file mode 100644 index 0000000..4e0392d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/commit.png differ diff --git a/app/src/main/res/drawable-xhdpi/database.png b/app/src/main/res/drawable-xhdpi/database.png new file mode 100644 index 0000000..08365b5 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/database.png differ diff --git a/app/src/main/res/drawable-xhdpi/githubgreylogo.png b/app/src/main/res/drawable-xhdpi/githubgreylogo.png new file mode 100644 index 0000000..488aa1f Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/githubgreylogo.png differ diff --git a/app/src/main/res/drawable-xhdpi/githublogo2.png b/app/src/main/res/drawable-xhdpi/githublogo2.png new file mode 100644 index 0000000..0c81525 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/githublogo2.png differ diff --git a/app/src/main/res/drawable-xhdpi/issue.png b/app/src/main/res/drawable-xhdpi/issue.png new file mode 100644 index 0000000..7774871 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/issue.png differ diff --git a/app/src/main/res/drawable-xhdpi/lock.png b/app/src/main/res/drawable-xhdpi/lock.png new file mode 100644 index 0000000..ec1f44d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/lock.png differ diff --git a/app/src/main/res/drawable-xhdpi/programming.png b/app/src/main/res/drawable-xhdpi/programming.png new file mode 100644 index 0000000..02c7cce Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/programming.png differ diff --git a/app/src/main/res/drawable-xhdpi/repoicon.png b/app/src/main/res/drawable-xhdpi/repoicon.png new file mode 100644 index 0000000..54a7649 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/repoicon.png differ diff --git a/app/src/main/res/drawable-xhdpi/rss.png b/app/src/main/res/drawable-xhdpi/rss.png new file mode 100644 index 0000000..4e84168 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/rss.png differ diff --git a/app/src/main/res/drawable-xhdpi/staricon.png b/app/src/main/res/drawable-xhdpi/staricon.png new file mode 100644 index 0000000..36f48ca Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/staricon.png differ diff --git a/app/src/main/res/drawable-xhdpi/update.png b/app/src/main/res/drawable-xhdpi/update.png new file mode 100644 index 0000000..3b55045 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/update.png differ diff --git a/app/src/main/res/drawable-xxhdpi/book.png b/app/src/main/res/drawable-xxhdpi/book.png new file mode 100644 index 0000000..d6b0a03 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/book.png differ diff --git a/app/src/main/res/drawable-xxhdpi/branch.png b/app/src/main/res/drawable-xxhdpi/branch.png new file mode 100644 index 0000000..e5cf69c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/branch.png differ diff --git a/app/src/main/res/drawable-xxhdpi/calendar.png b/app/src/main/res/drawable-xxhdpi/calendar.png new file mode 100644 index 0000000..1efe6fe Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/calendar.png differ diff --git a/app/src/main/res/drawable-xxhdpi/chevron.png b/app/src/main/res/drawable-xxhdpi/chevron.png new file mode 100644 index 0000000..0203f2d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/chevron.png differ diff --git a/app/src/main/res/drawable-xxhdpi/commit.png b/app/src/main/res/drawable-xxhdpi/commit.png new file mode 100644 index 0000000..9c186ff Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/commit.png differ diff --git a/app/src/main/res/drawable-xxhdpi/database.png b/app/src/main/res/drawable-xxhdpi/database.png new file mode 100644 index 0000000..e3e54ab Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/database.png differ diff --git a/app/src/main/res/drawable-xxhdpi/githubgreylogo.png b/app/src/main/res/drawable-xxhdpi/githubgreylogo.png new file mode 100644 index 0000000..d6c858e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/githubgreylogo.png differ diff --git a/app/src/main/res/drawable-xxhdpi/githublogo2.png b/app/src/main/res/drawable-xxhdpi/githublogo2.png new file mode 100644 index 0000000..60c0d76 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/githublogo2.png differ diff --git a/app/src/main/res/drawable-xxhdpi/issue.png b/app/src/main/res/drawable-xxhdpi/issue.png new file mode 100644 index 0000000..a3cc0f0 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/issue.png differ diff --git a/app/src/main/res/drawable-xxhdpi/lock.png b/app/src/main/res/drawable-xxhdpi/lock.png new file mode 100644 index 0000000..aa37fb5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/lock.png differ diff --git a/app/src/main/res/drawable-xxhdpi/programming.png b/app/src/main/res/drawable-xxhdpi/programming.png new file mode 100644 index 0000000..a75996f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/programming.png differ diff --git a/app/src/main/res/drawable-xxhdpi/repoicon.png b/app/src/main/res/drawable-xxhdpi/repoicon.png new file mode 100644 index 0000000..e65f721 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/repoicon.png differ diff --git a/app/src/main/res/drawable-xxhdpi/rss.png b/app/src/main/res/drawable-xxhdpi/rss.png new file mode 100644 index 0000000..33f3bbe Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/rss.png differ diff --git a/app/src/main/res/drawable-xxhdpi/staricon.png b/app/src/main/res/drawable-xxhdpi/staricon.png new file mode 100644 index 0000000..d9eb478 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/staricon.png differ diff --git a/app/src/main/res/drawable-xxhdpi/update.png b/app/src/main/res/drawable-xxhdpi/update.png new file mode 100644 index 0000000..b45aa0f Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/update.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/book.png b/app/src/main/res/drawable-xxxhdpi/book.png new file mode 100644 index 0000000..c95e0b3 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/book.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/branch.png b/app/src/main/res/drawable-xxxhdpi/branch.png new file mode 100644 index 0000000..8127a96 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/branch.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/calendar.png b/app/src/main/res/drawable-xxxhdpi/calendar.png new file mode 100644 index 0000000..720bbca Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/calendar.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/chevron.png b/app/src/main/res/drawable-xxxhdpi/chevron.png new file mode 100644 index 0000000..7eea52e Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/chevron.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/commit.png b/app/src/main/res/drawable-xxxhdpi/commit.png new file mode 100644 index 0000000..019c042 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/commit.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/database.png b/app/src/main/res/drawable-xxxhdpi/database.png new file mode 100644 index 0000000..c9220f2 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/database.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/githubgreylogo.png b/app/src/main/res/drawable-xxxhdpi/githubgreylogo.png new file mode 100644 index 0000000..f824dac Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/githubgreylogo.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/githublogo2.png b/app/src/main/res/drawable-xxxhdpi/githublogo2.png new file mode 100644 index 0000000..8506410 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/githublogo2.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/issue.png b/app/src/main/res/drawable-xxxhdpi/issue.png new file mode 100644 index 0000000..2939f89 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/issue.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/lock.png b/app/src/main/res/drawable-xxxhdpi/lock.png new file mode 100644 index 0000000..52d91e7 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/lock.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/programming.png b/app/src/main/res/drawable-xxxhdpi/programming.png new file mode 100644 index 0000000..1163a33 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/programming.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/repoicon.png b/app/src/main/res/drawable-xxxhdpi/repoicon.png new file mode 100644 index 0000000..4686238 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/repoicon.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/rss.png b/app/src/main/res/drawable-xxxhdpi/rss.png new file mode 100644 index 0000000..57512bf Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/rss.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/staricon.png b/app/src/main/res/drawable-xxxhdpi/staricon.png new file mode 100644 index 0000000..e2405b7 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/staricon.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/update.png b/app/src/main/res/drawable-xxxhdpi/update.png new file mode 100644 index 0000000..9615cf4 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/update.png differ diff --git a/app/src/main/res/drawable/biggest_line_background.xml b/app/src/main/res/drawable/biggest_line_background.xml new file mode 100644 index 0000000..f383aa4 --- /dev/null +++ b/app/src/main/res/drawable/biggest_line_background.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_line_background.xml b/app/src/main/res/drawable/button_line_background.xml new file mode 100644 index 0000000..2223d4a --- /dev/null +++ b/app/src/main/res/drawable/button_line_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/detail_line_background.xml b/app/src/main/res/drawable/detail_line_background.xml new file mode 100644 index 0000000..d88708d --- /dev/null +++ b/app/src/main/res/drawable/detail_line_background.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + \ No newline at end of file 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..d5fccc5 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/line_background.xml b/app/src/main/res/drawable/line_background.xml new file mode 100644 index 0000000..7d1738d --- /dev/null +++ b/app/src/main/res/drawable/line_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/medium_detail_line_background.xml b/app/src/main/res/drawable/medium_detail_line_background.xml new file mode 100644 index 0000000..c362c27 --- /dev/null +++ b/app/src/main/res/drawable/medium_detail_line_background.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/medium_detail_line_background_three.xml b/app/src/main/res/drawable/medium_detail_line_background_three.xml new file mode 100644 index 0000000..767e6a6 --- /dev/null +++ b/app/src/main/res/drawable/medium_detail_line_background_three.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/medium_detail_line_background_two.xml b/app/src/main/res/drawable/medium_detail_line_background_two.xml new file mode 100644 index 0000000..0c2e9a3 --- /dev/null +++ b/app/src/main/res/drawable/medium_detail_line_background_two.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/search_line_background.xml b/app/src/main/res/drawable/search_line_background.xml new file mode 100644 index 0000000..856444b --- /dev/null +++ b/app/src/main/res/drawable/search_line_background.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/small_detail_line_background.xml b/app/src/main/res/drawable/small_detail_line_background.xml new file mode 100644 index 0000000..24f58e4 --- /dev/null +++ b/app/src/main/res/drawable/small_detail_line_background.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/xl_detail_line_background.xml b/app/src/main/res/drawable/xl_detail_line_background.xml new file mode 100644 index 0000000..72887fe --- /dev/null +++ b/app/src/main/res/drawable/xl_detail_line_background.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + \ 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..166514e --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/detail_layout.xml b/app/src/main/res/layout/detail_layout.xml new file mode 100644 index 0000000..3ca816e --- /dev/null +++ b/app/src/main/res/layout/detail_layout.xml @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_list.xml b/app/src/main/res/layout/item_list.xml new file mode 100644 index 0000000..54380ae --- /dev/null +++ b/app/src/main/res/layout/item_list.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml new file mode 100644 index 0000000..c4c5c10 --- /dev/null +++ b/app/src/main/res/layout/list_item.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/search_layout.xml b/app/src/main/res/layout/search_layout.xml new file mode 100644 index 0000000..e4bfa3c --- /dev/null +++ b/app/src/main/res/layout/search_layout.xml @@ -0,0 +1,40 @@ + + + + + + + + + +