Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

Commit ee0ad96

Browse files
committed
fallback engine added
1 parent 5258215 commit ee0ad96

22 files changed

Lines changed: 109 additions & 198 deletions

File tree

.github/assets/triviahack.png

45.2 KB
Loading

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
![image](https://user-images.githubusercontent.com/40510200/47895774-2ebe6580-dea5-11e8-9db7-9693c1bd6403.png)
1+
# Trivia hack <a target="_blank" href="https://paypal.me/shubhamtyagi1" title="Donate using PayPal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" /></a>[![licence](https://img.shields.io/badge/Licence-GPLv3-red.svg)](https://github.com/SubhamTyagi/loco-answers/blob/master/LICENSE) ![version](https://img.shields.io/badge/Version-2.0-green.svg)
22

3-
4-
[![licence](https://img.shields.io/badge/Licence-GPLv3-red.svg)](https://github.com/SubhamTyagi/loco-answers/blob/master/LICENSE)
5-
![version](https://img.shields.io/badge/Version-2.0-green.svg)
6-
7-
8-
# Trivia hack <a target="_blank" href="https://paypal.me/shubhamtyagi1" title="Donate using PayPal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" /></a>
3+
![Banner](/.github/assets/triviahack.png?raw=true "Banner")
94

105
* A free, 100 % open source, ads free trivia helper app that respect user sentiments.
116
* Previously Known as LoKo HacK
@@ -37,6 +32,7 @@
3732

3833
## Contribution
3934
* [Shubham Tyagi](https://subhamtyagi.github.io/).
35+
* New icon is designed by [Deb Pedrano](https://github.com/debpedrano)
4036
* Valid Pull request always accepted.
4137

4238
## Screenshots

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
3636
3737
*/
3838
android {
39-
signingConfigs {
39+
/*signingConfigs {
4040
debug {
4141
keyAlias 'debug'
4242
keyPassword '123456'
4343
storeFile file('./../debug-key.jks')
4444
storePassword '123456'
4545
}
46-
}
46+
}*/
4747
compileSdkVersion 28
4848
buildToolsVersion "28.0.2"
4949
defaultConfig {
5050
applicationId "ai.loko.hk.ui"
5151
minSdkVersion 19 //19
5252
targetSdkVersion 28
53-
versionCode 24
54-
versionName '2.1.2'
53+
versionCode 25
54+
versionName '2.2'
5555
multiDexEnabled true
5656
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
5757
versionNameSuffix '-capybara'
@@ -86,7 +86,7 @@ android {
8686
renderscriptDebuggable true
8787
minifyEnabled false
8888
zipAlignEnabled false
89-
signingConfig signingConfigs.debug
89+
//signingConfig signingConfigs.debug
9090
}
9191
}
9292

app/src/main/ic_launcher-web.png

48 KB
Loading

app/src/main/java/ai/loko/hk/ui/Accessibility.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private void swagiq(AccessibilityNodeInfo source) {
119119
} catch (Exception io) {
120120
io.printStackTrace();
121121
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
122-
showCustomAlert("Some error occured");
122+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
123123

124124
}
125125

@@ -147,7 +147,7 @@ private void theQ(AccessibilityNodeInfo source) {
147147
} catch (Exception io) {
148148
io.printStackTrace();
149149
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
150-
showCustomAlert("Some error occured");
150+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
151151

152152
}
153153

@@ -175,7 +175,7 @@ private void swoo(AccessibilityNodeInfo source) {
175175
} catch (Exception io) {
176176
io.printStackTrace();
177177
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
178-
showCustomAlert("Some error occured");
178+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
179179
}
180180
}
181181

@@ -204,7 +204,7 @@ private void weshow(AccessibilityNodeInfo source) {
204204
} catch (Exception io) {
205205
io.printStackTrace();
206206
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
207-
showCustomAlert("Some error occured");
207+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
208208
}
209209

210210
}
@@ -237,7 +237,7 @@ private void justplay(AccessibilityNodeInfo source) {
237237
} catch (Exception io) {
238238
io.printStackTrace();
239239
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
240-
showCustomAlert("Some error occured");
240+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
241241
}
242242
}
243243

@@ -269,7 +269,7 @@ private void mobshow(AccessibilityNodeInfo source) {
269269
} catch (Exception io) {
270270
io.printStackTrace();
271271
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
272-
showCustomAlert("Some error occured");
272+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
273273
}
274274
}
275275

@@ -300,7 +300,7 @@ private void hq(AccessibilityNodeInfo source) {
300300
} catch (Exception io) {
301301
io.printStackTrace();
302302
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
303-
showCustomAlert("Some error occured");
303+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
304304
}
305305
}
306306

@@ -331,9 +331,9 @@ private void qureka(AccessibilityNodeInfo source) {
331331
option3ID.clear();
332332
}
333333
} catch (Exception io) {
334-
io.printStackTrace();
334+
335335
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
336-
showCustomAlert("Some error occured");
336+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
337337
}
338338
}
339339

@@ -361,9 +361,8 @@ private void brainbazzi(AccessibilityNodeInfo source) {
361361
option3ID.clear();
362362
}
363363
} catch (Exception io) {
364-
io.printStackTrace();
365-
Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
366-
showCustomAlert("Some error occured");
364+
365+
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
367366
}
368367

