Compare commits

..

2 commits

Author SHA1 Message Date
f32a0a7a43
Added missing Tor preference res files
Based on #2.
2021-03-03 22:18:38 -03:00
e8c2504a33
Added back button on game activity 2021-03-03 22:18:11 -03:00
4 changed files with 196 additions and 166 deletions

View file

@ -33,6 +33,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@ -40,6 +41,7 @@ import android.widget.TextView;
import java.io.IOException;
import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import butterknife.BindView;
@ -79,6 +81,10 @@ public class TriviaGameActivity extends BaseActivity
setContentView(R.layout.activity_trivia_game);
ButterKnife.bind(this);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null)
actionBar.setDisplayHomeAsUpEnabled(true);
if (savedInstanceState != null) {
this.game = (TriviaGame) savedInstanceState.getSerializable(STATE_TRIVIA_GAME);
} 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) {
if (json == null) {
onNetworkError();

View file

@ -25,4 +25,5 @@ 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>
<string name="pref_network_tor">pref_network_tor</string>
</resources>

View file

@ -83,11 +83,15 @@ Contact us at <joguitos+pluck@luca0n.com>.
<string name="ui_return_to_menu">Return To Menu</string>
<!-- 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>\nWas not able to find trivia questions that satisfied all options.</string>
<string name="title_activity_settings">Settings</string>
<!-- Setting Strings-->
<string name="pref_category_sound_title">Sound</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>

View file

@ -34,5 +34,13 @@ Contact us at <joguitos+pluck@luca0n.com>.
android:title="@string/pref_sound_answer_title" />
</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>