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

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhamTyagi committed Feb 7, 2019
1 parent ba5925b commit da33019
Show file tree
Hide file tree
Showing 87 changed files with 1,128 additions and 3,385 deletions.
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.idea
.DS_Store
/build
/captures
Expand All @@ -12,8 +9,10 @@
*.apk
*.ap_

*.properties
# Files for the ART/Dalvik VM
*.dex
keystore.properties

# Java class files
*.class
Expand All @@ -22,6 +21,8 @@
bin/
gen/
out/
app/betaVersion
app/release

# Gradle files
.gradle/
Expand Down Expand Up @@ -51,7 +52,6 @@ captures/
.idea/dictionaries
.idea/libraries
.idea/caches
.idea

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
Expand Down Expand Up @@ -83,6 +83,3 @@ fastlane/readme.md
/build
/captures
.externalNativeBuild
.gitlab-ci.yml
._config.yml

684 changes: 10 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# 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)

![Banner](/.github/assets/triviahack.png?raw=true "Banner")

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

* A free, 100 % open source, ads free trivia helper app that respect user sentiments.
* Previously Known as LoKo HacK
Expand Down Expand Up @@ -31,9 +35,8 @@
10. Swag IQ

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

## Screenshots
| HOME | PROFILE |
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

73 changes: 73 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,74 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
17 changes: 6 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

/*
def keystorePropertiesFile = rootProject.file("keystore.properties")
Expand All @@ -50,8 +50,8 @@ android {
applicationId "ai.loko.hk.ui"
minSdkVersion 19 //19
targetSdkVersion 28
versionCode 26
versionName '2.2.1'
versionCode 27
versionName '2.2.2'
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionNameSuffix '-capybara'
Expand Down Expand Up @@ -102,14 +102,9 @@ dependencies {
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

implementation 'com.google.android.gms:play-services-vision:17.0.2'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
transitive = true;
}

def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
Expand Down Expand Up @@ -137,4 +132,4 @@ dependencies {
gradle.taskGraph.whenReady {
setOutputName
}*/
apply plugin: 'com.google.gms.google-services'

16 changes: 1 addition & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<application
android:name="ai.loko.hk.ui.MyApplication"
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down Expand Up @@ -90,20 +90,6 @@
android:name="android.accessibilityservice"
android:resource="@xml/accessibilty"/>
</service>
<service android:name="ai.loko.hk.ui.notification.MyNotificationService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="ai.loko.hk.ui.notification.IDReceiver">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>

<meta-data
android:name="io.fabric.ApiKey"
android:value="87d0d959fa9b880a5f2cfed1a1707f4a6c41504e"/>

<activity
android:name="ai.loko.hk.ui.activities.SettingsActivity"
Expand Down
97 changes: 11 additions & 86 deletions app/src/main/java/ai/loko/hk/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
import android.widget.TextView;
import android.widget.Toast;

import com.crashlytics.android.Crashlytics;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
import com.nightonke.boommenu.BoomButtons.ButtonPlaceEnum;
import com.nightonke.boommenu.BoomButtons.HamButton;
import com.nightonke.boommenu.BoomButtons.OnBMClickListener;
Expand All @@ -70,36 +64,30 @@

import ai.loko.hk.ui.activities.ProfileActivity;
import ai.loko.hk.ui.activities.SettingsActivity;
import ai.loko.hk.ui.activities.TestActivity;
import ai.loko.hk.ui.constants.Constant;
import ai.loko.hk.ui.data.Data;
import ai.loko.hk.ui.services.Floating;
import ai.loko.hk.ui.services.OCRFloating;
import ai.loko.hk.ui.utils.Logger;
import cn.pedant.SweetAlert.SweetAlertDialog;
import io.fabric.sdk.android.Fabric;
import ui.BuildConfig;
import ui.R;


public class MainActivity extends AppCompatActivity {

private final Handler mHandler = new Handler();
SharedPreferences sharedPref;
private FirebaseAnalytics mFirebaseAnalytics;

private Intent mFloatingIntent;
private Button mOverlayPermmissionBtn, mAccessibilityPermissionBtn, startStopBtn, ocrBtn;
private FirebaseRemoteConfig mFirebaseRemoteConfig;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_launcher);
setupActionBar();

Fabric.with(this, new Crashlytics());
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

