Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions HelpStackExample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.helpstackexample"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:minSdkVersion="9"
android:targetSdkVersion="22" />

<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -22,7 +21,6 @@
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
3 changes: 1 addition & 2 deletions HelpStackExample/res/values-v14/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<!-- <item name="android:actionBarStyle">@style/MyActionBar</item> -->
</style>

<style name="MyActionBar"
parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">

</style>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@

import com.tenmiles.helpstack.HSHelpStack;
import com.tenmiles.helpstack.gears.HSEmailGear;
import com.tenmiles.helpstack.gears.HSZendeskGear;



public class HSApplication extends Application{
public class HSApplication extends Application {

HSHelpStack helpStack;

Expand All @@ -18,16 +15,16 @@ public void onCreate() {

helpStack = HSHelpStack.getInstance(this);

HSEmailGear emailGear = new HSEmailGear( "example@happyfox.com",R.xml.articles);
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",
// "<Your API Key>",
// "<Your Auth Code>",
// "<Category ID>", "<Priority ID>");
/* Uncomment the following to use the HappyFox gear with appropriate support email address */
// HSHappyfoxGear happyfoxGear = new HSHappyfoxGear(
// "https://example.happyfox.com",
// "<API Key>",
// "<Auth Code>",
// "<Category ID>",
// "<Priority ID>");
// helpStack.setGear(happyfoxGear);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion helpstack/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:minSdkVersion="9"
android:targetSdkVersion="22" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
2 changes: 1 addition & 1 deletion helpstack/res/layout/hs_activity_edit_attachment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:orientation="vertical"
tools:context=".MainActivity" >

<com.tenmiles.helpstack.activities.DrawingView
<com.tenmiles.helpstack.theme.widget.DrawingView
android:id="@+id/drawing"
android:layout_width="fill_parent"
android:layout_height="0dp"
Expand Down
9 changes: 6 additions & 3 deletions helpstack/res/values/hs_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<string name="hs_new_user_message">Please enter your contact details to reach you</string>

<!-- Strings used in new Issue screen -->
<string name="hs_issue_created_raised">Your issue has been created and raised.</string>
<string name="hs_issue_created_raised">Your issue has been created and raised</string>
<string name="hs_new_issue_title">Report Issue</string>
<string name="hs_subject_hint">Subject</string>
<string name="hs_message_hint">Message</string>
Expand Down Expand Up @@ -57,8 +57,8 @@
<string name="hs_download">Download</string>
<string name="hs_downloading_attachment">Downloading Attachment</string>
<string name="hs_download_complete">Download complete</string>
<string name="hs_loading">Loading...</string>
<string name="hs_notify_download_complete">You will be notified when the download finishes.</string>
<string name="hs_loading">Loading</string>
<string name="hs_notify_download_complete">You will be notified when the download finishes</string>
<string name="hs_open_with">Open with</string>

<!-- String used in error messages -->
Expand All @@ -76,4 +76,7 @@
<string name="hs_error_reporting_issue">Error in reporting issue</string>
<string name="hs_error_subject_message_empty">Subject and message cannot be empty</string>

<string name="drawing_saved">Drawing saved to Gallery</string>
<string name="image_not_saved">Image could not be saved</string>

</resources>
7 changes: 2 additions & 5 deletions helpstack/src/com/tenmiles/helpstack/HSHelpStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
}
}

Expand All @@ -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();
Expand All @@ -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();
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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();
}
}
Loading