Skip to content

Commit

Permalink
Add switch and click preference for dropbox and custom url in auto se…
Browse files Browse the repository at this point in the history
…nders screen
  • Loading branch information
mendhak committed May 30, 2022
1 parent 91571c8 commit 5c42528
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gpslogger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ android {
targetSdkVersion 30

versionCode 122
versionName "122-rc2"
versionName "122-rc3"

manifestPlaceholders = [
appAuthRedirectScheme: 'com.mendhak.gpslogger'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,50 @@ public void onCreate(Bundle savedInstanceState) {

findPreference("osm_setup").setOnPreferenceClickListener(this);
findPreference("autoemail_setup").setOnPreferenceClickListener(this);
findPreference("dropbox_setup").setOnPreferenceClickListener(this);
// findPreference("dropbox_setup").setOnPreferenceClickListener(this);
findPreference("opengts_setup").setOnPreferenceClickListener(this);
findPreference("autoftp_setup").setOnPreferenceClickListener(this);
findPreference("owncloud_setup").setOnPreferenceClickListener(this);
findPreference("sftp_setup").setOnPreferenceClickListener(this);
findPreference("customurl_setup").setOnPreferenceClickListener(this);
// findPreference("customurl_setup").setOnPreferenceClickListener(this);

((SwitchPlusClickPreference)findPreference(PreferenceNames.AUTOSEND_CUSTOMURL_ENABLED))
.setSwitchClickListener(new SwitchPlusClickPreference.SwitchPlusClickListener() {

((SwitchPlusClickPreference)findPreference(PreferenceNames.AUTOSEND_GOOGLE_DRIVE_ENABLED)).setSwitchClickListener(new SwitchPlusClickPreference.SwitchPlusClickListener() {
@Override
public void onCheckedChanged(SwitchCompat buttonView, boolean isChecked) {
// No need to do anything, the value gets propagated.
}

@Override
public void onClick(View view) {

Intent intent = new Intent(getActivity(), MainPreferenceActivity.class);
intent.putExtra("preference_fragment", MainPreferenceActivity.PREFERENCE_FRAGMENTS.CUSTOMURL);
startActivity(intent);
}
});

((SwitchPlusClickPreference)findPreference(PreferenceNames.AUTOSEND_DROPBOX_ENABLED))
.setSwitchClickListener(new SwitchPlusClickPreference.SwitchPlusClickListener() {

@Override
public void onCheckedChanged(SwitchCompat buttonView, boolean isChecked) {
// No need to do anything, the value gets propagated.
}

@Override
public void onClick(View view) {

Intent intent = new Intent(getActivity(), MainPreferenceActivity.class);
intent.putExtra("preference_fragment", MainPreferenceActivity.PREFERENCE_FRAGMENTS.DROPBOX);
startActivity(intent);
}
});


((SwitchPlusClickPreference)findPreference(PreferenceNames.AUTOSEND_GOOGLE_DRIVE_ENABLED))
.setSwitchClickListener(new SwitchPlusClickPreference.SwitchPlusClickListener() {

@Override
public void onCheckedChanged(SwitchCompat buttonView, boolean isChecked) {
Expand Down Expand Up @@ -129,9 +164,9 @@ public boolean onPreferenceClick(Preference preference) {
launchFragment = MainPreferenceActivity.PREFERENCE_FRAGMENTS.CUSTOMURL;
}

if(preference.getKey().equalsIgnoreCase("dropbox_setup")){
launchFragment = MainPreferenceActivity.PREFERENCE_FRAGMENTS.DROPBOX;
}
// if(preference.getKey().equalsIgnoreCase("dropbox_setup")){
// launchFragment = MainPreferenceActivity.PREFERENCE_FRAGMENTS.DROPBOX;
// }

if(preference.getKey().equalsIgnoreCase("opengts_setup")){
launchFragment = MainPreferenceActivity.PREFERENCE_FRAGMENTS.OPENGTS;
Expand Down
8 changes: 4 additions & 4 deletions gpslogger/src/main/res/xml/pref_upload.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
android:title="@string/autosend_targets_category"
app:iconSpaceReserved="false">

<Preference
android:key="customurl_setup"
<com.mendhak.gpslogger.ui.components.SwitchPlusClickPreference
android:key="autocustomurl_enabled"
android:title="@string/log_customurl_setup_title"
app:icon="@drawable/customurlsender"/>

<Preference
android:key="dropbox_setup"
<com.mendhak.gpslogger.ui.components.SwitchPlusClickPreference
android:key="dropbox_enabled"
android:title="@string/dropbox_setup_title"
app:icon="@drawable/dropbox" />

Expand Down

0 comments on commit 5c42528

Please sign in to comment.