mFloatingIntent = new Intent(MainActivity.this, Floating.class);
takeStoragePermission();

Expand Down Expand Up @@ -130,7 +118,7 @@ public void onClick(View view) {
}

givePermission();
getUpdate();


}

Expand Down Expand Up @@ -214,91 +202,27 @@ private void setupActionBar() {
@Override
public void onBoomButtonClick(int index) {
startActivity(new Intent(MainActivity.this, SettingsActivity.class));

}
}));
rightBmb.addBuilder(new HamButton.Builder().normalImageRes(R.drawable.ic_directions_run_black_24dp).subNormalText("Here you can test your question").normalText("Test your app").listener(new OnBMClickListener() {
@Override
public void onBoomButtonClick(int index) {
startActivity(new Intent(MainActivity.this, TestActivity.class));
}
}));

rightBmb.addBuilder(new HamButton.Builder().normalImageRes(R.drawable.ic_apps_black_24dp).subNormalText("Supported App that are currently working").normalText("Supported Apps").listener(new OnBMClickListener() {
@Override
public void onBoomButtonClick(int index) {
supportedApps();
}
}));
rightBmb.addBuilder(new HamButton.Builder().normalImageRes(R.drawable.ic_info_white_24dp).normalText("About").listener(new OnBMClickListener() {
rightBmb.addBuilder(new HamButton.Builder().normalImageRes(R.drawable.ic_info_white_24dp).normalText("About").subNormalText("About me").listener(new OnBMClickListener() {
@Override
public void onBoomButtonClick(int index) {
about();
}
}));
}

private void getUpdate() {

mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings;
if (Constant.DEBUG) {
configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
} else {
configSettings = new FirebaseRemoteConfigSettings.Builder()
.build();
}
mFirebaseRemoteConfig.setConfigSettings(configSettings);
mFirebaseRemoteConfig.setDefaults(R.xml.updates);
long cacheExpiration = 6 * 60 * 60;
if (mFirebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
cacheExpiration = 0;
}
mFirebaseRemoteConfig.fetch(cacheExpiration).addOnCompleteListener(this, new OnCompleteListener<Void>() {
rightBmb.addBuilder(new HamButton.Builder().normalImageRes(R.drawable.ic_directions_run_black_24dp).subNormalText("Click here to go to github release page").normalText("Update.").listener(new OnBMClickListener() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
mFirebaseRemoteConfig.activateFetched();

public void onBoomButtonClick(int index) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/SubhamTyagi/loco-answers/releases/")));
}
});

int latest = Integer.valueOf(mFirebaseRemoteConfig.getString(Constant.LATEST));
if (latest - Constant.VERSION > 1) {

new SweetAlertDialog(this, SweetAlertDialog.NORMAL_TYPE)
.setTitleText("New update is available")
.setContentText("Kindly update the app, Some problems are fixed and accuracy is extremely improved and much more.. ")
.setConfirmText("Update now")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/SubhamTyagi/loco-answers/releases/")));
sweetAlertDialog.dismissWithAnimation();
}
}).show();
} else if (latest > Constant.VERSION) {
new SweetAlertDialog(this, SweetAlertDialog.NORMAL_TYPE)
.setTitleText("New update is available")
.setContentText("Kindly update the app, Some problems are fixed and accuracy is extremely improved and much more.. ")
.setConfirmText("Update now")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/SubhamTyagi/loco-answers/releases/")));

}
})
.setCancelText("Later")
.setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
sweetAlertDialog.dismissWithAnimation();
}
})
.show();
}
}));
}

private boolean isServiceRunning(Class<?> serviceClass) {
Expand Down Expand Up @@ -427,7 +351,7 @@ protected void onResume() {
private void about() {
new SweetAlertDialog(this, SweetAlertDialog.NORMAL_TYPE)
.setTitleText("Trivia Hack VERSION " + Constant.VERSION_NAME)
.setContentText("Trivia Hack " + Constant.VERSION_NAME)
.setContentText("This app is free and open source hosted on GitHub")
.setConfirmText("Ok")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
Expand All @@ -454,6 +378,7 @@ public void onClick(SweetAlertDialog sweetAlertDialog) {
}).show();
}


@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
//if ()
Expand Down
Loading

0 comments on commit da33019

Please sign in to comment.