Commit 3ea5d43b authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Revert "Do not broadcast in 3G + info message"

As it couldn't be any other way, this broke somebody's workflow.

This reverts commit 440a12f8.
parent a172430c
......@@ -70,7 +70,7 @@
</LinearLayout>
<TextView
android:id="@+id/not_reachable_message"
android:id="@+id/unpair_message"
android:visibility="gone"
android:layout_width="match_parent"
android:drawableStart="@drawable/ic_error_outline_black_48dp"
......@@ -82,19 +82,6 @@
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:id="@+id/on_data_message"
android:visibility="gone"
android:layout_width="match_parent"
android:drawableStart="@drawable/ic_error_outline_black_48dp"
android:drawableLeft="@drawable/ic_error_outline_black_48dp"
android:drawablePadding="8dip"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/on_data_message"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<ListView
android:id="@+id/buttons_list"
android:layout_width="match_parent"
......
......@@ -193,7 +193,6 @@
<string name="device_rename_confirm">Rename</string>
<string name="refresh">Refresh</string>
<string name="unreachable_description">This paired device is not reachable. Make sure it is connected to your same network.</string>
<string name="on_data_message">It looks like you are on a mobile data connection. KDE Connect only works on local networks.</string>
<string name="no_file_browser">There are no file browsers installed.</string>
<string name="pref_plugin_telepathy">Send SMS</string>
<string name="pref_plugin_telepathy_desc">Send text messages from your desktop</string>
......
......@@ -31,7 +31,6 @@ import org.kde.kdeconnect.Backends.BaseLinkProvider;
import org.kde.kdeconnect.BackgroundService;
import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.Helpers.DeviceHelper;
import org.kde.kdeconnect.Helpers.NetworkHelper;
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
import org.kde.kdeconnect.Helpers.StringsHelper;
import org.kde.kdeconnect.NetworkPackage;
......@@ -363,11 +362,6 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
private void broadcastUdpPackage() {
if (NetworkHelper.isOnMobileNetwork(context)) {
Log.w("LanLinkProvider", "On 3G network, not sending broadcast.");
return;
}
new Thread(new Runnable() {
@Override
public void run() {
......
......@@ -119,7 +119,7 @@ public class BackgroundService extends Service {
}
};
public void onDeviceListChanged() {
private void onDeviceListChanged() {
for(DeviceListChangedCallback callback : deviceListChangedCallbacks.values()) {
callback.onDeviceListChanged();
}
......
package org.kde.kdeconnect.Helpers;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
public class NetworkHelper {
public static boolean isOnMobileNetwork(Context context) {
final ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connMgr.getActiveNetworkInfo();
return (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE);
}
}
......@@ -67,7 +67,6 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
@Override
public void onServiceStart(BackgroundService service) {
service.onDeviceListChanged();
service.onNetworkChange();
}
});
......
......@@ -40,7 +40,6 @@ import android.widget.TextView;
import org.kde.kdeconnect.BackgroundService;
import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.Helpers.NetworkHelper;
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.UserInterface.List.CustomItem;
......@@ -334,11 +333,9 @@ public class DeviceFragment extends Fragment {
boolean paired = device.isPaired();
boolean reachable = device.isReachable();
boolean onData = NetworkHelper.isOnMobileNetwork(getContext());
rootView.findViewById(R.id.pairing_buttons).setVisibility(paired ? View.GONE : View.VISIBLE);
rootView.findViewById(R.id.not_reachable_message).setVisibility((paired && !reachable && !onData) ? View.VISIBLE : View.GONE);
rootView.findViewById(R.id.on_data_message).setVisibility((paired && !reachable && onData) ? View.VISIBLE : View.GONE);
rootView.findViewById(R.id.unpair_message).setVisibility((paired && !reachable) ? View.VISIBLE : View.GONE);
try {
ArrayList<ListAdapter.Item> items = new ArrayList<>();
......
......@@ -36,7 +36,6 @@ import android.widget.TextView;
import org.kde.kdeconnect.BackgroundService;
import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.Helpers.NetworkHelper;
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
import org.kde.kdeconnect.UserInterface.List.PairingDeviceItem;
import org.kde.kdeconnect.UserInterface.List.SectionItem;
......@@ -61,8 +60,6 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
boolean listRefreshCalledThisFrame = false;
TextView headerText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
......@@ -77,10 +74,10 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
rootView = inflater.inflate(R.layout.activity_list, container, false);
headerText = new TextView(inflater.getContext());
headerText.setText(getString(R.string.pairing_description));
headerText.setPadding(0, (int) (16 * getResources().getDisplayMetrics().density), 0, (int) (12 * getResources().getDisplayMetrics().density));
((ListView) rootView).addHeaderView(headerText);
TextView text = new TextView(inflater.getContext());
text.setText(getString(R.string.pairing_description));
text.setPadding(0, (int) (16 * getResources().getDisplayMetrics().density), 0, (int) (12 * getResources().getDisplayMetrics().density));
((ListView) rootView).addHeaderView(text);
return rootView;
}
......@@ -107,8 +104,6 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
}
listRefreshCalledThisFrame = true;
headerText.setText(getString(NetworkHelper.isOnMobileNetwork(getContext()) ? R.string.on_data_message : R.string.pairing_description));
try {
Collection<Device> devices = service.getDevices().values();
final ArrayList<ListAdapter.Item> items = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment