diff --git a/HelpStackExample/AndroidManifest.xml b/HelpStackExample/AndroidManifest.xml index 716ab84..1a5a61f 100644 --- a/HelpStackExample/AndroidManifest.xml +++ b/HelpStackExample/AndroidManifest.xml @@ -1,12 +1,11 @@ @@ -22,7 +21,6 @@ android:label="@string/app_name" > - diff --git a/HelpStackExample/build.gradle b/HelpStackExample/build.gradle index 47317b9..3bf85e2 100644 --- a/HelpStackExample/build.gradle +++ b/HelpStackExample/build.gradle @@ -4,12 +4,12 @@ dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':helpstack') - compile 'com.android.support:appcompat-v7:22.2.0' + compile 'com.android.support:appcompat-v7:23.0.0' } android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.0" sourceSets { main { diff --git a/HelpStackExample/res/values-v14/styles.xml b/HelpStackExample/res/values-v14/styles.xml index 0bb798b..9ddc658 100644 --- a/HelpStackExample/res/values-v14/styles.xml +++ b/HelpStackExample/res/values-v14/styles.xml @@ -5,13 +5,12 @@ AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. --> - - diff --git a/HelpStackExample/src/com/example/helpstackexample/HSApplication.java b/HelpStackExample/src/com/example/helpstackexample/HSApplication.java index bb80726..de14250 100644 --- a/HelpStackExample/src/com/example/helpstackexample/HSApplication.java +++ b/HelpStackExample/src/com/example/helpstackexample/HSApplication.java @@ -4,11 +4,9 @@ import com.tenmiles.helpstack.HSHelpStack; import com.tenmiles.helpstack.gears.HSEmailGear; -import com.tenmiles.helpstack.gears.HSZendeskGear; +import com.tenmiles.helpstack.gears.HSHappyfoxGear; - - -public class HSApplication extends Application{ +public class HSApplication extends Application { HSHelpStack helpStack; @@ -18,16 +16,17 @@ public void onCreate() { helpStack = HSHelpStack.getInstance(this); - HSEmailGear emailGear = new HSEmailGear( "example@happyfox.com",R.xml.articles); - helpStack.setGear(emailGear); - +// HSEmailGear emailGear = new HSEmailGear("foo@bar.com", R.xml.articles); +// helpStack.setGear(emailGear); - /* Uncomment the following to use the Happyfox gear with appropriate support email address */ - // HSHappyfoxGear happyfoxGear = new HSHappyfoxGear("https://example.happyfox.com", - // "", - // "", - // "", ""); - // helpStack.setGear(happyfoxGear); + /* Uncomment the following to use the HappyFox gear with appropriate support email address */ + HSHappyfoxGear happyfoxGear = new HSHappyfoxGear( + "http://acmewidgetsco.happyfox.com", + "b3416a6ebf4245bf9bbeb55b296ecf92", + "6b562e17b1ab4c37bc8c955af8f5cc5c", + "107", + "1"); + helpStack.setGear(happyfoxGear); } } diff --git a/HelpStackExample/src/com/example/helpstackexample/MainActivity.java b/HelpStackExample/src/com/example/helpstackexample/MainActivity.java index aa320a3..18397d0 100644 --- a/HelpStackExample/src/com/example/helpstackexample/MainActivity.java +++ b/HelpStackExample/src/com/example/helpstackexample/MainActivity.java @@ -22,8 +22,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); if (savedInstanceState == null) { - getSupportFragmentManager().beginTransaction() - .add(R.id.container, new PlaceholderFragment()).commit(); + getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); } getSupportActionBar().setDisplayHomeAsUpEnabled(false); @@ -33,25 +32,18 @@ protected void onCreate(Bundle savedInstanceState) { @Override public boolean onCreateOptionsMenu(Menu menu) { - - // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } - - /** * A placeholder fragment containing a simple view. @@ -62,10 +54,8 @@ public PlaceholderFragment() { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View rootView = inflater.inflate(R.layout.fragment_main, container, - false); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_main, container, false); rootView.findViewById(R.id.button1).setOnClickListener(new OnClickListener() { @Override diff --git a/helpstack/AndroidManifest.xml b/helpstack/AndroidManifest.xml index 787a734..8fee5f6 100644 --- a/helpstack/AndroidManifest.xml +++ b/helpstack/AndroidManifest.xml @@ -5,7 +5,7 @@ android:versionName="1.0" > diff --git a/helpstack/build.gradle b/helpstack/build.gradle index cf16fd9..44b8df1 100644 --- a/helpstack/build.gradle +++ b/helpstack/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'maven' dependencies { compile fileTree(dir: 'libs', include: '*.jar') - compile 'com.android.support:appcompat-v7:22.2.0' + compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.google.code.gson:gson:2.3' @@ -13,8 +13,8 @@ dependencies { } android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.0" sourceSets { main { @@ -45,7 +45,7 @@ uploadArchives { repositories.mavenDeployer { pom.groupId = 'com.tenmiles' pom.artifactId = 'helpstack' - pom.version = '1.1.3' + pom.version = '1.2.0' // Add other pom properties here if you want (developer details / licenses) repository(url: "file:///Users/anirudh/Desktop/gradleRelease/") } diff --git a/helpstack/res/drawable-hdpi/hs_accept.png b/helpstack/res/drawable-hdpi/hs_accept.png new file mode 100644 index 0000000..c9c0174 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_accept.png differ diff --git a/helpstack/res/drawable-hdpi/hs_accept_light.png b/helpstack/res/drawable-hdpi/hs_accept_light.png new file mode 100644 index 0000000..0ebb555 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_accept_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_action_accept_img.png b/helpstack/res/drawable-hdpi/hs_action_accept_img.png deleted file mode 100644 index d93146d..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_accept_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_action_accept_light_img.png b/helpstack/res/drawable-hdpi/hs_action_accept_light_img.png deleted file mode 100644 index 700fc81..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_accept_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_action_attachment_light_img.png b/helpstack/res/drawable-hdpi/hs_action_attachment_light_img.png deleted file mode 100644 index 34fd62b..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_action_forward_img.png b/helpstack/res/drawable-hdpi/hs_action_forward_img.png deleted file mode 100644 index 347e2e2..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_forward_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_action_forward_light_img.png b/helpstack/res/drawable-hdpi/hs_action_forward_light_img.png deleted file mode 100644 index 5ca2f1b..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_forward_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_action_new_attachment_light_img.png b/helpstack/res/drawable-hdpi/hs_action_new_attachment_light_img.png deleted file mode 100644 index c01c2b3..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_new_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_action_send_now_light_img.png b/helpstack/res/drawable-hdpi/hs_action_send_now_light_img.png deleted file mode 100644 index 5c64d31..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_action_send_now_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_add_attachment_img.png b/helpstack/res/drawable-hdpi/hs_add_attachment_img.png index 5985f2e..d8e2bd9 100644 Binary files a/helpstack/res/drawable-hdpi/hs_add_attachment_img.png and b/helpstack/res/drawable-hdpi/hs_add_attachment_img.png differ diff --git a/helpstack/res/drawable-hdpi/hs_add_attachment_img_light.png b/helpstack/res/drawable-hdpi/hs_add_attachment_img_light.png new file mode 100644 index 0000000..7091eca Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_add_attachment_img_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_attachment.png b/helpstack/res/drawable-hdpi/hs_attachment.png new file mode 100644 index 0000000..7093edd Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_attachment.png differ diff --git a/helpstack/res/drawable-hdpi/hs_attachment_img.png b/helpstack/res/drawable-hdpi/hs_attachment_img.png deleted file mode 100644 index 7a630fe..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_attachment_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_attachment_light.png b/helpstack/res/drawable-hdpi/hs_attachment_light.png new file mode 100644 index 0000000..33f50d0 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_attachment_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_disclosure.png b/helpstack/res/drawable-hdpi/hs_disclosure.png new file mode 100644 index 0000000..1ecbc5f Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_disclosure.png differ diff --git a/helpstack/res/drawable-hdpi/hs_disclosure_img.png b/helpstack/res/drawable-hdpi/hs_disclosure_img.png deleted file mode 100644 index 1a1d32b..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_disclosure_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_disclosure_light.png b/helpstack/res/drawable-hdpi/hs_disclosure_light.png new file mode 100644 index 0000000..7920aa3 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_disclosure_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_download.png b/helpstack/res/drawable-hdpi/hs_download.png new file mode 100644 index 0000000..ce97c85 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_download.png differ diff --git a/helpstack/res/drawable-hdpi/hs_download_light.png b/helpstack/res/drawable-hdpi/hs_download_light.png new file mode 100644 index 0000000..671e0b3 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_download_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_forward.png b/helpstack/res/drawable-hdpi/hs_forward.png new file mode 100644 index 0000000..a124259 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_forward.png differ diff --git a/helpstack/res/drawable-hdpi/hs_forward_light.png b/helpstack/res/drawable-hdpi/hs_forward_light.png new file mode 100644 index 0000000..8c4c394 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_forward_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_launcher.png b/helpstack/res/drawable-hdpi/hs_launcher.png index 288b665..cde69bc 100644 Binary files a/helpstack/res/drawable-hdpi/hs_launcher.png and b/helpstack/res/drawable-hdpi/hs_launcher.png differ diff --git a/helpstack/res/drawable-hdpi/hs_notification_download_light_img.png b/helpstack/res/drawable-hdpi/hs_notification_download_light_img.png deleted file mode 100644 index d5bfa45..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_notification_download_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_search.png b/helpstack/res/drawable-hdpi/hs_search.png new file mode 100644 index 0000000..c593e7a Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_search.png differ diff --git a/helpstack/res/drawable-hdpi/hs_search_img.png b/helpstack/res/drawable-hdpi/hs_search_img.png deleted file mode 100644 index 00934f2..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_search_img.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_search_img_light.png b/helpstack/res/drawable-hdpi/hs_search_img_light.png deleted file mode 100644 index 772e359..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_search_img_light.png and /dev/null differ diff --git a/helpstack/res/drawable-hdpi/hs_search_light.png b/helpstack/res/drawable-hdpi/hs_search_light.png new file mode 100644 index 0000000..bbfbc96 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_search_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_send.png b/helpstack/res/drawable-hdpi/hs_send.png new file mode 100644 index 0000000..40b74eb Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_send.png differ diff --git a/helpstack/res/drawable-hdpi/hs_send_light.png b/helpstack/res/drawable-hdpi/hs_send_light.png new file mode 100644 index 0000000..1bc7552 Binary files /dev/null and b/helpstack/res/drawable-hdpi/hs_send_light.png differ diff --git a/helpstack/res/drawable-hdpi/hs_send_now_img.png b/helpstack/res/drawable-hdpi/hs_send_now_img.png deleted file mode 100644 index 7e0d46d..0000000 Binary files a/helpstack/res/drawable-hdpi/hs_send_now_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_accept.png b/helpstack/res/drawable-mdpi/hs_accept.png new file mode 100644 index 0000000..64a4944 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_accept.png differ diff --git a/helpstack/res/drawable-mdpi/hs_accept_light.png b/helpstack/res/drawable-mdpi/hs_accept_light.png new file mode 100644 index 0000000..3b2b65d Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_accept_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_action_accept_img.png b/helpstack/res/drawable-mdpi/hs_action_accept_img.png deleted file mode 100644 index 98df0c7..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_accept_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_action_accept_light_img.png b/helpstack/res/drawable-mdpi/hs_action_accept_light_img.png deleted file mode 100644 index 41107b8..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_accept_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_action_attachment_light_img.png b/helpstack/res/drawable-mdpi/hs_action_attachment_light_img.png deleted file mode 100644 index d0d8051..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_action_forward_img.png b/helpstack/res/drawable-mdpi/hs_action_forward_img.png deleted file mode 100644 index 74aad50..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_forward_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_action_forward_light_img.png b/helpstack/res/drawable-mdpi/hs_action_forward_light_img.png deleted file mode 100644 index a19e7f4..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_forward_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_action_new_attachment_light_img.png b/helpstack/res/drawable-mdpi/hs_action_new_attachment_light_img.png deleted file mode 100644 index 1d265aa..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_new_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_action_send_now_light_img.png b/helpstack/res/drawable-mdpi/hs_action_send_now_light_img.png deleted file mode 100644 index 414cc3c..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_action_send_now_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_add_attachment_img.png b/helpstack/res/drawable-mdpi/hs_add_attachment_img.png index fdf6ba2..30ac6f9 100644 Binary files a/helpstack/res/drawable-mdpi/hs_add_attachment_img.png and b/helpstack/res/drawable-mdpi/hs_add_attachment_img.png differ diff --git a/helpstack/res/drawable-mdpi/hs_add_attachment_img_light.png b/helpstack/res/drawable-mdpi/hs_add_attachment_img_light.png new file mode 100644 index 0000000..c3ff2bd Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_add_attachment_img_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_attachment.png b/helpstack/res/drawable-mdpi/hs_attachment.png new file mode 100644 index 0000000..b16a950 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_attachment.png differ diff --git a/helpstack/res/drawable-mdpi/hs_attachment_img.png b/helpstack/res/drawable-mdpi/hs_attachment_img.png deleted file mode 100644 index fa66985..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_attachment_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_attachment_light.png b/helpstack/res/drawable-mdpi/hs_attachment_light.png new file mode 100644 index 0000000..186c6ae Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_attachment_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_disclosure.png b/helpstack/res/drawable-mdpi/hs_disclosure.png new file mode 100644 index 0000000..23338b8 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_disclosure.png differ diff --git a/helpstack/res/drawable-mdpi/hs_disclosure_img.png b/helpstack/res/drawable-mdpi/hs_disclosure_img.png deleted file mode 100644 index 32bfaa9..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_disclosure_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_disclosure_light.png b/helpstack/res/drawable-mdpi/hs_disclosure_light.png new file mode 100644 index 0000000..93dec39 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_disclosure_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_download.png b/helpstack/res/drawable-mdpi/hs_download.png new file mode 100644 index 0000000..f5afb24 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_download.png differ diff --git a/helpstack/res/drawable-mdpi/hs_download_light.png b/helpstack/res/drawable-mdpi/hs_download_light.png new file mode 100644 index 0000000..f53cc0c Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_download_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_forward.png b/helpstack/res/drawable-mdpi/hs_forward.png new file mode 100644 index 0000000..27767f1 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_forward.png differ diff --git a/helpstack/res/drawable-mdpi/hs_forward_light.png b/helpstack/res/drawable-mdpi/hs_forward_light.png new file mode 100644 index 0000000..878b6e5 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_forward_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_launcher.png b/helpstack/res/drawable-mdpi/hs_launcher.png index 6ae570b..c133a0c 100644 Binary files a/helpstack/res/drawable-mdpi/hs_launcher.png and b/helpstack/res/drawable-mdpi/hs_launcher.png differ diff --git a/helpstack/res/drawable-mdpi/hs_notification_download_light_img.png b/helpstack/res/drawable-mdpi/hs_notification_download_light_img.png deleted file mode 100644 index cc4d957..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_notification_download_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_search.png b/helpstack/res/drawable-mdpi/hs_search.png new file mode 100644 index 0000000..6b16343 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_search.png differ diff --git a/helpstack/res/drawable-mdpi/hs_search_img.png b/helpstack/res/drawable-mdpi/hs_search_img.png deleted file mode 100644 index e16c624..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_search_img.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_search_img_light.png b/helpstack/res/drawable-mdpi/hs_search_img_light.png deleted file mode 100644 index 4edb1ff..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_search_img_light.png and /dev/null differ diff --git a/helpstack/res/drawable-mdpi/hs_search_light.png b/helpstack/res/drawable-mdpi/hs_search_light.png new file mode 100644 index 0000000..faefc59 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_search_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_send.png b/helpstack/res/drawable-mdpi/hs_send.png new file mode 100644 index 0000000..fd36be8 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_send.png differ diff --git a/helpstack/res/drawable-mdpi/hs_send_light.png b/helpstack/res/drawable-mdpi/hs_send_light.png new file mode 100644 index 0000000..ef59e77 Binary files /dev/null and b/helpstack/res/drawable-mdpi/hs_send_light.png differ diff --git a/helpstack/res/drawable-mdpi/hs_send_now_img.png b/helpstack/res/drawable-mdpi/hs_send_now_img.png deleted file mode 100644 index ab3db5f..0000000 Binary files a/helpstack/res/drawable-mdpi/hs_send_now_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_accept.png b/helpstack/res/drawable-xhdpi/hs_accept.png new file mode 100644 index 0000000..2f6d638 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_accept.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_accept_light.png b/helpstack/res/drawable-xhdpi/hs_accept_light.png new file mode 100644 index 0000000..d670618 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_accept_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_accept_img.png b/helpstack/res/drawable-xhdpi/hs_action_accept_img.png deleted file mode 100644 index 6c235cf..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_accept_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_accept_light_img.png b/helpstack/res/drawable-xhdpi/hs_action_accept_light_img.png deleted file mode 100644 index 6ee32b6..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_accept_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_attachment_light_img.png b/helpstack/res/drawable-xhdpi/hs_action_attachment_light_img.png deleted file mode 100644 index e01e86a..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_forward_img.png b/helpstack/res/drawable-xhdpi/hs_action_forward_img.png deleted file mode 100644 index 1a158c1..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_forward_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_forward_light_img.png b/helpstack/res/drawable-xhdpi/hs_action_forward_light_img.png deleted file mode 100644 index 64a0c61..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_forward_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_new_attachment_light_img.png b/helpstack/res/drawable-xhdpi/hs_action_new_attachment_light_img.png deleted file mode 100644 index 41cbab2..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_new_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_action_send_now_light_img.png b/helpstack/res/drawable-xhdpi/hs_action_send_now_light_img.png deleted file mode 100644 index 2629040..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_action_send_now_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_add_attachment_img.png b/helpstack/res/drawable-xhdpi/hs_add_attachment_img.png index 94b738b..620226d 100644 Binary files a/helpstack/res/drawable-xhdpi/hs_add_attachment_img.png and b/helpstack/res/drawable-xhdpi/hs_add_attachment_img.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_add_attachment_img_light.png b/helpstack/res/drawable-xhdpi/hs_add_attachment_img_light.png new file mode 100644 index 0000000..771425c Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_add_attachment_img_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_attachment.png b/helpstack/res/drawable-xhdpi/hs_attachment.png new file mode 100644 index 0000000..93ca795 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_attachment.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_attachment_img.png b/helpstack/res/drawable-xhdpi/hs_attachment_img.png deleted file mode 100644 index 1e0c6d5..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_attachment_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_attachment_light.png b/helpstack/res/drawable-xhdpi/hs_attachment_light.png new file mode 100644 index 0000000..730978d Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_attachment_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_disclosure.png b/helpstack/res/drawable-xhdpi/hs_disclosure.png new file mode 100644 index 0000000..7522b38 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_disclosure.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_disclosure_img.png b/helpstack/res/drawable-xhdpi/hs_disclosure_img.png deleted file mode 100644 index 9c136ac..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_disclosure_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_disclosure_light.png b/helpstack/res/drawable-xhdpi/hs_disclosure_light.png new file mode 100644 index 0000000..6858f02 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_disclosure_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_download.png b/helpstack/res/drawable-xhdpi/hs_download.png new file mode 100644 index 0000000..8c83bff Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_download.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_download_light.png b/helpstack/res/drawable-xhdpi/hs_download_light.png new file mode 100644 index 0000000..ded5652 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_download_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_forward.png b/helpstack/res/drawable-xhdpi/hs_forward.png new file mode 100644 index 0000000..8b5a681 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_forward.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_forward_light.png b/helpstack/res/drawable-xhdpi/hs_forward_light.png new file mode 100644 index 0000000..5e93f88 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_forward_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_launcher.png b/helpstack/res/drawable-xhdpi/hs_launcher.png index d4fb7cd..bfa42f0 100644 Binary files a/helpstack/res/drawable-xhdpi/hs_launcher.png and b/helpstack/res/drawable-xhdpi/hs_launcher.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_notification_download_light_img.png b/helpstack/res/drawable-xhdpi/hs_notification_download_light_img.png deleted file mode 100644 index bc0ced5..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_notification_download_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_search.png b/helpstack/res/drawable-xhdpi/hs_search.png new file mode 100644 index 0000000..6381902 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_search.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_search_img.png b/helpstack/res/drawable-xhdpi/hs_search_img.png deleted file mode 100644 index cebd6ac..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_search_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_search_img_light.png b/helpstack/res/drawable-xhdpi/hs_search_img_light.png deleted file mode 100644 index 19658e4..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_search_img_light.png and /dev/null differ diff --git a/helpstack/res/drawable-xhdpi/hs_search_light.png b/helpstack/res/drawable-xhdpi/hs_search_light.png new file mode 100644 index 0000000..bfc3e39 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_search_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_send.png b/helpstack/res/drawable-xhdpi/hs_send.png new file mode 100644 index 0000000..761929f Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_send.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_send_light.png b/helpstack/res/drawable-xhdpi/hs_send_light.png new file mode 100644 index 0000000..6aeaa85 Binary files /dev/null and b/helpstack/res/drawable-xhdpi/hs_send_light.png differ diff --git a/helpstack/res/drawable-xhdpi/hs_send_now_img.png b/helpstack/res/drawable-xhdpi/hs_send_now_img.png deleted file mode 100644 index ff0e369..0000000 Binary files a/helpstack/res/drawable-xhdpi/hs_send_now_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_accept.png b/helpstack/res/drawable-xxhdpi/hs_accept.png new file mode 100644 index 0000000..5697dba Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_accept.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_accept_light.png b/helpstack/res/drawable-xxhdpi/hs_accept_light.png new file mode 100644 index 0000000..bfd7b82 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_accept_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_accept_img.png b/helpstack/res/drawable-xxhdpi/hs_action_accept_img.png deleted file mode 100644 index 6fda89e..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_accept_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_accept_light_img.png b/helpstack/res/drawable-xxhdpi/hs_action_accept_light_img.png deleted file mode 100644 index 68c41de..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_accept_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_attachment_light_img.png b/helpstack/res/drawable-xxhdpi/hs_action_attachment_light_img.png deleted file mode 100644 index 305bc41..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_forward_img.png b/helpstack/res/drawable-xxhdpi/hs_action_forward_img.png deleted file mode 100644 index fe1d67c..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_forward_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_forward_light_img.png b/helpstack/res/drawable-xxhdpi/hs_action_forward_light_img.png deleted file mode 100644 index ae8ffaf..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_forward_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_new_attachment_light_img.png b/helpstack/res/drawable-xxhdpi/hs_action_new_attachment_light_img.png deleted file mode 100644 index ce7536c..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_new_attachment_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_action_send_now_light_img.png b/helpstack/res/drawable-xxhdpi/hs_action_send_now_light_img.png deleted file mode 100644 index 793f2cb..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_action_send_now_light_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_add_attachment_img.png b/helpstack/res/drawable-xxhdpi/hs_add_attachment_img.png index b66ffc2..a1d0e24 100644 Binary files a/helpstack/res/drawable-xxhdpi/hs_add_attachment_img.png and b/helpstack/res/drawable-xxhdpi/hs_add_attachment_img.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_add_attachment_img_light.png b/helpstack/res/drawable-xxhdpi/hs_add_attachment_img_light.png new file mode 100644 index 0000000..7ca8a2b Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_add_attachment_img_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_attachment.png b/helpstack/res/drawable-xxhdpi/hs_attachment.png new file mode 100644 index 0000000..12034a0 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_attachment.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_attachment_img.png b/helpstack/res/drawable-xxhdpi/hs_attachment_img.png deleted file mode 100644 index c20aecb..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_attachment_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_attachment_light.png b/helpstack/res/drawable-xxhdpi/hs_attachment_light.png new file mode 100644 index 0000000..bc58d0a Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_attachment_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_disclosure.png b/helpstack/res/drawable-xxhdpi/hs_disclosure.png new file mode 100644 index 0000000..6af00d7 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_disclosure.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_disclosure_img.png b/helpstack/res/drawable-xxhdpi/hs_disclosure_img.png deleted file mode 100644 index a486521..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_disclosure_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_disclosure_light.png b/helpstack/res/drawable-xxhdpi/hs_disclosure_light.png new file mode 100644 index 0000000..e383558 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_disclosure_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_download.png b/helpstack/res/drawable-xxhdpi/hs_download.png new file mode 100644 index 0000000..7024677 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_download.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_download_light.png b/helpstack/res/drawable-xxhdpi/hs_download_light.png new file mode 100644 index 0000000..6602791 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_download_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_forward.png b/helpstack/res/drawable-xxhdpi/hs_forward.png new file mode 100644 index 0000000..5c5eda0 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_forward.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_forward_light.png b/helpstack/res/drawable-xxhdpi/hs_forward_light.png new file mode 100644 index 0000000..f8cf79f Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_forward_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_launcher.png b/helpstack/res/drawable-xxhdpi/hs_launcher.png index 85a6081..324e72c 100644 Binary files a/helpstack/res/drawable-xxhdpi/hs_launcher.png and b/helpstack/res/drawable-xxhdpi/hs_launcher.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_search.png b/helpstack/res/drawable-xxhdpi/hs_search.png new file mode 100644 index 0000000..3ae490e Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_search.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_search_img.png b/helpstack/res/drawable-xxhdpi/hs_search_img.png deleted file mode 100644 index 91cf822..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_search_img.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_search_img_light.png b/helpstack/res/drawable-xxhdpi/hs_search_img_light.png deleted file mode 100644 index a108638..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_search_img_light.png and /dev/null differ diff --git a/helpstack/res/drawable-xxhdpi/hs_search_light.png b/helpstack/res/drawable-xxhdpi/hs_search_light.png new file mode 100644 index 0000000..abbb989 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_search_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_send.png b/helpstack/res/drawable-xxhdpi/hs_send.png new file mode 100644 index 0000000..f2d6ba9 Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_send.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_send_light.png b/helpstack/res/drawable-xxhdpi/hs_send_light.png new file mode 100644 index 0000000..14b90dd Binary files /dev/null and b/helpstack/res/drawable-xxhdpi/hs_send_light.png differ diff --git a/helpstack/res/drawable-xxhdpi/hs_send_now_img.png b/helpstack/res/drawable-xxhdpi/hs_send_now_img.png deleted file mode 100644 index 373dde2..0000000 Binary files a/helpstack/res/drawable-xxhdpi/hs_send_now_img.png and /dev/null differ diff --git a/helpstack/res/drawable/left_chat_bubble.xml b/helpstack/res/drawable/left_chat_bubble.xml index 28c9116..3df4ef1 100644 --- a/helpstack/res/drawable/left_chat_bubble.xml +++ b/helpstack/res/drawable/left_chat_bubble.xml @@ -2,6 +2,6 @@ - + diff --git a/helpstack/res/drawable/right_chat_bubble.xml b/helpstack/res/drawable/right_chat_bubble.xml index 4c254ce..37712c4 100644 --- a/helpstack/res/drawable/right_chat_bubble.xml +++ b/helpstack/res/drawable/right_chat_bubble.xml @@ -2,6 +2,6 @@ - + diff --git a/helpstack/res/layout/hs_activity_edit_attachment.xml b/helpstack/res/layout/hs_activity_edit_attachment.xml index 69adbd0..a163318 100644 --- a/helpstack/res/layout/hs_activity_edit_attachment.xml +++ b/helpstack/res/layout/hs_activity_edit_attachment.xml @@ -6,7 +6,7 @@ android:orientation="vertical" tools:context=".MainActivity" > - diff --git a/helpstack/res/layout/hs_expandable_child_issue_detail_staff_reply.xml b/helpstack/res/layout/hs_expandable_child_issue_detail_staff_reply.xml index dada2f4..2a7990c 100644 --- a/helpstack/res/layout/hs_expandable_child_issue_detail_staff_reply.xml +++ b/helpstack/res/layout/hs_expandable_child_issue_detail_staff_reply.xml @@ -5,18 +5,18 @@ android:layout_height="match_parent" android:paddingLeft="@dimen/hs_chatbubbleMarginWidth" android:paddingRight="@dimen/hs_chatbubbleMarginWidth" - android:paddingBottom="10dp" - android:paddingTop="10dp" > + android:paddingBottom="4dp" + android:paddingTop="4dp" > + android:text=""/> + android:paddingBottom="4dp" + android:paddingTop="4dp" > diff --git a/helpstack/res/layout/hs_expandable_footer_progress_bar.xml b/helpstack/res/layout/hs_expandable_footer_progress_bar.xml new file mode 100644 index 0000000..ed3c0e4 --- /dev/null +++ b/helpstack/res/layout/hs_expandable_footer_progress_bar.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/helpstack/res/layout/hs_expandable_parent_home_default.xml b/helpstack/res/layout/hs_expandable_parent_home_default.xml index 6f75aea..259279c 100644 --- a/helpstack/res/layout/hs_expandable_parent_home_default.xml +++ b/helpstack/res/layout/hs_expandable_parent_home_default.xml @@ -5,6 +5,12 @@ style="@style/hs_listView_headerBackgroundStyle" android:orientation="vertical" > + + diff --git a/helpstack/res/layout/hs_fragment_new_issue.xml b/helpstack/res/layout/hs_fragment_new_issue.xml index 20545e3..8ff5fe6 100644 --- a/helpstack/res/layout/hs_fragment_new_issue.xml +++ b/helpstack/res/layout/hs_fragment_new_issue.xml @@ -1,82 +1,65 @@ - + tools:context="com.tenmiles.helpstack.NewIssueActivity$PlaceholderFragment" + android:orientation="vertical"> - + android:orientation="horizontal"> - + + + + - + android:ems="10" + android:gravity="left|top" + android:hint="@string/hs_message_hint" + android:minLines="4" + android:inputType="textCapSentences|textMultiLine" + android:scrollbars="vertical" + android:text=""/> - - - - - - - - + + diff --git a/helpstack/res/layout/hs_fragment_new_user.xml b/helpstack/res/layout/hs_fragment_new_user.xml index 489384e..d03969f 100644 --- a/helpstack/res/layout/hs_fragment_new_user.xml +++ b/helpstack/res/layout/hs_fragment_new_user.xml @@ -1,70 +1,47 @@ - + android:layout_height="match_parent" + android:orientation="vertical" + xmlns:android="http://schemas.android.com/apk/res/android"> - - - - - - - - - - - + android:layout_height="wrap_content" + android:layout_marginLeft="10dp" + android:layout_marginRight="10dp" + android:layout_marginTop="20dp" + android:text="@string/hs_new_user_message" /> + + + + + + - - + - diff --git a/helpstack/res/values/hs_colors.xml b/helpstack/res/values/hs_colors.xml index bba9824..52bdb8a 100644 --- a/helpstack/res/values/hs_colors.xml +++ b/helpstack/res/values/hs_colors.xml @@ -1,5 +1,6 @@ + #228CD1 #e1e1e1 #228CD1 #ffffff diff --git a/helpstack/res/values/hs_default_theme.xml b/helpstack/res/values/hs_default_theme.xml index 8000efb..3e40079 100644 --- a/helpstack/res/values/hs_default_theme.xml +++ b/helpstack/res/values/hs_default_theme.xml @@ -60,20 +60,20 @@ - @drawable/hs_attachment_img + @drawable/hs_attachment - @drawable/hs_search_img + @drawable/hs_search_light - @drawable/hs_disclosure_img + @drawable/hs_disclosure @drawable/hs_add_attachment_img - @drawable/hs_action_accept_img + @drawable/hs_accept_light - @drawable/hs_action_forward_img + @drawable/hs_forward_light diff --git a/helpstack/res/values/hs_default_theme_base.xml b/helpstack/res/values/hs_default_theme_base.xml index 361cdd3..47421da 100644 --- a/helpstack/res/values/hs_default_theme_base.xml +++ b/helpstack/res/values/hs_default_theme_base.xml @@ -49,7 +49,6 @@ @dimen/hs_listView_ChildView_TextSize - @color/hs_rightchat_bubblecolor_defaultColor @@ -76,15 +75,12 @@ @drawable/left_chat_bubble_triangle - - @@ -118,11 +114,7 @@ - - diff --git a/helpstack/res/values/hs_dimens.xml b/helpstack/res/values/hs_dimens.xml index 7f10afa..8e2a4b0 100644 --- a/helpstack/res/values/hs_dimens.xml +++ b/helpstack/res/values/hs_dimens.xml @@ -4,14 +4,14 @@ 16dp 16dp - 20sp + 14sp 0.5dip 18sp - 18sp + 16sp 18sp 13sp 32dp - 20sp + 18sp 100dp 4dp diff --git a/helpstack/res/values/hs_strings.xml b/helpstack/res/values/hs_strings.xml index b92f0b0..7a95ec6 100644 --- a/helpstack/res/values/hs_strings.xml +++ b/helpstack/res/values/hs_strings.xml @@ -17,10 +17,11 @@ First Name Last Name Email Address - Please enter your contact details to reach you + Enter your contact details to reach you later - Your issue has been created and raised. + Creating issue + Your issue has been created and raised Report Issue Subject Message @@ -57,8 +58,8 @@ Download Downloading Attachment Download complete - Loading... - You will be notified when the download finishes. + Loading… + You will be notified when the download finishes Open with @@ -76,4 +77,7 @@ Error in reporting issue Subject and message cannot be empty + Drawing saved to Gallery + Image could not be saved + diff --git a/helpstack/src/com/tenmiles/helpstack/HSHelpStack.java b/helpstack/src/com/tenmiles/helpstack/HSHelpStack.java index dd5bf86..451c240 100644 --- a/helpstack/src/com/tenmiles/helpstack/HSHelpStack.java +++ b/helpstack/src/com/tenmiles/helpstack/HSHelpStack.java @@ -50,13 +50,10 @@ public class HSHelpStack { public static HSHelpStack getInstance(Context context) { if (singletonInstance == null) { synchronized (HSHelpStack.class) { // 1 - if (singletonInstance == null) // 2 - { + if (singletonInstance == null) { // 2 Log.d(TAG, "New Instance"); - singletonInstance = new HSHelpStack( - context.getApplicationContext()); // 3 + singletonInstance = new HSHelpStack(context.getApplicationContext()); // 3 } - } } return singletonInstance; diff --git a/helpstack/src/com/tenmiles/helpstack/activities/ArticleActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/ArticleActivity.java index 40ddc01..4b4ce07 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/ArticleActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/ArticleActivity.java @@ -36,36 +36,27 @@ public class ArticleActivity extends HSActivityParent { public static final String EXTRAS_ARTICLE_ITEM = "item"; - - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hs_activity_article); if (savedInstanceState == null) { - HSKBItem kbItem = (HSKBItem)getIntent().getSerializableExtra("item"); ArticleFragment sectionFragment = HSFragmentManager.getArticleFragment(this, kbItem); HSFragmentManager.putFragmentInActivity(this, R.id.container, sectionFragment, "Article"); getHelpStackActionBar().setTitle(R.string.hs_article); - } } @Override public boolean onCreateOptionsMenu(Menu menu) { - - // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.hs_article, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == android.R.id.home) { finish(); diff --git a/helpstack/src/com/tenmiles/helpstack/activities/EditAttachmentActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/EditAttachmentActivity.java index 8dbab90..66a844d 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/EditAttachmentActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/EditAttachmentActivity.java @@ -44,6 +44,7 @@ import com.tenmiles.helpstack.R; import com.tenmiles.helpstack.model.HSAttachment; +import com.tenmiles.helpstack.theme.widget.DrawingView; import java.io.FileNotFoundException; import java.util.UUID; @@ -99,7 +100,6 @@ public void onClick(View view) { @Override public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.hs_edit_attachment, menu); return super.onCreateOptionsMenu(menu); @@ -128,36 +128,40 @@ public void onBackPressed() { public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); - switch(requestCode) { - case REQUEST_CODE_PHOTO_PICKER: - if(resultCode == Activity.RESULT_OK){ - Uri selectedImage = intent.getData(); + if(requestCode == REQUEST_CODE_PHOTO_PICKER) { + if(resultCode == Activity.RESULT_OK) { + Uri selectedImage = intent.getData(); - Cursor cursor = this.getContentResolver().query(selectedImage, new String[] { + Cursor cursor = this.getContentResolver().query(selectedImage, + new String[] { MediaStore.Images.ImageColumns.DATA, MediaStore.Images.ImageColumns.DISPLAY_NAME, - MediaStore.Images.ImageColumns.MIME_TYPE }, null, null, null); + MediaStore.Images.ImageColumns.MIME_TYPE + }, null, null, null); + + if (cursor != null) { cursor.moveToFirst(); + } - String display_name = cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DISPLAY_NAME)); - String mime_type = cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.MIME_TYPE)); + String display_name = cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DISPLAY_NAME)); + String mime_type = cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.MIME_TYPE)); - cursor.close(); + cursor.close(); - selectedAttachment = HSAttachment.createAttachment(selectedImage.toString(), display_name, mime_type); + selectedAttachment = HSAttachment.createAttachment(selectedImage.toString(), display_name, mime_type); - try { - Uri uri = Uri.parse(selectedAttachment.getUrl()); - originalBitmap = BitmapFactory.decodeStream(this.getContentResolver().openInputStream(uri), null, null); - drawView.setCanvasBitmap(originalBitmap); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - else { - finish(); + try { + Uri uri = Uri.parse(selectedAttachment.getUrl()); + originalBitmap = BitmapFactory.decodeStream(this.getContentResolver().openInputStream(uri), null, null); + drawView.setCanvasBitmap(originalBitmap); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } + } + else { + finish(); + } } } @@ -176,8 +180,7 @@ private void onSaveClick() { } if(imageSaved!=null){ - Toast savedToast = Toast.makeText(getApplicationContext(), - "Drawing saved to Gallery!", Toast.LENGTH_SHORT); + Toast savedToast = Toast.makeText(getApplicationContext(), R.string.drawing_saved, Toast.LENGTH_SHORT); savedToast.show(); Intent resultIntent = new Intent(); @@ -187,8 +190,7 @@ private void onSaveClick() { finish(); } else{ - Toast unsavedToast = Toast.makeText(getApplicationContext(), - "Oops! Image could not be saved.", Toast.LENGTH_SHORT); + Toast unsavedToast = Toast.makeText(getApplicationContext(), R.string.image_not_saved, Toast.LENGTH_SHORT); unsavedToast.show(); } @@ -217,16 +219,16 @@ public void paintColorClicked(View view) { private void discardDraft() { if (drawView.hasBeenEdited()) { new AlertDialog.Builder(this) - .setTitle(R.string.discard) - .setMessage("Do you want to discard your changes?") - .setNegativeButton(android.R.string.no, null) - .setPositiveButton(R.string.discard, new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface arg0, int arg1) { - EditAttachmentActivity.super.onBackPressed(); - } - } - ).create().show(); + .setTitle(R.string.discard) + .setMessage("Do you want to discard your changes?") + .setNegativeButton(android.R.string.no, null) + .setPositiveButton(R.string.discard, new DialogInterface.OnClickListener() { + + public void onClick(DialogInterface arg0, int arg1) { + EditAttachmentActivity.super.onBackPressed(); + } + } + ).create().show(); } else { HSActivityManager.finishSafe(this); diff --git a/helpstack/src/com/tenmiles/helpstack/activities/HSActivityManager.java b/helpstack/src/com/tenmiles/helpstack/activities/HSActivityManager.java index 98879a2..6812d2d 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/HSActivityManager.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/HSActivityManager.java @@ -74,6 +74,7 @@ public static void startNewUserActivity(HSFragmentParent context, int requestCod Intent intent = new Intent(context.getActivity(), NewUserActivity.class); intent.putExtra(NewIssueActivity.EXTRAS_SUBJECT, subject); intent.putExtra(NewIssueActivity.EXTRAS_MESSAGE, message); + if (attachmentArray != null) { Gson json = new Gson(); intent.putExtra(NewIssueActivity.EXTRAS_ATTACHMENT, json.toJson(attachmentArray)); @@ -97,12 +98,12 @@ public static void startImageAttachmentDisplayActivity(Activity context, String public static void finishSafe(Activity context) { Intent intent = new Intent(); - context.setResult(HSActivityManager.resultCode_cancelled,intent); + context.setResult(HSActivityManager.resultCode_cancelled, intent); context.finish(); } public static void sendSuccessSignal(Activity context, Intent result) { - context.setResult(HSActivityManager.resultCode_sucess,result); + context.setResult(HSActivityManager.resultCode_sucess, result); context.finish(); } } diff --git a/helpstack/src/com/tenmiles/helpstack/activities/HSActivityParent.java b/helpstack/src/com/tenmiles/helpstack/activities/HSActivityParent.java index 3be8e07..1bfece9 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/HSActivityParent.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/HSActivityParent.java @@ -22,8 +22,6 @@ package com.tenmiles.helpstack.activities; -import com.tenmiles.helpstack.R; - import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; @@ -36,14 +34,16 @@ * */ public class HSActivityParent extends AppCompatActivity { + + private static final String ACTION_BAR_TITLE = "Actionbar_title"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); - // Handling actionbar title when activity changes so activity doesnot have to handle it. + + // Handling actionbar title when activity changes so activity does not have to handle it. if (savedInstanceState != null) { - getHelpStackActionBar().setTitle(savedInstanceState.getString("Actionbar_title")); + getHelpStackActionBar().setTitle(savedInstanceState.getString(ACTION_BAR_TITLE)); } getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -57,7 +57,7 @@ public void configureActionBar(ActionBar actionBar) { @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - outState.putString("Actionbar_title", getHelpStackActionBar().getTitle().toString()); + outState.putString(ACTION_BAR_TITLE, getHelpStackActionBar().getTitle().toString()); } public ActionBar getHelpStackActionBar() { diff --git a/helpstack/src/com/tenmiles/helpstack/activities/HomeActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/HomeActivity.java index c9e4c43..1ead094 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/HomeActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/HomeActivity.java @@ -39,8 +39,7 @@ * */ public class HomeActivity extends HSActivityParent { - - + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -50,7 +49,6 @@ protected void onCreate(Bundle savedInstanceState) { HomeFragment homeFrag = HSFragmentManager.getHomeFragment(); HSFragmentManager.putFragmentInActivity(this, R.id.container, homeFrag, "Home"); } - } @Override @@ -61,9 +59,6 @@ public void configureActionBar(ActionBar actionBar) { @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.search) { return true; diff --git a/helpstack/src/com/tenmiles/helpstack/activities/ImageAttachmentDisplayActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/ImageAttachmentDisplayActivity.java index c5e2c1a..e273e96 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/ImageAttachmentDisplayActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/ImageAttachmentDisplayActivity.java @@ -24,11 +24,11 @@ import android.os.Bundle; import android.support.v7.app.ActionBar; -import android.view.Menu; import android.view.MenuItem; import com.tenmiles.helpstack.R; import com.tenmiles.helpstack.fragments.HSFragmentManager; +import com.tenmiles.helpstack.fragments.ImageAttachmentDisplayFragment; public class ImageAttachmentDisplayActivity extends HSActivityParent { @@ -44,8 +44,8 @@ protected void onCreate(Bundle savedInstanceState) { String url = getIntent().getExtras().getString(EXTRAS_STRING_URL); String title = getIntent().getExtras().getString(EXTRAS_TITLE); getSupportActionBar().setTitle(title); - getSupportFragmentManager().beginTransaction() - .add(R.id.container, HSFragmentManager.getImageAttachmentDisplayFragment(this, url)).commit(); + ImageAttachmentDisplayFragment fragment = HSFragmentManager.getImageAttachmentDisplayFragment(this, url); + getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit(); } } @@ -56,9 +56,6 @@ public void configureActionBar(ActionBar actionBar) { @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == android.R.id.home) { finish(); diff --git a/helpstack/src/com/tenmiles/helpstack/activities/IssueDetailActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/IssueDetailActivity.java index 15bbdf2..b6668aa 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/IssueDetailActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/IssueDetailActivity.java @@ -33,7 +33,8 @@ import com.tenmiles.helpstack.model.HSTicket; public class IssueDetailActivity extends HSActivityParent { - + private static final String TAG = IssueDetailActivity.class.getSimpleName(); + public static final String EXTRAS_TICKET = "ticket"; @Override @@ -43,7 +44,8 @@ protected void onCreate(Bundle savedInstanceState) { if (savedInstanceState == null) { IssueDetailFragment mIssueDetailFragment = HSFragmentManager.getIssueDetailFragment(); - HSFragmentManager.putFragmentInActivity(this, R.id.container, mIssueDetailFragment, "IssueDetail"); + + HSFragmentManager.putFragmentInActivity(this, R.id.container, mIssueDetailFragment, TAG); HSTicket ticket = (HSTicket)getIntent().getExtras().getSerializable(EXTRAS_TICKET); mIssueDetailFragment.setTicket(ticket); getHelpStackActionBar().setTitle(ticket.getSubject()); @@ -57,25 +59,17 @@ public void configureActionBar(ActionBar actionBar) { @Override public boolean onCreateOptionsMenu(Menu menu) { - - // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.hs_issue_detail, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == android.R.id.home) { finish(); return true; } - if(id == android.R.id.home) { - finish(); - } return super.onOptionsItemSelected(item); } diff --git a/helpstack/src/com/tenmiles/helpstack/activities/NewIssueActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/NewIssueActivity.java index c7813ed..cc3ac4e 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/NewIssueActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/NewIssueActivity.java @@ -35,9 +35,8 @@ public class NewIssueActivity extends HSActivityParent { - public static final String EXTRAS_USER = "user"; public static final String RESULT_TICKET = "ticket"; - + public static final String EXTRAS_USER = "user"; public static final String EXTRAS_SUBJECT = "subject"; public static final String EXTRAS_MESSAGE = "message"; public static final String EXTRAS_ATTACHMENT = "attachment"; @@ -58,7 +57,6 @@ protected void onCreate(Bundle savedInstanceState) { } HSFragmentManager.putFragmentInActivity(this, R.id.container, newIssueFragment, "Issue"); } - } @Override @@ -69,17 +67,11 @@ public void configureActionBar(ActionBar actionBar) { @Override public boolean onCreateOptionsMenu(Menu menu) { - - - return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == android.R.id.home) { finishSafe(); @@ -94,6 +86,4 @@ public void finishSafe() { finish(); } - - } diff --git a/helpstack/src/com/tenmiles/helpstack/activities/NewUserActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/NewUserActivity.java index 74aa333..30ca47f 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/NewUserActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/NewUserActivity.java @@ -32,7 +32,7 @@ public class NewUserActivity extends HSActivityParent { - + private static final String TAG = "NewUser"; @Override protected void onCreate(Bundle savedInstanceState) { @@ -41,11 +41,10 @@ protected void onCreate(Bundle savedInstanceState) { if (savedInstanceState == null) { Bundle bundle = getIntent().getExtras(); - NewUserFragment newUserFragment = new NewUserFragment(); + NewUserFragment newUserFragment = new NewUserFragment(); newUserFragment.setArguments(bundle); - HSFragmentManager.putFragmentInActivity(this, R.id.container, newUserFragment, "NewUser"); - } - + HSFragmentManager.putFragmentInActivity(this, R.id.container, newUserFragment, TAG); + } } @Override @@ -56,9 +55,6 @@ public void configureActionBar(ActionBar actionBar) { @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == android.R.id.home) { HSActivityManager.finishSafe(this); diff --git a/helpstack/src/com/tenmiles/helpstack/activities/SectionActivity.java b/helpstack/src/com/tenmiles/helpstack/activities/SectionActivity.java index 0731e3c..4d8735c 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/SectionActivity.java +++ b/helpstack/src/com/tenmiles/helpstack/activities/SectionActivity.java @@ -40,7 +40,7 @@ * */ public class SectionActivity extends HSActivityParent { - + private static final String TAG = "Section"; public static final String EXTRAS_SECTION_ITEM = "section_item"; @Override @@ -49,28 +49,21 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.hs_activity_section); if (savedInstanceState == null) { - HSKBItem kbSectionItem = (HSKBItem)getIntent().getSerializableExtra(EXTRAS_SECTION_ITEM); SectionFragment sectionFragment = HSFragmentManager.getSectionFragment(this, kbSectionItem); - HSFragmentManager.putFragmentInActivity(this, R.id.container, sectionFragment, "Section"); + HSFragmentManager.putFragmentInActivity(this, R.id.container, sectionFragment, TAG); getHelpStackActionBar().setTitle(kbSectionItem.getSubject()); - } } @Override public boolean onCreateOptionsMenu(Menu menu) { - - // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.hs_section, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == android.R.id.home) { finish(); diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/ArticleFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/ArticleFragment.java index 73a9dea..feba2a5 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/ArticleFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/ArticleFragment.java @@ -35,8 +35,9 @@ public class ArticleFragment extends HSFragmentParent { public static final String HTML_WRAPPER_WITH_TITLE = - "" + + "" + "

