This repository has been archived by the owner on May 18, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6b40fd
commit 5600223
Showing
64 changed files
with
1,444 additions
and
1,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<resources> | ||
<string name="local_user_id">1</string> | ||
<string name="greenhouse_provider_id">greenhouse</string> | ||
<string name="greenhouse_oauth_callback_url">x-com-springsource-greenhouse://oauth-response</string> | ||
<string name="greenhouse_base_url">http://10.0.2.2:8080/greenhouse</string> | ||
<string name="greenhouse_consumer_key">a08318eb478a1ee31f69a55276f3af64</string> | ||
<string name="greenhouse_consumer_key_secret">80e7f8f7ba724aae9103f297e5fb9bdf</string> | ||
</resources> |
76 changes: 76 additions & 0 deletions
76
src/com/springsource/greenhouse/activities/AbstractGreenhouseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.springsource.greenhouse.activities; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.client.HttpClientErrorException; | ||
import org.springframework.web.client.ResourceAccessException; | ||
|
||
import android.app.Activity; | ||
import android.app.ProgressDialog; | ||
import android.view.Gravity; | ||
import android.widget.Toast; | ||
|
||
public abstract class AbstractGreenhouseActivity extends Activity implements GreenhouseActivity | ||
{ | ||
protected static final String TAG = AbstractGreenhouseActivity.class.getSimpleName(); | ||
|
||
private ProgressDialog _progressDialog; | ||
|
||
|
||
//*************************************** | ||
// GreenhouseActivity methods | ||
//*************************************** | ||
public void showProgressDialog() | ||
{ | ||
showProgressDialog("Loading. Please wait..."); | ||
} | ||
|
||
public void showProgressDialog(String message) | ||
{ | ||
_progressDialog = ProgressDialog.show(this, "", message, true); | ||
} | ||
|
||
public void dismissProgressDialog() | ||
{ | ||
if (_progressDialog != null) | ||
{ | ||
_progressDialog.dismiss(); | ||
} | ||
} | ||
|
||
|
||
//*************************************** | ||
// Protected methods | ||
//*************************************** | ||
protected void processException(Exception e) | ||
{ | ||
if (e != null) | ||
{ | ||
if (e instanceof ResourceAccessException) | ||
{ | ||
displayNetworkError(); | ||
} | ||
else if (e instanceof HttpClientErrorException) | ||
{ | ||
HttpClientErrorException httpError = (HttpClientErrorException) e; | ||
if (httpError.getStatusCode() == HttpStatus.UNAUTHORIZED) | ||
{ | ||
displayAuthorizationError(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
protected void displayNetworkError() | ||
{ | ||
Toast toast = Toast.makeText(this, "A problem occurred with the network connection while attempting to communicate with Greenhouse.", Toast.LENGTH_LONG); | ||
toast.setGravity(Gravity.CENTER, 0, 0); | ||
toast.show(); | ||
} | ||
|
||
protected void displayAuthorizationError() | ||
{ | ||
Toast toast = Toast.makeText(this, "You are not authorized to connect to Greenhouse. Please sign out and reauthorize the app.", Toast.LENGTH_LONG); | ||
toast.setGravity(Gravity.CENTER, 0, 0); | ||
toast.show(); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/com/springsource/greenhouse/activities/AbstractGreenhouseListActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.springsource.greenhouse.activities; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.client.HttpClientErrorException; | ||
import org.springframework.web.client.ResourceAccessException; | ||
|
||
import android.app.ListActivity; | ||
import android.app.ProgressDialog; | ||
import android.view.Gravity; | ||
import android.widget.Toast; | ||
|
||
public abstract class AbstractGreenhouseListActivity extends ListActivity implements GreenhouseActivity | ||
{ | ||
protected static final String TAG = AbstractGreenhouseListActivity.class.getSimpleName(); | ||
|
||
private ProgressDialog _progressDialog; | ||
|
||
|
||
//*************************************** | ||
// GreenhouseActivity methods | ||
//*************************************** | ||
public void showProgressDialog() | ||
{ | ||
showProgressDialog("Loading. Please wait..."); | ||
} | ||
|
||
public void showProgressDialog(String message) | ||
{ | ||
_progressDialog = ProgressDialog.show(this, "", message, true); | ||
} | ||
|
||
public void dismissProgressDialog() | ||
{ | ||
if (_progressDialog != null) | ||
{ | ||
_progressDialog.dismiss(); | ||
} | ||
} | ||
|
||
|
||
//*************************************** | ||
// Protected methods | ||
//*************************************** | ||
protected void processException(Exception e) | ||
{ | ||
if (e != null) | ||
{ | ||
if (e instanceof ResourceAccessException) | ||
{ | ||
displayNetworkError(); | ||
} | ||
else if (e instanceof HttpClientErrorException) | ||
{ | ||
HttpClientErrorException httpError = (HttpClientErrorException) e; | ||
if (httpError.getStatusCode() == HttpStatus.UNAUTHORIZED) | ||
{ | ||
displayAuthorizationError(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
protected void displayNetworkError() | ||
{ | ||
Toast toast = Toast.makeText(this, "A problem occurred with the network connection while attempting to communicate with Greenhouse.", Toast.LENGTH_LONG); | ||
toast.setGravity(Gravity.CENTER, 0, 0); | ||
toast.show(); | ||
} | ||
|
||
protected void displayAuthorizationError() | ||
{ | ||
Toast toast = Toast.makeText(this, "You are not authorized to connect to Greenhouse. Please sign out and reauthorize the app.", Toast.LENGTH_LONG); | ||
toast.setGravity(Gravity.CENTER, 0, 0); | ||
toast.show(); | ||
} | ||
} |
82 changes: 0 additions & 82 deletions
82
src/com/springsource/greenhouse/activities/BaseActivity.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.