1
0
mirror of https://gitlab.com/openlp/android.git synced 2024-12-22 11:52:49 +00:00

Search works

This commit is contained in:
Tim Bentley 2016-01-09 11:10:39 +00:00
parent afd85a2ba8
commit 2cae45c903
6 changed files with 238 additions and 31 deletions

View File

@ -90,4 +90,209 @@
<orderEntry type="library" exported="" name="design-22.2.1" level="project" /> <orderEntry type="library" exported="" name="design-22.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
</component> </component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
<map>
<entry key="property.analysisEffortLevel" value="default" />
<entry key="property.analyzeAfterAutoMake" value="false" />
<entry key="property.analyzeAfterCompile" value="false" />
<entry key="property.annotationGutterIconEnabled" value="true" />
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
<entry key="property.exportAsHtml" value="true" />
<entry key="property.exportAsXml" value="true" />
<entry key="property.exportBaseDir" value="" />
<entry key="property.exportCreateArchiveDir" value="false" />
<entry key="property.exportOpenBrowser" value="true" />
<entry key="property.minPriorityToReport" value="Medium" />
<entry key="property.runAnalysisInBackground" value="false" />
<entry key="property.showHiddenDetectors" value="false" />
<entry key="property.toolWindowToFront" value="true" />
</map>
</option>
<option name="_detectors">
<map>
<entry key="AppendingToAnObjectOutputStream" value="true" />
<entry key="AtomicityProblem" value="true" />
<entry key="BadAppletConstructor" value="false" />
<entry key="BadResultSetAccess" value="true" />
<entry key="BadSyntaxForRegularExpression" value="true" />
<entry key="BadUseOfReturnValue" value="true" />
<entry key="BadlyOverriddenAdapter" value="true" />
<entry key="BooleanReturnNull" value="true" />
<entry key="BuildInterproceduralCallGraph" value="false" />
<entry key="BuildObligationPolicyDatabase" value="true" />
<entry key="BuildStringPassthruGraph" value="true" />
<entry key="CallToUnsupportedMethod" value="false" />
<entry key="CalledMethods" value="true" />
<entry key="CheckCalls" value="false" />
<entry key="CheckExpectedWarnings" value="false" />
<entry key="CheckImmutableAnnotation" value="true" />
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
<entry key="CheckTypeQualifiers" value="true" />
<entry key="CloneIdiom" value="true" />
<entry key="ComparatorIdiom" value="true" />
<entry key="ConfusedInheritance" value="true" />
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
<entry key="CovariantArrayAssignment" value="false" />
<entry key="CrossSiteScripting" value="true" />
<entry key="DefaultEncodingDetector" value="true" />
<entry key="DoInsideDoPrivileged" value="true" />
<entry key="DontCatchIllegalMonitorStateException" value="true" />
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
<entry key="DontUseEnum" value="true" />
<entry key="DroppedException" value="true" />
<entry key="DumbMethodInvocations" value="true" />
<entry key="DumbMethods" value="true" />
<entry key="DuplicateBranches" value="true" />
<entry key="EmptyZipFileEntry" value="false" />
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
<entry key="ExplicitSerialization" value="true" />
<entry key="FieldItemSummary" value="true" />
<entry key="FinalizerNullsFields" value="true" />
<entry key="FindBadCast2" value="true" />
<entry key="FindBadForLoop" value="true" />
<entry key="FindBugsSummaryStats" value="true" />
<entry key="FindCircularDependencies" value="false" />
<entry key="FindComparatorProblems" value="true" />
<entry key="FindDeadLocalStores" value="true" />
<entry key="FindDoubleCheck" value="true" />
<entry key="FindEmptySynchronizedBlock" value="true" />
<entry key="FindFieldSelfAssignment" value="true" />
<entry key="FindFinalizeInvocations" value="true" />
<entry key="FindFloatEquality" value="true" />
<entry key="FindFloatMath" value="false" />
<entry key="FindHEmismatch" value="true" />
<entry key="FindInconsistentSync2" value="true" />
<entry key="FindJSR166LockMonitorenter" value="true" />
<entry key="FindLocalSelfAssignment2" value="true" />
<entry key="FindMaskedFields" value="true" />
<entry key="FindMismatchedWaitOrNotify" value="true" />
<entry key="FindNakedNotify" value="true" />
<entry key="FindNoSideEffectMethods" value="true" />
<entry key="FindNonSerializableStoreIntoSession" value="false" />
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
<entry key="FindNonShortCircuit" value="true" />
<entry key="FindNullDeref" value="true" />
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
<entry key="FindOpenStream" value="true" />
<entry key="FindPuzzlers" value="true" />
<entry key="FindRefComparison" value="true" />
<entry key="FindReturnRef" value="true" />
<entry key="FindRoughConstants" value="true" />
<entry key="FindRunInvocations" value="true" />
<entry key="FindSelfComparison" value="true" />
<entry key="FindSelfComparison2" value="true" />
<entry key="FindSleepWithLockHeld" value="true" />
<entry key="FindSpinLoop" value="true" />
<entry key="FindSqlInjection" value="true" />
<entry key="FindTwoLockWait" value="true" />
<entry key="FindUncalledPrivateMethods" value="true" />
<entry key="FindUnconditionalWait" value="true" />
<entry key="FindUninitializedGet" value="true" />
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
<entry key="FindUnreleasedLock" value="true" />
<entry key="FindUnsatisfiedObligation" value="true" />
<entry key="FindUnsyncGet" value="true" />
<entry key="FindUseOfNonSerializableValue" value="true" />
<entry key="FindUselessControlFlow" value="true" />
<entry key="FindUselessObjects" value="true" />
<entry key="FormatStringChecker" value="true" />
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
<entry key="HugeSharedStringConstants" value="true" />
<entry key="IDivResultCastToDouble" value="true" />
<entry key="IncompatMask" value="true" />
<entry key="InconsistentAnnotations" value="true" />
<entry key="InefficientIndexOf" value="false" />
<entry key="InefficientInitializationInsideLoop" value="false" />
<entry key="InefficientMemberAccess" value="false" />
<entry key="InefficientToArray" value="false" />
<entry key="InfiniteLoop" value="true" />
<entry key="InfiniteRecursiveLoop" value="true" />
<entry key="InheritanceUnsafeGetResource" value="true" />
<entry key="InitializationChain" value="true" />
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
<entry key="InstantiateStaticClass" value="true" />
<entry key="IntCast2LongAsInstant" value="true" />
<entry key="InvalidJUnitTest" value="true" />
<entry key="IteratorIdioms" value="true" />
<entry key="LazyInit" value="true" />
<entry key="LoadOfKnownNullValue" value="true" />
<entry key="LostLoggerDueToWeakReference" value="true" />
<entry key="MethodReturnCheck" value="true" />
<entry key="Methods" value="true" />
<entry key="MultithreadedInstanceAccess" value="true" />
<entry key="MutableEnum" value="true" />
<entry key="MutableLock" value="true" />
<entry key="MutableStaticFields" value="true" />
<entry key="Naming" value="true" />
<entry key="Noise" value="false" />
<entry key="NoiseNullDeref" value="false" />
<entry key="NoteAnnotationRetention" value="true" />
<entry key="NoteCheckReturnValueAnnotations" value="true" />
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
<entry key="NoteJCIPAnnotation" value="true" />
<entry key="NoteNonNullAnnotations" value="false" />
<entry key="NoteNonnullReturnValues" value="false" />
<entry key="NoteSuppressedWarnings" value="true" />
<entry key="NoteUnconditionalParamDerefs" value="true" />
<entry key="NumberConstructor" value="true" />
<entry key="OptionalReturnNull" value="true" />
<entry key="OverridingEqualsNotSymmetrical" value="true" />
<entry key="PreferZeroLengthArrays" value="true" />
<entry key="PublicSemaphores" value="false" />
<entry key="QuestionableBooleanAssignment" value="true" />
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
<entry key="ReadReturnShouldBeChecked" value="true" />
<entry key="RedundantConditions" value="true" />
<entry key="RedundantInterfaces" value="true" />
<entry key="ReflectiveClasses" value="true" />
<entry key="RepeatedConditionals" value="true" />
<entry key="ResolveAllReferences" value="false" />
<entry key="RuntimeExceptionCapture" value="true" />
<entry key="SerializableIdiom" value="true" />
<entry key="StartInConstructor" value="true" />
<entry key="StaticCalendarDetector" value="true" />
<entry key="StringConcatenation" value="true" />
<entry key="SuperfluousInstanceOf" value="true" />
<entry key="SuspiciousThreadInterrupted" value="true" />
<entry key="SwitchFallthrough" value="true" />
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
<entry key="SynchronizeAndNullCheckField" value="true" />
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
<entry key="TestASM" value="false" />
<entry key="TestDataflowAnalysis" value="false" />
<entry key="TestingGround" value="false" />
<entry key="TestingGround2" value="false" />
<entry key="TrainFieldStoreTypes" value="true" />
<entry key="TrainLongInstantfParams" value="true" />
<entry key="TrainNonNullAnnotations" value="true" />
<entry key="TrainUnconditionalDerefParams" value="true" />
<entry key="URLProblems" value="true" />
<entry key="UncallableMethodOfAnonymousClass" value="true" />
<entry key="UnnecessaryMath" value="true" />
<entry key="UnreadFields" value="true" />
<entry key="UselessSubclassMethod" value="false" />
<entry key="VarArgsProblems" value="true" />
<entry key="VolatileUsage" value="true" />
<entry key="WaitInLoop" value="true" />
<entry key="WrongMapIterator" value="true" />
<entry key="XMLFactoryBypass" value="true" />
</map>
</option>
<option name="_reportCategories">
<map>
<entry key="BAD_PRACTICE" value="true" />
<entry key="CORRECTNESS" value="true" />
<entry key="EXPERIMENTAL" value="true" />
<entry key="I18N" value="true" />
<entry key="MALICIOUS_CODE" value="true" />
<entry key="MT_CORRECTNESS" value="true" />
<entry key="PERFORMANCE" value="true" />
<entry key="SECURITY" value="true" />
<entry key="STYLE" value="true" />
</map>
</option>
</component>
</module> </module>

