Skip to content

Commit

Permalink
RED-149 #time 30m Remove the deprecated SendLoadingIntent annotation …
Browse files Browse the repository at this point in the history
…+ Remove the unused SendLogsTask class + Remove the sendRecipient getLogReportRecipient method from the SmartApplication class + Mark some classes (ForBusinessObject components) as deprecated + clean-up the code
  • Loading branch information
ludovicroland committed Oct 26, 2017
1 parent 8a11525 commit cb0c5ea
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,9 @@ void unregisterBroadcastListeners()
* Should be invoked during the {@link Droid4mizer#onBeforeRefreshBusinessObjectsAndDisplay()} method: is responsible for triggering a loading
* broadcast intent if required, in order to indicate that the activity is loading.
*/
@SuppressWarnings("deprecation")
void onStartLoading()
{
if (component.getClass().getAnnotation(AppPublics.SendLoadingIntentAnnotation.class) != null || component instanceof AppPublics.SendLoadingIntent)
if (component.getClass().getAnnotation(AppPublics.SendLoadingIntentAnnotation.class) != null)
{
// We indicate the activity which is loading, in order to filter the loading events
AppPublics.LoadingBroadcastListener.broadcastLoading(activity, System.identityHashCode(activity), System.identityHashCode(component), true);
Expand All @@ -515,10 +514,9 @@ void onStartLoading()
* Should be invoked just after the {@link SmartActivity#onSynchronizeDisplayObjects()} method: is responsible for triggering a loading broadcast
* intent if required, in order to indicate that the activity has stopped loading.
*/
@SuppressWarnings("deprecation")
void onStopLoading()
{
if (component.getClass().getAnnotation(AppPublics.SendLoadingIntentAnnotation.class) != null || component instanceof AppPublics.SendLoadingIntent)
if (component.getClass().getAnnotation(AppPublics.SendLoadingIntentAnnotation.class) != null)
{
// We indicate the activity which is loading, in order to filter the loading events
AppPublics.LoadingBroadcastListener.broadcastLoading(activity, System.identityHashCode(activity), System.identityHashCode(component), false);
Expand Down
13 changes: 0 additions & 13 deletions library/src/main/java/com/smartnsoft/droid4me/app/AppPublics.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,21 +266,8 @@ public interface BroadcastListenersProvider
/**
* When an {@link Activity} implements that interface, it will send broadcast intents while loading and once the loading is over.
*
* @see AppPublics.SendLoadingIntentAnnotation
* @see AppPublics.BroadcastListener
* @see AppPublics.BroadcastListenerProvider
* @since 2010.02.04
* @deprecated use {@link AppPublics.SendLoadingIntentAnnotation} instead
*/
public interface SendLoadingIntent
{

}

/**
* Same concept as {@link AppPublics.SendLoadingIntent}, but through an annotation.
*
* @see AppPublics.SendLoadingIntent
* @since 2013.04.12
*/
@Retention(RetentionPolicy.RUNTIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import com.smartnsoft.droid4me.app.SmartApplication.I18N;
import com.smartnsoft.droid4me.log.Logger;
import com.smartnsoft.droid4me.log.LoggerFactory;
import com.smartnsoft.droid4me.util.SendLogsTask;

/**
* A wrapper class which holds {@link ActivityController.ExceptionHandler} implementations.
Expand Down Expand Up @@ -534,66 +533,9 @@ public static class DefaultExceptionHandler
extends ExceptionHandlers.AbstractExceptionHandler
{

private final String logReportRecipients;

public DefaultExceptionHandler(I18N i18n, IssueAnalyzer issueAnalyzer, String logReportRecipients)
public DefaultExceptionHandler(I18N i18n, IssueAnalyzer issueAnalyzer)
{
super(i18n, issueAnalyzer);
this.logReportRecipients = logReportRecipients;
}

@Override
protected boolean onBusinessObjectAvailableExceptionFallback(Activity activity, Object component,
BusinessObjectUnavailableException exception)
{
if (logReportRecipients == null)
{
return super.onBusinessObjectAvailableExceptionFallback(activity, component, exception);
}
else
{
return sendLogs(activity);
}
}

@Override
protected boolean onActivityExceptionFallback(Activity activity, Object component, Throwable throwable)
{
if (logReportRecipients == null)
{
return super.onActivityExceptionFallback(activity, component, throwable);
}
else
{
return sendLogs(activity);
}
}

protected final boolean sendLogs(final Activity activity)
{
// If the logger recipient is not set, no e-mail submission is proposed
showDialog(activity, i18n.dialogBoxErrorTitle, i18n.otherProblemHint, i18n.reportButtonLabel, new OnClickListener()
{
public void onClick(DialogInterface dialogInterface, int which)
{
new SendLogsTask(activity, i18n.retrievingLogProgressMessage, "[" + i18n.applicationName + "] Error log - v%1s", logReportRecipients).execute(null, null);
}
}, activity.getString(android.R.string.cancel), new OnClickListener()
{
public void onClick(DialogInterface dialogInterface, int which)
{
// We leave the activity, because we cannot go any further
activity.finish();
}
}, new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
// We leave the activity, because we cannot go any further
activity.finish();
}
});
return true;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* @author Édouard Mercier
* @since 2008.04.13
*/
@Deprecated
public abstract class ForBusinessObjectActivity<AggregateClass, BusinessObjectClass>
extends SmartActivity<AggregateClass>
implements BusinessObjectLifeCycle<BusinessObjectClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import com.smartnsoft.droid4me.BuildConfig;
import com.smartnsoft.droid4me.app.ActivityController.ExceptionHandler;
import com.smartnsoft.droid4me.app.ExceptionHandlers.AbstractExceptionHandler;
import com.smartnsoft.droid4me.app.ExceptionHandlers.DefaultExceptionHandler;
import com.smartnsoft.droid4me.log.Logger;
import com.smartnsoft.droid4me.log.LoggerFactory;

Expand Down Expand Up @@ -311,17 +310,6 @@ public void onLowMemory()
}
}

/**
* If the application uses an {@link DefaultExceptionHandler} as an {@link ActivityController.ExceptionHandler}, when a managed
* exception is detected, and is not handled, a dialog box is submitted to the end-user, in order to propose to send the bug cause by inspecting the
* Android {@code logcat}. In that case, do not forget to declare the {@code android.permission.READ_LOGS} permission in the
* {@code AndroidManifest.xml}.
*
* @return the e-mail address that will be used when submitting an error log message ; if it returns {@code null}, the application will not propose
* to send the bug cause
*/
protected abstract String getLogReportRecipient();

/**
* <p>
* Caution: this method will return {@code null} as long as the parent {@link Application#onCreate()} has not been invoked.
Expand Down Expand Up @@ -423,7 +411,7 @@ protected ActivityController.Interceptor getInterceptor()
*/
protected ActivityController.ExceptionHandler getExceptionHandler()
{
return new ExceptionHandlers.DefaultExceptionHandler(getI18N(), null, getLogReportRecipient());
return new ExceptionHandlers.DefaultExceptionHandler(getI18N(), null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @author Édouard Mercier
* @since 2008.06.11
*/
@Deprecated
public interface BusinessObjectLifeCycle<BusinessObjectClass>
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @author Édouard Mercier
* @since 2008.08.11
*/
@Deprecated
public abstract class ForBusinessObjectImplementation<BusinessObjectClass>
implements BusinessObjectLifeCycle<BusinessObjectClass>
{
Expand Down
190 changes: 0 additions & 190 deletions library/src/main/java/com/smartnsoft/droid4me/util/SendLogsTask.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
final View child = getChildAt(index);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int measuredHeight = child.getMeasuredHeight();

final int measuredHeight = child.getMeasuredHeight();
if (measuredHeight > height)
{
height = measuredHeight;
Expand Down
Loading

0 comments on commit cb0c5ea

Please sign in to comment.