mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 12:42:56 -04:00
Add responses to user
For refusing to enable WiFi or Location Services
This commit is contained in:
parent
37b09bfa4b
commit
adeffa854b
@ -281,14 +281,6 @@ public class LocalFileTransferActivity extends AppCompatActivity implements Wifi
|
|||||||
config.deviceAddress = peerDevice.deviceAddress;
|
config.deviceAddress = peerDevice.deviceAddress;
|
||||||
config.wps.setup = WpsInfo.PBC;
|
config.wps.setup = WpsInfo.PBC;
|
||||||
|
|
||||||
/*// If self sender, then receiver will be group owner
|
|
||||||
if(isFileSender())
|
|
||||||
config.groupOwnerIntent = 0; // Sets inclination for own device. This way other device has got to be the owner.
|
|
||||||
// Maybe reset the previous wifi direct group data, which is causing a fixed group owner
|
|
||||||
|
|
||||||
*//*else
|
|
||||||
config.groupOwnerIntent = 15;*/
|
|
||||||
|
|
||||||
manager.connect(channel, config, new WifiP2pManager.ActionListener() {
|
manager.connect(channel, config, new WifiP2pManager.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@ -361,7 +353,6 @@ public class LocalFileTransferActivity extends AppCompatActivity implements Wifi
|
|||||||
Log.e(TAG, "Location permission not granted");
|
Log.e(TAG, "Location permission not granted");
|
||||||
|
|
||||||
Toast.makeText(this, "Cannot locate peer devices without location permissions", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Cannot locate peer devices without location permissions", Toast.LENGTH_LONG).show();
|
||||||
// TODO: Close activity - DONE
|
|
||||||
closeLocalFileTransferActivity();
|
closeLocalFileTransferActivity();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -372,7 +363,6 @@ public class LocalFileTransferActivity extends AppCompatActivity implements Wifi
|
|||||||
Log.e(TAG, "Storage write permission not granted");
|
Log.e(TAG, "Storage write permission not granted");
|
||||||
|
|
||||||
Toast.makeText(this, "Cannot access zim files without storage permission", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Cannot access zim files without storage permission", Toast.LENGTH_LONG).show();
|
||||||
//TODO: Close activity - DONE
|
|
||||||
closeLocalFileTransferActivity();
|
closeLocalFileTransferActivity();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -420,7 +410,12 @@ public class LocalFileTransferActivity extends AppCompatActivity implements Wifi
|
|||||||
startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), LocalFileTransferActivity.REQUEST_ENABLE_LOCATION_SERVICES);
|
startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), LocalFileTransferActivity.REQUEST_ENABLE_LOCATION_SERVICES);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton("No", null);
|
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Toast.makeText(getActivity(), "Cannot discover peers without location services", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
@ -450,7 +445,12 @@ public class LocalFileTransferActivity extends AppCompatActivity implements Wifi
|
|||||||
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton("No", null);
|
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Toast.makeText(getActivity(), "Cannot discover peers without WiFi ON", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user