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

Commit

Permalink
fallback engine added
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhamTyagi committed Nov 2, 2018
1 parent 5258215 commit ee0ad96
Show file tree
Hide file tree
Showing 22 changed files with 109 additions and 198 deletions.
Binary file added .github/assets/triviahack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
![image](https://user-images.githubusercontent.com/40510200/47895774-2ebe6580-dea5-11e8-9db7-9693c1bd6403.png)
# 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)


[![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)


# 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>
![Banner](/.github/assets/triviahack.png?raw=true "Banner")

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

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

## Screenshots
Expand Down
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
*/
android {
signingConfigs {
/*signingConfigs {
debug {
keyAlias 'debug'
keyPassword '123456'
storeFile file('./../debug-key.jks')
storePassword '123456'
}
}
}*/
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "ai.loko.hk.ui"
minSdkVersion 19 //19
targetSdkVersion 28
versionCode 24
versionName '2.1.2'
versionCode 25
versionName '2.2'
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionNameSuffix '-capybara'
Expand Down Expand Up @@ -86,7 +86,7 @@ android {
renderscriptDebuggable true
minifyEnabled false
zipAlignEnabled false
signingConfig signingConfigs.debug
//signingConfig signingConfigs.debug
}
}

Expand Down
Binary file modified app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 12 additions & 13 deletions app/src/main/java/ai/loko/hk/ui/Accessibility.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void swagiq(AccessibilityNodeInfo source) {
} catch (Exception io) {
io.printStackTrace();
// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
showCustomAlert("Some error occured");
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");

}

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

}

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

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

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

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

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

Expand Down Expand Up @@ -331,9 +331,9 @@ private void qureka(AccessibilityNodeInfo source) {
option3ID.clear();
}
} catch (Exception io) {
io.printStackTrace();

// Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
showCustomAlert("Some error occured");
showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
}
}

Expand Down Expand Up @@ -361,9 +361,8 @@ private void brainbazzi(AccessibilityNodeInfo source) {
option3ID.clear();
}
} catch (Exception io) {
io.printStackTrace();
Toast.makeText(this, "Error:::" + io.getMessage(), Toast.LENGTH_SHORT).show();
showCustomAlert("Some error occured");

showCustomAlert("Error:Accessibility is either switch off or disabled on this screen ");
}

}
Expand Down Expand Up @@ -419,7 +418,7 @@ private class Update extends AsyncTask<String, Void, String> {
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Which.itIsGoogle = true;

Intent i = new Intent(getApplicationContext(), Floating.class);
/*i.putExtra("option1", obj.getAcount());
i.putExtra("option2", obj.getBcount());
Expand Down
49 changes: 3 additions & 46 deletions app/src/main/java/ai/loko/hk/ui/activities/TestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class TestActivity extends AppCompatActivity {
TextView a1, b2, c3;
EditText q, a, b, c;

ActionProcessButton wiki, google;
ActionProcessButton google;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -77,11 +77,9 @@ protected void onCreate(Bundle savedInstanceState) {
b2 = findViewById(R.id.optionBtest);
c3 = findViewById(R.id.optionCtest);

wiki = findViewById(R.id.wiki1);

google = findViewById(R.id.getanswer1);
google.setMode(ActionProcessButton.Mode.ENDLESS);
wiki.setMode(ActionProcessButton.Mode.ENDLESS);


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

wiki.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Which.itIsGoogle = false;
Which.isWikiDone = false;
wiki.setProgress(1);

a1.setText("");
b2.setText("");
c3.setText("");

Random random = new Random(System.currentTimeMillis());
int index = random.nextInt(5);
qu = quA[index];
o1 = o1A[index];
o2 = o2A[index];
o3 = o3A[index];

q.setText(qu);
a.setText(o1);
b.setText(o2);
c.setText(o3);

if (q.getText().toString().length() > 0) {
qu = q.getText().toString();
}
if (a.getText().toString().length() > 0) {
o1 = a.getText().toString();
}
if (b.getText().toString().length() > 0) {
o2 = b.getText().toString();
}
if (c.getText().toString().length() > 0) {
o3 = c.getText().toString();
}
new Update().execute("save this to AI database");
}
});

google.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Which.itIsGoogle = true;

google.setProgress(1);

a1.setText("");
Expand Down Expand Up @@ -191,7 +150,6 @@ protected void onPostExecute(String s) {
b2.setText(obj.getB2());
c3.setText(obj.getC3());

wiki.setProgress(0);
google.setProgress(0);
switch (s) {
case "a":
Expand Down Expand Up @@ -221,7 +179,6 @@ protected void onProgressUpdate(Void... values) {
protected String doInBackground(String... strings) {
obj = new Engine(new Question(qu, o1, o2, o3));
return obj.search();

// obj = new FindAnswers(qu, o1, o2, o3);
//obj.search();
//return obj.getOptionRed();
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/ai/loko/hk/ui/answers/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

package ai.loko.hk.ui.answers;

import ai.loko.hk.ui.data.Data;
import ai.loko.hk.ui.data.Which;
import ai.loko.hk.ui.model.Question;

Expand Down Expand Up @@ -88,6 +89,10 @@ abstract class Base extends Which {
*/
String optionRed;

protected static String BASE_URL;



/**
* Instantiates a new Base.
*
Expand All @@ -101,9 +106,10 @@ public Base(Question questionObj) {
optionC = questionObj.getOptionC();

reset();
BASE_URL=Data.BASE_SEARCH_URL;
error = false;
checkForNegative = true;
isWikiDone = false;
isFallbackDone = false;
}

/**
Expand Down
Loading

0 comments on commit ee0ad96

Please sign in to comment.