View File

@ -173,6 +173,15 @@ public class OpenLP extends ActionBarActivity
toggerContainer(R.id.next_button, View.GONE); toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE); toggerContainer(R.id.prev_button, View.GONE);
break; break;
default:
singleTab();
fragmentManager.beginTransaction()
.replace(R.id.container, HomeFragment.newInstance())
.commit();
mTitle = getString(R.string.home);
toggerContainer(R.id.next_button, View.GONE);
toggerContainer(R.id.prev_button, View.GONE);
break;
} }
} }

View File

@ -46,25 +46,7 @@ abstract public class OpenLPDialog extends DialogFragment {
calledURL = url; calledURL = url;
Log.d(LOG_TAG, "Trigger Request for url " + url); Log.d(LOG_TAG, "Trigger Request for url " + url);
String callurl = String.format("%s%s", httpClient.getAbsoluteUrl(client), url); String callurl = String.format("%s%s", httpClient.getAbsoluteUrl(client), url);
processCall(callurl);
}
protected void triggerAction(String api, String plugin, String id ) {
String request = null;
try {
request = JsonHelpers.createRequestJSON("text", id);
} catch (JsonHelpers.JSONHandlerException e) {
e.printStackTrace();
}
String url = String.format(api, plugin.toLowerCase());
triggerTextRequest(String.format("%s%s", url, request));
calledURL = url;
Log.d(LOG_TAG, "Trigger action for url " + url);
String callurl = String.format("%s%s", httpClient.getAbsoluteUrl(client), url);
processCall(callurl);
}
private void processCall(String callurl){
client.get(callurl, null, new TextHttpResponseHandler() { client.get(callurl, null, new TextHttpResponseHandler() {
@Override @Override
public void onSuccess(int statusCode, Header[] headers, String responseString) { public void onSuccess(int statusCode, Header[] headers, String responseString) {

View File

@ -76,7 +76,7 @@ public class OpenLPHttpClient {
client.setSSLSocketFactory(sf); client.setSSLSocketFactory(sf);
} }
catch (Exception e){ catch (Exception e){
// Log.d(LOG_TAG, "Unable to support SSL");
} }
} }
return urlBase; return urlBase;

View File

@ -69,19 +69,21 @@ public class SearchSelectionDialog extends OpenLPDialog {
View view = inflater.inflate(R.layout.search_action_dialog, null); View view = inflater.inflate(R.layout.search_action_dialog, null);
builder.setView(view); builder.setView(view);
sendLive = (RadioButton) view.findViewById(R.id.buttonService); sendLive = (RadioButton) view.findViewById(R.id.buttonLive);
sendLive.setOnClickListener(new View.OnClickListener() { sendLive.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
triggerAction(Api.SEARCH_PLUGIN_LIVE, plugin, key); createLive();
SearchSelectionDialog.this.getDialog().cancel();
} }
}); });
addToService = (RadioButton) view.findViewById(R.id.buttonLive); addToService = (RadioButton) view.findViewById(R.id.buttonService);
addToService.setOnClickListener(new View.OnClickListener() { addToService.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
triggerAction(Api.SEARCH_PLUGIN_ADD, plugin, key); createService();
SearchSelectionDialog.this.getDialog().cancel();
} }
}); });
@ -107,15 +109,24 @@ public class SearchSelectionDialog extends OpenLPDialog {
Log.d(LOG_TAG, "Resuming..."); Log.d(LOG_TAG, "Resuming...");
} }
public void processUpdate(String response) { public void createLive() {
Toast.makeText(context, "Alert Requested", Toast.LENGTH_SHORT).show(); try {
String request = JsonHelpers.createRequestJSON("id", key);
String url = String.format(Api.SEARCH_PLUGIN_LIVE, plugin.toLowerCase());
triggerTextRequest(String.format("%s%s", url, request));
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)", Api.SEARCH_PLUGIN_LIVE, text));
} catch (JsonHelpers.JSONHandlerException e) {
e.printStackTrace();
Toast.makeText(context, "Request Failed", Toast.LENGTH_SHORT).show();
}
} }
public void requestAlert(String text) { public void createService() {
try { try {
String request = JsonHelpers.createRequestJSON("text", text); String request = JsonHelpers.createRequestJSON("id", key);
triggerTextRequest(String.format("%s%s", Api.ALERT, request)); String url = String.format(Api.SEARCH_PLUGIN_ADD, plugin.toLowerCase());
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)", Api.ALERT, text)); triggerTextRequest(String.format("%s%s", url, request));
Log.d(LOG_TAG, String.format("Setting list data. apiBase(%s), text(%s)", Api.SEARCH_PLUGIN_ADD, text));
} catch (JsonHelpers.JSONHandlerException e) { } catch (JsonHelpers.JSONHandlerException e) {
e.printStackTrace(); e.printStackTrace();
Toast.makeText(context, "Request Failed", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Request Failed", Toast.LENGTH_SHORT).show();

View File

@ -218,8 +218,8 @@ public class SearchFragment extends Fragment {
public void onItemClick(AdapterView<?> parent, final View view, public void onItemClick(AdapterView<?> parent, final View view,
int position, long id) { int position, long id) {
final JSONArray item = (JSONArray) parent.getItemAtPosition(position); final JSONArray item = (JSONArray) parent.getItemAtPosition(position);
Toast.makeText(context, "Item Pressed " + String.valueOf(position) + item, //Toast.makeText(context, "Item Pressed " + String.valueOf(position) + item,
Toast.LENGTH_SHORT).show(); // Toast.LENGTH_SHORT).show();
String it = ""; String it = "";
try { try {
it = (String)item.get(1); it = (String)item.get(1);