Remove Google Drive item from Send to Google dialog.

This commit is contained in:
Jimmy Shih
2013-06-03 15:54:12 -07:00
parent 8cda9df762
commit 56e272c5d4
8 changed files with 7 additions and 55 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

@@ -21,16 +21,6 @@ limitations under the License.
android:layout_width="match_parent" android:layout_width="match_parent"
android:padding="8dp" android:padding="8dp"
android:stretchColumns="1" > android:stretchColumns="1" >
<TableRow android:id="@+id/choose_upload_service_drive_options">
<ImageView
android:contentDescription="@string/send_google_drive"
android:src="@drawable/google_drive_icon"
style="@style/ChooseUploadServiceImageView" />
<CheckBox
android:id="@+id/choose_upload_service_drive"
android:text="@string/send_google_drive"
style="@style/ChooseUploadServiceCheckBox" />
</TableRow>
<TableRow> <TableRow>
<ImageView <ImageView
android:contentDescription="@string/send_google_maps" android:contentDescription="@string/send_google_maps"
-1
View File
@@ -35,7 +35,6 @@ limitations under the License.
<string name="min_required_accuracy_key">minRequiredAccuracy</string> <string name="min_required_accuracy_key">minRequiredAccuracy</string>
<string name="pick_existing_map_key">pickExistingMap</string> <string name="pick_existing_map_key">pickExistingMap</string>
<string name="report_speed_key">reportSpeed</string> <string name="report_speed_key">reportSpeed</string>
<string name="send_to_drive_key">sendToDrive</string>
<string name="send_to_fusion_tables_key">sendToFusionTables</string> <string name="send_to_fusion_tables_key">sendToFusionTables</string>
<string name="send_to_maps_key">sendToMaps</string> <string name="send_to_maps_key">sendToMaps</string>
<string name="send_to_spreadsheets_key">sendToSpreadsheets</string> <string name="send_to_spreadsheets_key">sendToSpreadsheets</string>
@@ -362,10 +362,7 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
return true; return true;
case R.id.track_detail_send_google: case R.id.track_detail_send_google:
AnalyticsUtils.sendPageViews(this, "/action/send_google"); AnalyticsUtils.sendPageViews(this, "/action/send_google");
Track track = myTracksProviderUtils.getTrack(trackId); new ChooseUploadServiceDialogFragment().show(getSupportFragmentManager(),
boolean sharedWithMe = track != null ? track.isSharedWithMe() : true;
ChooseUploadServiceDialogFragment.newInstance(sharedWithMe).show(
getSupportFragmentManager(),
ChooseUploadServiceDialogFragment.CHOOSE_UPLOAD_SERVICE_DIALOG_TAG); ChooseUploadServiceDialogFragment.CHOOSE_UPLOAD_SERVICE_DIALOG_TAG);
return true; return true;
case R.id.track_detail_save: case R.id.track_detail_save:
@@ -415,17 +412,13 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
} }
@Override @Override
public void onChooseUploadServiceDone(boolean sendDrive, boolean sendMaps, public void onChooseUploadServiceDone(boolean sendMaps, boolean sendFusionTables,
boolean sendFusionTables, boolean sendSpreadsheets, boolean mapsExistingMap) { boolean sendSpreadsheets, boolean mapsExistingMap) {
SendRequest sendRequest = new SendRequest(trackId); SendRequest sendRequest = new SendRequest(trackId);
sendRequest.setSendDrive(sendDrive);
sendRequest.setSendMaps(sendMaps); sendRequest.setSendMaps(sendMaps);
sendRequest.setSendFusionTables(sendFusionTables); sendRequest.setSendFusionTables(sendFusionTables);
sendRequest.setSendSpreadsheets(sendSpreadsheets); sendRequest.setSendSpreadsheets(sendSpreadsheets);
sendRequest.setMapsExistingMap(mapsExistingMap); sendRequest.setMapsExistingMap(mapsExistingMap);
if (sendDrive) {
AnalyticsUtils.sendPageViews(this, "/send/drive");
}
if (sendMaps) { if (sendMaps) {
AnalyticsUtils.sendPageViews(this, "/send/maps"); AnalyticsUtils.sendPageViews(this, "/send/maps");
} }
@@ -51,28 +51,15 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
/** /**
* Called when choose upload service is done. * Called when choose upload service is done.
*/ */
public void onChooseUploadServiceDone(boolean sendDrive, boolean sendMaps, public void onChooseUploadServiceDone(boolean sendMaps, boolean sendFusionTables,
boolean sendFusionTables, boolean sendSpreadsheets, boolean mapsExistingMap); boolean sendSpreadsheets, boolean mapsExistingMap);
} }
public static final String CHOOSE_UPLOAD_SERVICE_DIALOG_TAG = "chooseUploadService"; public static final String CHOOSE_UPLOAD_SERVICE_DIALOG_TAG = "chooseUploadService";
private static final String KEY_HIDE_DRIVE = "hideDrive";
public static ChooseUploadServiceDialogFragment newInstance(boolean hideDrive) {
Bundle bundle = new Bundle();
bundle.putBoolean(KEY_HIDE_DRIVE, hideDrive);
ChooseUploadServiceDialogFragment chooseUploadServiceDialogFragment = new ChooseUploadServiceDialogFragment();
chooseUploadServiceDialogFragment.setArguments(bundle);
return chooseUploadServiceDialogFragment;
}
private ChooseUploadServiceCaller caller; private ChooseUploadServiceCaller caller;
private FragmentActivity fragmentActivity; private FragmentActivity fragmentActivity;
private boolean hideDrive;
private CheckBox driveCheckBox;
private CheckBox mapsCheckBox; private CheckBox mapsCheckBox;
private CheckBox fusionTablesCheckBox; private CheckBox fusionTablesCheckBox;
private CheckBox spreadsheetsCheckBox; private CheckBox spreadsheetsCheckBox;
@@ -94,20 +81,13 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
fragmentActivity = getActivity(); fragmentActivity = getActivity();
hideDrive = getArguments().getBoolean(KEY_HIDE_DRIVE);
View view = fragmentActivity.getLayoutInflater().inflate(R.layout.choose_upload_service, null); View view = fragmentActivity.getLayoutInflater().inflate(R.layout.choose_upload_service, null);
view.findViewById(R.id.choose_upload_service_drive_options)
.setVisibility(hideDrive ? View.GONE : View.VISIBLE);
driveCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_drive);
mapsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_maps); mapsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_maps);
fusionTablesCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_fusion_tables); fusionTablesCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_fusion_tables);
spreadsheetsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_spreadsheets); spreadsheetsCheckBox = (CheckBox) view.findViewById(R.id.choose_upload_service_spreadsheets);
driveCheckBox.setChecked(PreferencesUtils.getBoolean(
fragmentActivity, R.string.send_to_drive_key, PreferencesUtils.SEND_TO_DRIVE_DEFAULT));
mapsCheckBox.setChecked(PreferencesUtils.getBoolean( mapsCheckBox.setChecked(PreferencesUtils.getBoolean(
fragmentActivity, R.string.send_to_maps_key, PreferencesUtils.SEND_TO_MAPS_DEFAULT)); fragmentActivity, R.string.send_to_maps_key, PreferencesUtils.SEND_TO_MAPS_DEFAULT));
fusionTablesCheckBox.setChecked(PreferencesUtils.getBoolean( fusionTablesCheckBox.setChecked(PreferencesUtils.getBoolean(
@@ -156,8 +136,6 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
.setPositiveButton(R.string.send_google_send_now, new DialogInterface.OnClickListener() { .setPositiveButton(R.string.send_google_send_now, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
PreferencesUtils.setBoolean(
fragmentActivity, R.string.send_to_drive_key, driveCheckBox.isChecked());
PreferencesUtils.setBoolean( PreferencesUtils.setBoolean(
fragmentActivity, R.string.pick_existing_map_key, existingMapRadioButton.isChecked()); fragmentActivity, R.string.pick_existing_map_key, existingMapRadioButton.isChecked());
PreferencesUtils.setBoolean( PreferencesUtils.setBoolean(
@@ -166,9 +144,9 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
fragmentActivity, R.string.send_to_fusion_tables_key, fusionTablesCheckBox.isChecked()); fragmentActivity, R.string.send_to_fusion_tables_key, fusionTablesCheckBox.isChecked());
PreferencesUtils.setBoolean( PreferencesUtils.setBoolean(
fragmentActivity, R.string.send_to_spreadsheets_key, spreadsheetsCheckBox.isChecked()); fragmentActivity, R.string.send_to_spreadsheets_key, spreadsheetsCheckBox.isChecked());
if (sendDrive() || mapsCheckBox.isChecked() || fusionTablesCheckBox.isChecked() if (mapsCheckBox.isChecked() || fusionTablesCheckBox.isChecked()
|| spreadsheetsCheckBox.isChecked()) { || spreadsheetsCheckBox.isChecked()) {
caller.onChooseUploadServiceDone(sendDrive(), mapsCheckBox.isChecked(), caller.onChooseUploadServiceDone(mapsCheckBox.isChecked(),
fusionTablesCheckBox.isChecked(), spreadsheetsCheckBox.isChecked(), fusionTablesCheckBox.isChecked(), spreadsheetsCheckBox.isChecked(),
existingMapRadioButton.isChecked()); existingMapRadioButton.isChecked());
} else { } else {
@@ -185,11 +163,4 @@ public class ChooseUploadServiceDialogFragment extends DialogFragment {
private void updateMapsOption() { private void updateMapsOption() {
mapsOptionTableRow.setVisibility(mapsCheckBox.isChecked() ? View.VISIBLE : View.GONE); mapsOptionTableRow.setVisibility(mapsCheckBox.isChecked() ? View.VISIBLE : View.GONE);
} }
/**
* True to send to Google Drive.
*/
private boolean sendDrive() {
return !hideDrive && driveCheckBox.isChecked();
}
} }
@@ -92,7 +92,6 @@ public class PreferencesUtils {
public static final boolean REPORT_SPEED_DEFAULT = true; public static final boolean REPORT_SPEED_DEFAULT = true;
public static final long SELECTED_TRACK_ID_DEFAULT = -1L; public static final long SELECTED_TRACK_ID_DEFAULT = -1L;
public static final boolean SEND_TO_DRIVE_DEFAULT = false;
public static final boolean SEND_TO_FUSION_TABLES_DEFAULT = false; public static final boolean SEND_TO_FUSION_TABLES_DEFAULT = false;
public static final boolean SEND_TO_MAPS_DEFAULT = false; public static final boolean SEND_TO_MAPS_DEFAULT = false;
public static final boolean SEND_TO_SPREADSHEETS_DEFAULT = false; public static final boolean SEND_TO_SPREADSHEETS_DEFAULT = false;