Rebranded the app
Modified the app packages, name and version and changed the compile SDK version to 29.
This commit is contained in:
parent
bf2ab65870
commit
3ce4cd4a6c
|
@ -1,2 +1,8 @@
|
|||
# Pluck
|
||||
|
||||
Pluck is a trivia game for Android. It is forked from [LibreTrivia](https://github.comhttps://github.com/tryton-vanmeer/LibreTrivia/).
|
||||
|
||||
## License
|
||||
|
||||
This game is licensed under the GNU General Public License version 3 or (at your option) any later version. Read [LICENSE](./LICENSE) for more details.
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion '28.0.3'
|
||||
compileSdkVersion 29
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.github.trytonvanmeer.libretrivia"
|
||||
applicationId "com.luca0n.joguitos.pluck"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 28
|
||||
versionCode 3
|
||||
versionName "0.3"
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -28,7 +27,7 @@ android {
|
|||
}
|
||||
|
||||
ext {
|
||||
butterknife = '9.0.0-rc2'
|
||||
butterknife = '10.2.3'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.github.trytonvanmeer.libretrivia">
|
||||
package="com.luca0n.joguitos.pluck">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name=".LibreTriviaApplication"
|
||||
android:name=".PluckApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
public class PluckApplication extends Application {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context context;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
PluckApplication.context = getApplicationContext();
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return PluckApplication.context;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.mikepenz.aboutlibraries.Libs;
|
||||
import com.mikepenz.aboutlibraries.LibsBuilder;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
import com.luca0n.joguitos.pluck.settings.SettingsActivity;
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.app_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.settings:
|
||||
onSettings();
|
||||
return true;
|
||||
case R.id.about:
|
||||
onAbout();
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void onSettings() {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void onAbout() {
|
||||
String appName = getResources().getString(R.string.app_name);
|
||||
String appDescription = getResources().getString(R.string.app_description);
|
||||
|
||||
new LibsBuilder()
|
||||
.withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
|
||||
.withAboutIconShown(true)
|
||||
.withAboutAppName(appName)
|
||||
.withAboutVersionShownName(true)
|
||||
.withAboutDescription(appDescription)
|
||||
.start(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaCategory;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaDifficulty;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuery;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.button_play)
|
||||
Button buttonPlay;
|
||||
@BindView(R.id.spinner_number)
|
||||
Spinner spinnerNumber;
|
||||
@BindView(R.id.spinner_category)
|
||||
Spinner spinnerCategory;
|
||||
@BindView(R.id.spinner_difficulty)
|
||||
Spinner spinnerDifficulty;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
buttonPlay.setOnClickListener(v -> {
|
||||
int amount = (int) spinnerNumber.getSelectedItem();
|
||||
TriviaCategory category = (TriviaCategory) spinnerCategory.getSelectedItem();
|
||||
TriviaDifficulty difficulty = (TriviaDifficulty) spinnerDifficulty.getSelectedItem();
|
||||
|
||||
TriviaQuery query = new TriviaQuery.Builder(amount)
|
||||
.category(category)
|
||||
.difficulty(difficulty)
|
||||
.build();
|
||||
|
||||
Intent intent = new Intent(getApplicationContext(), TriviaGameActivity.class);
|
||||
intent.putExtra(TriviaGameActivity.EXTRA_TRIVIA_QUERY, query);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
Integer[] numbers = new Integer[50];
|
||||
for (int i = 0; i < 50; ) {
|
||||
numbers[i] = ++i;
|
||||
}
|
||||
spinnerNumber.setAdapter(
|
||||
new ArrayAdapter<>(
|
||||
this, android.R.layout.simple_list_item_1, numbers)
|
||||
);
|
||||
spinnerNumber.setSelection(9);
|
||||
|
||||
spinnerCategory.setAdapter(
|
||||
new ArrayAdapter<>(
|
||||
this, android.R.layout.simple_list_item_1, TriviaCategory.values()));
|
||||
|
||||
spinnerDifficulty.setAdapter(
|
||||
new ArrayAdapter<>(
|
||||
this, android.R.layout.simple_list_item_1, TriviaDifficulty.values()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.activities;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
import com.luca0n.joguitos.pluck.exceptions.NoTriviaResultsException;
|
||||
import com.luca0n.joguitos.pluck.fragments.TriviaGameErrorFragment;
|
||||
import com.luca0n.joguitos.pluck.fragments.TriviaQuestionFragment;
|
||||
import com.luca0n.joguitos.pluck.interfaces.IDownloadTriviaQuestionReceiver;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaGame;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuery;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestion;
|
||||
import com.luca0n.joguitos.pluck.util.ApiUtil;
|
||||
import com.luca0n.joguitos.pluck.util.SoundUtil;
|
||||
|
||||
public class TriviaGameActivity extends BaseActivity
|
||||
implements IDownloadTriviaQuestionReceiver {
|
||||
static final String EXTRA_TRIVIA_QUERY = "extra_trivia_query";
|
||||
private final String STATE_TRIVIA_GAME = "state_trivia_game";
|
||||
|
||||
private TriviaGame game;
|
||||
|
||||
@BindView(R.id.progress_bar)
|
||||
ProgressBar progressBar;
|
||||
@BindView(R.id.trivia_status_bar)
|
||||
LinearLayout triviaStatusBar;
|
||||
@BindView(R.id.text_question_category)
|
||||
TextView textViewQuestionCategory;
|
||||
@BindView(R.id.text_question_difficulty)
|
||||
TextView textViewQuestionDifficulty;
|
||||
@BindView(R.id.text_question_progress)
|
||||
TextView textViewQuestionProgress;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_trivia_game);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
this.game = (TriviaGame) savedInstanceState.getSerializable(STATE_TRIVIA_GAME);
|
||||
} else {
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
assert bundle != null;
|
||||
TriviaQuery query = (TriviaQuery) bundle.get(EXTRA_TRIVIA_QUERY);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
DownloadTriviaQuestionsTask task = new DownloadTriviaQuestionsTask();
|
||||
task.setReceiver(this);
|
||||
task.execute(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putSerializable(STATE_TRIVIA_GAME, this.game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.frame_trivia_game);
|
||||
|
||||
if (fragment instanceof TriviaGameErrorFragment) {
|
||||
super.onBackPressed();
|
||||
} else {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.ui_quit_game)
|
||||
.setMessage(R.string.ui_quit_game_msg)
|
||||
.setPositiveButton(android.R.string.yes, (dialog, which) ->
|
||||
TriviaGameActivity.super.onBackPressed())
|
||||
.setNegativeButton(android.R.string.no, (dialog, which) -> {
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void onTriviaQuestionsDownloaded(String json) {
|
||||
if (json == null) {
|
||||
onNetworkError();
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
this.game = new TriviaGame(ApiUtil.jsonToQuestionArray(json));
|
||||
} catch (NoTriviaResultsException e) {
|
||||
onNoTriviaResults();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Setup game layout
|
||||
progressBar.setVisibility(View.GONE);
|
||||
triviaStatusBar.setVisibility(View.VISIBLE);
|
||||
updateStatusBar();
|
||||
updateTriviaQuestion();
|
||||
}
|
||||
|
||||
private void updateStatusBar() {
|
||||
String progress = getResources().getString(R.string.ui_question_progress,
|
||||
game.getQuestionProgress(), game.getQuestionsCount());
|
||||
|
||||
String category = (game.getCurrentQuestion().getCategory() != null)
|
||||
? game.getCurrentQuestion().getCategory().toString() : "";
|
||||
|
||||
String difficulty = game.getCurrentQuestion().getDifficulty().toString();
|
||||
|
||||
textViewQuestionProgress.setText(progress);
|
||||
textViewQuestionCategory.setText(category);
|
||||
textViewQuestionDifficulty.setText(difficulty);
|
||||
}
|
||||
|
||||
private void updateTriviaQuestion() {
|
||||
Fragment fragment = TriviaQuestionFragment.newInstance();
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.frame_trivia_game, fragment)
|
||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||
.commit();
|
||||
}
|
||||
|
||||
private void onNetworkError() {
|
||||
String msg = getResources().getString(R.string.error_network);
|
||||
Fragment errorFragment = TriviaGameErrorFragment.newInstance(msg);
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.frame_trivia_game, errorFragment);
|
||||
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
private void onNoTriviaResults() {
|
||||
String msg = getResources().getString(R.string.error_no_trivia_results);
|
||||
Fragment errorFragment = TriviaGameErrorFragment.newInstance(msg);
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.frame_trivia_game, errorFragment);
|
||||
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
public TriviaQuestion getCurrentQuestion() {
|
||||
return this.game.getCurrentQuestion();
|
||||
}
|
||||
|
||||
public void onAnswerClick(Button answer, Button correctAnswer) {
|
||||
boolean guess = game.nextQuestion(answer.getText().toString());
|
||||
|
||||
final int green = getResources().getColor(R.color.colorAccentGreen);
|
||||
int color = guess ? green
|
||||
: getResources().getColor(R.color.colorAccentRed);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
ColorStateList stateList = ColorStateList.valueOf(color);
|
||||
answer.setBackgroundTintList(stateList);
|
||||
|
||||
if (!guess) {
|
||||
final ColorStateList greenStateList = ColorStateList.valueOf(green);
|
||||
correctAnswer.setBackgroundTintList(greenStateList);
|
||||
}
|
||||
} else {
|
||||
answer.getBackground().getCurrent().setColorFilter(
|
||||
new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
|
||||
|
||||
if (!guess)
|
||||
correctAnswer.getBackground().getCurrent().setColorFilter(
|
||||
new PorterDuffColorFilter(green, PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
|
||||
SoundUtil.playSound(this, guess ?
|
||||
SoundUtil.SOUND_ANSWER_CORRECT : SoundUtil.SOUND_ANSWER_WRONG);
|
||||
|
||||
new Handler().postDelayed(() -> {
|
||||
if (game.isDone()) {
|
||||
Intent intent = new Intent(getApplicationContext(), TriviaGameResultsActivity.class);
|
||||
intent.putExtra(TriviaGameResultsActivity.EXTRA_TRIVIA_GAME, game);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
updateStatusBar();
|
||||
updateTriviaQuestion();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
private static class DownloadTriviaQuestionsTask extends AsyncTask<TriviaQuery, Integer, String> {
|
||||
private IDownloadTriviaQuestionReceiver receiver;
|
||||
|
||||
@Override
|
||||
protected String doInBackground(TriviaQuery... query) {
|
||||
String json;
|
||||
try {
|
||||
json = ApiUtil.GET(query[0]);
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String json) {
|
||||
receiver.onTriviaQuestionsDownloaded(json);
|
||||
}
|
||||
|
||||
private void setReceiver(IDownloadTriviaQuestionReceiver receiver) {
|
||||
this.receiver = receiver;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaGame;
|
||||
|
||||
public class TriviaGameResultsActivity extends BaseActivity {
|
||||
static final String EXTRA_TRIVIA_GAME = "extra_trivia_game";
|
||||
|
||||
@BindView(R.id.text_results_correct)
|
||||
TextView textResultsCorrect;
|
||||
@BindView(R.id.text_results_wrong)
|
||||
TextView textResultsWrong;
|
||||
@BindView(R.id.text_results_total)
|
||||
TextView textResultsTotal;
|
||||
@BindView(R.id.button_return_to_menu)
|
||||
Button buttonReturnToMenu;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_trivia_game_results);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
TriviaGame game = (TriviaGame) bundle.get(EXTRA_TRIVIA_GAME);
|
||||
|
||||
int correctTotal = 0;
|
||||
|
||||
for (boolean result : game.getResults()) {
|
||||
if (result) {
|
||||
correctTotal++;
|
||||
}
|
||||
}
|
||||
|
||||
textResultsCorrect.setText(String.valueOf(correctTotal));
|
||||
textResultsWrong.setText(String.valueOf(game.getQuestionsCount() - correctTotal));
|
||||
textResultsTotal.setText(String.valueOf(game.getQuestionsCount()));
|
||||
|
||||
buttonReturnToMenu.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.exceptions;
|
||||
|
||||
public class NoTriviaResultsException extends Exception {
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
|
||||
public class TriviaGameErrorFragment extends Fragment {
|
||||
private final static String ARG_ERROR_MSG = "arg_error_msg";
|
||||
|
||||
@BindView(R.id.text_error_msg)
|
||||
TextView textView;
|
||||
|
||||
public TriviaGameErrorFragment() {
|
||||
}
|
||||
|
||||
public static TriviaGameErrorFragment newInstance(String msg) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_ERROR_MSG, msg);
|
||||
|
||||
TriviaGameErrorFragment fragment = new TriviaGameErrorFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_trivia_game_error, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
Bundle args;
|
||||
if ((args = getArguments()) != null) {
|
||||
textView.setText(args.getString(ARG_ERROR_MSG));
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import butterknife.BindViews;
|
||||
import butterknife.ButterKnife;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
import com.luca0n.joguitos.pluck.activities.TriviaGameActivity;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestion;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionMultiple;
|
||||
|
||||
|
||||
public class TriviaQuestionFragment extends Fragment {
|
||||
|
||||
private static final int buttonAnswerOneID = R.id.button_answer_one;
|
||||
private static final int buttonAnswerTwoID = R.id.button_answer_two;
|
||||
private static final int buttonAnswerThreeID = R.id.button_answer_three;
|
||||
private static final int buttonAnswerFourID = R.id.button_answer_four;
|
||||
|
||||
@BindViews({
|
||||
buttonAnswerOneID,
|
||||
buttonAnswerTwoID,
|
||||
buttonAnswerThreeID,
|
||||
buttonAnswerFourID
|
||||
})
|
||||
Button[] buttonAnswers;
|
||||
|
||||
Button buttonAnswerCorrect;
|
||||
|
||||
Button buttonAnswerTrue;
|
||||
Button buttonAnswerFalse;
|
||||
|
||||
public TriviaQuestionFragment() {
|
||||
}
|
||||
|
||||
public static TriviaQuestionFragment newInstance() {
|
||||
return new TriviaQuestionFragment();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
TriviaQuestion question = ((TriviaGameActivity) getActivity()).getCurrentQuestion();
|
||||
View view;
|
||||
|
||||
if (question instanceof TriviaQuestionMultiple) {
|
||||
view = inflater.inflate(R.layout.fragment_trivia_question_multiple, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.fragment_trivia_question_boolean, container, false);
|
||||
this.buttonAnswerTrue = view.findViewById(R.id.button_answer_true);
|
||||
this.buttonAnswerFalse = view.findViewById(R.id.button_answer_false);
|
||||
}
|
||||
|
||||
TextView textViewQuestion = view.findViewById(R.id.text_trivia_question);
|
||||
textViewQuestion.setText(question.getQuestion());
|
||||
setupButtons();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void setupButtons() {
|
||||
AnswerButtonListener listener = new AnswerButtonListener();
|
||||
TriviaQuestion question = ((TriviaGameActivity) getActivity()).getCurrentQuestion();
|
||||
|
||||
if (question instanceof TriviaQuestionMultiple) {
|
||||
List<String> answers = Arrays.asList((
|
||||
(TriviaQuestionMultiple) question).getAnswerList());
|
||||
Collections.shuffle(answers);
|
||||
|
||||
for (int i = 0; i < buttonAnswers.length; i++) {
|
||||
buttonAnswers[i].setText(answers.get(i));
|
||||
buttonAnswers[i].setOnClickListener(listener);
|
||||
if (question.checkAnswer(answers.get(i))) {
|
||||
buttonAnswerCorrect = buttonAnswers[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buttonAnswerTrue.setOnClickListener(listener);
|
||||
buttonAnswerFalse.setOnClickListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
private void disableButtons() {
|
||||
TriviaQuestion question = ((TriviaGameActivity) getActivity()).getCurrentQuestion();
|
||||
if (question instanceof TriviaQuestionMultiple) {
|
||||
buttonAnswers[0].setEnabled(false);
|
||||
buttonAnswers[1].setEnabled(false);
|
||||
buttonAnswers[2].setEnabled(false);
|
||||
buttonAnswers[3].setEnabled(false);
|
||||
} else {
|
||||
buttonAnswerTrue.setEnabled(false);
|
||||
buttonAnswerFalse.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private class AnswerButtonListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
disableButtons();
|
||||
((TriviaGameActivity) getActivity()).onAnswerClick((Button) v, buttonAnswerCorrect);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.interfaces;
|
||||
|
||||
public interface IDownloadTriviaQuestionReceiver {
|
||||
void onTriviaQuestionsDownloaded(String json);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setTitle(null);
|
||||
}
|
||||
|
||||
getFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(android.R.id.content, new SettingsFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
|
||||
public class SettingsFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.luca0n.joguitos.pluck.PluckApplication;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
|
||||
/*
|
||||
Categories that a Trivia Question can fall into
|
||||
*/
|
||||
public enum TriviaCategory {
|
||||
ANY(-1, "Any", R.string.ui_any),
|
||||
|
||||
GENERAL_KNOWLEDGE(9, "General Knowledge",
|
||||
R.string.category_general_knowledge),
|
||||
ENTERTAINMENT_BOOKS(10, "Entertainment: Books",
|
||||
R.string.category_entertainment_books),
|
||||
ENTERTAINMENT_FILM(11, "Entertainment: Film",
|
||||
R.string.category_entertainment_film),
|
||||
ENTERTAINMENT_MUSIC(12, "Entertainment: Music",
|
||||
R.string.category_entertainment_music),
|
||||
ENTERTAINMENT_MUSICALS_THEATRES(13, "Entertainment: Musicals & Theatres",
|
||||
R.string.category_entertainment_musicals_theatres),
|
||||
ENTERTAINMENT_TELEVISION(14, "Entertainment: Television",
|
||||
R.string.category_entertainment_television),
|
||||
ENTERTAINMENT_VIDEO_GAMES(15, "Entertainment: Video Games",
|
||||
R.string.category_entertainment_video_games),
|
||||
ENTERTAINMENT_BOARD_GAMES(16, "Entertainment: Board Games",
|
||||
R.string.category_entertainment_board_games),
|
||||
ENTERTAINMENT_JAPANESE_ANIME_MANGA(31, "Entertainment: Japanese Anime & Manga",
|
||||
R.string.category_entertainment_japanese_anime_manga),
|
||||
ENTERTAINMENT_CARTOON_ANIMATIONS(32, "Entertainment: Cartoons & Animation",
|
||||
R.string.category_entertainment_cartoon_animations),
|
||||
ENTERTAINMENT_COMICS(29, "Entertainment: Comics",
|
||||
R.string.category_entertainment_comics),
|
||||
SCIENCE_NATURE(17, "Science & Nature",
|
||||
R.string.category_science_nature),
|
||||
SCIENCE_COMPUTERS(18, "Science: Computers",
|
||||
R.string.category_science_computers),
|
||||
SCIENCE_MATHEMATICS(19, "Science: Mathematics",
|
||||
R.string.category_science_mathematics),
|
||||
SCIENCE_GADGETS(30, "Science: Gadgets",
|
||||
R.string.category_science_gadgets),
|
||||
MYTHOLOGY(20, "Mythology",
|
||||
R.string.category_mythology),
|
||||
SPORTS(21, "Sports",
|
||||
R.string.category_sports),
|
||||
GEOGRAPHY(22, "Geography",
|
||||
R.string.category_geography),
|
||||
HISTORY(23, "History",
|
||||
R.string.category_history),
|
||||
POLITICS(24, "Politics",
|
||||
R.string.category_politics),
|
||||
ART(25, "Art",
|
||||
R.string.category_art),
|
||||
CELEBRITIES(26, "Celebrities",
|
||||
R.string.category_celebrities),
|
||||
ANIMALS(27, "Animals",
|
||||
R.string.category_animals),
|
||||
VEHICLES(28, "Vehicles",
|
||||
R.string.category_vehicles);
|
||||
|
||||
// The id of the category in the opentdb api
|
||||
// see <https://opentdb.com/api_category.php>
|
||||
private final int ID;
|
||||
// The name of the category in the JSON response
|
||||
private final String name;
|
||||
// The display name of the category
|
||||
private final int displayName;
|
||||
|
||||
private static final Map<String, TriviaCategory> lookup = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (TriviaCategory category : TriviaCategory.values()) {
|
||||
lookup.put(category.getName(), category);
|
||||
}
|
||||
}
|
||||
|
||||
TriviaCategory(int ID, String name, int displayName) {
|
||||
this.ID = ID;
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return this.ID;
|
||||
}
|
||||
|
||||
private String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static TriviaCategory get(String name) {
|
||||
return lookup.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return PluckApplication.getAppContext().getResources().getString(this.displayName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.luca0n.joguitos.pluck.PluckApplication;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
|
||||
public enum TriviaDifficulty {
|
||||
ANY("any", R.string.ui_any),
|
||||
|
||||
EASY("easy", R.string.difficulty_easy),
|
||||
MEDIUM("medium", R.string.difficulty_medium),
|
||||
HARD("hard", R.string.difficulty_hard);
|
||||
|
||||
// Name of difficulty used in queries
|
||||
private final String name;
|
||||
// Display name of the difficulty
|
||||
private final int displayName;
|
||||
|
||||
private static final Map<String, TriviaDifficulty> lookup = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (TriviaDifficulty difficulty : TriviaDifficulty.values()) {
|
||||
lookup.put(difficulty.getName(), difficulty);
|
||||
}
|
||||
}
|
||||
|
||||
TriviaDifficulty(String name, int displayName) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static TriviaDifficulty get(String name) {
|
||||
return lookup.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return PluckApplication.getAppContext().getResources().getString(this.displayName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class TriviaGame implements Serializable {
|
||||
private int currentQuestion;
|
||||
private final boolean[] results;
|
||||
private final List<TriviaQuestion> questions;
|
||||
|
||||
public TriviaGame(List<TriviaQuestion> questions) {
|
||||
this.currentQuestion = 0;
|
||||
this.questions = questions;
|
||||
this.results = new boolean[questions.size()];
|
||||
}
|
||||
|
||||
public TriviaQuestion getCurrentQuestion() {
|
||||
return this.questions.get(currentQuestion);
|
||||
}
|
||||
|
||||
public int getQuestionProgress() {
|
||||
return this.currentQuestion + 1;
|
||||
}
|
||||
|
||||
public int getQuestionsCount() {
|
||||
return this.questions.size();
|
||||
}
|
||||
|
||||
public boolean[] getResults() {
|
||||
return this.results;
|
||||
}
|
||||
|
||||
public boolean nextQuestion(String guess) {
|
||||
TriviaQuestion question = getCurrentQuestion();
|
||||
boolean answer = question.checkAnswer(guess);
|
||||
|
||||
results[currentQuestion] = answer;
|
||||
currentQuestion++;
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return (this.currentQuestion == questions.size());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TriviaQuery implements Serializable {
|
||||
private static final String BASE = "https://opentdb.com/api.php?";
|
||||
private static final int DEFAULT_AMOUNT = 10;
|
||||
|
||||
private final int amount;
|
||||
private final TriviaCategory category;
|
||||
private final TriviaDifficulty difficulty;
|
||||
private final TriviaType type;
|
||||
|
||||
private TriviaQuery(Builder builder) {
|
||||
this.amount = builder.amount;
|
||||
this.category = builder.category;
|
||||
this.difficulty = builder.difficulty;
|
||||
this.type = builder.type;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final int amount;
|
||||
private TriviaCategory category;
|
||||
private TriviaDifficulty difficulty;
|
||||
private TriviaType type;
|
||||
|
||||
public Builder() {
|
||||
this.amount = DEFAULT_AMOUNT;
|
||||
}
|
||||
|
||||
public Builder(int amount) {
|
||||
if (amount > 50) {
|
||||
this.amount = 50;
|
||||
} else {
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder category(TriviaCategory category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder difficulty(TriviaDifficulty difficulty) {
|
||||
this.difficulty = difficulty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder type(TriviaType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TriviaQuery build() {
|
||||
return new TriviaQuery(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder url = new StringBuilder();
|
||||
|
||||
url.append(BASE);
|
||||
url.append("amount=").append(this.amount);
|
||||
|
||||
if (this.category != null & this.category != TriviaCategory.ANY) {
|
||||
url.append("&category=").append(this.category.getID());
|
||||
}
|
||||
if (this.difficulty != null & this.difficulty != TriviaDifficulty.ANY) {
|
||||
url.append("&difficulty=").append(this.difficulty.getName());
|
||||
}
|
||||
if (this.type != null & this.type != TriviaType.ANY) {
|
||||
url.append("&type=").append(this.type.getName());
|
||||
}
|
||||
|
||||
return url.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class TriviaQuestion implements Serializable {
|
||||
private final TriviaCategory category;
|
||||
private final TriviaDifficulty difficulty;
|
||||
|
||||
private final String question;
|
||||
|
||||
TriviaQuestion(TriviaCategory category, TriviaDifficulty difficulty, String question) {
|
||||
this.category = category;
|
||||
this.difficulty = difficulty;
|
||||
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
public TriviaCategory getCategory() {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
public TriviaDifficulty getDifficulty() {
|
||||
return this.difficulty;
|
||||
}
|
||||
|
||||
public String getQuestion() {
|
||||
return this.question;
|
||||
}
|
||||
|
||||
public abstract boolean checkAnswer(String guess);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import android.text.Html;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public class TriviaQuestionBoolean extends TriviaQuestion {
|
||||
|
||||
private final Boolean correctAnswer;
|
||||
|
||||
public TriviaQuestionBoolean(TriviaCategory category, TriviaDifficulty difficulty,
|
||||
String question, boolean correctAnswer) {
|
||||
super(category, difficulty, question);
|
||||
this.correctAnswer = correctAnswer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAnswer(String guess) {
|
||||
return this.correctAnswer.equals(Boolean.valueOf(guess));
|
||||
}
|
||||
|
||||
public boolean checkAnswer(Boolean guess) {
|
||||
return checkAnswer(guess.toString());
|
||||
}
|
||||
|
||||
public static TriviaQuestionBoolean fromJson(JsonObject json) {
|
||||
TriviaCategory category = TriviaCategory.get(json.get("category").getAsString());
|
||||
TriviaDifficulty difficulty = TriviaDifficulty.get(json.get("difficulty").getAsString());
|
||||
String question = Html.fromHtml(json.get("question").getAsString()).toString();
|
||||
Boolean correctAnswer = json.get("correct_answer").getAsBoolean();
|
||||
|
||||
return new TriviaQuestionBoolean(category, difficulty, question, correctAnswer);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import android.text.Html;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public class TriviaQuestionMultiple extends TriviaQuestion {
|
||||
private final String correctAnswer;
|
||||
private final String[] incorrectAnswers;
|
||||
|
||||
public TriviaQuestionMultiple(TriviaCategory category, TriviaDifficulty difficulty,
|
||||
String question, String correctAnswer, String[] incorrectAnswers) {
|
||||
super(category, difficulty, question);
|
||||
|
||||
this.correctAnswer = correctAnswer;
|
||||
this.incorrectAnswers = incorrectAnswers;
|
||||
}
|
||||
|
||||
public String[] getAnswerList() {
|
||||
return new String[]{correctAnswer,
|
||||
incorrectAnswers[0],
|
||||
incorrectAnswers[1],
|
||||
incorrectAnswers[2]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAnswer(String guess) {
|
||||
return this.correctAnswer.equals(guess);
|
||||
}
|
||||
|
||||
public static TriviaQuestionMultiple fromJson(JsonObject json) {
|
||||
TriviaCategory category = TriviaCategory.get(json.get("category").getAsString());
|
||||
TriviaDifficulty difficulty = TriviaDifficulty.get(json.get("difficulty").getAsString());
|
||||
String question = Html.fromHtml(json.get("question").getAsString()).toString();
|
||||
String correctAnswer = Html.fromHtml(json.get("correct_answer").getAsString()).toString();
|
||||
|
||||
JsonArray incorrectAnswersJson = json.get("incorrect_answers").getAsJsonArray();
|
||||
String[] incorrectAnswers = new String[]{
|
||||
Html.fromHtml(incorrectAnswersJson.get(0).getAsString()).toString(),
|
||||
Html.fromHtml(incorrectAnswersJson.get(1).getAsString()).toString(),
|
||||
Html.fromHtml(incorrectAnswersJson.get(2).getAsString()).toString()
|
||||
};
|
||||
|
||||
return new TriviaQuestionMultiple(
|
||||
category, difficulty, question, correctAnswer, incorrectAnswers);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.trivia;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.luca0n.joguitos.pluck.PluckApplication;
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
|
||||
public enum TriviaType {
|
||||
ANY("any", R.string.ui_any),
|
||||
|
||||
MULTIPLE("multiple", R.string.question_type_multiple),
|
||||
BOOLEAN("boolean", R.string.question_type_boolean);
|
||||
|
||||
// Name of type used in queries
|
||||
private final String name;
|
||||
// Display name of the type
|
||||
private final int displayName;
|
||||
|
||||
private static final Map<String, TriviaType> lookup = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (TriviaType type : TriviaType.values()) {
|
||||
lookup.put(type.getName(), type);
|
||||
}
|
||||
}
|
||||
|
||||
TriviaType(String name, int displayName) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public static TriviaType get(String name) {
|
||||
return lookup.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return PluckApplication.getAppContext().getResources().getString(this.displayName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.util;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.luca0n.joguitos.pluck.exceptions.NoTriviaResultsException;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuery;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestion;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionBoolean;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionMultiple;
|
||||
import com.luca0n.joguitos.pluck.trivia.TriviaType;
|
||||
|
||||
public class ApiUtil {
|
||||
|
||||
private static String readStream(InputStream in) throws IOException {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in), 1000);
|
||||
|
||||
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
|
||||
builder.append(line);
|
||||
}
|
||||
|
||||
in.close();
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static String GET(String query) throws IOException {
|
||||
String response;
|
||||
|
||||
URL url = new URL(query);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
try {
|
||||
InputStream in = new BufferedInputStream(connection.getInputStream());
|
||||
response = readStream(in);
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public static String GET(TriviaQuery query) throws IOException {
|
||||
return GET(query.toString());
|
||||
}
|
||||
|
||||
public static ArrayList<TriviaQuestion> jsonToQuestionArray(String json) throws NoTriviaResultsException {
|
||||
JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
|
||||
|
||||
if (jsonObject.get("response_code").getAsInt() == 1) {
|
||||
throw new NoTriviaResultsException();
|
||||
}
|
||||
|
||||
JsonArray jsonArray = jsonObject.getAsJsonArray("results");
|
||||
|
||||
ArrayList<TriviaQuestion> questions = new ArrayList<>();
|
||||
|
||||
for (JsonElement element : jsonArray) {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
TriviaType type = TriviaType.get(object.get("type").getAsString());
|
||||
|
||||
if (type == TriviaType.MULTIPLE) {
|
||||
questions.add(TriviaQuestionMultiple.fromJson(object));
|
||||
} else {
|
||||
questions.add(TriviaQuestionBoolean.fromJson(object));
|
||||
}
|
||||
}
|
||||
|
||||
return questions;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
*/
|
||||
|
||||
package com.luca0n.joguitos.pluck.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.MediaPlayer;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.luca0n.joguitos.pluck.R;
|
||||
|
||||
public class SoundUtil {
|
||||
public static final int SOUND_ANSWER_CORRECT = R.raw.sound_answer_correct;
|
||||
public static final int SOUND_ANSWER_WRONG = R.raw.sound_answer_wrong;
|
||||
|
||||
public static void playSound(Context context, int sound) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String key_sound = context.getResources().getString(R.string.pref_sound_answer);
|
||||
boolean pref_sound = preferences.getBoolean(key_sound, true);
|
||||
|
||||
if (pref_sound) {
|
||||
final MediaPlayer player = MediaPlayer.create(context, sound);
|
||||
player.setVolume(0.25f, 0.25f);
|
||||
player.start();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.luca0n.pluck;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
public class PluckApplication extends Application {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context context;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
PluckApplication.context = getApplicationContext();
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return PluckApplication.context;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.activities;
|
||||
package com.luca0n.pluck.activities;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
|
@ -10,8 +10,8 @@ import com.mikepenz.aboutlibraries.Libs;
|
|||
import com.mikepenz.aboutlibraries.LibsBuilder;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import io.github.trytonvanmeer.libretrivia.settings.SettingsActivity;
|
||||
import com.luca0n.pluck.R;
|
||||
import com.luca0n.pluck.settings.SettingsActivity;
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActivity extends AppCompatActivity {
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.activities;
|
||||
package com.luca0n.pluck.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -8,10 +8,10 @@ import android.widget.Spinner;
|
|||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaCategory;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaDifficulty;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuery;
|
||||
import com.luca0n.pluck.R;
|
||||
import com.luca0n.pluck.trivia.TriviaCategory;
|
||||
import com.luca0n.pluck.trivia.TriviaDifficulty;
|
||||
import com.luca0n.pluck.trivia.TriviaQuery;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.activities;
|
||||
package com.luca0n.pluck.activities;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
|
@ -21,16 +21,16 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.fragment.app.FragmentTransaction;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import io.github.trytonvanmeer.libretrivia.exceptions.NoTriviaResultsException;
|
||||
import io.github.trytonvanmeer.libretrivia.fragments.TriviaGameErrorFragment;
|
||||
import io.github.trytonvanmeer.libretrivia.fragments.TriviaQuestionFragment;
|
||||
import io.github.trytonvanmeer.libretrivia.interfaces.IDownloadTriviaQuestionReceiver;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaGame;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuery;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuestion;
|
||||
import io.github.trytonvanmeer.libretrivia.util.ApiUtil;
|
||||
import io.github.trytonvanmeer.libretrivia.util.SoundUtil;
|
||||
import com.luca0n.pluck.R;
|
||||
import com.luca0n.pluck.exceptions.NoTriviaResultsException;
|
||||
import com.luca0n.pluck.fragments.TriviaGameErrorFragment;
|
||||
import com.luca0n.pluck.fragments.TriviaQuestionFragment;
|
||||
import com.luca0n.pluck.interfaces.IDownloadTriviaQuestionReceiver;
|
||||
import com.luca0n.pluck.trivia.TriviaGame;
|
||||
import com.luca0n.pluck.trivia.TriviaQuery;
|
||||
import com.luca0n.pluck.trivia.TriviaQuestion;
|
||||
import com.luca0n.pluck.util.ApiUtil;
|
||||
import com.luca0n.pluck.util.SoundUtil;
|
||||
|
||||
public class TriviaGameActivity extends BaseActivity
|
||||
implements IDownloadTriviaQuestionReceiver {
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.activities;
|
||||
package com.luca0n.pluck.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
|
@ -6,8 +6,8 @@ import android.widget.TextView;
|
|||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaGame;
|
||||
import com.luca0n.pluck.R;
|
||||
import com.luca0n.pluck.trivia.TriviaGame;
|
||||
|
||||
public class TriviaGameResultsActivity extends BaseActivity {
|
||||
static final String EXTRA_TRIVIA_GAME = "extra_trivia_game";
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.exceptions;
|
||||
package com.luca0n.pluck.exceptions;
|
||||
|
||||
public class NoTriviaResultsException extends Exception {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.fragments;
|
||||
package com.luca0n.pluck.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -10,7 +10,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import com.luca0n.pluck.R;
|
||||
|
||||
public class TriviaGameErrorFragment extends Fragment {
|
||||
private final static String ARG_ERROR_MSG = "arg_error_msg";
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.fragments;
|
||||
package com.luca0n.pluck.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -16,10 +16,10 @@ import androidx.annotation.Nullable;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import butterknife.BindViews;
|
||||
import butterknife.ButterKnife;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import io.github.trytonvanmeer.libretrivia.activities.TriviaGameActivity;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuestion;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuestionMultiple;
|
||||
import com.luca0n.pluck.R;
|
||||
import com.luca0n.pluck.activities.TriviaGameActivity;
|
||||
import com.luca0n.pluck.trivia.TriviaQuestion;
|
||||
import com.luca0n.pluck.trivia.TriviaQuestionMultiple;
|
||||
|
||||
|
||||
public class TriviaQuestionFragment extends Fragment {
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.interfaces;
|
||||
package com.luca0n.pluck.interfaces;
|
||||
|
||||
public interface IDownloadTriviaQuestionReceiver {
|
||||
void onTriviaQuestionsDownloaded(String json);
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.settings;
|
||||
package com.luca0n.pluck.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
|
@ -1,10 +1,10 @@
|
|||
package io.github.trytonvanmeer.libretrivia.settings;
|
||||
package com.luca0n.pluck.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import com.luca0n.pluck.R;
|
||||
|
||||
public class SettingsFragment extends PreferenceFragment {
|
||||
@Override
|
|
@ -1,10 +1,10 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.trytonvanmeer.libretrivia.LibreTriviaApplication;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import com.luca0n.pluck.PluckApplication;
|
||||
import com.luca0n.pluck.R;
|
||||
|
||||
/*
|
||||
Categories that a Trivia Question can fall into
|
||||
|
@ -97,6 +97,6 @@ public enum TriviaCategory {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return LibreTriviaApplication.getAppContext().getResources().getString(this.displayName);
|
||||
return PluckApplication.getAppContext().getResources().getString(this.displayName);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.trytonvanmeer.libretrivia.LibreTriviaApplication;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import com.luca0n.pluck.PluckApplication;
|
||||
import com.luca0n.pluck.R;
|
||||
|
||||
public enum TriviaDifficulty {
|
||||
ANY("any", R.string.ui_any),
|
||||
|
@ -41,6 +41,6 @@ public enum TriviaDifficulty {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return LibreTriviaApplication.getAppContext().getResources().getString(this.displayName);
|
||||
return PluckApplication.getAppContext().getResources().getString(this.displayName);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import android.text.Html;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import android.text.Html;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package io.github.trytonvanmeer.libretrivia.trivia;
|
||||
package com.luca0n.pluck.trivia;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.trytonvanmeer.libretrivia.LibreTriviaApplication;
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import com.luca0n.pluck.PluckApplication;
|
||||
import com.luca0n.pluck.R;
|
||||
|
||||
public enum TriviaType {
|
||||
ANY("any", R.string.ui_any),
|
||||
|
@ -40,6 +40,6 @@ public enum TriviaType {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return LibreTriviaApplication.getAppContext().getResources().getString(this.displayName);
|
||||
return PluckApplication.getAppContext().getResources().getString(this.displayName);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.github.trytonvanmeer.libretrivia.util;
|
||||
package com.luca0n.pluck.util;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
|
@ -14,12 +14,12 @@ import java.net.HttpURLConnection;
|
|||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.github.trytonvanmeer.libretrivia.exceptions.NoTriviaResultsException;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuery;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuestion;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuestionBoolean;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaQuestionMultiple;
|
||||
import io.github.trytonvanmeer.libretrivia.trivia.TriviaType;
|
||||
import com.luca0n.pluck.exceptions.NoTriviaResultsException;
|
||||
import com.luca0n.pluck.trivia.TriviaQuery;
|
||||
import com.luca0n.pluck.trivia.TriviaQuestion;
|
||||
import com.luca0n.pluck.trivia.TriviaQuestionBoolean;
|
||||
import com.luca0n.pluck.trivia.TriviaQuestionMultiple;
|
||||
import com.luca0n.pluck.trivia.TriviaType;
|
||||
|
||||
public class ApiUtil {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package io.github.trytonvanmeer.libretrivia.util;
|
||||
package com.luca0n.pluck.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.MediaPlayer;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import io.github.trytonvanmeer.libretrivia.R;
|
||||
import com.luca0n.pluck.R;
|
||||
|
||||
public class SoundUtil {
|
||||
public static final int SOUND_ANSWER_CORRECT = R.raw.sound_answer_correct;
|
|
@ -1,21 +0,0 @@
|
|||
package io.github.trytonvanmeer.libretrivia;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
public class LibreTriviaApplication extends Application {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Context context;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
LibreTriviaApplication.context = getApplicationContext();
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return LibreTriviaApplication.context;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_description">Ein Open-Source-Trivia-Spiel</string>
|
||||
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<color name="colorPrimary">#F44336</color>
|
||||
<color name="colorPrimaryDark">#D32F2F</color>
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="pref_category_sound">pref_key_category_sound</string>
|
||||
<string name="pref_sound_answer">pref_sound_answer</string>
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">LibreTrivia</string>
|
||||
<string name="app_name" translatable="false">Pluck</string>
|
||||
<string name="app_description">An open source trivia game.</string>
|
||||
|
||||
<!-- Category Names -->
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Pluck: an open source trivia game for Android
|
||||
|
||||
Copyright (C) 2021 Joguitos do luca0N!
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
This game is a fork of LibreTrivia, and its source code is available at
|
||||
<https://github.com/tryton-vanmeer/LibreTrivia>.
|
||||
|
||||
Contact us at <joguitos+pluck@luca0n.com>.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
|
|
|
@ -8,7 +8,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
Loading…
Reference in New Issue