-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setting to toogle copy to lookup
Fix #18
- Loading branch information
1 parent
f5478e7
commit b52d49b
Showing
11 changed files
with
56 additions
and
29 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
25 changes: 21 additions & 4 deletions
25
app/src/main/java/com/madeinhk/english_chinesedictionary/SettingFragment.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 |
---|---|---|
@@ -1,14 +1,31 @@ | ||
package com.madeinhk.english_chinesedictionary; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.preference.Preference; | ||
import android.support.v7.preference.PreferenceFragmentCompat; | ||
|
||
/** | ||
* Created by tonymak on 5/7/16. | ||
*/ | ||
public class SettingFragment extends PreferenceFragmentCompat { | ||
import com.madeinhk.english_chinesedictionary.service.ClipboardService; | ||
|
||
public class SettingFragment extends PreferenceFragmentCompat implements | ||
Preference.OnPreferenceChangeListener { | ||
public static final String KEY_COPY_TO_LOOKUP = "copy_lookup"; | ||
@Override | ||
public void onCreatePreferences(Bundle bundle, String s) { | ||
addPreferencesFromResource(R.xml.settings); | ||
findPreference(KEY_COPY_TO_LOOKUP).setOnPreferenceChangeListener(this); | ||
} | ||
|
||
@Override | ||
public boolean onPreferenceChange(Preference preference, Object o) { | ||
if (KEY_COPY_TO_LOOKUP.equals(preference.getKey())) { | ||
boolean newValue = (boolean) o; | ||
if (newValue) { | ||
ClipboardService.start(getActivity()); | ||
} else { | ||
|
||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<SwitchPreference | ||
<android.support.v7.preference.SwitchPreferenceCompat | ||
android:id="@+id/copy_lookup" | ||
android:text="@string/copy_lookup_word" | ||
android:defaultValue="true" | ||
android:key="copy_lookup" | ||
android:title="@string/copy_lookup_word" | ||
/> | ||
|
||
</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