forked from upstream-mirrors/OpenTracks
Use ApiAdapter to disable Google Feedback for pre-ICS
This commit is contained in:
@@ -311,7 +311,7 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
|
|||||||
voiceFrequencyMenuItem = menu.findItem(R.id.track_detail_voice_frequency);
|
voiceFrequencyMenuItem = menu.findItem(R.id.track_detail_voice_frequency);
|
||||||
splitFrequencyMenuItem = menu.findItem(R.id.track_detail_split_frequency);
|
splitFrequencyMenuItem = menu.findItem(R.id.track_detail_split_frequency);
|
||||||
feedbackMenuItem = menu.findItem(R.id.track_detail_split_frequency);
|
feedbackMenuItem = menu.findItem(R.id.track_detail_split_frequency);
|
||||||
feedbackMenuItem.setVisible(GoogleFeedbackUtils.isAvailable(this));
|
feedbackMenuItem.setVisible(ApiAdapterFactory.getApiAdapter().isGoogleFeedbackAvailable());
|
||||||
|
|
||||||
updateMenuItems(trackId == recordingTrackId, recordingTrackPaused);
|
updateMenuItems(trackId == recordingTrackId, recordingTrackPaused);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
|
|||||||
deleteAllMenuItem = menu.findItem(R.id.track_list_delete_all);
|
deleteAllMenuItem = menu.findItem(R.id.track_list_delete_all);
|
||||||
syncNowMenuItem = menu.findItem(R.id.track_list_sync_now);
|
syncNowMenuItem = menu.findItem(R.id.track_list_sync_now);
|
||||||
feedbackMenuItem = menu.findItem(R.id.track_list_feedback);
|
feedbackMenuItem = menu.findItem(R.id.track_list_feedback);
|
||||||
feedbackMenuItem.setVisible(GoogleFeedbackUtils.isAvailable(this));
|
feedbackMenuItem.setVisible(ApiAdapterFactory.getApiAdapter().isGoogleFeedbackAvailable());
|
||||||
|
|
||||||
ApiAdapterFactory.getApiAdapter().configureSearchWidget(this, searchMenuItem, trackController);
|
ApiAdapterFactory.getApiAdapter().configureSearchWidget(this, searchMenuItem, trackController);
|
||||||
boolean isGpsStarted = TrackRecordingServiceConnectionUtils.isRecordingServiceRunning(this);
|
boolean isGpsStarted = TrackRecordingServiceConnectionUtils.isRecordingServiceRunning(this);
|
||||||
|
|||||||
@@ -75,4 +75,9 @@ public class Api14Adapter extends Api11Adapter {
|
|||||||
menuItem.expandActionView();
|
menuItem.expandActionView();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoogleFeedbackAvailable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,11 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
// Return false and allow the framework to handle the search key.
|
// Return false and allow the framework to handle the search key.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoogleFeedbackAvailable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) {
|
public int getAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) {
|
||||||
|
|||||||
@@ -192,6 +192,13 @@ public interface ApiAdapter {
|
|||||||
*/
|
*/
|
||||||
public boolean handleSearchKey(MenuItem menu);
|
public boolean handleSearchKey(MenuItem menu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if Google Feedback is available.
|
||||||
|
* <p>
|
||||||
|
* Due to changes in ApI level 14.
|
||||||
|
*/
|
||||||
|
public boolean isGoogleFeedbackAvailable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the app widget size.
|
* Gets the app widget size.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -20,16 +20,12 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for Google Feedback.
|
* Utilities for Google Feedback.
|
||||||
*
|
*
|
||||||
@@ -37,36 +33,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class GoogleFeedbackUtils {
|
public class GoogleFeedbackUtils {
|
||||||
|
|
||||||
private static final String GOOGLE_FEEDBACK_PACKAGE_NAME = "com.google.android.feedback";
|
|
||||||
private static final String TAG = GoogleFeedbackUtils.class.getSimpleName();
|
private static final String TAG = GoogleFeedbackUtils.class.getSimpleName();
|
||||||
|
|
||||||
private static Boolean available = null;
|
|
||||||
|
|
||||||
private GoogleFeedbackUtils() {}
|
private GoogleFeedbackUtils() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the Google Feedback is available.
|
|
||||||
*
|
|
||||||
* @param context the context
|
|
||||||
*/
|
|
||||||
public static boolean isAvailable(Context context) {
|
|
||||||
if (available == null) {
|
|
||||||
List<ResolveInfo> infos = context.getPackageManager().queryIntentServices(
|
|
||||||
new Intent(Intent.ACTION_BUG_REPORT), PackageManager.MATCH_DEFAULT_ONLY);
|
|
||||||
for (ResolveInfo info : infos) {
|
|
||||||
if (info.serviceInfo != null && info.serviceInfo.packageName != null
|
|
||||||
&& info.serviceInfo.packageName.equals(GOOGLE_FEEDBACK_PACKAGE_NAME)) {
|
|
||||||
available = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (available == null) {
|
|
||||||
available = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return available;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the Google Feedback service.
|
* Binds the Google Feedback service.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user