Skip to content

Commit

Permalink
exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nayanesh committed Mar 23, 2016
1 parent 8bdf2ee commit 892e9aa
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 46 deletions.
6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TwitterCrashlytics.iml → VolleyExample.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="TwitterCrashlytics" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.id="VolleyExample" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
31 changes: 21 additions & 10 deletions app/app.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="TwitterCrashlytics" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="VolleyExample" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand All @@ -12,10 +12,7 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
Expand All @@ -28,7 +25,7 @@
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
Expand All @@ -50,13 +47,27 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
Expand All @@ -75,6 +86,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/mockable-android-23.jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
Expand All @@ -85,13 +97,12 @@
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="cardview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="library-1.0.19" level="project" />
<orderEntry type="library" exported="" name="butterknife-7.0.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.5" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.5" level="project" />
<orderEntry type="module" module-name="volley" exported="" />
</component>
</module>
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.5'
compile 'com.jakewharton:butterknife:7.0.1'
compile project(':volley')
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.twittercrashlytics.Utils;

import android.content.Context;
import android.widget.Toast;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.twittercrashlytics.R;
import com.twittercrashlytics.TwitterCrashlyticsApplication;
import com.twittercrashlytics.network.GsonRequest;
import com.twittercrashlytics.network.model.Comment;
Expand All @@ -13,7 +15,7 @@
import java.util.List;

/**
* Created by Nayanesh Gupte
*
*/
public class DataInitilizer implements Response.Listener<Comment[]>, Response.ErrorListener {

Expand Down Expand Up @@ -48,6 +50,7 @@ public void getCommentsList(String commentsUrl) {
TwitterCrashlyticsApplication.getInstance().addToRequestQueue(myReq, TAG);
} else {

Toast.makeText(context, context.getString(R.string.no_network), Toast.LENGTH_SHORT).show();

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
*
*/
public class CommentsListAdapter extends RecyclerView.Adapter<CommentsListAdapter.CommentsViewHolder> {

private List<Comment> data = new ArrayList<>();
private LayoutInflater inflater;
private Context context;

public CommentsListAdapter(Context context) {
this.context = context;
inflater = LayoutInflater.from(context);

}
Expand All @@ -37,8 +36,7 @@ public void add(List<Comment> data) {
@Override
public CommentsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.row_comments, parent, false);
CommentsViewHolder holder = new CommentsViewHolder(view);
return holder;
return new CommentsViewHolder(view);
}

@Override
Expand All @@ -61,9 +59,9 @@ public int getItemCount() {

static class CommentsViewHolder extends RecyclerView.ViewHolder {

TextView txtvTitle;
final TextView txtvTitle;

TextView txtvIssue;
final TextView txtvIssue;

public CommentsViewHolder(View itemView) {
super(itemView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@
import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
*
*/
public class IssuesListAdapter extends RecyclerView.Adapter<IssuesListAdapter.IssuesViewHolder> {
List<Issue> data = new ArrayList<>();
private LayoutInflater inflater;
private Context context;

private OnItemClickListener onItemClickListener;

private ImageLoader imageLoader;

public IssuesListAdapter(Context context) {
this.context = context;
inflater = LayoutInflater.from(context);

imageLoader = TwitterCrashlyticsApplication.getInstance().getImageLoader();
Expand Down Expand Up @@ -96,25 +91,24 @@ public int getItemCount() {

static class IssuesViewHolder extends RecyclerView.ViewHolder {

@Bind(R.id.txtvTitle)
TextView txtvTitle;
final TextView txtvTitle;

@Bind(R.id.txtvIssue)
TextView txtvIssue;
final TextView txtvIssue;

@Bind(R.id.imgUser)
NetworkImageView imgUser;
final NetworkImageView imgUser;

@Bind(R.id.cardView)
View view;
final View view;

public IssuesViewHolder(View itemView) {
super(itemView);

view = itemView;

ButterKnife.bind(this, itemView);
txtvTitle = (TextView) itemView.findViewById(R.id.txtvTitle);

txtvIssue = (TextView) itemView.findViewById(R.id.txtvIssue);

imgUser = (NetworkImageView) itemView.findViewById(R.id.imgUser);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import com.android.volley.toolbox.ImageLoader.ImageCache;

/**
*
*/
public class LruBitmapCache extends LruCache<String, Bitmap> implements
ImageCache {
public static int getDefaultLruCacheSize() {
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/menu/menu_main.xml

This file was deleted.

5 changes: 1 addition & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<resources>
<string name="app_name">TwitterCrashlytics</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="app_name">Github REST API</string>
<string name="issue">"Issue # "</string>
<string name="no_network">No Network Available</string>
<string name="title_activity_main">MainActivity</string>
</resources>
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include ':app'
include ':volley'
1 change: 1 addition & 0 deletions volley
Submodule volley added at f605da

0 comments on commit 892e9aa

Please sign in to comment.