369368
}
@@ -419,7 +418,7 @@ private class Update extends AsyncTask<String, Void, String> {
419418
@Override
420419
protected void onPostExecute(String s) {
421420
super.onPostExecute(s);
422-
Which.itIsGoogle = true;
421+
423422
Intent i = new Intent(getApplicationContext(), Floating.class);
424423
/*i.putExtra("option1", obj.getAcount());
425424
i.putExtra("option2", obj.getBcount());

app/src/main/java/ai/loko/hk/ui/activities/TestActivity.java

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class TestActivity extends AppCompatActivity {
6565
TextView a1, b2, c3;
6666
EditText q, a, b, c;
6767

68-
ActionProcessButton wiki, google;
68+
ActionProcessButton google;
6969

7070
@Override
7171
protected void onCreate(Bundle savedInstanceState) {
@@ -77,11 +77,9 @@ protected void onCreate(Bundle savedInstanceState) {
7777
b2 = findViewById(R.id.optionBtest);
7878
c3 = findViewById(R.id.optionCtest);
7979

80-
wiki = findViewById(R.id.wiki1);
80+
8181
google = findViewById(R.id.getanswer1);
8282
google.setMode(ActionProcessButton.Mode.ENDLESS);
83-
wiki.setMode(ActionProcessButton.Mode.ENDLESS);
84-
8583

8684
new CustomToast(this, "In future this will be used for AI learning").setDuration(1).show();
8785
q = findViewById(R.id.q_test);
@@ -94,49 +92,10 @@ protected void onCreate(Bundle savedInstanceState) {
9492
b.setText(o2);
9593
c.setText(o3);
9694

97-
wiki.setOnClickListener(new View.OnClickListener() {
98-
@Override
99-
public void onClick(View v) {
100-
Which.itIsGoogle = false;
101-
Which.isWikiDone = false;
102-
wiki.setProgress(1);
103-
104-
a1.setText("");
105-
b2.setText("");
106-
c3.setText("");
107-
108-
Random random = new Random(System.currentTimeMillis());
109-
int index = random.nextInt(5);
110-
qu = quA[index];
111-
o1 = o1A[index];
112-
o2 = o2A[index];
113-
o3 = o3A[index];
114-
115-
q.setText(qu);
116-
a.setText(o1);
117-
b.setText(o2);
118-
c.setText(o3);
119-
120-
if (q.getText().toString().length() > 0) {
121-
qu = q.getText().toString();
122-
}
123-
if (a.getText().toString().length() > 0) {
124-
o1 = a.getText().toString();
125-
}
126-
if (b.getText().toString().length() > 0) {
127-
o2 = b.getText().toString();
128-
}
129-
if (c.getText().toString().length() > 0) {
130-
o3 = c.getText().toString();
131-
}
132-
new Update().execute("save this to AI database");
133-
}
134-
});
135-
13695
google.setOnClickListener(new View.OnClickListener() {
13796
@Override
13897
public void onClick(View v) {
139-
Which.itIsGoogle = true;
98+
14099
google.setProgress(1);
141100

142101
a1.setText("");
@@ -191,7 +150,6 @@ protected void onPostExecute(String s) {
191150
b2.setText(obj.getB2());
192151
c3.setText(obj.getC3());
193152

194-
wiki.setProgress(0);
195153
google.setProgress(0);
196154
switch (s) {
197155
case "a":
@@ -221,7 +179,6 @@ protected void onProgressUpdate(Void... values) {
221179
protected String doInBackground(String... strings) {
222180
obj = new Engine(new Question(qu, o1, o2, o3));
223181
return obj.search();
224-
225182
// obj = new FindAnswers(qu, o1, o2, o3);
226183
//obj.search();
227184
//return obj.getOptionRed();

app/src/main/java/ai/loko/hk/ui/answers/Base.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
package ai.loko.hk.ui.answers;
3030

31+
import ai.loko.hk.ui.data.Data;
3132
import ai.loko.hk.ui.data.Which;
3233
import ai.loko.hk.ui.model.Question;
3334

@@ -88,6 +89,10 @@ abstract class Base extends Which {
8889
*/
8990
String optionRed;
9091

92+
protected static String BASE_URL;
93+
94+
95+
9196
/**
9297
* Instantiates a new Base.
9398
*
@@ -101,9 +106,10 @@ public Base(Question questionObj) {
101106
optionC = questionObj.getOptionC();
102107

103108
reset();
109+
BASE_URL=Data.BASE_SEARCH_URL;
104110
error = false;
105111
checkForNegative = true;
106-
isWikiDone = false;
112+
isFallbackDone = false;
107113
}
108114

109115
/**

0 commit comments

Comments
 (0)