%s

%s"; + public HSKBItem kbItem; private WebView webview; @@ -44,8 +45,7 @@ public ArticleFragment() { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.hs_fragment_article, container, false); webview = (WebView)rootView.findViewById(R.id.webview); diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentManager.java b/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentManager.java index 65e335f..40da53b 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentManager.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentManager.java @@ -39,8 +39,7 @@ public class HSFragmentManager { public static HomeFragment getHomeFragment() { - HomeFragment fragment = new HomeFragment(); - return fragment; + return new HomeFragment(); } public static NewIssueFragment getNewIssueFragment(HSUser user) { @@ -52,40 +51,33 @@ public static IssueDetailFragment getIssueDetailFragment() { } public static SearchFragment getSearchFragment() { - SearchFragment fragment = new SearchFragment(); - return fragment; + return new SearchFragment(); } - public static HSFragmentParent getFragmentInActivity(HSActivityParent activity,String tag) { + public static HSFragmentParent getFragmentInActivity(HSActivityParent activity, String tag) { FragmentManager fragMgr = activity.getSupportFragmentManager(); return (HSFragmentParent) fragMgr.findFragmentByTag(tag); } - public static SectionFragment getSectionFragment(HSActivityParent activity, HSKBItem kbItem) - { + public static SectionFragment getSectionFragment(HSActivityParent activity, HSKBItem kbItem) { SectionFragment sectionFragment = new SectionFragment(); sectionFragment.sectionItemToDisplay = kbItem; return sectionFragment; } - public static ArticleFragment getArticleFragment(HSActivityParent activity, HSKBItem kbItem) - { + public static ArticleFragment getArticleFragment(HSActivityParent activity, HSKBItem kbItem) { ArticleFragment sectionFragment = new ArticleFragment(); sectionFragment.kbItem = kbItem; return sectionFragment; } - public static ImageAttachmentDisplayFragment getImageAttachmentDisplayFragment(HSActivityParent activity, String url) - { + public static ImageAttachmentDisplayFragment getImageAttachmentDisplayFragment(HSActivityParent activity, String url) { ImageAttachmentDisplayFragment fragment = new ImageAttachmentDisplayFragment(); fragment.image_url = url; return fragment; } - - - + public static void putFragmentInActivity(HSActivityParent activity, int resid, HSFragmentParent frag, String tag) { - // above is proper. FragmentManager fragMgr = activity.getSupportFragmentManager(); FragmentTransaction xact = fragMgr.beginTransaction(); xact.replace(resid, frag, tag); @@ -93,7 +85,6 @@ public static void putFragmentInActivity(HSActivityParent activity, int resid, H } public static void putFragmentBackStackInActivity(HSActivityParent activity, int resid, HSFragmentParent frag, String tag) { - // above is proper. FragmentManager fragMgr = activity.getSupportFragmentManager(); FragmentTransaction xact = fragMgr.beginTransaction(); xact.replace(resid, frag); diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentParent.java b/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentParent.java index e3dcc37..fd71b55 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentParent.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/HSFragmentParent.java @@ -22,11 +22,11 @@ package com.tenmiles.helpstack.fragments; -import com.tenmiles.helpstack.activities.HSActivityParent; - import android.support.v4.app.Fragment; import android.support.v7.app.ActionBar; +import com.tenmiles.helpstack.activities.HSActivityParent; + /** * * This is the parent class for any Fragment used in HelpStack. diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/HomeFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/HomeFragment.java index aa20020..327192b 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/HomeFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/HomeFragment.java @@ -34,6 +34,7 @@ import android.view.ViewGroup; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; +import android.widget.ProgressBar; import android.widget.TextView; import com.android.volley.Response.ErrorListener; @@ -66,24 +67,22 @@ public class HomeFragment extends HSFragmentParent { private ExpandableListView mExpandableListView; private LocalAdapter mAdapter; - - private SearchFragment mSearchFragment; + private SearchFragment mSearchFragment; private HSSource gearSource; - private HSKBItem[] fetchedKbArticles; private HSTicket[] fetchedTickets; // To show loading until both the kb and tickets are not fetched. private int numberOfServerCallWaiting = 0; + private ProgressBar progressBar; + private int faq_position = 0; - public HomeFragment() { - + public HomeFragment() { } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.hs_fragment_home, container, false); @@ -91,6 +90,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, mExpandableListView = (ExpandableListView) rootView.findViewById(R.id.expandableList); mAdapter = new LocalAdapter(getActivity()); + View progress_bar_view = inflater.inflate(R.layout.hs_expandable_footer_progress_bar, null); + progressBar = (ProgressBar) progress_bar_view.findViewById(R.id.progressBar1); + mExpandableListView.addFooterView(progress_bar_view); + // report an issue View report_an_issue_view = inflater.inflate(R.layout.hs_expandable_footer_report_issue, null); report_an_issue_view.findViewById(R.id.button1).setOnClickListener(reportIssueClickListener); @@ -130,7 +133,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, else { refreshList(); } - } return rootView; @@ -174,9 +176,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); - // Inflate the menu; this adds items to the action bar if it is present. inflater.inflate(R.menu.hs_search_menu, menu); - MenuItem searchItem = menu.findItem(R.id.search); mSearchFragment.addSearchViewInMenuItem(getActivity(), searchItem); } @@ -188,37 +188,26 @@ public void onDetach() { } private void initializeView() { + startHomeScreenLoadingDisplay(true); - startHomeScreenLoadingDisplay(true); - - // Show Loading gearSource.requestKBArticle("FAQ", null, new OnFetchedArraySuccessListener() { - - @Override public void onSuccess(Object[] kbArticles) { - fetchedKbArticles = (HSKBItem[]) kbArticles; mSearchFragment.setKBArticleList(fetchedKbArticles); refreshList(); - - // Stop Loading startHomeScreenLoadingDisplay(false); - } - }, new ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { - // Stop Loading startHomeScreenLoadingDisplay(false); if(numberOfServerCallWaiting == 0) { HSUtils.showAlertDialog(getActivity(), getResources().getString(R.string.hs_error), getResources().getString(R.string.hs_error_fetching_articles_issues)); } } - }); gearSource.requestAllTickets(new OnFetchedArraySuccessListener() { @@ -233,12 +222,10 @@ public void onSuccess(Object[] tickets) { @Override public void onErrorResponse(VolleyError error) { - // Stop Loading startHomeScreenLoadingDisplay(false); if(numberOfServerCallWaiting == 0) { HSUtils.showAlertDialog(getActivity(), getResources().getString(R.string.hs_error), getResources().getString(R.string.hs_error_fetching_articles_issues)); } - } }); @@ -247,16 +234,15 @@ public void onErrorResponse(VolleyError error) { public void startHomeScreenLoadingDisplay(boolean loading) { if (loading) { numberOfServerCallWaiting = 2; - getHelpStackActivity().setProgressBarIndeterminateVisibility(true); + progressBar.setVisibility(View.VISIBLE); } else { // Stop Loading numberOfServerCallWaiting--; if (numberOfServerCallWaiting == 0) { if (getHelpStackActivity() != null) { // To handle a crash that happens if activity is re-created and we receive network response after that. - getHelpStackActivity().setProgressBarIndeterminateVisibility(false); + progressBar.setVisibility(View.GONE); } - } } } @@ -264,15 +250,13 @@ public void startHomeScreenLoadingDisplay(boolean loading) { protected OnChildClickListener expandableChildViewClickListener = new OnChildClickListener() { @Override - public boolean onChildClick(ExpandableListView parent, View v, - int groupPosition, int childPosition, long id) { - - if (groupPosition == 0) { + public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { + if (groupPosition == faq_position) { HSKBItem kbItemClicked = (HSKBItem) mAdapter.getChild(groupPosition, childPosition); articleClickedOnPosition(kbItemClicked); return true; } - if (groupPosition == 1) { + if (groupPosition == get_issues_position()) { HSTicket ticket = (HSTicket) mAdapter.getChild(groupPosition, childPosition); HSActivityManager.startIssueDetailActivity(getHelpStackActivity(), ticket); return true; @@ -286,7 +270,6 @@ public boolean onChildClick(ExpandableListView parent, View v, @Override public void onClick(View v) { - gearSource.launchCreateNewTicketScreen(HomeFragment.this, REQUEST_CODE_NEW_TICKET); } }; @@ -296,50 +279,38 @@ public void onClick(View v) { @Override public void startReportAnIssue() { - mSearchFragment.setVisibility(false); gearSource.launchCreateNewTicketScreen(HomeFragment.this, REQUEST_CODE_NEW_TICKET); } - - }; - - ////////////////////////////////////// // UTILITY FUNCTIONS /// ///////////////////////////////////// - - private void refreshList() { - mAdapter.clearAll(); - mAdapter.addParent(0, getString(R.string.hs_articles_title)); + if (fetchedTickets != null && fetchedTickets.length > 0) { + faq_position = 1; + mAdapter.addParent(0, getString(R.string.hs_issues_title)); - if (fetchedKbArticles != null) { - for (int i = 0; i < fetchedKbArticles.length ; i++) { - - HSKBItem item = (HSKBItem) fetchedKbArticles[i]; + for (int i = 0; i < fetchedTickets.length ; i++) { + HSTicket item = fetchedTickets[i]; mAdapter.addChild(0, item); } } + mAdapter.addParent(faq_position, getString(R.string.hs_articles_title)); - if (fetchedTickets != null && fetchedTickets.length > 0) { - mAdapter.addParent(1, getString(R.string.hs_issues_title)); - - for (int i = 0; i < fetchedTickets.length ; i++) { - - HSTicket item = (HSTicket) fetchedTickets[i]; - mAdapter.addChild(1, item); - } - } - + if (fetchedKbArticles != null) { + for (int i = 0; i < fetchedKbArticles.length ; i++) { + HSKBItem item = fetchedKbArticles[i]; + mAdapter.addChild(faq_position, item); + } + } mAdapter.notifyDataSetChanged(); - expandAll(); } @@ -353,62 +324,52 @@ private void expandAll() { protected void articleClickedOnPosition(HSKBItem kbItemClicked) { if(kbItemClicked.getArticleType() == HSKBItem.TYPE_ARTICLE) { HSActivityManager.startArticleActivity(this, kbItemClicked, REQUEST_CODE_NEW_TICKET); - - } else { + } + else { HSActivityManager.startSectionActivity(this, kbItemClicked, REQUEST_CODE_NEW_TICKET); } } - private class LocalAdapter extends HSBaseExpandableListAdapter - { + private class LocalAdapter extends HSBaseExpandableListAdapter { public LocalAdapter(Context context) { super(context); } @Override - public View getChildView(final int groupPosition,final int childPosition, - boolean isLastChild, View convertView, ViewGroup parent) { - + public View getChildView(final int groupPosition,final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { ChildViewHolder holder; if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.hs_expandable_child_home_default, null); holder = new ChildViewHolder(); - holder.textView1 = (TextView) convertView.findViewById(R.id.textView1); - convertView.setTag(holder); } else { holder = (ChildViewHolder) convertView.getTag(); } - if (groupPosition == 0) { - HSKBItem item = (HSKBItem) getChild(groupPosition, childPosition); - holder.textView1.setText(item.getSubject()); - - + if (groupPosition == faq_position) { + HSKBItem item = (HSKBItem) getChild(groupPosition, childPosition); + holder.textView1.setText(item.getSubject()); } - else if (groupPosition == 1){ - HSTicket item = (HSTicket) getChild(groupPosition, childPosition); - holder.textView1.setText(item.getSubject()); + else if (groupPosition == get_issues_position()){ + HSTicket item = (HSTicket) getChild(groupPosition, childPosition); + holder.textView1.setText(item.getSubject()); } return convertView; } @Override - public View getGroupView(int groupPosition, boolean isExpanded, - View convertView, ViewGroup parent) { + public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { ParentViewHolder holder; if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.hs_expandable_parent_home_default, null); holder = new ParentViewHolder(); - holder.textView1 = (TextView) convertView.findViewById(R.id.textView1); - convertView.setTag(holder); } else { @@ -416,9 +377,7 @@ public View getGroupView(int groupPosition, boolean isExpanded, } String text = (String) getGroup(groupPosition); - holder.textView1.setText(text); - return convertView; } @@ -430,4 +389,8 @@ private class ChildViewHolder { TextView textView1; } } + + private int get_issues_position() { + return 1 - faq_position; + } } diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/ImageAttachmentDisplayFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/ImageAttachmentDisplayFragment.java index d9875ac..013954d 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/ImageAttachmentDisplayFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/ImageAttachmentDisplayFragment.java @@ -53,25 +53,17 @@ public class ImageAttachmentDisplayFragment extends HSFragmentParent { public String image_url; - GestureImageView imageView; - LocalAsync localAsync; - - private View progressView; - - boolean isAttachmentDownloaded = false; + private GestureImageView imageView; + private LocalAsync localAsync; + private View progressView; + private boolean isAttachmentDownloaded = false; @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - - - View rootView = inflater.inflate( - R.layout.hs_fragment_image_attachment_display, container, - false); - - progressView = rootView.findViewById(R.id.progressHolder); - - imageView = (GestureImageView) rootView.findViewById(R.id.image); + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View rootView = inflater.inflate(R.layout.hs_fragment_image_attachment_display, container, false); + progressView = rootView.findViewById(R.id.progressHolder); + imageView = (GestureImageView) rootView.findViewById(R.id.image); setHasOptionsMenu(true); @@ -89,8 +81,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, showLoading(true); loadImage(); } - - } return rootView; @@ -130,7 +120,6 @@ public void onPrepareOptionsMenu(Menu menu) { else { downloadItem.setVisible(false); } - } @Override @@ -155,19 +144,15 @@ else if (image_url.startsWith("content")) { selectedBitmap = NewIssueFragment.downscaleAndReadBitmap(getActivity(), Uri.parse(image_url)); imageView.setImageBitmap(selectedBitmap); showLoading(false); - } - catch (FileNotFoundException e) { + } catch (FileNotFoundException e) { Toast.makeText(getActivity(), "Sorry! could not open attachment, unknown image", Toast.LENGTH_LONG).show(); getActivity().finish(); } - } else { Toast.makeText(getActivity(), "Sorry! could not open attachment, unknown image", Toast.LENGTH_LONG).show(); getActivity().finish(); } - - } public void closeAsync() { @@ -217,7 +202,7 @@ private static Bitmap downloadBitmap(String url) throws IOException { InputStream in = null; try { BitmapFactory.Options options = new BitmapFactory.Options(); - bitmap = BitmapFactory.decodeStream(new URL(url).openStream(),null,options); + bitmap = BitmapFactory.decodeStream(new URL(url).openStream(), null, options); } catch (IOException e) { Log.e(TAG, "Could not load Bitmap from: " + url); @@ -228,7 +213,7 @@ private static Bitmap downloadBitmap(String url) throws IOException { } } - return bitmap; + return bitmap; } } diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/IssueDetailFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/IssueDetailFragment.java index 8d59e1c..353783c 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/IssueDetailFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/IssueDetailFragment.java @@ -30,6 +30,7 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.provider.MediaStore.Images.ImageColumns; import android.text.method.LinkMovementMethod; @@ -71,15 +72,11 @@ import java.util.Date; import java.util.StringTokenizer; -public class IssueDetailFragment extends HSFragmentParent -{ +public class IssueDetailFragment extends HSFragmentParent { private final int REQUEST_CODE_PHOTO_PICKER = 100; - - public IssueDetailFragment() { - } - - private ExpandableListView mExpandableListView; + + private ExpandableListView mExpandableListView; private LocalAdapter mAdapter; private ImageView sendButton; private EditText replyEditTextView; @@ -89,18 +86,16 @@ public IssueDetailFragment() { private HSTicket ticket; private HSTicketUpdate[] fetchedUpdates; private HSAttachment selectedAttachment; - - - - + + public IssueDetailFragment() { + } + @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.hs_fragment_issue_detail, null); - - replyEditTextView = (EditText) rootView.findViewById(R.id.replyEditText); + replyEditTextView = (EditText) rootView.findViewById(R.id.replyEditText); sendButton = (ImageView)rootView.findViewById(R.id.button1); sendButton.setOnClickListener(sendReplyListener); @@ -141,8 +136,7 @@ public void onActivityCreated(Bundle savedInstanceState) { ticket = (HSTicket) savedInstanceState.getSerializable("ticket"); selectedAttachment = (HSAttachment) savedInstanceState.getSerializable("selectedAttachment"); replyEditTextView.setText(savedInstanceState.getString("replyEditTextView")); - - + refreshList(); resetAttachmentImage(); @@ -170,7 +164,6 @@ public void onPause() { super.onPause(); HSAttachment[] attachmentArray = null; - if (selectedAttachment != null) { attachmentArray = new HSAttachment[1]; attachmentArray[0] = selectedAttachment; @@ -182,27 +175,27 @@ public void onPause() { @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { - if(requestCode == REQUEST_CODE_PHOTO_PICKER && resultCode == Activity.RESULT_OK) - { - + if(requestCode == REQUEST_CODE_PHOTO_PICKER && resultCode == Activity.RESULT_OK) { Uri selectedImage = Uri.parse(intent.getStringExtra("URI")); - - //User had pick an image. - Cursor cursor = getActivity().getContentResolver().query(selectedImage, new String[] { - ImageColumns.DATA, - ImageColumns.DISPLAY_NAME, - ImageColumns.MIME_TYPE }, null, null, null); - cursor.moveToFirst(); - - String display_name = cursor.getString(cursor.getColumnIndex(ImageColumns.DISPLAY_NAME)); + + Cursor cursor = getActivity().getContentResolver().query(selectedImage, + new String[] { + ImageColumns.DATA, + ImageColumns.DISPLAY_NAME, + ImageColumns.MIME_TYPE + }, null, null, null); + + if (cursor != null) { + cursor.moveToFirst(); + } + + String display_name = cursor.getString(cursor.getColumnIndex(ImageColumns.DISPLAY_NAME)); String mime_type = cursor.getString(cursor.getColumnIndex(ImageColumns.MIME_TYPE)); - - cursor.close(); + + cursor.close(); selectedAttachment = HSAttachment.createAttachment(selectedImage.toString(), display_name, mime_type); - resetAttachmentImage(); - } }; @@ -214,16 +207,13 @@ public void onDetach() { } private void refreshUpdateFromServer() { - getHelpStackActivity().setProgressBarIndeterminateVisibility(true); gearSource.requestAllUpdatesOnTicket("ALL_UPDATES", ticket, new OnFetchedArraySuccessListener() { @Override public void onSuccess(Object[] successObject) { - fetchedUpdates = (HSTicketUpdate[]) successObject; - refreshList(); getHelpStackActivity().setProgressBarIndeterminateVisibility(false); @@ -242,21 +232,17 @@ public void onErrorResponse(VolleyError error) { private OnChildItemClickListener listChildClickListener = new OnChildItemClickListener() { @Override - public boolean onChildListItemLongClick(int groupPosition, - int childPosition, String type, Object map) { + public boolean onChildListItemLongClick(int groupPosition, int childPosition, String type, Object map) { return false; } @Override - public void onChildListItemClick(int groupPosition, int childPosition, - String type, Object map) { + public void onChildListItemClick(int groupPosition, int childPosition, String type, Object map) { showAttachments(((HSTicketUpdate)map).getAttachments()); } @Override - public void onChildCheckedListner(int groupPosition, int childPosition, - String type, Object map, boolean checked) { - + public void onChildCheckedListener(int groupPosition, int childPosition, String type, Object map, boolean checked) { } }; @@ -273,7 +259,7 @@ public void onClick(View v) { else { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); alertBuilder.setTitle(getResources().getString(R.string.hs_attachment)); - alertBuilder.setIcon(R.drawable.hs_attachment_img); + alertBuilder.setIcon(R.drawable.hs_attachment); String[] attachmentOptions = {getResources().getString(R.string.hs_change), getResources().getString(R.string.hs_remove)}; alertBuilder.setItems(attachmentOptions, new DialogInterface.OnClickListener() { @@ -292,7 +278,6 @@ else if (which == 1) { }); alertBuilder.create().show(); } - } }; @@ -300,7 +285,6 @@ else if (which == 1) { @Override public void onClick(View v) { - String message = replyEditTextView.getText().toString(); if(message.trim().length() == 0) { return; @@ -308,18 +292,19 @@ public void onClick(View v) { getHelpStackActivity().setProgressBarIndeterminateVisibility(true); sendButton.setEnabled(false); - sendButton.setAlpha((float)0.4); - - HSAttachment[] attachmentArray = null; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + sendButton.setAlpha((float)0.4); + } + + HSAttachment[] attachmentArray = null; if (selectedAttachment != null) { attachmentArray = new HSAttachment[1]; attachmentArray[0] = selectedAttachment; } - InputMethodManager imm = (InputMethodManager)getActivity().getSystemService( - Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(replyEditTextView.getWindowToken(), 0); + InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(replyEditTextView.getWindowToken(), 0); gearSource.addReplyOnATicket("REPLY_TO_A_TICKET", message, attachmentArray, ticket, new OnFetchedSuccessListener() { @@ -328,8 +313,10 @@ public void onSuccess(Object successObject) { clearFormData(); sendButton.setEnabled(true); - sendButton.setAlpha((float)1.0); - HSTicketUpdate update = (HSTicketUpdate) successObject; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + sendButton.setAlpha((float)1.0); + } + HSTicketUpdate update = (HSTicketUpdate) successObject; ArrayList updateList = new ArrayList(); updateList.addAll(Arrays.asList(fetchedUpdates)); @@ -343,8 +330,7 @@ public void onSuccess(Object successObject) { selectedAttachment = null; replyEditTextView.setText(""); resetAttachmentImage(); - - + getHelpStackActivity().setProgressBarIndeterminateVisibility(false); scrollListToBottom(); @@ -355,8 +341,10 @@ public void onSuccess(Object successObject) { public void onErrorResponse(VolleyError error) { HSUtils.showAlertDialog(getActivity(), getResources().getString(R.string.hs_error), getResources().getString(R.string.hs_error_posting_reply)); sendButton.setEnabled(true); - sendButton.setAlpha((float)1.0); - getHelpStackActivity().setProgressBarIndeterminateVisibility(false); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + sendButton.setAlpha((float)1.0); + } + getHelpStackActivity().setProgressBarIndeterminateVisibility(false); } }); } @@ -375,23 +363,20 @@ private void expandAll() { } private void refreshList() { - mAdapter.clearAll(); if (fetchedUpdates != null) { mAdapter.addParent(1, ""); - for (int i = 0; i < fetchedUpdates.length; i++) { - mAdapter.addChild(1, fetchedUpdates[i]); - } + for (HSTicketUpdate fetchedUpdate : fetchedUpdates) { + mAdapter.addChild(1, fetchedUpdate); + } } mAdapter.notifyDataSetChanged(); - expandAll(); } private void showAttachments(final HSAttachment[] attachmentsArray) { - if (attachmentsArray.length == 1) { HSAttachment attachmentToShow = attachmentsArray[0]; openAttachment(attachmentToShow); @@ -402,6 +387,7 @@ private void showAttachments(final HSAttachment[] attachmentsArray) { for(HSAttachment attachment : attachmentsArray) { attachments.add(attachment.getFileName()); } + String[] attachmentNames = attachments.toArray(new String[attachments.size()]); AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); @@ -427,16 +413,13 @@ public void onItemClick(AdapterView parent, View view, dialog.show(); } - - private class LocalAdapter extends HSBaseExpandableListAdapter - { + private class LocalAdapter extends HSBaseExpandableListAdapter { public LocalAdapter(Context context) { super(context); } @Override - public View getChildView(final int groupPosition, final int childPosition, - boolean isLastChild, View convertView, ViewGroup parent) { + public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { ChildViewHolder holder; if (convertView == null) { holder = new ChildViewHolder(); @@ -475,21 +458,22 @@ public View getChildView(final int groupPosition, final int childPosition, holder.textView1.setText(text); } - - if(update.isUserUpdate()) { holder.nameField.setText(getResources().getString(R.string.hs_me)); - }else { + } + else { if(update.name != null) { holder.nameField.setText(update.name); - } else { + } + else { holder.nameField.setText(getResources().getString(R.string.hs_staff)); } } - if(update.isAttachmentEmtpy()) { + if(update.isAttachmentEmpty()) { holder.attachmentButton.setVisibility(View.INVISIBLE); - }else { + } + else { holder.attachmentButton.setVisibility(View.VISIBLE); holder.attachmentButton.setFocusable(true); holder.attachmentButton.setOnClickListener(new OnClickListener() { @@ -502,7 +486,6 @@ public void onClick(View v) { } Date updatedTime = update.getUpdatedTime(); - String dateString = HSUtils.convertToHumanReadableTime(updatedTime, Calendar.getInstance().getTimeInMillis()); holder.timeField.setText(dateString.trim()); @@ -510,15 +493,13 @@ public void onClick(View v) { } @Override - public View getGroupView(int groupPosition, boolean isExpanded, - View convertView, ViewGroup parent) { + public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { ParentViewHolder holder; if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.hs_expandable_parent_issue_detail_default, null); holder = new ParentViewHolder(); holder.parent = convertView; - - convertView.setTag(holder); + convertView.setTag(holder); } else { holder = (ParentViewHolder) convertView.getTag(); @@ -565,7 +546,6 @@ private void resetAttachmentImage() { this.mAttachmentButton.setImageResource(R.drawable.hs_add_attachment); } else { - try { Uri uri = Uri.parse(selectedAttachment.getUrl()); Bitmap selectedBitmap; @@ -574,16 +554,12 @@ private void resetAttachmentImage() { } catch (FileNotFoundException e) { e.printStackTrace(); } - - } - } private void scrollListToBottom() { mExpandableListView.setSelectedChild(0, mAdapter.getChildrenCount(0) - 1, true); } - /** * @return the ticket @@ -599,9 +575,7 @@ public HSTicket getTicket() { public void setTicket(HSTicket ticket) { this.ticket = ticket; } - - - + /// Attachments private void openAttachment(HSAttachment attachment) { if(knownAttachmentType(attachment)) { @@ -610,12 +584,10 @@ private void openAttachment(HSAttachment attachment) { else { downloadAttachment(attachment); } - } - private boolean knownAttachmentType(HSAttachment attachment) - { - String mime_type = attachment.getMime_type(); + private boolean knownAttachmentType(HSAttachment attachment) { + String mime_type = attachment.getMimeType(); if (mime_type != null && mime_type.startsWith("image")) { return true; } @@ -628,16 +600,16 @@ private boolean knownAttachmentType(HSAttachment attachment) private boolean isKnowFileNameType(String file_name) { // get the type of file - StringTokenizer strtok = new StringTokenizer(file_name, "."); + StringTokenizer stringTokenizer = new StringTokenizer(file_name, "."); // getting the last token String fileType = null; - while (strtok.hasMoreTokens()) { + while (stringTokenizer.hasMoreTokens()) { // parsing to get last token - fileType = strtok.nextToken(); + fileType = stringTokenizer.nextToken(); } String[] knownFileType = {"png", "jpg", "jpeg"}; - if(containString(knownFileType,fileType.toLowerCase())) { + if(fileType!=null && containString(knownFileType, fileType.toLowerCase())) { return true; } return false; diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/NewIssueFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/NewIssueFragment.java index 4ce4c1b..23b0d51 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/NewIssueFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/NewIssueFragment.java @@ -22,8 +22,6 @@ package com.tenmiles.helpstack.fragments; -import java.io.FileNotFoundException; - import android.app.Activity; import android.app.AlertDialog; import android.content.Context; @@ -61,6 +59,8 @@ import com.tenmiles.helpstack.model.HSTicket; import com.tenmiles.helpstack.model.HSUser; +import java.io.FileNotFoundException; + public class NewIssueFragment extends HSFragmentParent { private final int REQUEST_CODE_PHOTO_PICKER = 100; @@ -73,15 +73,13 @@ public class NewIssueFragment extends HSFragmentParent { public static final String EXTRAS_MESSAGE = NewIssueActivity.EXTRAS_MESSAGE; public static final String EXTRAS_ATTACHMENT = NewIssueActivity.EXTRAS_ATTACHMENT; + private HSUser userDetails; EditText subjectField, messageField; ImageView imageView1; - - private HSUser userDetails; HSAttachment selectedAttachment; HSSource gearSource; - public static NewIssueFragment createNewIssueFragment(HSUser user) - { + public static NewIssueFragment createNewIssueFragment(HSUser user) { NewIssueFragment frag = new NewIssueFragment(); if(user != null) { @@ -94,21 +92,16 @@ public static NewIssueFragment createNewIssueFragment(HSUser user) } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); View rootView = inflater.inflate(R.layout.hs_fragment_new_issue, container, false); this.subjectField = (EditText) rootView.findViewById(R.id.subjectField); - this.messageField = (EditText) rootView.findViewById(R.id.messageField); - this.imageView1 = (ImageView) rootView.findViewById(R.id.imageView1); this.imageView1.setOnClickListener(attachmentClickListener); - // Read user value Bundle args = savedInstanceState; if (args == null) { @@ -131,7 +124,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, if (!HSHelpStack.getInstance(getActivity()).getShowCredits()) { rootView.findViewById(R.id.footerTextLabel).setVisibility(View.GONE); - rootView.findViewById(R.id.footerDivider).setVisibility(View.GONE); } return rootView; @@ -194,7 +186,6 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { @Override public boolean onOptionsItemSelected(MenuItem item) { - int id = item.getItemId(); if (id == R.id.doneItem) { @@ -235,6 +226,8 @@ public void onErrorResponse(VolleyError error) { getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); } }); + + Toast.makeText(getActivity(), getResources().getString(R.string.hs_creating_issue), Toast.LENGTH_LONG).show(); } else { HSActivityManager.startNewUserActivity(this, REQUEST_CODE_NEW_TICKET, getSubject(), formattedBody, attachmentArray); @@ -253,34 +246,37 @@ else if(id == R.id.clearItem) { public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); - switch(requestCode) { - case REQUEST_CODE_PHOTO_PICKER: - if(resultCode == Activity.RESULT_OK){ + if(requestCode == REQUEST_CODE_PHOTO_PICKER) { + if (resultCode == Activity.RESULT_OK) { + + Uri selectedImage = Uri.parse(intent.getStringExtra("URI")); - Uri selectedImage = Uri.parse(intent.getStringExtra("URI")); + //User had pick an image. + Cursor cursor = getActivity().getContentResolver().query(selectedImage, + new String[]{ + ImageColumns.DATA, + ImageColumns.DISPLAY_NAME, + ImageColumns.MIME_TYPE + }, null, null, null); - //User had pick an image. - Cursor cursor = getActivity().getContentResolver().query(selectedImage, new String[] { - ImageColumns.DATA, - ImageColumns.DISPLAY_NAME, - ImageColumns.MIME_TYPE }, null, null, null); + if (cursor != null) { cursor.moveToFirst(); + } - String display_name = cursor.getString(cursor.getColumnIndex(ImageColumns.DISPLAY_NAME)); - String mime_type = cursor.getString(cursor.getColumnIndex(ImageColumns.MIME_TYPE)); + String display_name = cursor.getString(cursor.getColumnIndex(ImageColumns.DISPLAY_NAME)); + String mime_type = cursor.getString(cursor.getColumnIndex(ImageColumns.MIME_TYPE)); - cursor.close(); + cursor.close(); - selectedAttachment = HSAttachment.createAttachment(selectedImage.toString(), display_name, mime_type); + selectedAttachment = HSAttachment.createAttachment(selectedImage.toString(), display_name, mime_type); - resetAttachmentImage(); - break; - } - case REQUEST_CODE_NEW_TICKET: - if (resultCode == HSActivityManager.resultCode_sucess) { - HSActivityManager.sendSuccessSignal(getActivity(), intent); - break; - } + resetAttachmentImage(); + } + } + else if(requestCode == REQUEST_CODE_NEW_TICKET) { + if (resultCode == HSActivityManager.resultCode_sucess) { + HSActivityManager.sendSuccessSignal(getActivity(), intent); + } } } @@ -302,7 +298,7 @@ public void onClick(View v) { else { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); alertBuilder.setTitle(getResources().getString(R.string.hs_attachment)); - alertBuilder.setIcon(R.drawable.hs_attachment_img); + alertBuilder.setIcon(R.drawable.hs_attachment); String[] attachmentOptions = {getResources().getString(R.string.hs_change), getResources().getString(R.string.hs_remove)}; alertBuilder.setItems(attachmentOptions, new DialogInterface.OnClickListener() { @@ -320,7 +316,6 @@ else if (which == 1) { }); alertBuilder.create().show(); } - } }; @@ -341,7 +336,6 @@ private void resetAttachmentImage() { } } - private void clearFormData() { this.subjectField.setText(""); this.messageField.setText(""); @@ -374,8 +368,7 @@ public static Bitmap downscaleAndReadBitmap(Context context, Uri selectedImage) int width_tmp = o.outWidth, height_tmp = o.outHeight; int scale = 1; while (true) { - if (width_tmp / 2 < REQUIRED_SIZE - || height_tmp / 2 < REQUIRED_SIZE) { + if ((width_tmp/2 < REQUIRED_SIZE) || (height_tmp/2 < REQUIRED_SIZE)) { break; } width_tmp /= 2; diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/NewUserFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/NewUserFragment.java index a15366a..7ea16fe 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/NewUserFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/NewUserFragment.java @@ -61,40 +61,34 @@ public class NewUserFragment extends HSFragmentParent { private String subject; private String message; private HSAttachment[] attachmentArray; + private EditText firstNameField, lastNameField, emailField; + private HSSource gearSource; public NewUserFragment() { - } - - EditText firstNameField, lastNameField, emailField; - - HSSource gearSource; - + @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); View rootView = inflater.inflate(R.layout.hs_fragment_new_user, container, false); - this.firstNameField = (EditText) rootView.findViewById(R.id.firstname); this.lastNameField = (EditText) rootView.findViewById(R.id.lastname); this.emailField = (EditText) rootView.findViewById(R.id.email); - - return rootView; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); + outState.putString(EXTRAS_FIRST_NAME, firstNameField.getText().toString()); outState.putString(EXTRAS_LAST_NAME, lastNameField.getText().toString()); outState.putString(EXTRAS_EMAIL, emailField.getText().toString()); outState.putString(EXTRAS_SUBJECT, subject); outState.putString(EXTRAS_MESSAGE, message); + if (attachmentArray != null) { Gson gson = new Gson(); outState.putString(EXTRAS_ATTACHMENT, gson.toJson(attachmentArray)); @@ -179,46 +173,46 @@ public boolean onOptionsItemSelected(MenuItem item) { getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(true); - gearSource.checkForUserDetailsValidity("NEW_USER", getFirstName(), getLastName(), - getEmailAdddress(), new OnFetchedSuccessListener() { - - @Override - public void onSuccess(Object successObject) { - String formattedBody = message; - - gearSource.createNewTicket("NEW_TICKET", (HSUser)successObject, subject, formattedBody, attachmentArray, - new OnNewTicketFetchedSuccessListener() { - - @Override - public void onSuccess(HSUser udpatedUserDetail, HSTicket ticket) { - - getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); - sendSuccessSignal(ticket); - gearSource.clearTicketDraft(); - Toast.makeText(getActivity(), getResources().getString(R.string.hs_issue_created_raised), Toast.LENGTH_LONG).show(); - } - - }, new ErrorListener() { - - @Override - public void onErrorResponse(VolleyError error) { - HSUtils.showAlertDialog(getActivity(), getResources().getString(R.string.hs_error_reporting_issue), getResources().getString(R.string.hs_error_check_network_connection)); - getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); - } - }); - } - }, new ErrorListener() { - - @Override - public void onErrorResponse(VolleyError error) { - getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); - } - }); + gearSource.checkForUserDetailsValidity("NEW_USER", getFirstName(), getLastName(), + getEmailAdddress(), new OnFetchedSuccessListener() { + + @Override + public void onSuccess(Object successObject) { + String formattedBody = message; + + gearSource.createNewTicket("NEW_TICKET", (HSUser) successObject, subject, formattedBody, attachmentArray, + new OnNewTicketFetchedSuccessListener() { + + @Override + public void onSuccess(HSUser udpatedUserDetail, HSTicket ticket) { + getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); + sendSuccessSignal(ticket); + gearSource.clearTicketDraft(); + Toast.makeText(getActivity(), getResources().getString(R.string.hs_issue_created_raised), Toast.LENGTH_LONG).show(); + } + + }, new ErrorListener() { + + @Override + public void onErrorResponse(VolleyError error) { + HSUtils.showAlertDialog(getActivity(), getResources().getString(R.string.hs_error_reporting_issue), getResources().getString(R.string.hs_error_check_network_connection)); + getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); + } + }); + } + }, new ErrorListener() { + + @Override + public void onErrorResponse(VolleyError error) { + getHelpStackActivity().setSupportProgressBarIndeterminateVisibility(false); + } + }); + + Toast.makeText(getActivity(), getResources().getString(R.string.hs_creating_issue), Toast.LENGTH_LONG).show(); return true; } - - + return super.onOptionsItemSelected(item); } diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/SearchFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/SearchFragment.java index c9c469b..12e626c 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/SearchFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/SearchFragment.java @@ -22,10 +22,6 @@ package com.tenmiles.helpstack.fragments; -import java.util.ArrayList; -import java.util.List; - -import android.app.Activity; import android.content.Context; import android.os.Build; import android.os.Bundle; @@ -49,6 +45,9 @@ import com.tenmiles.helpstack.activities.HSActivityManager; import com.tenmiles.helpstack.model.HSKBItem; +import java.util.ArrayList; +import java.util.List; + /** * Search Fragment * @@ -64,13 +63,10 @@ public class SearchFragment extends HSFragmentParent { private OnReportAnIssueClickListener articleSelecetedListener; public SearchFragment() { - // Required empty public constructor } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - // Inflate the layout for this fragment + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.hs_fragment_search, container, false); setVisibility(false); listView = (ListView)rootView.findViewById(R.id.searchList); @@ -80,10 +76,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, report_an_issue_view.findViewById(R.id.button1).setOnClickListener(reportIssueClickListener); listView.addFooterView(report_an_issue_view); - - listView.setAdapter(searchAdapter); - - listView.setOnItemClickListener(listItemClickListener); + listView.setAdapter(searchAdapter); + listView.setOnItemClickListener(listItemClickListener); return rootView; } @@ -136,7 +130,6 @@ public void onItemClick(AdapterView parent, View view, protected void articleClickedOnPosition(HSKBItem kbItemClicked) { if(kbItemClicked.getArticleType() == HSKBItem.TYPE_ARTICLE) { HSActivityManager.startArticleActivity(this, kbItemClicked, HomeFragment.REQUEST_CODE_NEW_TICKET); - } else { HSActivityManager.startSectionActivity(this, kbItemClicked, HomeFragment.REQUEST_CODE_NEW_TICKET); } @@ -161,9 +154,7 @@ public void onClick(View v) { @Override public boolean onQueryTextSubmit(String q) { - doSearchForQuery(q); - return true; } @@ -193,15 +184,12 @@ public boolean onMenuItemActionCollapse(MenuItem item) { if (Build.VERSION.SDK_INT >= 14) { searchView.setQueryHint(getString(R.string.hs_search_hint)); // Works on android 4.0 and above, but crashes in below version. } - - } private OnClickListener reportIssueClickListener = new OnClickListener() { @Override public void onClick(View v) { - if (articleSelecetedListener != null) { articleSelecetedListener.startReportAnIssue(); } @@ -216,7 +204,7 @@ public interface OnReportAnIssueClickListener { public void startReportAnIssue(); } - private class SearchAdapter extends BaseAdapter implements Filterable{ + private class SearchAdapter extends BaseAdapter implements Filterable { private HSKBItem[] allKBItems; private HSKBItem[] searchResults; @@ -257,7 +245,8 @@ public View getView(final int position, View convertView, ViewGroup parent) { holder = new ViewHolder(); holder.textview = (TextView)convertView.findViewById(R.id.sectionlisttextview); convertView.setTag(holder); - }else { + } + else { holder = (ViewHolder)convertView.getTag(); } holder.textview.setText(((HSKBItem)this.searchResults[position]).getSubject()); @@ -286,13 +275,15 @@ protected FilterResults performFiltering(CharSequence constraint) { results.values = (HSKBItem[])allKBItems; results.count = allKBItems.length; - } else { + } + else { // We perform filtering operation List filterList = new ArrayList(); for (HSKBItem p : allKBItems) { - if (p.getSubject().toUpperCase().contains(constraint.toString().toUpperCase())) //.startsWith(constraint.toString().toUpperCase())) - filterList.add(p); + if (p.getSubject().toUpperCase().contains(constraint.toString().toUpperCase())) { //.startsWith(constraint.toString().toUpperCase())) + filterList.add(p); + } } HSKBItem[] values = filterList.toArray(new HSKBItem[filterList.size()]); results.values = values; @@ -306,14 +297,13 @@ protected void publishResults(CharSequence constraint, FilterResults results) { if(results == null) { notifyDataSetInvalidated(); - }else { + } + else { searchResults = (HSKBItem[]) results.values; notifyDataSetChanged(); } - } - } - } + } diff --git a/helpstack/src/com/tenmiles/helpstack/fragments/SectionFragment.java b/helpstack/src/com/tenmiles/helpstack/fragments/SectionFragment.java index 08a361b..2cba3d3 100644 --- a/helpstack/src/com/tenmiles/helpstack/fragments/SectionFragment.java +++ b/helpstack/src/com/tenmiles/helpstack/fragments/SectionFragment.java @@ -58,26 +58,23 @@ public class SectionFragment extends HSFragmentParent { private static final int REQUEST_CODE_NEW_TICKET = HomeFragment.REQUEST_CODE_NEW_TICKET; - + + public HSKBItem sectionItemToDisplay; + private ListView mListView; private SectionAdapter mAdapter; private SearchFragment mSearchFragment; - - public HSKBItem sectionItemToDisplay; - - private HSSource gearSource; + private HSSource gearSource; private HSKBItem[] fetchedKbItems; public SectionFragment() { - } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.hs_fragment_section, container, false); - + // List View mListView = (ListView)rootView.findViewById(R.id.sectionlistview); @@ -110,7 +107,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, refreshList(); } - return rootView; } @@ -148,8 +144,7 @@ public void onDetach() { } private void initializeView() { - - getHelpStackActivity().setProgressBarIndeterminateVisibility(true); + getHelpStackActivity().setProgressBarIndeterminateVisibility(true); gearSource.requestKBArticle("SECTION_FAQ", this.sectionItemToDisplay, new OnFetchedArraySuccessListener() { @@ -175,9 +170,7 @@ public void onErrorResponse(VolleyError error) { @Override public void onClick(View v) { - - gearSource.launchCreateNewTicketScreen(SectionFragment.this, REQUEST_CODE_NEW_TICKET); - + gearSource.launchCreateNewTicketScreen(SectionFragment.this, REQUEST_CODE_NEW_TICKET); } }; @@ -185,12 +178,9 @@ public void onClick(View v) { @Override public void startReportAnIssue() { - - mSearchFragment.setVisibility(false); + mSearchFragment.setVisibility(false); gearSource.launchCreateNewTicketScreen(SectionFragment.this, REQUEST_CODE_NEW_TICKET); } - - }; protected OnItemClickListener listItemClickListener = new OnItemClickListener() { @@ -210,8 +200,8 @@ private void refreshList() { protected void articleClickedOnPosition(HSKBItem kbItemClicked) { if(kbItemClicked.getArticleType() == HSKBItem.TYPE_ARTICLE) { HSActivityManager.startArticleActivity(this, kbItemClicked, REQUEST_CODE_NEW_TICKET); - - } else { + } + else { HSActivityManager.startSectionActivity(this, kbItemClicked, REQUEST_CODE_NEW_TICKET); } } @@ -231,11 +221,9 @@ public void setKbArticles(HSKBItem[] fetchedKbItems) { @Override public int getCount() { - if (kbItems == null) { return 0; } - return this.kbItems.length; } @@ -251,20 +239,19 @@ public long getItemId(int position) { @Override public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder holder = null; - + if(convertView == null) { holder = new ViewHolder(); LayoutInflater inflater = getActivity().getLayoutInflater(); convertView = inflater.inflate(R.layout.hs_sectionlist_article, null); holder.title = (TextView)convertView.findViewById(R.id.sectionlisttextview); convertView.setTag(holder); - }else { + } + else { holder = (ViewHolder)convertView.getTag(); } - - holder.title.setText(((HSKBItem)getItem(position)).getSubject()); + holder.title.setText(((HSKBItem)getItem(position)).getSubject()); return convertView; } diff --git a/helpstack/src/com/tenmiles/helpstack/gears/HSDeskGear.java b/helpstack/src/com/tenmiles/helpstack/gears/HSDeskGear.java index 9dffcc9..af637c1 100644 --- a/helpstack/src/com/tenmiles/helpstack/gears/HSDeskGear.java +++ b/helpstack/src/com/tenmiles/helpstack/gears/HSDeskGear.java @@ -61,7 +61,6 @@ import static com.tenmiles.helpstack.model.HSUser.createNewUserWithDetails; - public class HSDeskGear extends HSGear { private String instanceUrl; @@ -85,7 +84,6 @@ public void fetchKBArticle(String cancelTag, HSKBItem section, RequestQueue queu OnFetchedArraySuccessListener successListener, Response.ErrorListener errorListener) { if (section == null) { - // String url = getApiUrl().concat("topics"); DeskJsonObjectRequest request = new DeskJsonObjectRequest(cancelTag, url, new DeskArrayBaseListener(successListener, errorListener) { @@ -108,7 +106,6 @@ public void onResponse(JSONObject sectionsArray) { } else { // Fetch articles under that section. - DeskJsonObjectRequest request = new DeskJsonObjectRequest(cancelTag, section.getId(), null, new DeskArrayBaseListener(successListener, errorListener) { @Override @@ -125,19 +122,17 @@ public void onResponse(JSONObject sectionsObject) { }, errorListener); addRequestAndStartQueue(queue, request); - - } } @Override - public void registerNewUser(final String cancelTag, final String firstName, final String lastname, - final String emailAddress, final RequestQueue queue,OnFetchedSuccessListener successListener, - Response.ErrorListener errorListener) { + public void registerNewUser(final String cancelTag, final String firstName, final String lastname, final String emailAddress, final RequestQueue queue, + OnFetchedSuccessListener successListener, Response.ErrorListener errorListener) { HSUser user = createNewUserWithDetails(firstName, lastname, emailAddress); - DeskJsonObjectRequest request = new DeskJsonObjectRequest(cancelTag, getApiUrl().concat("customers/search?email=").concat(user.getEmail()), new CreateNewUserSuccessListener(user, successListener, errorListener) { + DeskJsonObjectRequest request = new DeskJsonObjectRequest(cancelTag, getApiUrl().concat("customers/search?email=").concat(user.getEmail()), + new CreateNewUserSuccessListener(user, successListener, errorListener) { @Override public void onResponse(JSONObject responseObject) { @@ -152,7 +147,6 @@ public void onResponse(JSONObject responseObject) { if (totalEntries >= 1) { try { - JSONObject validUserDetail = null; JSONArray couldBeValidUsersArray = responseObject.getJSONObject("_embedded").getJSONArray("entries"); @@ -178,7 +172,6 @@ public void onResponse(JSONObject responseObject) { } if (validUserDetail != null) { - String firstName = validUserDetail.getString("first_name"); String lastName = validUserDetail.getString("last_name"); String email = validUserDetail.getJSONArray("emails").getJSONObject(0).getString("value"); @@ -217,7 +210,6 @@ public void onResponse(JSONObject responseObject) { @Override public void onResponse(JSONObject responseObject) { - String firstName; String lastName; String apiHref; @@ -229,7 +221,6 @@ public void onResponse(JSONObject responseObject) { firstName = responseObject.getString("first_name"); lastName = responseObject.getString("last_name"); apiHref = responseObject.getJSONObject("_links").getJSONObject("self").getString("href"); - emailsArray = responseObject.getJSONArray("emails"); int eventsArrayLength = emailsArray.length(); @@ -263,8 +254,7 @@ public void onResponse(JSONObject responseObject) { @Override public void createNewTicket(final String cancelTag, HSUser user, String message, String body, final HSUploadAttachment[] attachments, final RequestQueue queue, - OnNewTicketFetchedSuccessListener successListener, - Response.ErrorListener errorListener) { + OnNewTicketFetchedSuccessListener successListener, Response.ErrorListener errorListener) { JSONObject ticketJson = null; try { @@ -275,7 +265,8 @@ public void createNewTicket(final String cancelTag, HSUser user, String message, return; } - DeskJsonObjectRequest request = new DeskJsonObjectRequest(cancelTag, getApiUrl().concat("cases"), ticketJson, new CreateNewTicketSuccessListener(user, successListener, errorListener) { + DeskJsonObjectRequest request = new DeskJsonObjectRequest(cancelTag, getApiUrl().concat("cases"), ticketJson, + new CreateNewTicketSuccessListener(user, successListener, errorListener) { @Override public void onResponse(JSONObject response) { @@ -291,7 +282,6 @@ public void onResponse(JSONObject response) { if (attachments != null && attachments.length > 0) { HSUploadAttachment attachmentObject = attachments[0]; // We are handling the number of attachments in constructor - uploadAttachmentToServer(cancelTag, caseIdHref, attachmentObject, queue, new Response.Listener() { @Override public void onResponse(JSONObject jsonObject) { @@ -330,7 +320,6 @@ public void onResponse(JSONObject responseObject) { String content = responseObject.getString("body"); String from = responseObject.getString("from"); - final Date update_time = parseTime(responseObject.getString("updated_at")); HSTicketUpdate originalMessage = HSTicketUpdate.createUpdateByUser(ticket.getTicketId(), from, content, update_time, null); @@ -405,8 +394,8 @@ public void onResponse(JSONObject repliesObject) { } @Override - public void addReplyOnATicket(final String cancelTag, final String message, final HSUploadAttachment[] attachments, final HSTicket ticket, final HSUser user, - final RequestQueue queue, final OnFetchedSuccessListener successListener, Response.ErrorListener errorListener) { + public void addReplyOnATicket(final String cancelTag, final String message, final HSUploadAttachment[] attachments, final HSTicket ticket, final HSUser user, final RequestQueue queue, + final OnFetchedSuccessListener successListener, Response.ErrorListener errorListener) { JSONObject replyJson = null; try { @@ -421,7 +410,6 @@ public void addReplyOnATicket(final String cancelTag, final String message, fina @Override public void onResponse(JSONObject responseObject) { - String content = null; String userName = null; Date update_time = null; @@ -444,7 +432,6 @@ public void onResponse(JSONObject responseObject) { if (attachments != null && attachments.length > 0) { HSUploadAttachment attachmentObject = attachments[0]; // We are handling the number of attachments in constructor - uploadAttachmentToServer(cancelTag, ticket.getApiHref(), attachmentObject, queue, new Response.Listener() { @Override public void onResponse(JSONObject jsonObject) { @@ -456,9 +443,6 @@ public void onResponse(JSONObject jsonObject) { else { successListener.onSuccess(userReply); } - - - } catch (JSONException e) { e.printStackTrace(); errorListener.onErrorResponse(new VolleyError("Error when parsing replies")); @@ -486,7 +470,8 @@ private void addRequestAndStartQueue(RequestQueue queue, DeskJsonObjectRequest r queue.start(); } - private void uploadAttachmentToServer(String cancelTag, String caseId, HSUploadAttachment attachmentObject, RequestQueue queue, Response.Listener successListener, Response.ErrorListener errorListener) throws JSONException { + private void uploadAttachmentToServer(String cancelTag, String caseId, HSUploadAttachment attachmentObject, RequestQueue queue, + Response.Listener successListener, Response.ErrorListener errorListener) throws JSONException { Uri.Builder builder = new Uri.Builder(); builder.encodedPath(instanceUrl); @@ -494,10 +479,9 @@ private void uploadAttachmentToServer(String cancelTag, String caseId, HSUpload builder.appendEncodedPath("attachments"); String attachmentUrl = builder.build().toString(); - - String attachmentFileName = attachmentObject.getAttachment().getFileName() == null ? "picture":attachmentObject.getAttachment().getFileName(); - String attachmentMimeType = attachmentObject.getAttachment().getMime_type(); + String attachmentMimeType = attachmentObject.getAttachment().getMimeType(); + try { JSONObject attachmentPostObject = new JSONObject(); @@ -518,8 +502,6 @@ private void uploadAttachmentToServer(String cancelTag, String caseId, HSUpload attachmentPostObject.put("content_type", attachmentMimeType); attachmentPostObject.put("file_name", attachmentFileName); - - DeskJsonObjectRequest attachmentRequest = new DeskJsonObjectRequest(cancelTag, attachmentUrl, attachmentPostObject, successListener, errorListener); @@ -530,8 +512,6 @@ private void uploadAttachmentToServer(String cancelTag, String caseId, HSUpload } } - - private String retrieveSectionId(String href) throws JSONException { // href will be of the form: /api/v2/topic/
//
will therefore be the text after the last / @@ -576,7 +556,6 @@ private HSKBItem[] readSectionsFromEntries(JSONArray sectionsArray) throws JSONE } private JSONObject retrieveTicketProperties(HSUser user, String body, String message) throws JSONException { - JSONObject messageFields = new JSONObject(); JSONObject customerLinks = new JSONObject(); JSONObject customerParameter = new JSONObject(); @@ -598,17 +577,14 @@ private JSONObject retrieveTicketProperties(HSUser user, String body, String mes params.put("_links", customerParameter); params.put("message", messageFields); - return params; } private JSONObject createUserReply(String message, String email) throws JSONException { JSONObject userReply = new JSONObject(); - userReply.put("direction", "in"); userReply.put("body", message); userReply.put("to", email); - return userReply; } @@ -637,29 +613,23 @@ private static Date parseUTCString(String timeStr, String pattern) throws ParseE } private abstract class DeskArrayBaseListener implements Response.Listener { - protected OnFetchedArraySuccessListener successListener; protected Response.ErrorListener errorListener; - public DeskArrayBaseListener(OnFetchedArraySuccessListener successListener, - Response.ErrorListener errorListener) { + public DeskArrayBaseListener(OnFetchedArraySuccessListener successListener, Response.ErrorListener errorListener) { this.successListener = successListener; this.errorListener = errorListener; } - } private abstract class DeskBaseListener implements Response.Listener { - protected OnFetchedSuccessListener successListener; protected Response.ErrorListener errorListener; - public DeskBaseListener(OnFetchedSuccessListener successListener, - Response.ErrorListener errorListener) { + public DeskBaseListener(OnFetchedSuccessListener successListener, Response.ErrorListener errorListener) { this.successListener = successListener; this.errorListener = errorListener; } - } private class DeskJsonObjectRequest extends JsonObjectRequest { @@ -667,7 +637,7 @@ private class DeskJsonObjectRequest extends JsonObjectRequest { protected static final int TIMEOUT_MS = 10000; /** Default number of retries for image requests */ - protected static final int MAX_RETRIES = 0; + protected static final int MAX_RETRIES = 2; /** Default backoff multiplier for image requests */ protected static final float BACKOFF_MULT = 0f; @@ -703,18 +673,14 @@ public void addCredential(String name, String password) { public Map getHeaders() throws AuthFailureError { return headers; } - } - private abstract class CreateNewTicketSuccessListener implements Response.Listener - { - + private abstract class CreateNewTicketSuccessListener implements Response.Listener { protected HSUser user; protected OnNewTicketFetchedSuccessListener successListener; protected Response.ErrorListener errorListener; - public CreateNewTicketSuccessListener(HSUser user, OnNewTicketFetchedSuccessListener successListener, - Response.ErrorListener errorListener) { + public CreateNewTicketSuccessListener(HSUser user, OnNewTicketFetchedSuccessListener successListener, Response.ErrorListener errorListener) { this.user = user; this.successListener = successListener; this.errorListener = errorListener; @@ -722,13 +688,11 @@ public CreateNewTicketSuccessListener(HSUser user, OnNewTicketFetchedSuccessList } private abstract class CreateNewUserSuccessListener implements Response.Listener { - protected HSUser user; protected OnFetchedSuccessListener successListener; protected Response.ErrorListener errorListener; - public CreateNewUserSuccessListener(HSUser user, OnFetchedSuccessListener successListener, - Response.ErrorListener errorListener) { + public CreateNewUserSuccessListener(HSUser user, OnFetchedSuccessListener successListener, Response.ErrorListener errorListener) { this.user = user; this.successListener = successListener; this.errorListener = errorListener; diff --git a/helpstack/src/com/tenmiles/helpstack/gears/HSEmailGear.java b/helpstack/src/com/tenmiles/helpstack/gears/HSEmailGear.java index edeca73..c2a3c44 100644 --- a/helpstack/src/com/tenmiles/helpstack/gears/HSEmailGear.java +++ b/helpstack/src/com/tenmiles/helpstack/gears/HSEmailGear.java @@ -31,8 +31,7 @@ */ public class HSEmailGear extends HSGear { - public HSEmailGear(String supportEmailAddress, int localArticleResId) - { + public HSEmailGear(String supportEmailAddress, int localArticleResId) { setNotImplementingKBFetching(localArticleResId); setNotImplementingTicketsFetching(supportEmailAddress); } diff --git a/helpstack/src/com/tenmiles/helpstack/gears/HSHappyfoxGear.java b/helpstack/src/com/tenmiles/helpstack/gears/HSHappyfoxGear.java index 23e1b1c..ccd779f 100644 --- a/helpstack/src/com/tenmiles/helpstack/gears/HSHappyfoxGear.java +++ b/helpstack/src/com/tenmiles/helpstack/gears/HSHappyfoxGear.java @@ -72,7 +72,6 @@ import java.util.Properties; import java.util.TimeZone; - public class HSHappyfoxGear extends HSGear { private static final String TAG = HSHappyfoxGear.class.getSimpleName(); @@ -106,8 +105,7 @@ public HSHappyfoxGear(String instanceUrl, String api_key, String auth_code, Stri // If user taps on a section, then section is send as a paremeter to the function @Override - public void fetchKBArticle(String cancelTag, HSKBItem section, RequestQueue queue, - OnFetchedArraySuccessListener success, ErrorListener errorListener) { + public void fetchKBArticle(String cancelTag, HSKBItem section, RequestQueue queue, OnFetchedArraySuccessListener success, ErrorListener errorListener) { if (section == null) { // This is first request of sections @@ -126,10 +124,9 @@ public void onResponse(JSONArray sectionsArray) { }, errorListener); // to avoid server overload call - request.setRetryPolicy(new DefaultRetryPolicy(TicketFormRequest.TIMEOUT_MS, - TicketFormRequest.MAX_RETRIES, TicketFormRequest.BACKOFF_MULT)); + request.setRetryPolicy(new DefaultRetryPolicy(TicketFormRequest.TIMEOUT_MS, TicketFormRequest.MAX_RETRIES, TicketFormRequest.BACKOFF_MULT)); + request.setTag(cancelTag); - request.setTag(cancelTag); queue.add(request); queue.start(); } @@ -152,10 +149,9 @@ public void onResponse(JSONObject sectionsArray) { }, errorListener); // to avoid server overload call - request.setRetryPolicy(new DefaultRetryPolicy(TicketFormRequest.TIMEOUT_MS, - TicketFormRequest.MAX_RETRIES, TicketFormRequest.BACKOFF_MULT)); + request.setRetryPolicy(new DefaultRetryPolicy(TicketFormRequest.TIMEOUT_MS, TicketFormRequest.MAX_RETRIES, TicketFormRequest.BACKOFF_MULT)); + request.setTag(cancelTag); - request.setTag(cancelTag); queue.add(request); queue.start(); } @@ -187,20 +183,16 @@ public void onResponse(JSONObject sectionsArray) { } @Override - public void registerNewUser(String cancelTag, String firstName, String lastname, - String emailAddress, RequestQueue queue,OnFetchedSuccessListener success, - ErrorListener error) { + public void registerNewUser(String cancelTag, String firstName, String lastname, String emailAddress, RequestQueue queue, + OnFetchedSuccessListener success, ErrorListener error) { HSUser user = HSUser.createNewUserWithDetails(firstName, lastname, emailAddress); success.onSuccess(user); - } @Override public void createNewTicket(String cancelTag, HSUser user, String message, String body, HSUploadAttachment[] attachments, RequestQueue queue, - OnNewTicketFetchedSuccessListener successListener, - ErrorListener errorListener) { - + OnNewTicketFetchedSuccessListener successListener, ErrorListener errorListener) { Properties prop = new Properties(); prop.put("name", user.getFullName()); @@ -210,8 +202,6 @@ public void createNewTicket(String cancelTag, HSUser user, String message, Strin prop.put("subject", message); prop.put("text", body); - - TicketFormRequest request = new TicketFormRequest(getApiUrl()+"new_ticket/", prop, attachments, new CreateNewTicketSuccessListener(user, successListener, errorListener) { @Override @@ -225,7 +215,6 @@ public void onResponse(JSONObject response) { e.printStackTrace(); this.errorListener.onErrorResponse(new VolleyError("Parsing failed when creating a ticket")); } - } }, errorListener); @@ -281,25 +270,20 @@ public void onResponse(JSONObject response) { } @Override - public void addReplyOnATicket(String cancelTag, String message, HSUploadAttachment[] attachments, HSTicket ticket, HSUser user, - RequestQueue queue, OnFetchedSuccessListener success, - ErrorListener errorListener) { + public void addReplyOnATicket(String cancelTag, String message, HSUploadAttachment[] attachments, HSTicket ticket, HSUser user, RequestQueue queue, + OnFetchedSuccessListener success, ErrorListener errorListener) { Properties prop = new Properties(); prop.put("user", user.getUserId()); prop.put("text", message); - TicketFormRequest request = new TicketFormRequest( - getApiUrl()+"ticket/" + ticket.getTicketId() + "/user_reply/", - prop, - attachments, + TicketFormRequest request = new TicketFormRequest(getApiUrl()+"ticket/" + ticket.getTicketId() + "/user_reply/", prop, attachments, new HappyfoxBaseListner(success, errorListener) { @Override public void onResponse(JSONObject response) { try { - HSTicketUpdate update = null; // fetch last message from user in update array. JSONArray updateArray = response.getJSONArray("updates"); @@ -330,8 +314,6 @@ public void onResponse(JSONObject response) { this.successCallback.onSuccess(update); } - - } catch (JSONException e) { e.printStackTrace(); this.errorListener.onErrorResponse(new VolleyError("Parsing failed when adding reply to a ticket")); @@ -345,7 +327,6 @@ public void onResponse(JSONObject response) { queue.add(request); queue.start(); - } public void setSectionId(String sectionId) { @@ -482,12 +463,10 @@ private abstract class HappyfoxArrayBaseListener implements Listener { protected OnFetchedArraySuccessListener successCallback; protected ErrorListener errorListener; - public HappyfoxArrayBaseListener(OnFetchedArraySuccessListener success, - ErrorListener errorListener) { + public HappyfoxArrayBaseListener(OnFetchedArraySuccessListener success, ErrorListener errorListener) { this.successCallback = success; this.errorListener = errorListener; } - } private abstract class HappyfoxBaseListner implements Listener { @@ -495,16 +474,13 @@ private abstract class HappyfoxBaseListner implements Listener { protected OnFetchedSuccessListener successCallback; protected ErrorListener errorListener; - public HappyfoxBaseListner(OnFetchedSuccessListener success, - ErrorListener errorListener) { + public HappyfoxBaseListner(OnFetchedSuccessListener success, ErrorListener errorListener) { this.successCallback = success; this.errorListener = errorListener; } - } - private abstract class CreateNewTicketSuccessListener implements Listener - { + private abstract class CreateNewTicketSuccessListener implements Listener { protected HSUser user; protected OnNewTicketFetchedSuccessListener successListener; @@ -518,15 +494,13 @@ public CreateNewTicketSuccessListener(HSUser user, OnNewTicketFetchedSuccessList } } - - private class TicketFormRequest extends Request { /** Socket timeout in milliseconds for image requests */ protected static final int TIMEOUT_MS = 10000; /** Default number of retries for image requests */ - protected static final int MAX_RETRIES = 0; + protected static final int MAX_RETRIES = 2; /** Default backoff multiplier for image requests */ protected static final float BACKOFF_MULT = 1f; @@ -537,8 +511,8 @@ private class TicketFormRequest extends Request { HashMap headers = new HashMap(); - public TicketFormRequest(String url, Properties requestProperties, HSUploadAttachment[] attachments_to_upload, Listener listener, - ErrorListener errorListener) { + public TicketFormRequest(String url, Properties requestProperties, HSUploadAttachment[] attachments_to_upload, + Listener listener, ErrorListener errorListener) { super(Method.POST, url, errorListener); mListener = listener; @@ -570,15 +544,12 @@ public TicketFormRequest(String url, Properties requestProperties, HSUploadAttac } } } - } - public TicketFormRequest(String url, Listener listener, - ErrorListener errorListener) { + public TicketFormRequest(String url, Listener listener, ErrorListener errorListener) { super(Method.GET, url, errorListener); mListener = listener; - setRetryPolicy( - new DefaultRetryPolicy(TIMEOUT_MS, MAX_RETRIES, BACKOFF_MULT)); + setRetryPolicy(new DefaultRetryPolicy(TIMEOUT_MS, MAX_RETRIES, BACKOFF_MULT)); } @Override @@ -597,12 +568,9 @@ public byte[] getBody() throws AuthFailureError return super.getBody(); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); - try - { + try { entity.writeTo(bos); - } - catch (IOException e) - { + } catch (IOException e) { VolleyLog.e("IOException writing to ByteArrayOutputStream"); } return bos.toByteArray(); diff --git a/helpstack/src/com/tenmiles/helpstack/gears/HSZendeskGear.java b/helpstack/src/com/tenmiles/helpstack/gears/HSZendeskGear.java index 949c9c6..bfd2987 100644 --- a/helpstack/src/com/tenmiles/helpstack/gears/HSZendeskGear.java +++ b/helpstack/src/com/tenmiles/helpstack/gears/HSZendeskGear.java @@ -113,8 +113,7 @@ public void onResponse(JSONObject sectionsArray) { }, errorListener); request.setTag(cancelTag); - request.setRetryPolicy(new DefaultRetryPolicy(ZendeskJsonObjectRequest.TIMEOUT_MS, - ZendeskJsonObjectRequest.MAX_RETRIES, ZendeskJsonObjectRequest.BACKOFF_MULT)); + request.setRetryPolicy(new DefaultRetryPolicy(ZendeskJsonObjectRequest.TIMEOUT_MS, ZendeskJsonObjectRequest.MAX_RETRIES, ZendeskJsonObjectRequest.BACKOFF_MULT)); queue.add(request); queue.start(); @@ -130,8 +129,7 @@ public void onResponse(JSONObject sectionsArray) { @Override public void createNewTicket(String cancelTag, HSUser user, String message, String body, HSUploadAttachment[] attachments, RequestQueue queue, - OnNewTicketFetchedSuccessListener successListener, - ErrorListener errorListener) { + OnNewTicketFetchedSuccessListener successListener, ErrorListener errorListener) { if (attachments != null && attachments.length > 0) { createNewTicketWithAttachment(cancelTag, user, message, body, attachments, queue, successListener, errorListener); @@ -197,8 +195,6 @@ public void addReplyOnATicket(final String cancelTag, final String message, fina } } - - public void setSectionId(String section_id) { this.section_id = section_id; } @@ -239,8 +235,7 @@ public void onResponse(JSONObject jsonObject) { attachmentRequest.addCredential(staff_email_address, api_token); attachmentRequest.setTag(cancelTag); - attachmentRequest.setRetryPolicy(new DefaultRetryPolicy(ZendeskJsonObjectRequest.TIMEOUT_MS, - ZendeskJsonObjectRequest.MAX_RETRIES, ZendeskJsonObjectRequest.BACKOFF_MULT)); + attachmentRequest.setRetryPolicy(new DefaultRetryPolicy(ZendeskJsonObjectRequest.TIMEOUT_MS, ZendeskJsonObjectRequest.MAX_RETRIES, ZendeskJsonObjectRequest.BACKOFF_MULT)); queue.add(attachmentRequest); queue.start(); @@ -303,7 +298,6 @@ public void onResponse(JSONObject jsonObject) { String[] attachmentTokenList = new String[1]; // It is been specified in constructor, so hard-coding the value. Can be changed later attachmentTokenList[0] = attachmentToken; - HSAttachment[] attachmentObjectList = new HSAttachment[1]; // It is been specified in constructor, so hard-coding the value. Can be changed later attachmentObjectList[0] = attachmentObject.getAttachment(); @@ -317,8 +311,7 @@ public void onResponse(JSONObject jsonObject) { attachmentRequest.addCredential(staff_email_address, api_token); attachmentRequest.setTag(cancelTag); - attachmentRequest.setRetryPolicy(new DefaultRetryPolicy(ZendeskJsonObjectRequest.TIMEOUT_MS, - ZendeskJsonObjectRequest.MAX_RETRIES, ZendeskJsonObjectRequest.BACKOFF_MULT)); + attachmentRequest.setRetryPolicy(new DefaultRetryPolicy(ZendeskJsonObjectRequest.TIMEOUT_MS, ZendeskJsonObjectRequest.MAX_RETRIES, ZendeskJsonObjectRequest.BACKOFF_MULT)); queue.add(attachmentRequest); queue.start(); @@ -339,8 +332,8 @@ private void addReplyToTicket(String cancelTag, HSTicket ticket, HSUser user, fi } ZendeskJsonObjectRequest request = new ZendeskJsonObjectRequest(cancelTag, user.getEmail(), Request.Method.PUT, - getApiUrl().concat("requests/").concat(ticket.getTicketId()).concat(".json"), - ticketJson, new ZendeskBaseListener(successListener, errorListener) { + getApiUrl().concat("requests/").concat(ticket.getTicketId()).concat(".json"), ticketJson, + new ZendeskBaseListener(successListener, errorListener) { @Override public void onResponse(JSONObject response) { @@ -432,7 +425,6 @@ private JSONObject retrieveRequestProperties(String body, String[] attachmentTok } requestProperties.put("comment", comment); - requestObject.put("request", requestProperties); return requestObject; @@ -490,8 +482,6 @@ private HSTicketUpdate retrieveTicketUpdate(JSONObject updateObject, JSONArray u isUpdateTypeUserReply = true; } } - - if (!updateObject.isNull("created_at")) { update_time = parseTime(updateObject.getString("created_at")); @@ -512,8 +502,7 @@ private HSTicketUpdate retrieveTicketUpdate(JSONObject updateObject, JSONArray u } attachments = attachmentArray.toArray(new HSAttachment[length]); } - - + break; } } @@ -654,7 +643,7 @@ private class ZendeskJsonObjectRequest extends JsonObjectRequest { protected static final int TIMEOUT_MS = 10000; /** Default number of retries for image requests */ - protected static final int MAX_RETRIES = 0; + protected static final int MAX_RETRIES = 2; /** Default backoff multiplier for image requests */ protected static final float BACKOFF_MULT = 1f; diff --git a/helpstack/src/com/tenmiles/helpstack/helper/HSBaseExpandableListAdapter.java b/helpstack/src/com/tenmiles/helpstack/helper/HSBaseExpandableListAdapter.java index f0810f7..35a8511 100644 --- a/helpstack/src/com/tenmiles/helpstack/helper/HSBaseExpandableListAdapter.java +++ b/helpstack/src/com/tenmiles/helpstack/helper/HSBaseExpandableListAdapter.java @@ -22,8 +22,6 @@ package com.tenmiles.helpstack.helper; -import java.util.ArrayList; - import android.content.Context; import android.util.SparseArray; import android.view.LayoutInflater; @@ -31,6 +29,8 @@ import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; +import java.util.ArrayList; + /** * * This is simple adapter that helps in storing Parent and Child value, @@ -43,7 +43,7 @@ */ public abstract class HSBaseExpandableListAdapter extends BaseExpandableListAdapter { - ArrayList childrens = new ArrayList(); + ArrayList children = new ArrayList(); SparseArray groups = new SparseArray(); protected final LayoutInflater mLayoutInflater; @@ -67,7 +67,7 @@ public void notifyDataSetChanged() { } public void clearAll() { - childrens.clear(); + children.clear(); groups.clear(); } @@ -80,15 +80,15 @@ public void clearParent(int parentId) { // Please note the value of the previous parent will be overridden public void addParent(int parentId, Object parent) { assert parent!=null; - Parent parentholder = new Parent(); - parentholder.id = parentId; - parentholder.parent = parent; - groups.put(parentId, parentholder); + Parent parentHolder = new Parent(); + parentHolder.id = parentId; + parentHolder.parent = parent; + groups.put(parentId, parentHolder); } public void addChild(int parentId, Object child) { - childrens.add(child); - int pos = childrens.indexOf(child); + children.add(child); + int pos = children.indexOf(child); groups.get(parentId).childs.add(pos); } @@ -101,7 +101,7 @@ public void addChildAll(int parentId, ArrayList child) { @Override public Object getChild(int groupPosition, int childPosition) { int childPos = groups.valueAt(groupPosition).childs.get(childPosition); - return childrens.get(childPos); + return children.get(childPos); } @Override @@ -156,51 +156,50 @@ public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } -//Listeners - - protected OnChildItemClickListener childlistener; - protected OnParentItemClickListener parentlistener; + //Listeners + protected OnChildItemClickListener childListener; + protected OnParentItemClickListener parentListener; protected void sendChildClickEvent(int groupPosition, int childPosition,String type, Object map) { - if(childlistener!=null) { - childlistener.onChildListItemClick(groupPosition,childPosition,type,map); + if(childListener!=null) { + childListener.onChildListItemClick(groupPosition, childPosition, type, map); } } protected void sendParentItemClickEvent(int groupPosition,String type, Object obj) { - if(parentlistener!=null) { - parentlistener.onParentItemClicked(groupPosition,type,obj); + if(parentListener!=null) { + parentListener.onParentItemClicked(groupPosition, type, obj); } } protected boolean sendChildLongClickEvent(int groupPosition, int childPosition,String type, Object map) { - if(childlistener!=null) { - return childlistener.onChildListItemLongClick(groupPosition,childPosition,type, map); + if(childListener!=null) { + return childListener.onChildListItemLongClick(groupPosition,childPosition,type, map); } return false; } protected void sendChildCheckedEvent(int groupPosition, int childPosition,String type,Object map,boolean checked) { - if(childlistener!=null) { - childlistener.onChildCheckedListner(groupPosition,childPosition,type, map,checked); + if(childListener!=null) { + childListener.onChildCheckedListener(groupPosition, childPosition, type, map, checked); } } public void setOnChildItemClickListener(OnChildItemClickListener listener) { - this.childlistener = listener; + this.childListener = listener; } public void setOnParentItemClickListener(OnParentItemClickListener listener) { - this.parentlistener = listener; + this.parentListener = listener; } public interface OnChildItemClickListener { void onChildListItemClick(int groupPosition, int childPosition,String type,Object map); - void onChildCheckedListner(int groupPosition, int childPosition,String type,Object map,boolean checked); - boolean onChildListItemLongClick(int groupPosition, int childPosition,String type,Object map); + void onChildCheckedListener(int groupPosition, int childPosition, String type, Object map, boolean checked); + boolean onChildListItemLongClick(int groupPosition, int childPosition, String type, Object map); } public interface OnParentItemClickListener { - void onParentItemClicked(int groupPosition,String type, Object obj); + void onParentItemClicked(int groupPosition, String type, Object obj); } } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/HSArticleReader.java b/helpstack/src/com/tenmiles/helpstack/logic/HSArticleReader.java index d42843f..ea3ede4 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/HSArticleReader.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/HSArticleReader.java @@ -46,41 +46,38 @@ public HSArticleReader(int articlesResourceId) { } public HSKBItem[] readArticlesFromResource(Context context) throws XmlPullParserException, IOException { - ArrayList articles = new ArrayList(); - XmlPullParser xpp = context.getResources().getXml(articleResourceId); + ArrayList articles = new ArrayList(); + XmlPullParser xpp = context.getResources().getXml(articleResourceId); - while (xpp.getEventType()!=XmlPullParser.END_DOCUMENT) { - if (xpp.getEventType()==XmlPullParser.START_TAG) { - - if (xpp.getName().equals("article")) { - - int attributeCount = xpp.getAttributeCount(); - String subject = null; - String text = null; - for (int i = 0; i < attributeCount; i++) { - String attrName = xpp.getAttributeName(i); - if (attrName.equals("subject")) { - subject = xpp.getAttributeValue(i); - } - if (attrName.equals("text")) { - text = xpp.getAttributeValue(i); - } - } - - assert subject != null : "Subject was not specified in xml for article @ index "+articles.size()+1; - assert text != null : "Text was not specified in xml for article @ index "+articles.size()+1; - articles.add(new HSKBItem(null, subject, text)); - - } - } + while (xpp.getEventType()!=XmlPullParser.END_DOCUMENT) { + if (xpp.getEventType()==XmlPullParser.START_TAG) { + if (xpp.getName().equals("article")) { + int attributeCount = xpp.getAttributeCount(); + String subject = null; + String text = null; - xpp.next(); - } - - HSKBItem[] articleArray = new HSKBItem[0]; - articleArray = articles.toArray(articleArray); - return articleArray; + for (int i = 0; i < attributeCount; i++) { + String attrName = xpp.getAttributeName(i); + if (attrName.equals("subject")) { + subject = xpp.getAttributeValue(i); + } + if (attrName.equals("text")) { + text = xpp.getAttributeValue(i); + } + } + + assert subject != null : "Subject was not specified in xml for article @ index "+articles.size()+1; + assert text != null : "Text was not specified in xml for article @ index "+articles.size()+1; + articles.add(new HSKBItem(null, subject, text)); + } + } + + xpp.next(); + } + + HSKBItem[] articleArray = new HSKBItem[0]; + articleArray = articles.toArray(articleArray); + return articleArray; } - } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/HSGear.java b/helpstack/src/com/tenmiles/helpstack/logic/HSGear.java index 028f63a..025949b 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/HSGear.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/HSGear.java @@ -48,8 +48,7 @@ public HSGear() { * @param success Success listener * @param errorListener Error listener */ - public void fetchKBArticle(String cancelTag, HSKBItem section, RequestQueue queue, OnFetchedArraySuccessListener success, ErrorListener errorListener ) - { + public void fetchKBArticle(String cancelTag, HSKBItem section, RequestQueue queue, OnFetchedArraySuccessListener success, ErrorListener errorListener ) { errorListener.onErrorResponse(new VolleyError("Not implemented method")); } @@ -63,8 +62,7 @@ public void fetchKBArticle(String cancelTag, HSKBItem section, RequestQueue queu * @param success Success Listener * @param errorListener Error Listener */ - public void registerNewUser(String cancelTag, String firstName, String lastname, String emailAddress, RequestQueue queue, OnFetchedSuccessListener success, ErrorListener errorListener) - { + public void registerNewUser(String cancelTag, String firstName, String lastname, String emailAddress, RequestQueue queue, OnFetchedSuccessListener success, ErrorListener errorListener) { success.onSuccess(HSUser.createNewUserWithDetails(firstName, lastname, emailAddress)); } @@ -78,7 +76,7 @@ public void registerNewUser(String cancelTag, String firstName, String lastname, * @param successListener Success Listener * @param errorListener Error Listener */ - public void createNewTicket(String cancelTag, HSUser user, String subject, String body, HSUploadAttachment[] attachments, RequestQueue queue, OnNewTicketFetchedSuccessListener successListener, ErrorListener errorListener ) { + public void createNewTicket(String cancelTag, HSUser user, String subject, String body, HSUploadAttachment[] attachments, RequestQueue queue, OnNewTicketFetchedSuccessListener successListener, ErrorListener errorListener) { errorListener.onErrorResponse(new VolleyError("Not implemented method")); } @@ -91,8 +89,7 @@ public void createNewTicket(String cancelTag, HSUser user, String subject, Strin * @param success Success Listener * @param errorListener Error Listener */ - public void fetchAllUpdateOnTicket(String cancelTag, HSTicket ticket, HSUser user, RequestQueue queue, OnFetchedArraySuccessListener success, ErrorListener errorListener) - { + public void fetchAllUpdateOnTicket(String cancelTag, HSTicket ticket, HSUser user, RequestQueue queue, OnFetchedArraySuccessListener success, ErrorListener errorListener) { errorListener.onErrorResponse(new VolleyError("Not implemented method")); } @@ -187,11 +184,10 @@ public void uploadMessageAsHtmlString(boolean htmlEnabled) { * Default: false * */ - public boolean canUplaodMessageAsHtmlString() { + public boolean canUploadMessageAsHtmlString() { return supportHtmlMessage; } - /** * * Sets maximum number of attachment gears can handle. @@ -254,5 +250,4 @@ public boolean canIgnoreTicketUpdateInformationAfterAddingReply() { private boolean ignoreTicketUpdateInformationAfterAddingReply = false; - } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/HSSource.java b/helpstack/src/com/tenmiles/helpstack/logic/HSSource.java index 0c4ac76..7f6b047 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/HSSource.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/HSSource.java @@ -39,9 +39,9 @@ import com.tenmiles.helpstack.activities.HSActivityManager; import com.tenmiles.helpstack.fragments.HSFragmentParent; import com.tenmiles.helpstack.model.HSAttachment; -import com.tenmiles.helpstack.model.HSDraft; import com.tenmiles.helpstack.model.HSCachedTicket; import com.tenmiles.helpstack.model.HSCachedUser; +import com.tenmiles.helpstack.model.HSDraft; import com.tenmiles.helpstack.model.HSKBItem; import com.tenmiles.helpstack.model.HSTicket; import com.tenmiles.helpstack.model.HSTicketUpdate; @@ -94,39 +94,32 @@ public static HSSource getInstance(Context context) { private HSGear gear; private Context mContext; private RequestQueue mRequestQueue; - private HSCachedTicket cachedTicket; private HSCachedUser cachedUser; - private HSDraft draftObject; private HSSource(Context context) { this.mContext = context; setGear(HSHelpStack.getInstance(context).getGear()); mRequestQueue = HSHelpStack.getInstance(context).getRequestQueue(); - refreshFieldsFromCache(); } - public void requestKBArticle(String cancelTag, HSKBItem section, OnFetchedArraySuccessListener success, ErrorListener errorListener ) { if (gear.haveImplementedKBFetching()) { - gear.fetchKBArticle(cancelTag, section,mRequestQueue, new SuccessWrapper(success) { - @Override + + @Override public void onSuccess(Object[] successObject) { - - assert successObject != null : "It seems requestKBArticle was not implemented in gear" ; + assert successObject != null : "It seems requestKBArticle was not implemented in gear" ; // Do your work here, may be caching, data validation etc. super.onSuccess(successObject); - } }, new ErrorWrapper("Fetching KB articles", errorListener)); } else { - try { HSArticleReader reader = new HSArticleReader(gear.getLocalArticleResourceId()); success.onSuccess(reader.readArticlesFromResource(mContext)); @@ -141,7 +134,6 @@ public void onSuccess(Object[] successObject) { } public void requestAllTickets(OnFetchedArraySuccessListener success, ErrorListener error ) { - if (cachedTicket == null) { success.onSuccess(new HSTicket[0]); } @@ -157,10 +149,9 @@ public void checkForUserDetailsValidity(String cancelTag, String firstName, Stri public void createNewTicket(String cancelTag, HSUser user, String subject, String message, HSAttachment[] attachment, OnNewTicketFetchedSuccessListener successListener, ErrorListener errorListener) { HSUploadAttachment[] upload_attachments = convertAttachmentArrayToUploadAttachment(attachment); - message = message + getDeviceInformation(mContext); - if (gear.canUplaodMessageAsHtmlString()) { + if (gear.canUploadMessageAsHtmlString()) { message = Html.toHtml(new SpannableString(message)); } @@ -185,7 +176,7 @@ public void requestAllUpdatesOnTicket(String cancelTag, HSTicket ticket, OnFetch public void addReplyOnATicket(String cancelTag, String message, HSAttachment[] attachments, HSTicket ticket, OnFetchedSuccessListener success, ErrorListener errorListener) { - if (gear.canUplaodMessageAsHtmlString()) { + if (gear.canUploadMessageAsHtmlString()) { message = Html.toHtml(new SpannableString(message)); } @@ -304,14 +295,14 @@ public void launchCreateNewTicketScreen(HSFragmentParent fragment, int requestCo if (haveImplementedTicketFetching()) { if(isNewUser()) { HSActivityManager.startNewIssueActivity(fragment, null, requestCode); - }else { + } + else { HSActivityManager.startNewIssueActivity(fragment, getUser(), requestCode); } } else { launchEmailAppWithEmailAddress(fragment.getActivity()); } - } public void launchEmailAppWithEmailAddress(Activity activity) { @@ -328,17 +319,17 @@ private static String getDeviceInformation(Context activity) { StringBuilder builder = new StringBuilder(); builder.append("\n\n\n"); builder.append("========"); - builder.append("\nDevice Android version : "); + builder.append("\nDevice brand: "); + builder.append(Build.MODEL); + builder.append("\nAndroid version: "); builder.append(Build.VERSION.SDK_INT); - builder.append("\nDevice brand : "); - builder.append(Build.MODEL); - builder.append("\nApplication package :"); + builder.append("\nApp package :"); try { builder.append(activity.getPackageManager().getPackageInfo(activity.getPackageName(),0).packageName); } catch (NameNotFoundException e) { builder.append("NA"); } - builder.append("\nApplication version :"); + builder.append("\nApp version :"); try { builder.append(activity.getPackageManager().getPackageInfo(activity.getPackageName(),0).versionCode); } catch (NameNotFoundException e) { @@ -352,7 +343,6 @@ public void cancelOperation(String cancelTag) { mRequestQueue.cancelAll(cancelTag); } - ///////////////////////////////////////////////// //////// Utility Functions ///////////////// ///////////////////////////////////////////////// @@ -381,16 +371,16 @@ private String readJsonFromFile(File file) { try { StringBuilder datax = new StringBuilder(); inputStream = new FileInputStream(file); - InputStreamReader isr = new InputStreamReader ( inputStream ) ; - BufferedReader buffreader = new BufferedReader ( isr ) ; + InputStreamReader isr = new InputStreamReader(inputStream); + BufferedReader bufferReader = new BufferedReader(isr); - String readString = buffreader.readLine ( ) ; - while ( readString != null ) { + String readString = bufferReader.readLine(); + while (readString != null) { datax.append(readString); - readString = buffreader.readLine ( ) ; + readString = bufferReader.readLine(); } - isr.close ( ) ; + isr.close(); json = datax.toString(); return json; @@ -416,37 +406,28 @@ private void writeJsonIntoFile (File file, String json) { } protected void doSaveNewTicketPropertiesForGearInCache(HSTicket ticket) { - - cachedTicket.addTicketAtStart(ticket); + cachedTicket.addTicketAtStart(ticket); Gson gson = new Gson(); String ticketsgson = gson.toJson(cachedTicket); - - - File ticketFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_FILE_NAME); + File ticketFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_FILE_NAME); writeJsonIntoFile(ticketFile, ticketsgson); - } protected void doSaveNewUserPropertiesForGearInCache(HSUser user) { - cachedUser.setUser(user); Gson gson = new Gson(); String userjson = gson.toJson(cachedUser); - - File userFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_USER_DATA); + File userFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_USER_DATA); writeJsonIntoFile(userFile, userjson); - } protected void doReadTicketsFromCache() { - File ticketFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_FILE_NAME); - - String json = readJsonFromFile(ticketFile); + String json = readJsonFromFile(ticketFile); if (json == null) { cachedTicket = new HSCachedTicket(); @@ -457,13 +438,9 @@ protected void doReadTicketsFromCache() { } } - - - protected void doReadUserFromCache() { - - File userFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_USER_DATA); - - String json = readJsonFromFile(userFile); + protected void doReadUserFromCache() { + File userFile = new File(getProjectDirectory(), HELPSTACK_TICKETS_USER_DATA); + String json = readJsonFromFile(userFile); if (json == null) { cachedUser = new HSCachedUser(); @@ -476,7 +453,6 @@ protected void doReadUserFromCache() { protected void doReadDraftFromCache() { File draftFile = new File(getProjectDirectory(), HELPSTACK_DRAFT); - String json = readJsonFromFile(draftFile); if (json == null) { @@ -497,7 +473,7 @@ protected void doSaveTicketDraftForGearInCache(String subject, String message, H } protected void doSaveUserDraftForGearInCache(HSUser user) { - draftObject.setDraftUSer(user); + draftObject.setDraftUser(user); writeDraftIntoFile(); } @@ -518,7 +494,6 @@ private void writeDraftIntoFile() { } protected File getProjectDirectory() { - File projDir = new File(mContext.getFilesDir(), HELPSTACK_DIRECTORY); if (!projDir.exists()) projDir.mkdirs(); @@ -534,21 +509,19 @@ public void clearReplyDraft() { saveReplyDetailsInDraft("", null); } - private class NewTicketSuccessWrapper implements OnNewTicketFetchedSuccessListener - { + private class NewTicketSuccessWrapper implements OnNewTicketFetchedSuccessListener { - private OnNewTicketFetchedSuccessListener lastListner; + private OnNewTicketFetchedSuccessListener lastListener; - public NewTicketSuccessWrapper(OnNewTicketFetchedSuccessListener lastListner) { - this.lastListner = lastListner; + public NewTicketSuccessWrapper(OnNewTicketFetchedSuccessListener lastListener) { + this.lastListener = lastListener; } @Override public void onSuccess(HSUser udpatedUserDetail, HSTicket ticket) { - if (lastListner != null) - lastListner.onSuccess(udpatedUserDetail, ticket); + if (lastListener != null) + lastListener.onSuccess(udpatedUserDetail, ticket); } - } protected HSUploadAttachment[] convertAttachmentArrayToUploadAttachment(HSAttachment[] attachment) { @@ -557,7 +530,7 @@ protected HSUploadAttachment[] convertAttachmentArrayToUploadAttachment(HSAttach if (attachment != null && attachment.length > 0) { int attachmentCount = gear.getNumberOfAttachmentGearCanHandle(); - assert attachmentCount >= attachment.length : "Gear cannot handle more than "+attachmentCount+" attachmnets"; + assert attachmentCount >= attachment.length : "Gear cannot handle more than "+attachmentCount+" attachments"; upload_attachments = new HSUploadAttachment[attachment.length]; for (int i = 0; i < upload_attachments.length; i++) { upload_attachments[i] = new HSUploadAttachment(mContext, attachment[i]); @@ -567,21 +540,19 @@ protected HSUploadAttachment[] convertAttachmentArrayToUploadAttachment(HSAttach return upload_attachments; } - private class SuccessWrapper implements OnFetchedArraySuccessListener - { + private class SuccessWrapper implements OnFetchedArraySuccessListener { - private OnFetchedArraySuccessListener lastListner; + private OnFetchedArraySuccessListener lastListener; - public SuccessWrapper(OnFetchedArraySuccessListener lastListner) { - this.lastListner = lastListner; + public SuccessWrapper(OnFetchedArraySuccessListener lastListener) { + this.lastListener = lastListener; } @Override public void onSuccess(Object[] successObject) { - if (lastListner != null) - lastListner.onSuccess(successObject); + if (lastListener != null) + lastListener.onSuccess(successObject); } - } private class OnFetchedSuccessListenerWrapper implements OnFetchedSuccessListener { @@ -596,7 +567,6 @@ private OnFetchedSuccessListenerWrapper(OnFetchedSuccessListener listener, Strin this.attachments = attachments; } - @Override public void onSuccess(Object successObject) { if (this.listener != null) { @@ -628,8 +598,7 @@ public static void throwError(ErrorListener errorListener, String error) { errorListener.onErrorResponse(volleyError); } - private static void printErrorDescription (String methodName, VolleyError error) - { + private static void printErrorDescription (String methodName, VolleyError error) { if (methodName == null) { Log.e(HSHelpStack.LOG_TAG, "Error occurred in HelpStack"); } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/HSTestDataGear.java b/helpstack/src/com/tenmiles/helpstack/logic/HSTestDataGear.java index 3ba9101..2c007ee 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/HSTestDataGear.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/HSTestDataGear.java @@ -22,8 +22,6 @@ package com.tenmiles.helpstack.logic; -import java.util.Calendar; - import com.android.volley.RequestQueue; import com.android.volley.Response.ErrorListener; import com.android.volley.VolleyError; @@ -33,8 +31,9 @@ import com.tenmiles.helpstack.model.HSUploadAttachment; import com.tenmiles.helpstack.model.HSUser; -public class HSTestDataGear extends HSGear -{ +import java.util.Calendar; + +public class HSTestDataGear extends HSGear { private String newTicketBody; private HSUploadAttachment[] newTicketattachment; @@ -44,18 +43,15 @@ public HSTestDataGear(int articleResId) { } @Override - public void registerNewUser(String cancelTag, String firstName, String lastname, - String emailAddress, RequestQueue queue, + public void registerNewUser(String cancelTag, String firstName, String lastName, String emailAddress, RequestQueue queue, OnFetchedSuccessListener success, ErrorListener errorListener) { - - success.onSuccess(HSUser.createNewUserWithDetails(firstName, lastname, emailAddress)); + + success.onSuccess(HSUser.createNewUserWithDetails(firstName, lastName, emailAddress)); } @Override - public void createNewTicket(String cancelTag, HSUser user, String message, String body, HSUploadAttachment[] attachment, - RequestQueue queue, - OnNewTicketFetchedSuccessListener successListener, - ErrorListener errorListener) { + public void createNewTicket(String cancelTag, HSUser user, String message, String body, HSUploadAttachment[] attachment, RequestQueue queue, + OnNewTicketFetchedSuccessListener successListener, ErrorListener errorListener) { this.newTicketBody = body; this.newTicketattachment = attachment; @@ -63,9 +59,9 @@ public void createNewTicket(String cancelTag, HSUser user, String message, Strin } @Override - public void addReplyOnATicket(String cancelTag, String message, HSUploadAttachment[] uploadattachments, HSTicket ticket, HSUser user, - RequestQueue queue, OnFetchedSuccessListener success, - ErrorListener errorListener) { + public void addReplyOnATicket(String cancelTag, String message, HSUploadAttachment[] uploadattachments, HSTicket ticket, HSUser user, RequestQueue queue, + OnFetchedSuccessListener success, ErrorListener errorListener) { + HSAttachment[] attachments = new HSAttachment[uploadattachments.length]; for (int i = 0; i < attachments.length; i++) { attachments[i] = uploadattachments[i].getAttachment(); @@ -82,13 +78,13 @@ public void fetchAllUpdateOnTicket(String cancelTag, HSTicket ticket,HSUser user HSTicketUpdate[] updateArray = new HSTicketUpdate[2]; Calendar delayTime = Calendar.getInstance(); delayTime.add(Calendar.MINUTE, -30); - updateArray[0] = HSTicketUpdate.createUpdateByUser("1","John", "I have not received my order yet. Order id is 23405", delayTime.getTime(), null); + updateArray[0] = HSTicketUpdate.createUpdateByUser("1", "John", "I have not received my order yet. Order id is 23405", delayTime.getTime(), null); updateArray[1] = HSTicketUpdate.createUpdateByStaff("2", "Staff", "We have confirmed, it is on the way and you will receive it in 2 days", Calendar.getInstance().getTime(), null); success.onSuccess(updateArray); } else if (ticket.getTicketId().equals("2")) { HSTicketUpdate[] updateArray = new HSTicketUpdate[1]; - updateArray[0] = HSTicketUpdate.createUpdateByUser("1","John", "Where are you located.", Calendar.getInstance().getTime(), null); + updateArray[0] = HSTicketUpdate.createUpdateByUser("1", "John", "Where are you located?", Calendar.getInstance().getTime(), null); success.onSuccess(updateArray); } else if (ticket.getTicketId().equals("4")) { @@ -101,8 +97,6 @@ else if (ticket.getTicketId().equals("4")) { else { errorListener.onErrorResponse(new VolleyError("Not Found")); } - - - } + } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/HSUtils.java b/helpstack/src/com/tenmiles/helpstack/logic/HSUtils.java index b6b4d3d..37a1d04 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/HSUtils.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/HSUtils.java @@ -34,41 +34,40 @@ public class HSUtils { private static final long TIME_MILLIS = 1000; - private static final long TIME_MINUTE = 60*TIME_MILLIS; - private static final long TIME_HOUR = 60*TIME_MINUTE; - private static final long TIME_DAY = 24*TIME_HOUR; + private static final long TIME_MINUTE = 60 * TIME_MILLIS; + private static final long TIME_HOUR = 60 * TIME_MINUTE; + private static final long TIME_DAY = 24 * TIME_HOUR; public static final String DATE_PATTERN_SHORT = "yyyy-MM-dd"; public static final String DATE_PATTERN_MEDIUM = "yyyy-MM-dd HH:mm:ss"; public static final String DATE_PATTERN_USER_DISPLAY_SHORT = "dd-MMM, yyyy"; public HSUtils() { - } - - + //TODO: optimize this function - public static String convertToHumanReadableTime(Date givenDate, long currentTimeLong) { - + public static String convertToHumanReadableTime(Date givenDate, long currentTimeLong) { + Calendar currentTime = Calendar.getInstance(); currentTime.setTimeZone(TimeZone.getTimeZone("UTC")); currentTime.setTimeInMillis(currentTimeLong); + Calendar givenTime = Calendar.getInstance(); givenTime.setTimeZone(TimeZone.getTimeZone("UTC")); givenTime.setTime(givenDate); + // Step 1: To see if time difference is less than 24 hours of not long timeDiff = currentTime.getTimeInMillis() - givenTime.getTimeInMillis(); if(timeDiff<=0) { - // I am not sure why can we here return "Now"; } String humanString = null; // Checking if timeDiff is less than 24 or not if((timeDiff/TIME_DAY)>=1) { - // day - int day = (int) (timeDiff/TIME_DAY); - humanString = String.format(Locale.getDefault(),"%dd", day); + // days + int days = (int) (timeDiff/TIME_DAY); + humanString = String.format(Locale.getDefault(), "%dd", days); } else { // checking if greater than hour @@ -82,8 +81,7 @@ else if((timeDiff/TIME_MINUTE)>=1){ humanString = String.format(Locale.getDefault(),"%ds", (timeDiff/TIME_MILLIS)); } } - - + return humanString; } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedArraySuccessListener.java b/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedArraySuccessListener.java index bbbbd08..697ba1d 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedArraySuccessListener.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedArraySuccessListener.java @@ -22,9 +22,6 @@ package com.tenmiles.helpstack.logic; -import java.util.ArrayList; - -public interface OnFetchedArraySuccessListener -{ +public interface OnFetchedArraySuccessListener { public void onSuccess(Object[] successObject); } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedSuccessListener.java b/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedSuccessListener.java index 9f4c2d2..7f8342d 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedSuccessListener.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/OnFetchedSuccessListener.java @@ -23,7 +23,6 @@ package com.tenmiles.helpstack.logic; -public interface OnFetchedSuccessListener -{ +public interface OnFetchedSuccessListener { public void onSuccess(Object successObject); } diff --git a/helpstack/src/com/tenmiles/helpstack/logic/OnNewTicketFetchedSuccessListener.java b/helpstack/src/com/tenmiles/helpstack/logic/OnNewTicketFetchedSuccessListener.java index e18cbef..26007c9 100644 --- a/helpstack/src/com/tenmiles/helpstack/logic/OnNewTicketFetchedSuccessListener.java +++ b/helpstack/src/com/tenmiles/helpstack/logic/OnNewTicketFetchedSuccessListener.java @@ -26,7 +26,6 @@ import com.tenmiles.helpstack.model.HSUser; -public interface OnNewTicketFetchedSuccessListener -{ +public interface OnNewTicketFetchedSuccessListener { public void onSuccess(HSUser udpatedUserDetail, HSTicket ticket); } diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSAttachment.java b/helpstack/src/com/tenmiles/helpstack/model/HSAttachment.java index 9a9f13f..29f671d 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSAttachment.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSAttachment.java @@ -23,10 +23,10 @@ package com.tenmiles.helpstack.model; -import java.io.Serializable; - import com.google.gson.annotations.SerializedName; +import java.io.Serializable; + public class HSAttachment implements Serializable{ private static final long serialVersionUID = 8417480406914032499L; @@ -35,7 +35,7 @@ public class HSAttachment implements Serializable{ private String fileName; @SerializedName("mime_type") - private String mime_type; + private String mimeType; @SerializedName("url") private String url; @@ -43,12 +43,11 @@ public class HSAttachment implements Serializable{ public HSAttachment() { } - public static HSAttachment createAttachment(String url, String fileName, String mime_type) - { + public static HSAttachment createAttachment(String url, String fileName, String mimeType) { HSAttachment attachment = new HSAttachment(); attachment.fileName = fileName; - attachment.mime_type = mime_type; + attachment.mimeType = mimeType; attachment.url = url; return attachment; @@ -62,8 +61,8 @@ public String getUrl() { return url; } - public String getMime_type() { - return mime_type; + public String getMimeType() { + return mimeType; } } diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSCachedTicket.java b/helpstack/src/com/tenmiles/helpstack/model/HSCachedTicket.java index 239f570..a8b01a2 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSCachedTicket.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSCachedTicket.java @@ -22,12 +22,12 @@ package com.tenmiles.helpstack.model; +import com.google.gson.annotations.SerializedName; + import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; -import com.google.gson.annotations.SerializedName; - public class HSCachedTicket implements Serializable { @SerializedName("data") @@ -46,7 +46,6 @@ public void setTickets(HSTicket[] tickets) { } public void addTicketAtStart(HSTicket ticket) { - // append the data . and save in cache ArrayList ticketsList = new ArrayList(); ticketsList.add(ticket); ticketsList.addAll(Arrays.asList(tickets)); diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSCachedUser.java b/helpstack/src/com/tenmiles/helpstack/model/HSCachedUser.java index 6320606..df96bc5 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSCachedUser.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSCachedUser.java @@ -22,10 +22,10 @@ package com.tenmiles.helpstack.model; -import java.io.Serializable; - import com.google.gson.annotations.SerializedName; +import java.io.Serializable; + public class HSCachedUser implements Serializable { @SerializedName ("data") diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSDraft.java b/helpstack/src/com/tenmiles/helpstack/model/HSDraft.java index 8044e05..ccadde4 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSDraft.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSDraft.java @@ -67,7 +67,7 @@ public void setDraftAttachments(HSAttachment[] attachmentsArray) { this.draftAttachments = attachmentsArray; } - public void setDraftUSer(HSUser user) { + public void setDraftUser(HSUser user) { this.draftUser = user; } diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSKBItem.java b/helpstack/src/com/tenmiles/helpstack/model/HSKBItem.java index 4442b21..1e2270c 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSKBItem.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSKBItem.java @@ -22,10 +22,10 @@ package com.tenmiles.helpstack.model; -import java.io.Serializable; - import com.google.gson.annotations.SerializedName; +import java.io.Serializable; + public class HSKBItem implements Serializable{ transient public static final int TYPE_ARTICLE = 0; diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSTicket.java b/helpstack/src/com/tenmiles/helpstack/model/HSTicket.java index 2f15d75..51a6ed6 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSTicket.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSTicket.java @@ -22,10 +22,10 @@ package com.tenmiles.helpstack.model; -import java.io.Serializable; - import com.google.gson.annotations.SerializedName; +import java.io.Serializable; + /** * * @author Nalin Chhajer diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSTicketUpdate.java b/helpstack/src/com/tenmiles/helpstack/model/HSTicketUpdate.java index 2bd8e4a..cdf8a79 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSTicketUpdate.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSTicketUpdate.java @@ -22,11 +22,11 @@ package com.tenmiles.helpstack.model; +import com.google.gson.annotations.SerializedName; + import java.io.Serializable; import java.util.Date; -import com.google.gson.annotations.SerializedName; - public class HSTicketUpdate implements Serializable { public static final int TYPE_STAFF = 0; @@ -52,24 +52,24 @@ public class HSTicketUpdate implements Serializable { // Date, Attachments etc will come here - public static HSTicketUpdate createUpdateByStaff(String updateId, String name, String text, Date update_time, HSAttachment[] attachments) { + public static HSTicketUpdate createUpdateByStaff(String updateId, String name, String text, Date updateTime, HSAttachment[] attachments) { HSTicketUpdate update = new HSTicketUpdate(); update.updateBy = TYPE_STAFF; update.text = text; update.updateId = updateId; update.name = name; - update.updateTime = update_time; + update.updateTime = updateTime; update.attachments = attachments; return update; } - public static HSTicketUpdate createUpdateByUser(String updateId, String name, String text, Date update_time, HSAttachment[] attachments) { + public static HSTicketUpdate createUpdateByUser(String updateId, String name, String text, Date updateTime, HSAttachment[] attachments) { HSTicketUpdate update = new HSTicketUpdate(); update.updateBy = TYPE_USER; update.text = text; update.updateId = updateId; update.name = name; - update.updateTime = update_time; + update.updateTime = updateTime; update.attachments = attachments; return update; } @@ -94,15 +94,11 @@ public HSAttachment[] getAttachments() { return attachments; } - public boolean isAttachmentEmtpy() { - if(attachments == null) { + public boolean isAttachmentEmpty() { + if(attachments == null || attachments.length == 0) { return true; - } else { - if(attachments.length == 0) { - return true; - } } - return false; + return false; } } diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSUploadAttachment.java b/helpstack/src/com/tenmiles/helpstack/model/HSUploadAttachment.java index d728e13..f5844c4 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSUploadAttachment.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSUploadAttachment.java @@ -22,13 +22,13 @@ package com.tenmiles.helpstack.model; -import java.io.FileNotFoundException; -import java.io.InputStream; +import android.content.Context; +import android.net.Uri; import org.apache.http.entity.mime.content.InputStreamBody; -import android.content.Context; -import android.net.Uri; +import java.io.FileNotFoundException; +import java.io.InputStream; public class HSUploadAttachment { @@ -42,10 +42,13 @@ public HSUploadAttachment(Context context, HSAttachment attachment) { public InputStreamBody generateStreamToUpload() throws FileNotFoundException { InputStream stream = generateInputStreamToUpload(); - - InputStreamBody body = new InputStreamBody(stream, attachment.getMime_type(), - attachment.getFileName() == null?"attachment":attachment.getFileName()); - + + String attachmentFileName = "attachment"; + if (attachment.getFileName()!=null) { + attachmentFileName = attachment.getFileName(); + } + + InputStreamBody body = new InputStreamBody(stream, attachment.getMimeType(), attachmentFileName); return body; } @@ -54,7 +57,6 @@ public InputStream generateInputStreamToUpload() throws FileNotFoundException { return stream; } - public HSAttachment getAttachment() { return attachment; } diff --git a/helpstack/src/com/tenmiles/helpstack/model/HSUser.java b/helpstack/src/com/tenmiles/helpstack/model/HSUser.java index 8c83da4..d48c9cd 100644 --- a/helpstack/src/com/tenmiles/helpstack/model/HSUser.java +++ b/helpstack/src/com/tenmiles/helpstack/model/HSUser.java @@ -34,10 +34,10 @@ public class HSUser implements Serializable { @SerializedName("first_name") - private String first_Name; + private String firstName; @SerializedName("last_name") - private String last_Name; + private String lastName; @SerializedName("email") private String emailAddress; @@ -54,30 +54,30 @@ public class HSUser implements Serializable { public HSUser() { } - public static HSUser createNewUserWithDetails(String first_name, String last_name, String email) { + public static HSUser createNewUserWithDetails(String firstName, String lastName, String email) { HSUser user = new HSUser(); - user.first_Name = first_name; - user.last_Name = last_name; + user.firstName = firstName; + user.lastName = lastName; user.emailAddress = email; return user; } - public static HSUser createNewUserWithDetails(String first_name, String last_name, String email, String userLink) { - HSUser user = createNewUserWithDetails(first_name, last_name, email); + public static HSUser createNewUserWithDetails(String firstName, String lastName, String email, String userLink) { + HSUser user = createNewUserWithDetails(firstName, lastName, email); user.userApiHref = userLink; return user; } public String getFirstName() { - return first_Name; + return firstName; } public String getLastName() { - return last_Name; + return lastName; } public String getFullName() { - return ""+first_Name+" "+last_Name; + return ""+ firstName +" "+ lastName; } public String getEmail() { diff --git a/helpstack/src/com/tenmiles/helpstack/service/AttachmentDownloadReceiver.java b/helpstack/src/com/tenmiles/helpstack/service/AttachmentDownloadReceiver.java index 58fde34..1877928 100644 --- a/helpstack/src/com/tenmiles/helpstack/service/AttachmentDownloadReceiver.java +++ b/helpstack/src/com/tenmiles/helpstack/service/AttachmentDownloadReceiver.java @@ -40,17 +40,18 @@ public class AttachmentDownloadReceiver extends BroadcastReceiver { private static final int NOTIFICATION_ID = 1008; private static final int PENDING_INTENT_REQUEST_CODE = 108; + @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - String package_name = intent.getPackage(); - String cpackage = context.getPackageName(); + String intendedPackage = intent.getPackage(); + String contextPackage = context.getPackageName(); - if (package_name.equals(cpackage) && DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { + if (intendedPackage.equals(contextPackage) && DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { downloadCompleted(context, intent); } - else if (package_name.equals(cpackage) && DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { - notificationClicked(context,intent); + else if (intendedPackage.equals(contextPackage) && DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { + notificationClicked(context, intent); } } @@ -61,14 +62,14 @@ private void notificationClicked(Context context, Intent intent) { } private void downloadCompleted(Context context, Intent intent) { - StringBuilder text = new StringBuilder(); //Files are ready String filename = context.getString(R.string.hs_attachment); String filepath = null; String mediaType = null; - DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); - long downloadId = intent.getLongExtra( - DownloadManager.EXTRA_DOWNLOAD_ID, 0); + DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); + long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0); + StringBuilder text = new StringBuilder(); + Query query = new Query(); query.setFilterById(downloadId); Cursor c = dm.query(query); @@ -79,26 +80,23 @@ private void downloadCompleted(Context context, Intent intent) { mediaType = c.getString(c.getColumnIndex(DownloadManager.COLUMN_MEDIA_TYPE)); if(status == DownloadManager.STATUS_SUCCESSFUL) { text.append(context.getString(R.string.hs_download_complete)); - } else { text.append(context.getString(R.string.hs_error_during_download)); } } - - NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - NotificationCompat.Builder notificationbuilder = new NotificationCompat.Builder(context); - notificationbuilder.setAutoCancel(true); - notificationbuilder.setContentText(text.toString()); - notificationbuilder.setContentTitle(filename); - notificationbuilder.setSmallIcon(R.drawable.hs_notification_download_light_img); - notificationbuilder.setDefaults(Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE); - notificationbuilder.setContentIntent(getPendingIntent(context)); + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context); + notificationBuilder.setAutoCancel(true); + notificationBuilder.setContentText(text.toString()); + notificationBuilder.setContentTitle(filename); + notificationBuilder.setSmallIcon(R.drawable.hs_download_light); + notificationBuilder.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE); + notificationBuilder.setContentIntent(getPendingIntent(context)); - notificationManager.notify(filename,NOTIFICATION_ID, notificationbuilder.build()); + notificationManager.notify(filename, NOTIFICATION_ID, notificationBuilder.build()); } public PendingIntent getPendingIntent(Context context, String filename, String mediatype) { diff --git a/helpstack/src/com/tenmiles/helpstack/service/DownloadAttachmentUtility.java b/helpstack/src/com/tenmiles/helpstack/service/DownloadAttachmentUtility.java index 132a9a0..1c6ab40 100644 --- a/helpstack/src/com/tenmiles/helpstack/service/DownloadAttachmentUtility.java +++ b/helpstack/src/com/tenmiles/helpstack/service/DownloadAttachmentUtility.java @@ -22,35 +22,32 @@ package com.tenmiles.helpstack.service; -import com.tenmiles.helpstack.R; - import android.app.DownloadManager; import android.content.Context; import android.net.Uri; import android.os.Build; import android.widget.Toast; +import com.tenmiles.helpstack.R; + public class DownloadAttachmentUtility { public static long downloadAttachment(Context ctx, String url, String title) { DownloadManager dm; - - dm = (DownloadManager) ctx.getSystemService(Context.DOWNLOAD_SERVICE); - - DownloadManager.Request request = new DownloadManager.Request( - Uri.parse(url)); - request.setTitle(title); - request.setDescription(ctx.getString(R.string.hs_attachments)); + dm = (DownloadManager) ctx.getSystemService(Context.DOWNLOAD_SERVICE); + + DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); + request.setTitle(title); + request.setDescription(ctx.getString(R.string.hs_attachments)); + if(Build.VERSION.SDK_INT >= 11) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE); request.allowScanningByMediaScanner(); } long enqueue = dm.enqueue(request); - Toast.makeText(ctx, - ctx.getString(R.string.hs_attachments) + " " + title + ". " + ctx.getString(R.string.hs_notify_download_complete), - Toast.LENGTH_LONG) - .show(); + final String toastText = ctx.getString(R.string.hs_attachments) + " " + title + ". " + ctx.getString(R.string.hs_notify_download_complete); + Toast.makeText(ctx, toastText, Toast.LENGTH_LONG).show(); return enqueue; } diff --git a/helpstack/src/com/tenmiles/helpstack/activities/DrawingView.java b/helpstack/src/com/tenmiles/helpstack/widget/DrawingView.java similarity index 98% rename from helpstack/src/com/tenmiles/helpstack/activities/DrawingView.java rename to helpstack/src/com/tenmiles/helpstack/widget/DrawingView.java index 6ea0dd6..92c39b2 100644 --- a/helpstack/src/com/tenmiles/helpstack/activities/DrawingView.java +++ b/helpstack/src/com/tenmiles/helpstack/widget/DrawingView.java @@ -1,4 +1,4 @@ -package com.tenmiles.helpstack.activities; +package com.tenmiles.helpstack.theme.widget; import android.content.Context; import android.graphics.Bitmap; @@ -10,10 +10,8 @@ import android.view.MotionEvent; import android.view.View; -import static java.lang.StrictMath.max; import static java.lang.StrictMath.min; - public class DrawingView extends View { private Path mPath; diff --git a/helpstack/src/com/tenmiles/helpstack/theme/widget/HSExpandableListView.java b/helpstack/src/com/tenmiles/helpstack/widget/HSExpandableListView.java similarity index 98% rename from helpstack/src/com/tenmiles/helpstack/theme/widget/HSExpandableListView.java rename to helpstack/src/com/tenmiles/helpstack/widget/HSExpandableListView.java index 3bdfeae..2483a12 100644 --- a/helpstack/src/com/tenmiles/helpstack/theme/widget/HSExpandableListView.java +++ b/helpstack/src/com/tenmiles/helpstack/widget/HSExpandableListView.java @@ -35,8 +35,7 @@ */ public class HSExpandableListView extends ExpandableListView { - public HSExpandableListView(Context context, AttributeSet attrs, - int defStyle) { + public HSExpandableListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initView(context); } @@ -52,8 +51,5 @@ public HSExpandableListView(Context context) { } public void initView(Context context) { - } - - }