forked from organicmaps/organicmaps
[android] Fixed review notes
This commit is contained in:
parent
a0e5c9b476
commit
1356d7989a
7 changed files with 23 additions and 24 deletions
android
jni/com/mapswithme/maps/uber
res/drawable-v21
src/com/mapswithme
maps
util
|
@ -14,6 +14,7 @@ jobject g_routingControllerInstance;
|
|||
jmethodID g_productConstructor;
|
||||
jmethodID g_routingControllerGetMethod;
|
||||
jmethodID g_uberInfoCallbackMethod;
|
||||
jmethodID g_uberErrorCallbackMethod;
|
||||
jclass g_uberLinksClass;
|
||||
jmethodID g_uberLinksConstructor;
|
||||
uint64_t g_lastRequestId;
|
||||
|
@ -38,6 +39,8 @@ void PrepareClassRefs(JNIEnv * env)
|
|||
g_uberInfoCallbackMethod =
|
||||
jni::GetMethodID(env, g_routingControllerInstance, "onUberInfoReceived",
|
||||
"(Lcom/mapswithme/maps/uber/UberInfo;)V");
|
||||
g_uberErrorCallbackMethod = jni::GetMethodID(env, g_routingControllerInstance,
|
||||
"onUberError", "(Ljava/lang/String;)V");
|
||||
g_uberInfoConstructor = jni::GetConstructorID(env, g_uberInfoClass,
|
||||
"([Lcom/mapswithme/maps/uber/UberInfo$Product;)V");
|
||||
g_uberLinksClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/uber/UberLinks");
|
||||
|
@ -82,10 +85,8 @@ void OnUberError(uber::ErrorCode const code, uint64_t const requestId)
|
|||
|
||||
jobject const routingControllerInstance =
|
||||
env->CallStaticObjectMethod(g_routingControllerClass, g_routingControllerGetMethod);
|
||||
static jmethodID const uberErrorMethod =
|
||||
jni::GetMethodID(env, routingControllerInstance, "onUberError", "(Ljava/lang/String;)V");
|
||||
|
||||
env->CallVoidMethod(routingControllerInstance, uberErrorMethod,
|
||||
env->CallVoidMethod(routingControllerInstance, g_uberErrorCallbackMethod,
|
||||
jni::ToJavaString(env, uber::DebugPrint(code)));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,5 +11,3 @@
|
|||
</selector>
|
||||
</item>
|
||||
</ripple>
|
||||
|
||||
|
||||
|
|
|
@ -11,5 +11,3 @@
|
|||
</selector>
|
||||
</item>
|
||||
</ripple>
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class RoutingController
|
|||
private RoutingInfo mCachedRoutingInfo;
|
||||
private boolean mUberRequestHandled;
|
||||
private boolean mUberPlanning;
|
||||
private boolean mUberInternetConnected;
|
||||
private boolean mInternetConnected;
|
||||
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private final Framework.RoutingListener mRoutingListener = new Framework.RoutingListener()
|
||||
|
@ -268,11 +268,11 @@ public class RoutingController
|
|||
mLogger.d("build");
|
||||
mUberRequestHandled = false;
|
||||
mLastBuildProgress = 0;
|
||||
mUberInternetConnected = ConnectionState.isConnected();
|
||||
mInternetConnected = ConnectionState.isConnected();
|
||||
|
||||
if (mLastRouterType == Framework.ROUTER_TYPE_TAXI)
|
||||
{
|
||||
if (!mUberInternetConnected)
|
||||
if (!mInternetConnected)
|
||||
{
|
||||
completeUberRequest();
|
||||
return;
|
||||
|
@ -541,9 +541,9 @@ public class RoutingController
|
|||
return mUberRequestHandled;
|
||||
}
|
||||
|
||||
boolean isUberInternetConnected()
|
||||
boolean isInternetConnected()
|
||||
{
|
||||
return mUberInternetConnected;
|
||||
return mInternetConnected;
|
||||
}
|
||||
|
||||
BuildState getBuildState()
|
||||
|
@ -718,8 +718,8 @@ public class RoutingController
|
|||
{
|
||||
mLogger.d("setRouterType: " + mLastRouterType + " -> " + router);
|
||||
|
||||
//Repeating tap on Uber icon should trigger the route building always,
|
||||
//because it may be "No internet connection, try later" case
|
||||
// Repeating tap on Uber icon should trigger the route building always,
|
||||
// because it may be "No internet connection, try later" case
|
||||
if (router == mLastRouterType && router != Framework.ROUTER_TYPE_TAXI)
|
||||
return;
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ public class RoutingPlanController extends ToolbarController
|
|||
|
||||
if (RoutingController.get().isUberRequestHandled())
|
||||
{
|
||||
if (!RoutingController.get().isUberInternetConnected())
|
||||
if (!RoutingController.get().isInternetConnected())
|
||||
{
|
||||
showNoInternetError();
|
||||
return;
|
||||
|
@ -448,7 +448,9 @@ public class RoutingPlanController extends ToolbarController
|
|||
|
||||
private void showNoInternetError()
|
||||
{
|
||||
RoutingToolbarButton rb = (RoutingToolbarButton) mRouterTypes.findViewById(mRouterTypes.getCheckedRadioButtonId());
|
||||
@IdRes
|
||||
int checkedId = mRouterTypes.getCheckedRadioButtonId();
|
||||
RoutingToolbarButton rb = (RoutingToolbarButton) mRouterTypes.findViewById(checkedId);
|
||||
rb.error();
|
||||
showError(R.string.uber_no_internet);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.mapswithme.util.ThemeUtils;
|
|||
|
||||
public class RoutingToolbarButton extends AppCompatRadioButton
|
||||
{
|
||||
private boolean mProgress;
|
||||
private boolean mInProgress;
|
||||
@DrawableRes
|
||||
private int mIcon;
|
||||
|
||||
|
@ -44,18 +44,18 @@ public class RoutingToolbarButton extends AppCompatRadioButton
|
|||
|
||||
public void progress()
|
||||
{
|
||||
if (mProgress)
|
||||
if (mInProgress)
|
||||
return;
|
||||
|
||||
setButtonDrawable(mIcon);
|
||||
mProgress = true;
|
||||
mInProgress = true;
|
||||
setActivated(false);
|
||||
setSelected(true);
|
||||
}
|
||||
|
||||
public void error()
|
||||
{
|
||||
mProgress = false;
|
||||
mInProgress = false;
|
||||
setSelected(false);
|
||||
setButtonDrawable(R.drawable.ic_reload);
|
||||
setActivated(true);
|
||||
|
@ -63,7 +63,7 @@ public class RoutingToolbarButton extends AppCompatRadioButton
|
|||
|
||||
public void activate()
|
||||
{
|
||||
if (!mProgress)
|
||||
if (!mInProgress)
|
||||
{
|
||||
setButtonDrawable(mIcon);
|
||||
setSelected(false);
|
||||
|
@ -73,14 +73,14 @@ public class RoutingToolbarButton extends AppCompatRadioButton
|
|||
|
||||
public void complete()
|
||||
{
|
||||
mProgress = false;
|
||||
mInProgress = false;
|
||||
activate();
|
||||
}
|
||||
|
||||
public void deactivate()
|
||||
{
|
||||
setActivated(false);
|
||||
mProgress = false;
|
||||
mInProgress = false;
|
||||
}
|
||||
|
||||
public void setButtonTintList(@ColorRes int color)
|
||||
|
|
|
@ -416,7 +416,7 @@ public class Utils
|
|||
|
||||
public static void launchUber(@NonNull Activity context, @NonNull UberLinks links)
|
||||
{
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
if (isUberInstalled(context))
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue