-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepared for #7 auto refresh by adding a system setting (and moving h…
…elp options to a separate screen).
- Loading branch information
Showing
11 changed files
with
221 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright 2010-2013 Eric Kok et al. | ||
Transdroid 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. | ||
Transdroid 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 Transdroid. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<Preference | ||
android:key="system_sendlog" | ||
android:title="@string/pref_sendlog" | ||
android:summary="@string/pref_sendlog_info" /> | ||
|
||
<Preference | ||
android:key="system_installhelp" | ||
android:title="@string/pref_installhelp" | ||
android:summary="@string/pref_installhelp_info" /> | ||
|
||
<Preference | ||
android:key="system_changelog" | ||
android:title="@string/pref_changelog" /> | ||
|
||
<Preference | ||
android:key="system_about" /> | ||
|
||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
core/src/org/transdroid/core/gui/settings/HelpSettingsActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* Copyright 2010-2013 Eric Kok et al. | ||
* | ||
* Transdroid 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. | ||
* | ||
* Transdroid 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 Transdroid. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.transdroid.core.gui.settings; | ||
|
||
import org.androidannotations.annotations.Bean; | ||
import org.androidannotations.annotations.EActivity; | ||
import org.androidannotations.annotations.OptionsItem; | ||
import org.transdroid.core.R; | ||
import org.transdroid.core.app.settings.ApplicationSettings; | ||
import org.transdroid.core.app.settings.SettingsPersistence; | ||
import org.transdroid.core.gui.log.ErrorLogSender; | ||
import org.transdroid.core.gui.navigation.DialogHelper; | ||
import org.transdroid.core.gui.navigation.NavigationHelper; | ||
|
||
import android.annotation.TargetApi; | ||
import android.app.Dialog; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.preference.Preference; | ||
import android.preference.Preference.OnPreferenceClickListener; | ||
|
||
import com.actionbarsherlock.app.SherlockPreferenceActivity; | ||
|
||
@EActivity | ||
public class HelpSettingsActivity extends SherlockPreferenceActivity { | ||
|
||
protected static final int DIALOG_CHANGELOG = 0; | ||
protected static final int DIALOG_ABOUT = 1; | ||
protected static final String INSTALLHELP_URI = "http://www.transdroid.org/download/"; | ||
|
||
@Bean | ||
protected NavigationHelper navigationHelper; | ||
@Bean | ||
protected ApplicationSettings applicationSettings; | ||
@Bean | ||
protected ErrorLogSender errorLogSender; | ||
@Bean | ||
protected SettingsPersistence settingsPersistence; | ||
|
||
@SuppressWarnings("deprecation") | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
|
||
// Just load the system-related preferences from XML | ||
addPreferencesFromResource(R.xml.pref_help); | ||
|
||
// Handle outgoing links and preference changes | ||
findPreference("system_sendlog").setOnPreferenceClickListener(onSendLogClick); | ||
findPreference("system_installhelp").setOnPreferenceClickListener(onInstallHelpClick); | ||
findPreference("system_changelog").setOnPreferenceClickListener(onChangeLogClick); | ||
findPreference("system_about").setTitle(getString(R.string.pref_about, getString(R.string.app_name))); | ||
findPreference("system_about").setOnPreferenceClickListener(onAboutClick); | ||
} | ||
|
||
@TargetApi(Build.VERSION_CODES.HONEYCOMB) | ||
@OptionsItem(android.R.id.home) | ||
protected void navigateUp() { | ||
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); | ||
} | ||
|
||
private OnPreferenceClickListener onSendLogClick = new OnPreferenceClickListener() { | ||
@Override | ||
public boolean onPreferenceClick(Preference preference) { | ||
errorLogSender.collectAndSendLog(HelpSettingsActivity.this, applicationSettings.getLastUsedServer()); | ||
return true; | ||
} | ||
}; | ||
|
||
private OnPreferenceClickListener onInstallHelpClick = new OnPreferenceClickListener() { | ||
@Override | ||
public boolean onPreferenceClick(Preference preference) { | ||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(INSTALLHELP_URI))); | ||
return true; | ||
} | ||
}; | ||
|
||
private OnPreferenceClickListener onChangeLogClick = new OnPreferenceClickListener() { | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
public boolean onPreferenceClick(Preference preference) { | ||
showDialog(DIALOG_CHANGELOG); | ||
return true; | ||
} | ||
}; | ||
|
||
private OnPreferenceClickListener onAboutClick = new OnPreferenceClickListener() { | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
public boolean onPreferenceClick(Preference preference) { | ||
showDialog(DIALOG_ABOUT); | ||
return true; | ||
} | ||
}; | ||
|
||
protected Dialog onCreateDialog(int id) { | ||
switch (id) { | ||
case DIALOG_CHANGELOG: | ||
return DialogHelper.showDialog(this, new ChangelogDialog()); | ||
case DIALOG_ABOUT: | ||
return DialogHelper.showDialog(this, new AboutDialog()); | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.