codesyle cringe
This commit is contained in:
@@ -90,18 +90,18 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
* generating a proxy if needed.
|
||||
*/
|
||||
public static ILibVkxService asInterface(android.os.IBinder obj){
|
||||
if((obj == null)){
|
||||
if ((obj == null)) {
|
||||
return null;
|
||||
}
|
||||
android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
|
||||
if(((iin != null) && (iin instanceof ILibVkxService))){
|
||||
if (((iin != null) && (iin instanceof ILibVkxService))) {
|
||||
return ((ILibVkxService) iin);
|
||||
}
|
||||
return new Proxy(obj);
|
||||
}
|
||||
|
||||
public static boolean setDefaultImpl(ILibVkxService impl){
|
||||
if(Proxy.sDefaultImpl == null && impl != null){
|
||||
if (Proxy.sDefaultImpl == null && impl != null) {
|
||||
Proxy.sDefaultImpl = impl;
|
||||
return true;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
_data.writeInt(index);
|
||||
_data.writeString(playbackContext);
|
||||
boolean _status = mRemote.transact(Stub.TRANSACTION_play, _data, _reply, 0);
|
||||
if(!_status && getDefaultImpl() != null){
|
||||
if (!_status && getDefaultImpl() != null) {
|
||||
getDefaultImpl().play(audio_ids, index, playbackContext);
|
||||
return;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
try {
|
||||
_data.writeInterfaceToken(DESCRIPTOR);
|
||||
boolean _status = mRemote.transact(Stub.TRANSACTION_getUserId, _data, _reply, 0);
|
||||
if(!_status && getDefaultImpl() != null){
|
||||
if (!_status && getDefaultImpl() != null) {
|
||||
return getDefaultImpl().getUserId();
|
||||
}
|
||||
_reply.readException();
|
||||
@@ -261,7 +261,7 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
_data.writeInt(owner_id);
|
||||
_data.writeString(access_key);
|
||||
boolean _status = mRemote.transact(Stub.TRANSACTION_addTrackToCache, _data, _reply, 0);
|
||||
if(!_status && getDefaultImpl() != null){
|
||||
if (!_status && getDefaultImpl() != null) {
|
||||
getDefaultImpl().addTrackToCache(track_id, owner_id, access_key);
|
||||
return;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
_data.writeInt(track_id);
|
||||
_data.writeInt(owner_id);
|
||||
boolean _status = mRemote.transact(Stub.TRANSACTION_deleteTrackFromCache, _data, _reply, 0);
|
||||
if(!_status && getDefaultImpl() != null){
|
||||
if (!_status && getDefaultImpl() != null) {
|
||||
getDefaultImpl().deleteTrackFromCache(track_id, owner_id);
|
||||
return;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
_data.writeInt(track_id);
|
||||
_data.writeInt(owner_id);
|
||||
boolean _status = mRemote.transact(Stub.TRANSACTION_isTrackCached, _data, _reply, 0);
|
||||
if(!_status && getDefaultImpl() != null){
|
||||
if (!_status && getDefaultImpl() != null) {
|
||||
return getDefaultImpl().isTrackCached(track_id, owner_id);
|
||||
}
|
||||
_reply.readException();
|
||||
@@ -324,7 +324,7 @@ public interface ILibVkxService extends android.os.IInterface{
|
||||
try {
|
||||
_data.writeInterfaceToken(DESCRIPTOR);
|
||||
boolean _status = mRemote.transact(Stub.TRANSACTION_getCache, _data, _reply, 0);
|
||||
if(!_status && getDefaultImpl() != null){
|
||||
if (!_status && getDefaultImpl() != null) {
|
||||
return getDefaultImpl().getCache();
|
||||
}
|
||||
_reply.readException();
|
||||
|
||||
@@ -20,7 +20,7 @@ public class LibVKXClient{
|
||||
private static LibVKXClientImpl impl;
|
||||
|
||||
public static LibVKXClientImpl getInstance(Context context){
|
||||
if(impl == null){
|
||||
if (impl == null) {
|
||||
impl = new LibVKXClientImpl(context);
|
||||
}
|
||||
return impl;
|
||||
@@ -40,7 +40,7 @@ public class LibVKXClient{
|
||||
}
|
||||
|
||||
public static boolean play(MusicTrack musicTrack, List<MusicTrack> list, MusicPlaybackLaunchContext playerRefer){
|
||||
if(!isIntegrationEnabled()){
|
||||
if (!isIntegrationEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class LibVKXClient{
|
||||
while(it.hasNext()) {
|
||||
arrayList.add(asId((MusicTrack) it.next()));
|
||||
}
|
||||
if(indexOf == -1){
|
||||
if (indexOf == -1) {
|
||||
indexOf = 0;
|
||||
}
|
||||
try {
|
||||
@@ -68,7 +68,7 @@ public class LibVKXClient{
|
||||
|
||||
private static String asId(MusicTrack musicTrack){
|
||||
String str = musicTrack.d + "_" + musicTrack.e;
|
||||
if(musicTrack.O == null || musicTrack.O.equals("")){
|
||||
if (musicTrack.O == null || musicTrack.O.equals("")) {
|
||||
return str;
|
||||
}
|
||||
return str + "_" + musicTrack.O;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class LibVKXClientImpl{
|
||||
}
|
||||
|
||||
public void finish(){
|
||||
if(cn != null){
|
||||
if (cn != null) {
|
||||
ctx.unbindService(cn);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class LibVKXClientImpl{
|
||||
}
|
||||
|
||||
public <T> T runOnServiceSync(LibVKXActionGeneric<T> action){
|
||||
if(serviceInstance != null){
|
||||
if (serviceInstance != null) {
|
||||
return action.run(serviceInstance);
|
||||
} else {
|
||||
return action.defaultValue();
|
||||
@@ -50,9 +50,9 @@ public class LibVKXClientImpl{
|
||||
// true - action is ran
|
||||
// false - action is failed, should fallback to default UI/UX
|
||||
public boolean runOnService(LibVKXAction action){
|
||||
if(serviceInstance != null){
|
||||
if (serviceInstance != null) {
|
||||
try {
|
||||
if(serviceInstance.getUserId() != getUserId()) return false;
|
||||
if (serviceInstance.getUserId() != getUserId()) return false;
|
||||
action.run(serviceInstance);
|
||||
return true;
|
||||
} catch (RemoteException e) {
|
||||
@@ -65,18 +65,18 @@ public class LibVKXClientImpl{
|
||||
}
|
||||
|
||||
private boolean requestServiceInit(LibVKXAction runAfterBind){
|
||||
if(!verifyBindActuality()) return false;
|
||||
if (!verifyBindActuality()) return false;
|
||||
|
||||
cn = new ServiceConnection(){
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service){
|
||||
serviceInstance = ILibVkxService.Stub.asInterface(service);
|
||||
if(serviceInstance == null){
|
||||
if (serviceInstance == null) {
|
||||
// op mycopok...
|
||||
isBindFailed = true;
|
||||
} else {
|
||||
try {
|
||||
if(serviceInstance.getUserId() != getUserId()) return;
|
||||
if (serviceInstance.getUserId() != getUserId()) return;
|
||||
runAfterBind.run(serviceInstance);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
@@ -95,7 +95,7 @@ public class LibVKXClientImpl{
|
||||
}
|
||||
|
||||
private boolean verifyBindActuality(){
|
||||
if(!checkIfAppExists()) return false; // no need
|
||||
if (!checkIfAppExists()) return false; // no need
|
||||
return !isBindFailed;
|
||||
}
|
||||
|
||||
@@ -105,10 +105,10 @@ public class LibVKXClientImpl{
|
||||
|
||||
private boolean checkIfAppExists(){
|
||||
List<ResolveInfo> resolveInfos = pm.queryIntentServices(getIntent(), 0);
|
||||
if(resolveInfos == null || resolveInfos.isEmpty()) return false;
|
||||
if (resolveInfos == null || resolveInfos.isEmpty()) return false;
|
||||
|
||||
for(ResolveInfo rs : resolveInfos) {
|
||||
if(rs.serviceInfo.packageName.equals(ClientConstants.PACKAGE)) return true;
|
||||
for (ResolveInfo rs : resolveInfos) {
|
||||
if (rs.serviceInfo.packageName.equals(ClientConstants.PACKAGE)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user