Compare commits
2 commits
fb2d81550c
...
f32a0a7a43
Author | SHA1 | Date | |
---|---|---|---|
f32a0a7a43 | |||
e8c2504a33 |
4 changed files with 196 additions and 166 deletions
|
@ -33,6 +33,7 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
@ -40,6 +41,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
@ -79,6 +81,10 @@ public class TriviaGameActivity extends BaseActivity
|
||||||
setContentView(R.layout.activity_trivia_game);
|
setContentView(R.layout.activity_trivia_game);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null)
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
this.game = (TriviaGame) savedInstanceState.getSerializable(STATE_TRIVIA_GAME);
|
this.game = (TriviaGame) savedInstanceState.getSerializable(STATE_TRIVIA_GAME);
|
||||||
} else {
|
} else {
|
||||||
|
@ -118,6 +124,17 @@ public class TriviaGameActivity extends BaseActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onTriviaQuestionsDownloaded(String json) {
|
public void onTriviaQuestionsDownloaded(String json) {
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
onNetworkError();
|
onNetworkError();
|
||||||
|
|
|
@ -25,4 +25,5 @@ Contact us at <joguitos+pluck@luca0n.com>.
|
||||||
<resources>
|
<resources>
|
||||||
<string name="pref_category_sound">pref_key_category_sound</string>
|
<string name="pref_category_sound">pref_key_category_sound</string>
|
||||||
<string name="pref_sound_answer">pref_sound_answer</string>
|
<string name="pref_sound_answer">pref_sound_answer</string>
|
||||||
|
<string name="pref_network_tor">pref_network_tor</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -83,11 +83,15 @@ Contact us at <joguitos+pluck@luca0n.com>.
|
||||||
<string name="ui_return_to_menu">Return To Menu</string>
|
<string name="ui_return_to_menu">Return To Menu</string>
|
||||||
|
|
||||||
<!-- Error Strings -->
|
<!-- Error Strings -->
|
||||||
<string name="error_network"><b>Network error!</b>\n Could not connect to a network.</string>
|
<string name="error_network"><b>Network error!</b>\nCould not connect to a network.\n\nIf Tor is enabled in the game settings, check if Orbot is running and then try again.</string>
|
||||||
<string name="error_no_trivia_results"><b>No trivia results!</b>\n Was not able to find trivia questions that satisfied all options.</string>
|
<string name="error_no_trivia_results"><b>No trivia results!</b>\nWas not able to find trivia questions that satisfied all options.</string>
|
||||||
<string name="title_activity_settings">Settings</string>
|
<string name="title_activity_settings">Settings</string>
|
||||||
|
|
||||||
<!-- Setting Strings-->
|
<!-- Setting Strings-->
|
||||||
<string name="pref_category_sound_title">Sound</string>
|
<string name="pref_category_sound_title">Sound</string>
|
||||||
<string name="pref_sound_answer_title">Answer Sound Effect</string>
|
<string name="pref_sound_answer_title">Answer Sound Effect</string>
|
||||||
|
|
||||||
|
<string name="pref_category_network_title">Network</string>
|
||||||
|
<string name="pref_network_tor_title">Connect using Tor</string>
|
||||||
|
<string name="pref_network_tor_summary">Retrieves trivia data via the Tor network. Requires Orbot.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -34,5 +34,13 @@ Contact us at <joguitos+pluck@luca0n.com>.
|
||||||
android:title="@string/pref_sound_answer_title" />
|
android:title="@string/pref_sound_answer_title" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/pref_category_network_title">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/pref_network_tor"
|
||||||
|
android:title="@string/pref_network_tor_title"
|
||||||
|
android:summary="@string/pref_network_tor_summary" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue