conflict_resolution
stringlengths
27
16k
<<<<<<< tabPreferences.put(BriefcasePreferences.AGGREGATE_1_0_URL, destinationServerInfo.getUrl()); tabPreferences.put(BriefcasePreferences.USERNAME, destinationServerInfo.getUsername()); ======= formTransferTable.setSourceSelected(!TextUtils.isEmpty(txtDestinationName.getText())); PREFERENCES.put(BriefcasePreferences.AGGREGATE_1_0_URL, destinationServerInfo.getUrl()); PREFERENCES.put(BriefcasePreferences.USERNAME, destinationServerInfo.getUsername()); >>>>>>> formTransferTable.setSourceSelected(!TextUtils.isEmpty(txtDestinationName.getText())); tabPreferences.put(BriefcasePreferences.AGGREGATE_1_0_URL, destinationServerInfo.getUrl()); tabPreferences.put(BriefcasePreferences.USERNAME, destinationServerInfo.getUsername());
<<<<<<< private final ILogger logger = Logger.getLogger(InMemoryXmlConfig.class); ======= private final static ILogger logger = Logger.getLogger(InMemoryXmlConfig.class.getName()); >>>>>>> private final static ILogger logger = Logger.getLogger(InMemoryXmlConfig.class);
<<<<<<< ======= private boolean seriesMetadataDatasource = true; private final BooleanSettingDefinition categorySupportDefiniton = createCategorySupportDefinition(); >>>>>>> <<<<<<< ======= protected BooleanSettingDefinition createTransactionalDefinition() { return new BooleanSettingDefinition().setDefaultValue(TRANSACTIONAL_DEFAULT_VALUE) .setTitle(TRANSACTIONAL_TITLE).setDescription(TRANSACTIONAL_DESCRIPTION).setGroup(ADVANCED_GROUP) .setOrder(SettingDefinitionProvider.ORDER_4).setKey(TRANSACTIONAL_KEY); } protected BooleanSettingDefinition createMultilingualismDefinition() { return new BooleanSettingDefinition().setDefaultValue(MULTILINGUALISM_DEFAULT_VALUE) .setTitle(MULTILINGUALISM_TITLE).setDescription(MULTILINGUALISM_DESCRIPTION).setGroup(ADVANCED_GROUP) .setOrder(SettingDefinitionProvider.ORDER_5).setKey(MULTILINGUALISM_KEY); } /** * Create settings definition for sereis metadata support * * @return Series metadata support settings definition */ >>>>>>> <<<<<<< return paths; ======= if (DatabaseConcept.SERIES_CONCEPT.equals(databaseConcept)) { Boolean t = (Boolean) settings.get(categorySupportDefiniton.getKey()); if (t != null && t) { config.addDirectory(resource(HIBERNATE_MAPPING_SERIES_CATEGORY_PATH)); } else { config.addDirectory(resource(HIBERNATE_MAPPING_SERIES_DEFAULT_PATH)); } } if (isSetSchema(settings)) { Properties properties = new Properties(); properties.put(HibernateConstants.DEFAULT_SCHEMA, settings.get(HibernateConstants.DEFAULT_SCHEMA)); config.addProperties(properties); } config.buildMappings(); return config; >>>>>>> return paths;
<<<<<<< public static final String QUEUE_SERVICE_NAME = "hz:impl:queueService"; ======= public static final String SERVICE_NAME = "hz:impl:queueService"; >>>>>>> public static final String SERVICE_NAME = "hz:impl:queueService"; <<<<<<< public void init(NodeEngine nodeEngine, Properties properties) { registerClientOperationHandlers(); } ======= >>>>>>> public void init(NodeEngine nodeEngine, Properties properties) { registerClientOperationHandlers(); }
<<<<<<< private NodeEngineImpl nodeEngine; private ICacheService cacheService; ======= private final NodeEngine nodeEngine; private final CacheService cacheService; >>>>>>> private final NodeEngine nodeEngine; private final ICacheService cacheService;
<<<<<<< private final ConstructorFunction<ObjectNamespace, LockStoreImpl> lockStoreConstructor = new ConstructorFunction<ObjectNamespace, LockStoreImpl>() { public LockStoreImpl createNew(ObjectNamespace key) { return new LockStoreImpl(key, 1, 0, lockService); ======= private final ConstructorFunction<ILockNamespace, LockStoreImpl> lockStoreConstructor = new ConstructorFunction<ILockNamespace, LockStoreImpl>() { public LockStoreImpl createNew(ILockNamespace key) { return new LockStoreImpl(key, 1, 0); >>>>>>> private final ConstructorFunction<ObjectNamespace, LockStoreImpl> lockStoreConstructor = new ConstructorFunction<ObjectNamespace, LockStoreImpl>() { public LockStoreImpl createNew(ObjectNamespace key) { return new LockStoreImpl(key, 1, 0, lockService); <<<<<<< LockStoreImpl getLockStore(ObjectNamespace namespace) { return lockStores.get(namespace); } Collection<LockStoreImpl> getLockStores() { ======= public Collection<LockStoreImpl> getLockStores() { >>>>>>> public Collection<LockStoreImpl> getLockStores() { LockStoreImpl getLockStore(ObjectNamespace namespace) { return lockStores.get(namespace); } Collection<LockStoreImpl> getLockStores() {
<<<<<<< private String startupLog; private String startupExceptionLog; ======= >>>>>>> private String startupLog; private String startupExceptionLog; <<<<<<< public String getStartupLog() { return startupLog; } public String getStartupExceptionLog() { return startupExceptionLog; } ======= public PlaceHolderManager getPlaceHolderManager() { return placeHolderManager; } >>>>>>> public String getStartupLog() { return startupLog; } public String getStartupExceptionLog() { return startupExceptionLog; } public PlaceHolderManager getPlaceHolderManager() { return placeHolderManager; }
<<<<<<< import com.hazelcast.concurrent.atomiclong.client.AddAndGetHandler; import com.hazelcast.concurrent.atomiclong.client.GetAndAddHandler; import com.hazelcast.concurrent.atomiclong.client.CompareAndSetHandler; ======= >>>>>>> import com.hazelcast.concurrent.atomiclong.client.AddAndGetHandler; import com.hazelcast.concurrent.atomiclong.client.GetAndAddHandler; import com.hazelcast.concurrent.atomiclong.client.CompareAndSetHandler;
<<<<<<< import com.hazelcast.core.ICompletableFuture; ======= import com.hazelcast.client.spi.impl.ClientCallFuture; import com.hazelcast.core.CompletableFuture; >>>>>>> import com.hazelcast.core.ICompletableFuture; <<<<<<< ICompletableFuture<T> f = getContext().getExecutionService().submit(new Callable<T>() { public T call() throws Exception { return invoke(request, address); } }); ======= CompletableFuture<T> f = invokeFuture(request); >>>>>>> ICompletableFuture<T> f = invokeFuture(request); <<<<<<< private Data toData(Object o) { return getContext().getSerializationService().toData(o); } private <T> T invoke(Object request, Address target) { try { return getContext().getInvocationService().invokeOnTarget(request, target); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } } private <T> T invoke(Object request) { try { return getContext().getInvocationService().invokeOnRandomTarget(request); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } } private <T> ICompletableFuture<T> checkSync(ICompletableFuture<T> f) { ======= private <T> CompletableFuture<T> checkSync(CompletableFuture<T> f) { >>>>>>> private <T> ICompletableFuture<T> checkSync(ICompletableFuture<T> f) {
<<<<<<< public QueueContainer(String name, NodeEngine nodeEngine, QueueService service) throws Exception { this(); this.name = name; this.partitionId = nodeEngine.getPartitionService().getPartitionId(nodeEngine.getSerializationService().toData(name, QueueService.PARTITIONING_STRATEGY)); setConfig(nodeEngine.getConfig().getQueueConfig(name), nodeEngine, service); ======= public QueueContainer(String name, QueueConfig config, NodeEngine nodeEngine, QueueService service) throws Exception { this(name); setConfig(config, nodeEngine, service); >>>>>>> public QueueContainer(String name, QueueConfig config, NodeEngine nodeEngine, QueueService service) throws Exception { this(name); setConfig(config, nodeEngine, service); <<<<<<< txMap.put(item.getItemId(), item); return item; ======= txMap.put(item.getItemId(), new TxQueueItem(item).setPollOperation(true).setTransactionId(transactionId)); return item; >>>>>>> txMap.put(item.getItemId(), new TxQueueItem(item).setPollOperation(true).setTransactionId(transactionId)); return item; <<<<<<< out.writeUTF(name); out.writeInt(partitionId); ======= >>>>>>> out.writeUTF(name); <<<<<<< name = in.readUTF(); partitionId = in.readInt(); ======= >>>>>>> name = in.readUTF();
<<<<<<< int size = 10000; TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3); ======= int size = 100000; StaticNodeFactory nodeFactory = createNodeFactory(3); >>>>>>> int size = 100000; TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3);
<<<<<<< TransactionalService, RemoteService, ClientProtocolService { ======= TransactionalService, RemoteService, EventPublishingService<EntryEvent, EntryListener> { >>>>>>> TransactionalService, RemoteService, EventPublishingService<EntryEvent, EntryListener>, ClientProtocolService { <<<<<<< private Map<String, ClientCommandHandler> commandHandlers = new HashMap<String, ClientCommandHandler>(); ======= private final ConcurrentMap<ListenerKey, String> eventRegistrations; >>>>>>> private Map<String, ClientCommandHandler> commandHandlers = new HashMap<String, ClientCommandHandler>(); private final ConcurrentMap<ListenerKey, String> eventRegistrations; <<<<<<< nodeService.scheduleWithFixedDelay(new CleanupTask(), 1, 1, TimeUnit.SECONDS); registerClientOperationHandlers(); } private void registerClientOperationHandlers() { registerHandler("MGET", new MapGetHandler(this)); } void registerHandler(String command, ClientCommandHandler handler) { commandHandlers.put(command, handler); ======= mapsWithTTL.add("mapp"); nodeEngine.getExecutionService().scheduleAtFixedRate(new CleanupTask(), 1, 1, TimeUnit.SECONDS); >>>>>>> mapsWithTTL.add("mapp"); nodeEngine.getExecutionService().scheduleAtFixedRate(new CleanupTask(), 1, 1, TimeUnit.SECONDS); registerClientOperationHandlers(); } private void registerClientOperationHandlers() { registerHandler("MGET", new MapGetHandler(this)); } void registerHandler(String command, ClientCommandHandler handler) { commandHandlers.put(command, handler); <<<<<<< public void memberAdded(final MemberImpl member) { ======= public void memberAdded(final MembershipServiceEvent membershipEvent) { >>>>>>> public void memberAdded(final MembershipServiceEvent membershipEvent) { <<<<<<< public Map<String, ClientCommandHandler> getCommandMap() { return commandHandlers; ======= public void publishEvent(String mapName, Data key, EntryEvent event) { Collection<EventRegistration> candidates = nodeEngine.getEventService().getRegistrations(MAP_SERVICE_NAME, mapName); Set<EventRegistration> registrationsWithValue = new HashSet<EventRegistration>(); Set<EventRegistration> registrationsWithoutValue = new HashSet<EventRegistration>(); for (EventRegistration candidate : candidates) { EntryEventFilter filter = (EntryEventFilter) candidate.getFilter(); if (filter.eval(key)) { if (filter.isIncludeValue()) { registrationsWithValue.add(candidate); } else { registrationsWithoutValue.add(candidate); } } } nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME, registrationsWithValue, event); nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME, registrationsWithoutValue, event.cloneWithoutValues()); } public void addEventListener(EntryListener entryListener, EventFilter eventFilter, String mapName) { EventRegistration registration = nodeEngine.getEventService().registerListener(MAP_SERVICE_NAME, mapName, eventFilter, entryListener); eventRegistrations.put(new ListenerKey(entryListener, ((EntryEventFilter)eventFilter).getKey()), registration.getId()); } public void removeEventListener(EntryListener entryListener, String mapName, Object key) { String registrationId = eventRegistrations.get(new ListenerKey(entryListener, key)); nodeEngine.getEventService().deregisterListener(MAP_SERVICE_NAME, mapName, registrationId); } public void dispatchEvent(EntryEvent event, EntryListener listener) { switch (event.getEventType()) { case ADDED: listener.entryAdded(event); break; case EVICTED: listener.entryEvicted(event); break; case UPDATED: listener.entryUpdated(event); break; case REMOVED: listener.entryRemoved(event); break; } >>>>>>> public Map<String, ClientCommandHandler> getCommandMap() { return commandHandlers; } public void publishEvent(String mapName, Data key, EntryEvent event) { Collection<EventRegistration> candidates = nodeEngine.getEventService().getRegistrations(MAP_SERVICE_NAME, mapName); Set<EventRegistration> registrationsWithValue = new HashSet<EventRegistration>(); Set<EventRegistration> registrationsWithoutValue = new HashSet<EventRegistration>(); for (EventRegistration candidate : candidates) { EntryEventFilter filter = (EntryEventFilter) candidate.getFilter(); if (filter.eval(key)) { if (filter.isIncludeValue()) { registrationsWithValue.add(candidate); } else { registrationsWithoutValue.add(candidate); } } } nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME, registrationsWithValue, event); nodeEngine.getEventService().publishEvent(MAP_SERVICE_NAME, registrationsWithoutValue, event.cloneWithoutValues()); } public void addEventListener(EntryListener entryListener, EventFilter eventFilter, String mapName) { EventRegistration registration = nodeEngine.getEventService().registerListener(MAP_SERVICE_NAME, mapName, eventFilter, entryListener); eventRegistrations.put(new ListenerKey(entryListener, ((EntryEventFilter) eventFilter).getKey()), registration.getId()); } public void removeEventListener(EntryListener entryListener, String mapName, Object key) { String registrationId = eventRegistrations.get(new ListenerKey(entryListener, key)); nodeEngine.getEventService().deregisterListener(MAP_SERVICE_NAME, mapName, registrationId); } public void dispatchEvent(EntryEvent event, EntryListener listener) { switch (event.getEventType()) { case ADDED: listener.entryAdded(event); break; case EVICTED: listener.entryEvicted(event); break; case UPDATED: listener.entryUpdated(event); break; case REMOVED: listener.entryRemoved(event); break; }
<<<<<<< targetAddress = joinInfo.address; sendClusterMergeToOthers(targetAddress); node.hazelcastInstance.getLifecycleService().restart(); ======= targetAddress = joinInfo.address; node.clusterManager.sendClusterMergeToOthers(targetAddress); splitBrainHandler.restart(); >>>>>>> targetAddress = joinInfo.address; sendClusterMergeToOthers(targetAddress); splitBrainHandler.restart();
<<<<<<< import com.hazelcast.impl.map.MapService; ======= >>>>>>> import com.hazelcast.impl.map.MapService; <<<<<<< mput.putTransient(name, key, value, ttl); } ======= mput.putTransient(name, key, value, timeout, ttl); } >>>>>>> mput.putTransient(name, key, value, ttl); }
<<<<<<< private final GetShareTokenLogic getShareTokenLogic; private final RefreshShareTokenLogic refreshShareTokenLogic; private final GetSharedDashLogic getSharedDashLogic; ======= private final AppMailLogic appMailLogic; >>>>>>> private final AppMailLogic appMailLogic; private final GetShareTokenLogic getShareTokenLogic; private final RefreshShareTokenLogic refreshShareTokenLogic; private final GetSharedDashLogic getSharedDashLogic; <<<<<<< this.token = new GetTokenLogic(userRegistry); this.hardwareApp = new HardwareAppLogic(sessionsHolder); this.refreshToken = new RefreshTokenLogic(userRegistry); this.graphData = new GetGraphDataLogic(storageDao); this.getShareTokenLogic = new GetShareTokenLogic(userRegistry); this.refreshShareTokenLogic = new RefreshShareTokenLogic(userRegistry); this.getSharedDashLogic = new GetSharedDashLogic(userRegistry); ======= this.token = new GetTokenLogic(userDao); this.hardwareApp = new HardwareAppLogic(sessionDao); this.refreshToken = new RefreshTokenLogic(userDao); this.graphData = new GetGraphDataLogic(reportingDao); this.appMailLogic = new AppMailLogic(notificationsProcessor); >>>>>>> this.token = new GetTokenLogic(userDao); this.hardwareApp = new HardwareAppLogic(sessionDao); this.refreshToken = new RefreshTokenLogic(userDao); this.graphData = new GetGraphDataLogic(reportingDao); this.appMailLogic = new AppMailLogic(notificationsProcessor); this.getShareTokenLogic = new GetShareTokenLogic(userDao); this.refreshShareTokenLogic = new RefreshShareTokenLogic(userDao); this.getSharedDashLogic = new GetSharedDashLogic(userDao); <<<<<<< case GET_SHARE_TOKEN : getShareTokenLogic.messageReceived(ctx, state.user, msg); break; case REFRESH_SHARE_TOKEN : refreshShareTokenLogic.messageReceived(ctx, state.user, msg); break; case GET_SHARED_DASH : getSharedDashLogic.messageReceived(ctx, msg); break; ======= case EMAIL : appMailLogic.messageReceived(ctx, state.user, msg); break; >>>>>>> case GET_SHARE_TOKEN : getShareTokenLogic.messageReceived(ctx, state.user, msg); break; case REFRESH_SHARE_TOKEN : refreshShareTokenLogic.messageReceived(ctx, state.user, msg); break; case GET_SHARED_DASH : getSharedDashLogic.messageReceived(ctx, msg); break; case EMAIL : appMailLogic.messageReceived(ctx, state.user, msg); break;
<<<<<<< AppLoginHandler appLoginHandler = new AppLoginHandler(userRegistry, sessionsHolder); AppShareLoginHandler appShareLoginHandler = new AppShareLoginHandler(userRegistry, sessionsHolder); ======= AppLoginHandler appLoginHandler = new AppLoginHandler(props, userRegistry, sessionsHolder, storageDao); >>>>>>> AppLoginHandler appLoginHandler = new AppLoginHandler(props, userRegistry, sessionsHolder, storageDao); AppShareLoginHandler appShareLoginHandler = new AppShareLoginHandler(userRegistry, sessionsHolder); <<<<<<< pipeline.addLast(appShareLoginHandler); pipeline.addLast(appHandler); ======= pipeline.addLast(new UserNotLoggerHandler()); >>>>>>> pipeline.addLast(new UserNotLoggerHandler());
<<<<<<< import cc.blynk.server.dao.graph.GraphKey; import cc.blynk.server.storage.reporting.average.AverageAggregator; ======= import cc.blynk.server.model.enums.PinType; import cc.blynk.server.model.graph.GraphKey; import cc.blynk.server.model.graph.StoreMessage; import cc.blynk.server.reporting.average.AverageAggregator; >>>>>>> import cc.blynk.server.model.enums.PinType; import cc.blynk.server.model.graph.GraphKey; import cc.blynk.server.model.graph.StoreMessage; import cc.blynk.server.reporting.average.AverageAggregator; import cc.blynk.server.dao.graph.GraphKey; import cc.blynk.server.storage.reporting.average.AverageAggregator;
<<<<<<< private final ILogger logger = Logger.getLogger(ClasspathXmlConfig.class); ======= private final static ILogger logger = Logger.getLogger(ClasspathXmlConfig.class.getName()); >>>>>>> private final static ILogger logger = Logger.getLogger(ClasspathXmlConfig.class);
<<<<<<< threadContext = new ThreadContext(Thread.currentThread()); mapContexts.put(currentThread, threadContext); Iterator<Entry<Thread,ThreadContext>> threads = mapContexts.entrySet().iterator(); while (threads.hasNext()) { Entry<Thread, ThreadContext> entry = threads.next(); if (!entry.getKey().isAlive()) { entry.getValue().destroy(); threads.remove(); ======= try { threadContext = new ThreadContext(Thread.currentThread()); mapContexts.put(currentThread, threadContext); Iterator<Thread> threads = mapContexts.keySet().iterator(); while (threads.hasNext()) { Thread thread = threads.next(); if (!thread.isAlive()) { threads.remove(); } >>>>>>> try { threadContext = new ThreadContext(Thread.currentThread()); mapContexts.put(currentThread, threadContext); Iterator<Entry<Thread,ThreadContext>> threads = mapContexts.entrySet().iterator(); while (threads.hasNext()) { Entry<Thread, ThreadContext> entry = threads.next(); if (!entry.getKey().isAlive()) { entry.getValue().destroy(); threads.remove(); }
<<<<<<< import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.n52.iceland.convert.ConverterException; import org.n52.iceland.ds.ConnectionProvider; import org.n52.iceland.exception.CodedException; import org.n52.iceland.exception.ows.NoApplicableCodeException; import org.n52.iceland.exception.ows.OwsExceptionReport; import org.n52.iceland.exception.ows.concrete.NotYetSupportedException; import org.n52.iceland.i18n.LocaleHelper; import org.n52.iceland.ogc.ows.OWSConstants.ExtendedIndeterminateTime; import org.n52.iceland.ogc.ows.ServiceMetadataRepository; import org.n52.iceland.ogc.sos.ConformanceClasses; import org.n52.iceland.ogc.sos.Sos1Constants; import org.n52.iceland.ogc.sos.Sos2Constants; import org.n52.iceland.ogc.sos.SosConstants; import org.n52.iceland.service.ServiceConfiguration; import org.n52.iceland.util.CollectionHelper; import org.n52.iceland.util.http.HTTPStatus; import org.n52.sos.ds.AbstractGetObservationHandler; import org.n52.sos.ds.FeatureQueryHandler; import org.n52.sos.ds.hibernate.dao.AbstractObservationDAO; ======= import org.n52.sos.convert.ConverterException; import org.n52.sos.ds.AbstractGetObservationDAO; import org.n52.sos.ds.HibernateDatasourceConstants; >>>>>>> import org.n52.iceland.convert.ConverterException; import org.n52.iceland.ds.ConnectionProvider; import org.n52.iceland.exception.CodedException; import org.n52.iceland.exception.ows.NoApplicableCodeException; import org.n52.iceland.exception.ows.OwsExceptionReport; import org.n52.iceland.exception.ows.concrete.NotYetSupportedException; import org.n52.iceland.ogc.ows.OWSConstants.ExtendedIndeterminateTime; import org.n52.iceland.ogc.ows.ServiceMetadataRepository; import org.n52.iceland.ogc.sos.ConformanceClasses; import org.n52.iceland.ogc.sos.Sos1Constants; import org.n52.iceland.ogc.sos.Sos2Constants; import org.n52.iceland.ogc.sos.SosConstants; import org.n52.iceland.service.ServiceConfiguration; import org.n52.iceland.util.CollectionHelper; import org.n52.iceland.util.http.HTTPStatus; import org.n52.sos.ds.AbstractGetObservationHandler; import org.n52.sos.ds.FeatureQueryHandler; <<<<<<< @Inject public void setServiceMetadataRepository(ServiceMetadataRepository repo) { this.serviceMetadataRepository = repo; } @Inject public void setConnectionProvider(ConnectionProvider connectionProvider) { this.sessionHolder = new HibernateSessionHolder(connectionProvider); ======= @Override public String getDatasourceDaoIdentifier() { return HibernateDatasourceConstants.ORM_DATASOURCE_DAO_IDENTIFIER; >>>>>>> @Inject public void setServiceMetadataRepository(ServiceMetadataRepository repo) { this.serviceMetadataRepository = repo; } @Inject public void setConnectionProvider(ConnectionProvider connectionProvider) { this.sessionHolder = new HibernateSessionHolder(connectionProvider); <<<<<<< final List<OmObservation> result = new LinkedList<OmObservation>(); Collection<SeriesObservation> seriesObservations = Lists.newArrayList(); ======= final List<OmObservation> result = new LinkedList<>(); Collection<SeriesObservation<?>> seriesObservations = Lists.newArrayList(); >>>>>>> final List<OmObservation> result = new LinkedList<>(); Collection<SeriesObservation<?>> seriesObservations = Lists.newArrayList();
<<<<<<< ======= ensureNotFreed(); modified.set(true); >>>>>>> modified.set(true); <<<<<<< ======= ensureNotFreed(); modified.set(true); >>>>>>> modified.set(true); <<<<<<< getDoubleBuffer().put(i,element); ======= modified.set(true); ensureNotFreed(); data[i] = element; >>>>>>> modified.set(true); getDoubleBuffer().put(i,element);
<<<<<<< ProxyRegistry registry = getOrPutIfAbsent(registries, serviceName, registryConstructor); registry.createProxy(name, true, true); ======= ProxyRegistry registry = ConcurrencyUtil.getOrPutIfAbsent(registries, serviceName, registryConstructor); registry.getOrCreateProxy(name, true, true); >>>>>>> ProxyRegistry registry = getOrPutIfAbsent(registries, serviceName, registryConstructor); registry.createProxy(name, true, true); <<<<<<< final ProxyRegistry registry = getOrPutIfAbsent(proxyService.registries, proxy.serviceName, proxyService.registryConstructor); final DistributedObject object = registry.createProxy(proxy.objectName, false, false); if (object != null && object instanceof InitializingObject) { nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR, new Runnable() { public void run() { try { ((InitializingObject) object).initialize(); } catch (Exception e) { getLogger().warning("Error while initializing proxy: " + object, e); ======= final ProxyRegistry registry = ConcurrencyUtil .getOrPutIfAbsent(proxyService.registries, proxy.serviceName, proxyService.registryConstructor); DistributedObjectFuture future = registry.createProxy(proxy.objectName, false, false); if (future != null) { final DistributedObject object = future.get(); if (object instanceof InitializingObject) { nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR, new Runnable() { public void run() { try { ((InitializingObject) object).initialize(); } catch (Exception e) { getLogger().warning("Error while initializing proxy: " + object, e); } >>>>>>> final ProxyRegistry registry = getOrPutIfAbsent(proxyService.registries, proxy.serviceName, proxyService.registryConstructor); DistributedObjectFuture future = registry.createProxy(proxy.objectName, false, false); if (future != null) { final DistributedObject object = future.get(); if (object instanceof InitializingObject) { nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR, new Runnable() { public void run() { try { ((InitializingObject) object).initialize(); } catch (Exception e) { getLogger().warning("Error while initializing proxy: " + object, e); }
<<<<<<< import com.hazelcast.test.RandomBlockJUnit4ClassRunner; ======= import com.hazelcast.instance.StaticNodeFactory; >>>>>>> import com.hazelcast.test.RandomBlockJUnit4ClassRunner; import com.hazelcast.instance.StaticNodeFactory;
<<<<<<< /** * Issue #923 */ @Test public void testPartitionAwareKey() { String name = "testPartitionAwareKey"; PartitionAwareKey key = new PartitionAwareKey("key", "123"); String value = "value"; IMap<Object, Object> map1 = server.getMap(name); map1.put(key, value); assertEquals(value, map1.get(key)); IMap<Object, Object> map2 = hz.getMap(name); assertEquals(value, map2.get(key)); } private static class PartitionAwareKey implements PartitionAware, Serializable { private final String key; private final String pk; private PartitionAwareKey(String key, String pk) { this.key = key; this.pk = pk; } @Override public Object getPartitionKey() { return pk; } } ======= /** * Issue #996 */ @Test public void testEntryListener() throws InterruptedException { final CountDownLatch gateAdd = new CountDownLatch(2); final CountDownLatch gateRemove = new CountDownLatch(1); final CountDownLatch gateEvict = new CountDownLatch(1); final CountDownLatch gateUpdate = new CountDownLatch(1); final String mapName = "testEntryListener"; final IMap<Object, Object> serverMap = server.getMap(mapName); serverMap.put(3, new Deal(3)); final IMap<Object, Object> clientMap = hz.getMap(mapName); assertEquals(1, clientMap.size()); final EntryListener listener = new EntListener(gateAdd, gateRemove, gateEvict, gateUpdate); clientMap.addEntryListener(listener, new SqlPredicate("id=1"), 2, true); clientMap.put(2, new Deal(1)); clientMap.put(2, new Deal(1)); clientMap.remove(2); clientMap.put(2, new Deal(1)); clientMap.evict(2); assertTrue(gateAdd.await(10, TimeUnit.SECONDS)); assertTrue(gateRemove.await(10, TimeUnit.SECONDS)); assertTrue(gateEvict.await(10, TimeUnit.SECONDS)); assertTrue(gateUpdate.await(10, TimeUnit.SECONDS)); } static class EntListener implements EntryListener<Integer, Deal>, Serializable { private final CountDownLatch _gateAdd; private final CountDownLatch _gateRemove; private final CountDownLatch _gateEvict; private final CountDownLatch _gateUpdate; EntListener(CountDownLatch gateAdd, CountDownLatch gateRemove, CountDownLatch gateEvict, CountDownLatch gateUpdate) { _gateAdd = gateAdd; _gateRemove = gateRemove; _gateEvict = gateEvict; _gateUpdate = gateUpdate; } @Override public void entryAdded(EntryEvent<Integer, Deal> arg0) { _gateAdd.countDown(); } @Override public void entryEvicted(EntryEvent<Integer, Deal> arg0) { _gateEvict.countDown(); } @Override public void entryRemoved(EntryEvent<Integer, Deal> arg0) { _gateRemove.countDown(); } @Override public void entryUpdated(EntryEvent<Integer, Deal> arg0) { _gateUpdate.countDown(); } } static class Deal implements Serializable { Integer id; Deal(Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } >>>>>>> /** * Issue #996 */ @Test public void testEntryListener() throws InterruptedException { final CountDownLatch gateAdd = new CountDownLatch(2); final CountDownLatch gateRemove = new CountDownLatch(1); final CountDownLatch gateEvict = new CountDownLatch(1); final CountDownLatch gateUpdate = new CountDownLatch(1); final String mapName = "testEntryListener"; final IMap<Object, Object> serverMap = server.getMap(mapName); serverMap.put(3, new Deal(3)); final IMap<Object, Object> clientMap = hz.getMap(mapName); assertEquals(1, clientMap.size()); final EntryListener listener = new EntListener(gateAdd, gateRemove, gateEvict, gateUpdate); clientMap.addEntryListener(listener, new SqlPredicate("id=1"), 2, true); clientMap.put(2, new Deal(1)); clientMap.put(2, new Deal(1)); clientMap.remove(2); clientMap.put(2, new Deal(1)); clientMap.evict(2); assertTrue(gateAdd.await(10, TimeUnit.SECONDS)); assertTrue(gateRemove.await(10, TimeUnit.SECONDS)); assertTrue(gateEvict.await(10, TimeUnit.SECONDS)); assertTrue(gateUpdate.await(10, TimeUnit.SECONDS)); } static class EntListener implements EntryListener<Integer, Deal>, Serializable { private final CountDownLatch _gateAdd; private final CountDownLatch _gateRemove; private final CountDownLatch _gateEvict; private final CountDownLatch _gateUpdate; EntListener(CountDownLatch gateAdd, CountDownLatch gateRemove, CountDownLatch gateEvict, CountDownLatch gateUpdate) { _gateAdd = gateAdd; _gateRemove = gateRemove; _gateEvict = gateEvict; _gateUpdate = gateUpdate; } @Override public void entryAdded(EntryEvent<Integer, Deal> arg0) { _gateAdd.countDown(); } @Override public void entryEvicted(EntryEvent<Integer, Deal> arg0) { _gateEvict.countDown(); } @Override public void entryRemoved(EntryEvent<Integer, Deal> arg0) { _gateRemove.countDown(); } @Override public void entryUpdated(EntryEvent<Integer, Deal> arg0) { _gateUpdate.countDown(); } } static class Deal implements Serializable { Integer id; Deal(Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } /** * Issue #923 */ @Test public void testPartitionAwareKey() { String name = "testPartitionAwareKey"; PartitionAwareKey key = new PartitionAwareKey("key", "123"); String value = "value"; IMap<Object, Object> map1 = server.getMap(name); map1.put(key, value); assertEquals(value, map1.get(key)); IMap<Object, Object> map2 = hz.getMap(name); assertEquals(value, map2.get(key)); } private static class PartitionAwareKey implements PartitionAware, Serializable { private final String key; private final String pk; private PartitionAwareKey(String key, String pk) { this.key = key; this.pk = pk; } @Override public Object getPartitionKey() { return pk; } }
<<<<<<< private final ILogger logger = Logger.getLogger(FileSystemXmlConfig.class); ======= private final static ILogger logger = Logger.getLogger(FileSystemXmlConfig.class.getName()); >>>>>>> private final static ILogger logger = Logger.getLogger(FileSystemXmlConfig.class);
<<<<<<< @Test(expected = InvalidConfigurationException.class) public void testWanConfigSnapshotEnabledForWrongPublisher() { String xml = "<hazelcast>\n" + "<wan-replication name=\"my-wan-cluster\" snapshot-enabled=\"true\">\n" + " <target-cluster group-name=\"test-cluster-1\" group-password=\"test-pass\">\n" + " <replication-impl>com.hazelcast.wan.impl.WanNoDelayReplication</replication-impl>\n" + " <end-points>\n" + " <address>20.30.40.50:5701</address>\n" + " <address>20.30.40.50:5702</address>\n" + " </end-points>\n" + " </target-cluster>\n" + "</wan-replication>\n" + "</hazelcast>"; Config config = buildConfig(xml); WanReplicationConfig wanConfig = config.getWanReplicationConfig("my-wan-cluster"); assertNotNull(wanConfig); } ======= @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_CacheBackupCount() { buildConfig("cache-backup-count", getInvalidBackupCount()); } @Test public void testWhenValid_CacheBackupCount() { buildConfig("cache-backup-count", getValidBackupCount()); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_CacheAsyncBackupCount() { buildConfig("cache-async-backup-count", getInvalidBackupCount()); } @Test public void testWhenValid_CacheAsyncBackupCount() { buildConfig("cache-async-backup-count", getValidBackupCount()); } @Test public void WhenValid_CacheInMemoryFormat() { buildConfig("cache-in-memory-format", "OBJECT"); } @Test(expected = InvalidConfigurationException.class) public void WhenInvalid_CacheInMemoryFormat() { buildConfig("cache-in-memory-format", "binaryyy"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_CacheEvictionSize() { buildConfig("cache-eviction-size", "-100"); } @Test public void testWhenValid_CacheEvictionSize() { buildConfig("cache-eviction-size", "100"); } @Test public void WhenValid_NearCacheInMemoryFormat() { buildConfig("near-cache-in-memory-format", "OBJECT"); } @Test(expected = InvalidConfigurationException.class) public void WhenInvalid_NearCacheInMemoryFormat() { buildConfig("near-cache-in-memory-format", "binaryyy"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_NearCacheTTLSeconds() { buildConfig("near-cache-time-to-live-seconds", "-1"); } @Test public void testWhenValid_NearCacheTTLSeconds() { buildConfig("near-cache-time-to-live-seconds", "100"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_NearCacheMaxIdleSeconds() { buildConfig("near-cache-max-idle-seconds", "-1"); } @Test public void testWhenValid_NearCacheMaxIdleSeconds() { buildConfig("near-cache-max-idle-seconds", "100"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_NearCacheEvictionSize() { buildConfig("near-cache-eviction-size", "-100"); } @Test public void testWhenValid_NearCacheEvictionSize() { buildConfig("near-cache-eviction-size", "100"); } >>>>>>> @Test(expected = InvalidConfigurationException.class) public void testWanConfigSnapshotEnabledForWrongPublisher() { String xml = "<hazelcast>\n" + "<wan-replication name=\"my-wan-cluster\" snapshot-enabled=\"true\">\n" + " <target-cluster group-name=\"test-cluster-1\" group-password=\"test-pass\">\n" + " <replication-impl>com.hazelcast.wan.impl.WanNoDelayReplication</replication-impl>\n" + " <end-points>\n" + " <address>20.30.40.50:5701</address>\n" + " <address>20.30.40.50:5702</address>\n" + " </end-points>\n" + " </target-cluster>\n" + "</wan-replication>\n" + "</hazelcast>"; Config config = buildConfig(xml); WanReplicationConfig wanConfig = config.getWanReplicationConfig("my-wan-cluster"); assertNotNull(wanConfig); } public void testWhenInvalid_CacheBackupCount() { buildConfig("cache-backup-count", getInvalidBackupCount()); } @Test public void testWhenValid_CacheBackupCount() { buildConfig("cache-backup-count", getValidBackupCount()); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_CacheAsyncBackupCount() { buildConfig("cache-async-backup-count", getInvalidBackupCount()); } @Test public void testWhenValid_CacheAsyncBackupCount() { buildConfig("cache-async-backup-count", getValidBackupCount()); } @Test public void WhenValid_CacheInMemoryFormat() { buildConfig("cache-in-memory-format", "OBJECT"); } @Test(expected = InvalidConfigurationException.class) public void WhenInvalid_CacheInMemoryFormat() { buildConfig("cache-in-memory-format", "binaryyy"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_CacheEvictionSize() { buildConfig("cache-eviction-size", "-100"); } @Test public void testWhenValid_CacheEvictionSize() { buildConfig("cache-eviction-size", "100"); } @Test public void WhenValid_NearCacheInMemoryFormat() { buildConfig("near-cache-in-memory-format", "OBJECT"); } @Test(expected = InvalidConfigurationException.class) public void WhenInvalid_NearCacheInMemoryFormat() { buildConfig("near-cache-in-memory-format", "binaryyy"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_NearCacheTTLSeconds() { buildConfig("near-cache-time-to-live-seconds", "-1"); } @Test public void testWhenValid_NearCacheTTLSeconds() { buildConfig("near-cache-time-to-live-seconds", "100"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_NearCacheMaxIdleSeconds() { buildConfig("near-cache-max-idle-seconds", "-1"); } @Test public void testWhenValid_NearCacheMaxIdleSeconds() { buildConfig("near-cache-max-idle-seconds", "100"); } @Test(expected = InvalidConfigurationException.class) public void testWhenInvalid_NearCacheEvictionSize() { buildConfig("near-cache-eviction-size", "-100"); } @Test public void testWhenValid_NearCacheEvictionSize() { buildConfig("near-cache-eviction-size", "100"); }
<<<<<<< import com.hazelcast.collection.CollectionWrapper; ======= import com.hazelcast.collection.CollectionService; >>>>>>> import com.hazelcast.collection.CollectionWrapper; import com.hazelcast.collection.CollectionService;
<<<<<<< ======= for (String mapName : proxies.keySet()) { MapConfig mapConfig = nodeEngine.getConfig().getMapConfig(mapName); if (mapConfig.getTimeToLiveSeconds() > 0 || mapConfig.getMaxIdleSeconds() > 0) mapsWithTTL.add(mapName); } // todo make this 1 second configurable nodeEngine.getExecutionService().scheduleAtFixedRate(new CleanupTask(), 1, 1, TimeUnit.SECONDS); >>>>>>> // todo make this 1 second configurable nodeEngine.getExecutionService().scheduleAtFixedRate(new CleanupTask(), 1, 1, TimeUnit.SECONDS); <<<<<<< public void scheduleOperation(String mapName, Data key, long executeTime) { MapRecordStateOperation stateOperation = new MapRecordStateOperation(mapName, key); MapRecordTask recordTask = new MapRecordTask(nodeEngine, stateOperation); recordTaskExecutor.schedule(recordTask, executeTime, TimeUnit.MILLISECONDS); } ======= >>>>>>> public void scheduleOperation(String mapName, Data key, long executeTime) { MapRecordStateOperation stateOperation = new MapRecordStateOperation(mapName, key); MapRecordTask recordTask = new MapRecordTask(nodeEngine, stateOperation); recordTaskExecutor.schedule(recordTask, executeTime, TimeUnit.MILLISECONDS); } <<<<<<< // Node node = nodeEngine.getNode(); // for (int i = 0; i < nodeEngine.getPartitionCount(); i++) { // Address owner = node.partitionService.getPartitionOwner(i); // if (node.address.equals(owner)) { // for (String mapName : mapInfos.keySet()) { // if(!mapInfos.get(mapName).shouldCheckExpiredRecords()) // continue; // PartitionContainer pc = partitionContainers[i]; // RecordStore recordStore = pc.getRecordStore(mapName); // Set<Map.Entry<Data, Record>> recordEntries = recordStore.getRecords().entrySet(); // List<Data> keysToRemoved = new ArrayList<Data>(); // for (Map.Entry<Data, Record> entry : recordEntries) { // Record record = entry.getValue(); // if (!record.isActive() && !record.isDirty()) // keysToRemoved.add(entry.getKey()); // } // recordStore.evictAll(keysToRemoved); // } // } // } ======= if (mapsWithTTL.isEmpty()) return; for (int i = 0; i < nodeEngine.getPartitionCount(); i++) { Node node = nodeEngine.getNode(); Address owner = node.partitionService.getPartitionOwner(i); if (node.address.equals(owner)) { for (String mapName : mapsWithTTL) { PartitionContainer pc = partitionContainers[i]; RecordStore recordStore = pc.getRecordStore(mapName); Set<Map.Entry<Data, Record>> recordEntries = recordStore.getRecords().entrySet(); List<Data> keysToRemoved = new ArrayList<Data>(); for (Map.Entry<Data, Record> entry : recordEntries) { Record record = entry.getValue(); if (!record.isActive()) keysToRemoved.add(entry.getKey()); } recordStore.removeAll(keysToRemoved); } } } >>>>>>> // Node node = nodeEngine.getNode(); // for (int i = 0; i < nodeEngine.getPartitionCount(); i++) { // Address owner = node.partitionService.getPartitionOwner(i); // if (node.address.equals(owner)) { // for (String mapName : mapInfos.keySet()) { // if(!mapInfos.get(mapName).shouldCheckExpiredRecords()) // continue; // PartitionContainer pc = partitionContainers[i]; // RecordStore recordStore = pc.getRecordStore(mapName); // Set<Map.Entry<Data, Record>> recordEntries = recordStore.getRecords().entrySet(); // List<Data> keysToRemoved = new ArrayList<Data>(); // for (Map.Entry<Data, Record> entry : recordEntries) { // Record record = entry.getValue(); // if (!record.isActive() && !record.isDirty()) // keysToRemoved.add(entry.getKey()); // } // recordStore.evictAll(keysToRemoved); // } // } // }
<<<<<<< import com.hazelcast.transaction.TransactionalObject; ======= import com.hazelcast.util.ConcurrencyUtil; >>>>>>> import com.hazelcast.util.ConcurrencyUtil; import com.hazelcast.transaction.TransactionalObject; <<<<<<< public <T extends TransactionalObject> T createTransactionalObject(Object id, Transaction transaction) { return null; ======= public TransactionalMultimapProxySupport createTransactionalObject(Object id, Transaction transaction) { return new TransactionalMultimapProxy((CollectionProxyId) id, nodeEngine, this, transaction); >>>>>>> public <T extends TransactionalObject> T createTransactionalObject(Object id, Transaction transaction) { return null;
<<<<<<< public static final int IS_EMPTY = 46; ======= public static final int EVICT_ALL = 46; >>>>>>> public static final int EVICT_ALL = 46; public static final int IS_EMPTY = 47; <<<<<<< final ConstructorFunction<Integer, Portable> constructors[] = new ConstructorFunction[IS_EMPTY + 1]; ======= final ConstructorFunction<Integer, Portable> constructors[] = new ConstructorFunction[EVICT_ALL + 1]; >>>>>>> final ConstructorFunction<Integer, Portable> constructors[] = new ConstructorFunction[IS_EMPTY + 1]; <<<<<<< constructors[IS_EMPTY] = new ConstructorFunction<Integer, Portable>() { public Portable createNew(Integer arg) { return new MapIsEmptyRequest(); } }; ======= constructors[EVICT_ALL] = new ConstructorFunction<Integer, Portable>() { public Portable createNew(Integer arg) { return new MapEvictAllRequest(); } }; >>>>>>> constructors[EVICT_ALL] = new ConstructorFunction<Integer, Portable>() { public Portable createNew(Integer arg) { return new MapEvictAllRequest(); } }; constructors[IS_EMPTY] = new ConstructorFunction<Integer, Portable>() { public Portable createNew(Integer arg) { return new MapIsEmptyRequest(); } };
<<<<<<< import com.hazelcast.test.RandomBlockJUnit4ClassRunner; ======= import com.hazelcast.instance.StaticNodeFactory; >>>>>>> import com.hazelcast.test.RandomBlockJUnit4ClassRunner; import com.hazelcast.instance.StaticNodeFactory;
<<<<<<< import com.hazelcast.core.Member; import com.hazelcast.core.PartitionAware; import com.hazelcast.impl.ClusterOperation; import com.hazelcast.impl.Keys; import com.hazelcast.instance.ThreadContext; ======= >>>>>>> import com.hazelcast.core.PartitionAware; import com.hazelcast.impl.Keys; import com.hazelcast.instance.ThreadContext; <<<<<<< import static com.hazelcast.nio.IOUtil.toObject; ======= >>>>>>> import static com.hazelcast.nio.IOUtil.toObject; <<<<<<< return result; } return null; } public void destroy() { doOp(ClusterOperation.DESTROY, null, null); this.client.destroy(name); } public <K> Collection<K> keys(Predicate predicate) { Keys keys = (Keys) doOp(ClusterOperation.CONCURRENT_MAP_ITERATE_KEYS, null, predicate); Collection<K> collection = new ArrayList<K>(); for (Data d : keys) { collection.add((K) toObject(d.buffer)); } return collection; } public <K> Collection<K> entries(final Predicate predicate) { Keys keys = (Keys) doOp(ClusterOperation.CONCURRENT_MAP_ITERATE_ENTRIES, null, predicate); Collection<K> collection = new ArrayList<K>(); for (Data d : keys) { collection.add((K) toObject(d.buffer)); } return collection; } static void check(Object obj) { if (obj == null) { throw new NullPointerException("Object cannot be null."); } // if (!(obj instanceof Serializable)) { // throw new IllegalArgumentException(obj.getClass().getName() + " is not Serializable."); // } } static void check(EventListener listener) { if (listener == null) { throw new NullPointerException("Listener can not be null"); } } static void checkTime(long time, TimeUnit timeunit) { if (time < 0) { throw new IllegalArgumentException("Time can not be less than 0."); } if (timeunit == null) { throw new NullPointerException("TimeUnit can not be null."); ======= >>>>>>> } } public void destroy() { // doOp(ClusterOperation.DESTROY, null, null); // this.client.destroy(name); } public <K> Collection<K> keys(Predicate predicate) { // Keys keys = (Keys) doOp(ClusterOperation.CONCURRENT_MAP_ITERATE_KEYS, null, predicate); Collection<K> collection = new ArrayList<K>(); // for (Data d : keys) { // collection.add((K) toObject(d.buffer)); // } return collection; } public <K> Collection<K> entries(final Predicate predicate) { // Keys keys = (Keys) doOp(ClusterOperation.CONCURRENT_MAP_ITERATE_ENTRIES, null, predicate); Collection<K> collection = new ArrayList<K>(); // for (Data d : keys) { // collection.add((K) toObject(d.buffer)); // } return collection; } static void check(Object obj) { if (obj == null) { throw new NullPointerException("Object cannot be null."); } // if (!(obj instanceof Serializable)) { // throw new IllegalArgumentException(obj.getClass().getName() + " is not Serializable."); // } } static void check(EventListener listener) { if (listener == null) { throw new NullPointerException("Listener can not be null"); } } static void checkTime(long time, TimeUnit timeunit) { if (time < 0) { throw new IllegalArgumentException("Time can not be less than 0."); } if (timeunit == null) { throw new NullPointerException("TimeUnit can not be null.");
<<<<<<< public class MigrationNotification extends AbstractOperation implements NoReply, NonBlockingOperation { MigratingPartition migratingPartition; boolean started; ======= public class MigrationNotification extends AbstractRemotelyProcessable { MigrationRequestTask migrationRequestTask; MigrationStatus status; >>>>>>> public class MigrationNotification extends AbstractOperation implements NoReply, NonBlockingOperation { MigratingPartition migratingPartition; MigrationStatus status;
<<<<<<< for (PartitionRecordStore mapPartition : container.maps.values()) { mapPartition.clear(); ======= for (DefaultRecordStore mapPartition : container.maps.values()) { mapPartition.destroy(); >>>>>>> for (PartitionRecordStore mapPartition : container.maps.values()) { mapPartition.destroy(); <<<<<<< private void releaseMemberLocks(MemberImpl member) { for (PartitionContainer container : partitionContainers) { for (PartitionRecordStore recordStore : container.maps.values()) { Map<Data, LockInfo> locks = recordStore.getLocks(); for (Map.Entry<Data, LockInfo> entry : locks.entrySet()) { if (entry.getValue().getLockOwner().equals(member.getAddress())) { ForceUnlockOperation forceUnlockOperation = new ForceUnlockOperation(recordStore.name, entry.getKey()); forceUnlockOperation.setNodeEngine(nodeEngine); forceUnlockOperation.setServiceName(SERVICE_NAME); forceUnlockOperation.setResponseHandler(ResponseHandlerFactory.createEmptyResponseHandler()); forceUnlockOperation.setPartitionId(container.partitionInfo.getPartitionId()); nodeEngine.getOperationService().runOperation(forceUnlockOperation); recordStore.forceUnlock(entry.getKey()); } } } } } ======= >>>>>>> <<<<<<< public LocalMapStatsImpl createLocalMapStats(String mapName) { LocalMapStatsImpl localMapStats = new LocalMapStatsImpl(); long now = Clock.currentTimeMillis(); long ownedEntryCount = 0; long backupEntryCount = 0; long dirtyCount = 0; long ownedEntryMemoryCost = 0; long backupEntryMemoryCost = 0; long hits = 0; long lockedEntryCount = 0; MapContainer mapContainer = getMapContainer(mapName); int backupCount = mapContainer.getBackupCount(); ClusterServiceImpl clusterService = (ClusterServiceImpl) nodeEngine.getClusterService(); Address thisAddress = clusterService.getThisAddress(); for (int i = 0; i < nodeEngine.getPartitionService().getPartitionCount(); i++) { PartitionInfo partitionInfo = nodeEngine.getPartitionService().getPartitionInfo(i); if (partitionInfo.getOwner().equals(thisAddress)) { PartitionContainer partitionContainer = getPartitionContainer(i); RecordStore recordStore = partitionContainer.getRecordStore(mapName); ConcurrentMap<Data, Record> records = recordStore.getRecords(); for (Record record : records.values()) { RecordStats stats = record.getStats(); RecordState state = record.getState(); // there is map store and the record is dirty (waits to be stored) if (mapContainer.getStore() != null && state.isDirty()) { dirtyCount++; } ownedEntryCount++; ownedEntryMemoryCost += record.getCost(); localMapStats.setLastAccessTime(stats.getLastAccessTime()); localMapStats.setLastUpdateTime(stats.getLastUpdateTime()); hits += stats.getHits(); if (recordStore.isLocked(record.getKey())) { lockedEntryCount++; } } } else { for (int j = 1; j < backupCount; j++) { if (partitionInfo.getReplicaAddress(i).equals(thisAddress)) { PartitionContainer partitionContainer = getPartitionContainer(i); RecordStore recordStore = partitionContainer.getRecordStore(mapName); ConcurrentMap<Data, Record> records = recordStore.getRecords(); for (Record record : records.values()) { backupEntryCount++; backupEntryMemoryCost += record.getCost(); } } } } } localMapStats.setDirtyEntryCount(Util.zeroOrPositive(dirtyCount)); localMapStats.setLockedEntryCount(Util.zeroOrPositive(lockedEntryCount)); localMapStats.setHits(Util.zeroOrPositive(hits)); localMapStats.setOwnedEntryCount(Util.zeroOrPositive(ownedEntryCount)); localMapStats.setBackupEntryCount(Util.zeroOrPositive(backupEntryCount)); localMapStats.setOwnedEntryMemoryCost(Util.zeroOrPositive(ownedEntryMemoryCost)); localMapStats.setBackupEntryMemoryCost(Util.zeroOrPositive(backupEntryMemoryCost)); localMapStats.setCreationTime(Util.zeroOrPositive(clusterService.getClusterTimeFor(mapContainer.getCreationTime()))); return localMapStats; } ======= public static String getNamespace(String name) { return MapService.SERVICE_NAME + '/' + name; } >>>>>>> public static String getNamespace(String name) { return MapService.SERVICE_NAME + '/' + name; } public LocalMapStatsImpl createLocalMapStats(String mapName) { LocalMapStatsImpl localMapStats = new LocalMapStatsImpl(); long now = Clock.currentTimeMillis(); long ownedEntryCount = 0; long backupEntryCount = 0; long dirtyCount = 0; long ownedEntryMemoryCost = 0; long backupEntryMemoryCost = 0; long hits = 0; long lockedEntryCount = 0; MapContainer mapContainer = getMapContainer(mapName); int backupCount = mapContainer.getBackupCount(); ClusterServiceImpl clusterService = (ClusterServiceImpl) nodeEngine.getClusterService(); Address thisAddress = clusterService.getThisAddress(); for (int i = 0; i < nodeEngine.getPartitionService().getPartitionCount(); i++) { PartitionInfo partitionInfo = nodeEngine.getPartitionService().getPartitionInfo(i); if (partitionInfo.getOwner().equals(thisAddress)) { PartitionContainer partitionContainer = getPartitionContainer(i); RecordStore recordStore = partitionContainer.getRecordStore(mapName); ConcurrentMap<Data, Record> records = recordStore.getRecords(); for (Record record : records.values()) { RecordStats stats = record.getStats(); RecordState state = record.getState(); // there is map store and the record is dirty (waits to be stored) if (mapContainer.getStore() != null && state.isDirty()) { dirtyCount++; } ownedEntryCount++; ownedEntryMemoryCost += record.getCost(); localMapStats.setLastAccessTime(stats.getLastAccessTime()); localMapStats.setLastUpdateTime(stats.getLastUpdateTime()); hits += stats.getHits(); if (recordStore.isLocked(record.getKey())) { lockedEntryCount++; } } } else { for (int j = 1; j < backupCount; j++) { if (partitionInfo.getReplicaAddress(i).equals(thisAddress)) { PartitionContainer partitionContainer = getPartitionContainer(i); RecordStore recordStore = partitionContainer.getRecordStore(mapName); ConcurrentMap<Data, Record> records = recordStore.getRecords(); for (Record record : records.values()) { backupEntryCount++; backupEntryMemoryCost += record.getCost(); } } } } } localMapStats.setDirtyEntryCount(Util.zeroOrPositive(dirtyCount)); localMapStats.setLockedEntryCount(Util.zeroOrPositive(lockedEntryCount)); localMapStats.setHits(Util.zeroOrPositive(hits)); localMapStats.setOwnedEntryCount(Util.zeroOrPositive(ownedEntryCount)); localMapStats.setBackupEntryCount(Util.zeroOrPositive(backupEntryCount)); localMapStats.setOwnedEntryMemoryCost(Util.zeroOrPositive(ownedEntryMemoryCost)); localMapStats.setBackupEntryMemoryCost(Util.zeroOrPositive(backupEntryMemoryCost)); localMapStats.setCreationTime(Util.zeroOrPositive(clusterService.getClusterTimeFor(mapContainer.getCreationTime()))); return localMapStats; }
<<<<<<< public LocalQueueStats createLocalQueueStats(String name, int partitionId){ LocalQueueStatsImpl stats = new LocalQueueStatsImpl(); QueueContainer container = containerMap.get(name); if (container == null){ return stats; } Address thisAddress = nodeEngine.getClusterService().getThisAddress(); PartitionInfo info = nodeEngine.getPartitionService().getPartitionInfo(partitionId); if (thisAddress.equals(info.getOwner())){ stats.setOwnedItemCount(container.size()); } else{ stats.setBackupItemCount(container.size()); } container.setStats(stats); stats.setOperationStats(getOrCreateOperationsCounter(name).getPublishedStats()); return stats; } public QueueOperationsCounter getOrCreateOperationsCounter(String name){ QueueOperationsCounter operationsCounter = counterMap.get(name); if (operationsCounter == null){ operationsCounter = new QueueOperationsCounter(); QueueOperationsCounter counter = counterMap.putIfAbsent(name, operationsCounter); if (counter != null){ operationsCounter = counter; } } return operationsCounter; } ======= public TransactionalQueueProxy createTransactionalObject(Object id, Transaction transaction) { return new TransactionalQueueProxy(String.valueOf(id), nodeEngine, this, transaction); } >>>>>>> public LocalQueueStats createLocalQueueStats(String name, int partitionId){ LocalQueueStatsImpl stats = new LocalQueueStatsImpl(); QueueContainer container = containerMap.get(name); if (container == null){ return stats; } Address thisAddress = nodeEngine.getClusterService().getThisAddress(); PartitionInfo info = nodeEngine.getPartitionService().getPartitionInfo(partitionId); if (thisAddress.equals(info.getOwner())){ stats.setOwnedItemCount(container.size()); } else{ stats.setBackupItemCount(container.size()); } container.setStats(stats); stats.setOperationStats(getOrCreateOperationsCounter(name).getPublishedStats()); return stats; } public QueueOperationsCounter getOrCreateOperationsCounter(String name){ QueueOperationsCounter operationsCounter = counterMap.get(name); if (operationsCounter == null){ operationsCounter = new QueueOperationsCounter(); QueueOperationsCounter counter = counterMap.putIfAbsent(name, operationsCounter); if (counter != null){ operationsCounter = counter; } } return operationsCounter; } public TransactionalQueueProxy createTransactionalObject(Object id, Transaction transaction) { return new TransactionalQueueProxy(String.valueOf(id), nodeEngine, this, transaction); }
<<<<<<< public class ClientEngineImpl implements ClientEngine, CoreService, ManagedService, MembershipAwareService, EventPublishingService<ClientEndpoint, ClientListener>, PostJoinAwareService { ======= /** * Class that requests, listeners from client handled in node side. */ public class ClientEngineImpl implements ClientEngine, CoreService, ManagedService, MembershipAwareService, EventPublishingService<ClientEndpoint, ClientListener> { >>>>>>> /** * Class that requests, listeners from client handled in node side. */ public class ClientEngineImpl implements ClientEngine, CoreService, PostJoinAwareService, ManagedService, MembershipAwareService, EventPublishingService<ClientEndpoint, ClientListener> { <<<<<<< public static final int DESTROY_ENDPOINT_DELAY_MS = 1111; public static final int ENDPOINT_REMOVE_DELAY = 10; public static final int THREADS_PER_CORE = 10; public static final int RIDICULOUS_THREADS_PER_CORE = 100000; static final Data NULL = new Data(); ======= private static final int DESTROY_ENDPOINT_DELAY_MS = 1111; private static final int ENDPOINT_REMOVE_DELAY_MS = 10; private static final int THREADS_PER_CORE = 10; private static final int EXECUTOR_QUEUE_CAPACITY_PER_CORE = 100000; >>>>>>> private static final int ENDPOINT_REMOVE_DELAY_MS = 10; private static final int THREADS_PER_CORE = 10; private static final int EXECUTOR_QUEUE_CAPACITY_PER_CORE = 100000; <<<<<<< private final ConcurrentMap<Connection, ClientEndpoint> endpoints = new ConcurrentHashMap<Connection, ClientEndpoint>(); // client uuid -> member uuid private final ConcurrentMap<String, String> ownershipMappings = new ConcurrentHashMap<String, String>(); ======= private final ClientEndpointManager endpointManager; >>>>>>> // client uuid -> member uuid private final ConcurrentMap<String, String> ownershipMappings = new ConcurrentHashMap<String, String>(); private final ClientEndpointManager endpointManager; <<<<<<< nodeEngine.getExecutionService().schedule(new DestroyEndpointTask(deadMemberUuid), ENDPOINT_REMOVE_DELAY, TimeUnit.SECONDS); ======= nodeEngine.getExecutionService().schedule(new Runnable() { @Override public void run() { Iterator<ClientEndpoint> iterator = endpointManager.values().iterator(); while (iterator.hasNext()) { ClientEndpoint endpoint = iterator.next(); String ownerUuid = endpoint.getPrincipal().getOwnerUuid(); if (uuid.equals(ownerUuid)) { iterator.remove(); destroyEndpoint(endpoint, true); } } } }, ENDPOINT_REMOVE_DELAY_MS, TimeUnit.SECONDS); >>>>>>> nodeEngine.getExecutionService().schedule(new DestroyEndpointTask(deadMemberUuid), ENDPOINT_REMOVE_DELAY_MS, TimeUnit.SECONDS); <<<<<<< endpoints.clear(); ownershipMappings.clear(); } void addOwnershipMapping(String clientUuid, String ownerUuid) { ownershipMappings.put(clientUuid, ownerUuid); } void removeOwnershipMapping(String clientUuid) { ownershipMappings.remove(clientUuid); ======= endpointManager.clear(); >>>>>>> endpointManager.clear(); ownershipMappings.clear(); } void addOwnershipMapping(String clientUuid, String ownerUuid) { ownershipMappings.put(clientUuid, ownerUuid); } void removeOwnershipMapping(String clientUuid) { ownershipMappings.remove(clientUuid); <<<<<<< removeEndpoint(endpoint); ======= endpointManager.removeEndpoint(conn); >>>>>>> endpointManager.removeEndpoint(endpoint); <<<<<<< private void callDisconnectionOperation(ClientEndpoint endpoint) { ======= private void doRemoveEndpoint(Connection connection, ClientEndpoint endpoint) { endpointManager.removeEndpoint(connection, true); if (!endpoint.isFirstConnection()) { return; } NodeEngine nodeEngine = node.nodeEngine; >>>>>>> private void callDisconnectionOperation(ClientEndpoint endpoint) {
<<<<<<< private class MapExecutionCallbackAdapter implements Callback { private final ExecutionCallback executionCallback; public MapExecutionCallbackAdapter(ExecutionCallback executionCallback) { this.executionCallback = executionCallback; } @Override public void notify(Object response) { if (response instanceof Throwable) { executionCallback.onFailure((Throwable) response); } else { executionCallback.onResponse(getService().toObject(response)); } } } ======= >>>>>>> private class MapExecutionCallbackAdapter implements Callback { private final ExecutionCallback executionCallback; public MapExecutionCallbackAdapter(ExecutionCallback executionCallback) { this.executionCallback = executionCallback; } @Override public void notify(Object response) { if (response instanceof Throwable) { executionCallback.onFailure((Throwable) response); } else { executionCallback.onResponse(getService().toObject(response)); } } }
<<<<<<< y.secondaryStride()); else if (x.data().dataType() == DataBuffer.Type.DOUBLE) { ======= y.majorStride()); else if (x.data().dataType() == DataBuffer.DOUBLE) { >>>>>>> y.majorStride()); else if (x.data().dataType() == DataBuffer.Type.DOUBLE) { <<<<<<< y.secondaryStride())); else if (x.data().dataType() == DataBuffer.Type.DOUBLE) ======= y.majorStride())); else if (x.data().dataType() == DataBuffer.DOUBLE) >>>>>>> y.majorStride())); else if (x.data().dataType() == DataBuffer.Type.DOUBLE) <<<<<<< y.secondaryStride())); if (x.data().dataType() == DataBuffer.Type.DOUBLE) ======= y.majorStride())); if (x.data().dataType() == DataBuffer.DOUBLE) >>>>>>> y.majorStride())); if (x.data().dataType() == DataBuffer.Type.DOUBLE) <<<<<<< x.secondaryStride()); else if (x.data().dataType() == DataBuffer.Type.DOUBLE) ======= x.majorStride()); else if (x.data().dataType() == DataBuffer.DOUBLE) >>>>>>> x.majorStride()); else if (x.data().dataType() == DataBuffer.Type.DOUBLE) <<<<<<< x.secondaryStride()); if (x.data().dataType() == DataBuffer.Type.DOUBLE) ======= x.majorStride()); if (x.data().dataType() == DataBuffer.DOUBLE) >>>>>>> x.majorStride()); if (x.data().dataType() == DataBuffer.Type.DOUBLE) <<<<<<< x.secondaryStride()) - 1; else if (x.data().dataType() == DataBuffer.Type.DOUBLE) { ======= x.majorStride()) - 1; else if (x.data().dataType() == DataBuffer.DOUBLE) { >>>>>>> x.majorStride()) - 1; else if (x.data().dataType() == DataBuffer.Type.DOUBLE) {
<<<<<<< protocolProxyHelper.doCommand(Command.DESTROY, new String[]{"queue", getName()}); ======= proxyHelper.doCommand(Command.DESTROY, new String[]{InstanceType.QUEUE.name(), getName()}); >>>>>>> proxyHelper.doCommand(Command.DESTROY, new String[]{"queue", getName()});
<<<<<<< initializeDevicesAndFunctions(); int numThreads = 0; ======= int numThreads; >>>>>>> initializeDevicesAndFunctions(); int numThreads;
<<<<<<< ======= import org.nd4j.linalg.memory.provider.BasicWorkspaceManager; import org.nd4j.linalg.memory.stash.BasicStashManager; import org.nd4j.linalg.memory.stash.StashManager; >>>>>>> import org.nd4j.linalg.memory.provider.BasicWorkspaceManager; import org.nd4j.linalg.memory.stash.BasicStashManager; import org.nd4j.linalg.memory.stash.StashManager;
<<<<<<< @Test public void testUtilizarNumeroConvenio() throws Exception { this.emissor = Emissor.novoEmissor().comCedente("BOTICARIO") .comNumeroConvenio("3903125").comCarteira("102") .comNossoNumero("3827130004722"); boleto.comEmissor(emissor); assertThat(banco.geraCodigoDeBarrasPara(boleto), is("03391569200000219509390312538271300047220102")); } ======= @Test public void testRetornarDigitoNossoNumero() throws Exception { emissor.comNossoNumero("566612457800"); String digito = banco.calcularDigitoVerificadorNossoNumero(emissor); assertThat(digito, is("2")); } @Test public void testLancarExcecaoQuandoNossoNumeroForMaiorQueDoze() throws Exception { excecao.expect(IllegalArgumentException.class); emissor.comNossoNumero("1056137495014"); banco.calcularDigitoVerificadorNossoNumero(emissor); } @Test public void testLancarExcecaoQuandoNossoNumeroForNulo() throws Exception { excecao.expect(IllegalArgumentException.class); emissor.comNossoNumero(null); banco.calcularDigitoVerificadorNossoNumero(emissor); } @Test public void testRetornarDigitoQuandoNossoNumeroForMenorQueDoze() throws Exception { emissor.comNossoNumero("1"); String digito = banco.calcularDigitoVerificadorNossoNumero(emissor); assertThat(digito, is("9")); } >>>>>>> @Test public void testUtilizarNumeroConvenio() throws Exception { this.emissor = Emissor.novoEmissor().comCedente("BOTICARIO") .comNumeroConvenio("3903125").comCarteira("102") .comNossoNumero("3827130004722"); boleto.comEmissor(emissor); assertThat(banco.geraCodigoDeBarrasPara(boleto), is("03391569200000219509390312538271300047220102")); } @Test public void testRetornarDigitoNossoNumero() throws Exception { emissor.comNossoNumero("566612457800"); String digito = banco.calcularDigitoVerificadorNossoNumero(emissor); assertThat(digito, is("2")); } @Test public void testLancarExcecaoQuandoNossoNumeroForMaiorQueDoze() throws Exception { excecao.expect(IllegalArgumentException.class); emissor.comNossoNumero("1056137495014"); banco.calcularDigitoVerificadorNossoNumero(emissor); } @Test public void testLancarExcecaoQuandoNossoNumeroForNulo() throws Exception { excecao.expect(IllegalArgumentException.class); emissor.comNossoNumero(null); banco.calcularDigitoVerificadorNossoNumero(emissor); } @Test public void testRetornarDigitoQuandoNossoNumeroForMenorQueDoze() throws Exception { emissor.comNossoNumero("1"); String digito = banco.calcularDigitoVerificadorNossoNumero(emissor); assertThat(digito, is("9")); }
<<<<<<< import it.ozimov.springboot.templating.mail.configuration.EnableEmailTools; ======= import org.springframework.beans.BeansException; >>>>>>> import it.ozimov.springboot.templating.mail.configuration.EnableEmailTools; import org.springframework.beans.BeansException; <<<<<<< @EnableEmailTools public class PlainTextEmailApplication { ======= @ComponentScan(basePackages = {"com.test", "it.ozimov.springboot.templating.mail"}) public class PlainTextEmailApplication implements ApplicationContextAware { private ApplicationContext applicationContext; >>>>>>> @EnableEmailTools public class PlainTextEmailApplication implements ApplicationContextAware { private ApplicationContext applicationContext;
<<<<<<< final MimeMessageHelperExt messageHelper = new MimeMessageHelperExt(mimeMessage, fromNullable(email.getEncoding()).or(StandardCharsets.UTF_8.name())); ======= final boolean isMultipart = nonNull(email.getAttachments()) && !email.getAttachments().isEmpty(); >>>>>>> final boolean isMultipart = nonNull(email.getAttachments()) && !email.getAttachments().isEmpty(); <<<<<<< if (ofNullable(email.getAttachments()).isPresent()) { for (final EmailAttachment attachment : email.getAttachments()) { ======= if (isMultipart) { for (final EmailAttachmentImpl attachment : email.getAttachments()) { >>>>>>> if (isMultipart) { for (final EmailAttachment attachment : email.getAttachments()) {
<<<<<<< ======= import com.google.common.collect.ImmutableList; import it.ozimov.springboot.templating.mail.model.impl.EmailAttachmentImpl; import it.ozimov.springboot.templating.mail.utils.StringUtils; import lombok.NonNull; >>>>>>> import com.google.common.collect.ImmutableList; import it.ozimov.springboot.templating.mail.utils.StringUtils; import lombok.NonNull; <<<<<<< Collection<EmailAttachment> getAttachments(); ======= //FIXME Release 0.4.0 will fix this bug to have Collection<EmailAttachment> default @NonNull Collection<EmailAttachmentImpl> getAttachments() { return ImmutableList.of(); } >>>>>>> default @NonNull Collection<EmailAttachment> getAttachments() { return ImmutableList.of(); }
<<<<<<< INDArray[] tear(INDArray tensor, int... dimensions); ======= /** * Create from an in memory numpy pointer * @param pointer the pointer to the * numpy array * @return an ndarray created from the in memory * numpy pointer */ INDArray createFromNpyPointer(Pointer pointer); /** * Create from a given numpy file. * @param file the file to create the ndarray from * @return the created ndarray */ INDArray createFromNpyFile(File file); >>>>>>> /** * Create from an in memory numpy pointer * @param pointer the pointer to the * numpy array * @return an ndarray created from the in memory * numpy pointer */ INDArray createFromNpyPointer(Pointer pointer); /** * Create from a given numpy file. * @param file the file to create the ndarray from * @return the created ndarray */ INDArray createFromNpyFile(File file); INDArray[] tear(INDArray tensor, int... dimensions);
<<<<<<< ======= import com.owncloud.android.operations.CreateShareOperation; >>>>>>> import com.owncloud.android.operations.CreateShareOperation; <<<<<<< // public void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) { // int childCount = viewGroup.getChildCount(); // for (int i = 0; i < childCount; i++) { // View view = viewGroup.getChildAt(i); // view.setEnabled(enabled); // view.setClickable(!enabled); // if (view instanceof ViewGroup) { // enableDisableViewGroup((ViewGroup) view, enabled); // } // } // } ======= public void shareFileWithLink(OCFile file) { if (isSharedSupported()) { // Create the Share CreateShareOperation createShare = new CreateShareOperation(file.getRemotePath(), ShareType.PUBLIC_LINK, "", false, "", 1); createShare.execute(getStorageManager(), this, this, mHandler, this); // TODO // Get the link --> when the operation is finished } else { // Show a Message Toast t = Toast.makeText(this, getString(R.string.share_link_no_support_share_api), Toast.LENGTH_LONG); t.show(); } } >>>>>>>
<<<<<<< ======= /* refreshListOfFilesFragment(); */ >>>>>>> <<<<<<< protected void refeshListOfFilesFragment() { ======= protected void refreshListOfFilesFragment() { >>>>>>> protected void refreshListOfFilesFragment() { <<<<<<< ======= >>>>>>> <<<<<<< ======= >>>>>>> <<<<<<< refeshListOfFilesFragment(); ======= refreshListOfFilesFragment(); >>>>>>> refreshListOfFilesFragment(); <<<<<<< refeshListOfFilesFragment(); ======= refreshListOfFilesFragment(); >>>>>>> refreshListOfFilesFragment(); <<<<<<< ======= // TODO: delete this method?? // /** // * {@inheritDoc} // */ // // @Override // public void onFileStateChanged() { // /* TODO WIP COMMENT // refeshListOfFilesFragment(); // updateNavigationElementsInActionBar(getSecondFragment().getFile()); // */ // } // >>>>>>>
<<<<<<< ======= import androidx.fragment.app.FragmentActivity; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; >>>>>>> import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; <<<<<<< * @return int font color to use adapted from https://github.com/nextcloud/server/blob/master/apps/theming/lib/Util.php#L90-L102 ======= * returns the font color based on the server side theming and uses black/white as a fallback based on replaceWhite. * * @param context the context * @param replaceWhite FLAG to return white/black if server side color isn't available * @return int font color to use >>>>>>> * returns the font color based on the server side theming and uses black/white as a fallback based on * replaceWhite. * * @param context the context * @param replaceWhite FLAG to return white/black if server side color isn't available * @return int font color to use <<<<<<< text.setSpan(new ForegroundColorSpan(fontAppbarColor(context)), ======= text.setSpan(new ForegroundColorSpan(toolbarTextColor(context)), >>>>>>> text.setSpan(new ForegroundColorSpan(fontAppbarColor(context)),
<<<<<<< import com.owncloud.android.authentication.AccountAuthenticator; ======= import com.owncloud.android.Log_OC; import com.owncloud.android.authenticator.AccountAuthenticator; >>>>>>> import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.Log_OC;
<<<<<<< ======= >>>>>>> <<<<<<< equals(event) &&/// TODO refactor and make common synchResult != null && !synchResult.isSuccess() && (synchResult.getCode() == ResultCode.UNAUTHORIZED || synchResult.isIdPRedirection() || (synchResult.isException() && synchResult.getException() instanceof AuthenticatorException))) { ======= equals(event) && /// TODO refactor and make common synchResult != null && !synchResult.isSuccess() && (synchResult.getCode() == ResultCode.UNAUTHORIZED || synchResult.isIdPRedirection() || (synchResult.isException() && synchResult.getException() instanceof AuthenticatorException))) { >>>>>>> equals(event) &&/// TODO refactor and make common synchResult != null && !synchResult.isSuccess() && (synchResult.getCode() == ResultCode.UNAUTHORIZED || synchResult.isIdPRedirection() || (synchResult.isException() && synchResult.getException() instanceof AuthenticatorException))) { <<<<<<< ======= >>>>>>> <<<<<<< // Force the preview if the file is an image or text file if (uploadWasFine) { OCFile ocFile = getFile(); if (PreviewImageFragment.canBePreviewed(ocFile)) startImagePreview(getFile()); else if (PreviewTextFragment.canBePreviewed(ocFile)) startTextPreview(ocFile); // TODO what about other kind of previews? } ======= // Force the preview if the file is an image if (uploadWasFine && PreviewImageFragment.canBePreviewed(getFile())) { startImagePreview(getFile()); } // TODO what about other kind of previews? >>>>>>> // Force the preview if the file is an image or text file if (uploadWasFine) { OCFile ocFile = getFile(); if (PreviewImageFragment.canBePreviewed(ocFile)) startImagePreview(getFile()); else if (PreviewTextFragment.canBePreviewed(ocFile)) startTextPreview(ocFile); // TODO what about other kind of previews? } <<<<<<< ======= >>>>>>> <<<<<<< ======= } >>>>>>> } <<<<<<< ======= >>>>>>> <<<<<<< ======= >>>>>>>
<<<<<<< import android.accounts.OperationCanceledException; ======= >>>>>>> import android.accounts.OperationCanceledException; <<<<<<< import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.util.Log; ======= >>>>>>> import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.util.Log; <<<<<<< import com.owncloud.android.ui.adapter.FileListListAdapter; import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter; ======= import com.owncloud.android.ui.dialog.ConfirmationDialogFragment; >>>>>>> import com.owncloud.android.ui.adapter.FileListListAdapter; import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter; import com.owncloud.android.ui.dialog.ConfirmationDialogFragment; <<<<<<< private String DIALOG_UNTRUSTED_CERT; private OCFile mWaitingToSend; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; private boolean showAccounts = false; ======= private static String DIALOG_UNTRUSTED_CERT = "DIALOG_UNTRUSTED_CERT"; private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER"; private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE"; private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED"; private OCFile mWaitingToSend; >>>>>>> private static String DIALOG_UNTRUSTED_CERT = "DIALOG_UNTRUSTED_CERT"; private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER"; private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE"; private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED"; private OCFile mWaitingToSend; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; private boolean showAccounts = false; <<<<<<< public void restart(){ Intent i = new Intent(this, FileDisplayActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } public void closeDrawer() { mDrawerLayout.closeDrawers(); } ======= >>>>>>> public void restart(){ Intent i = new Intent(this, FileDisplayActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } public void closeDrawer() { mDrawerLayout.closeDrawers(); }
<<<<<<< import com.owncloud.android.authentication.AccountAuthenticator; ======= import com.owncloud.android.Log_OC; import com.owncloud.android.authenticator.AccountAuthenticator; >>>>>>> import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.Log_OC;
<<<<<<< import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockPreferenceActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import com.owncloud.android.BuildConfig; ======= >>>>>>> import com.owncloud.android.BuildConfig;
<<<<<<< import java.io.File; import java.io.Serializable; import com.owncloud.android.lib.common.utils.Log_OC; import third_parties.daveKoeller.AlphanumComparator; ======= >>>>>>> import java.io.File; import java.io.Serializable; <<<<<<< // OCFile needs to be Serializable because it is stored persistently inside UploadDbObject. // (Parcelable is not suitable for persistent storage.) public class OCFile implements Parcelable, Comparable<OCFile>, Serializable { /** * Should be changed whenever any property of OCFile changes. */ private static final long serialVersionUID = 5604080482686390078L; ======= import com.owncloud.android.lib.common.utils.Log_OC; import java.io.File; import third_parties.daveKoeller.AlphanumComparator; public class OCFile implements Parcelable, Comparable<OCFile> { >>>>>>> import com.owncloud.android.lib.common.utils.Log_OC; import third_parties.daveKoeller.AlphanumComparator; // OCFile needs to be Serializable because it is stored persistently inside UploadDbObject. // (Parcelable is not suitable for persistent storage.) public class OCFile implements Parcelable, Comparable<OCFile>, Serializable { /** * Should be changed whenever any property of OCFile changes. */ private static final long serialVersionUID = 5604080482686390078L; <<<<<<< * Can be used to set the path where the local file is stored * ======= * Can be used to set the path where the file is stored * >>>>>>> * Can be used to set the path where the local file is stored *
<<<<<<< ======= import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatDelegate; import android.support.v7.widget.Toolbar; >>>>>>> import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatDelegate; import android.support.v7.widget.Toolbar;
<<<<<<< import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.OnScanCompletedListener; import android.net.Uri; ======= import android.content.SharedPreferences; import android.os.Build; >>>>>>> import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.OnScanCompletedListener; import android.net.Uri; import android.content.SharedPreferences; import android.os.Build; <<<<<<< final OCFile file = mStorageManager.getFileByPath(downloadedRemotePath); ======= OCFile file = getStorageManager().getFileByPath(downloadedRemotePath); >>>>>>> OCFile file = getStorageManager().getFileByPath(downloadedRemotePath);
<<<<<<< /** * Remove value from map or complete entry if values for key are empty * * @param map * Map to check * @param value * Value to remove */ protected static <K, V> void removeValue(Map<K, Set<String>> map, String value) { for (K key : map.keySet()) { if (map.get(key).contains(value)) { if (map.get(key).size() > 1) { map.get(key).remove(value); } else { map.remove(key); } } } } ======= /** * @return the updateTime */ public DateTime getUpdateTime() { return updateTime; } /** * @param updateTime the updateTime to set */ public void setUpdateTime(DateTime updateTime) { this.updateTime = updateTime; } private DateTime updateTime; >>>>>>> /** * Remove value from map or complete entry if values for key are empty * * @param map * Map to check * @param value * Value to remove */ protected static <K, V> void removeValue(Map<K, Set<String>> map, String value) { for (K key : map.keySet()) { if (map.get(key).contains(value)) { if (map.get(key).size() > 1) { map.get(key).remove(value); } else { map.remove(key); } } } } /** * @return the updateTime */ public DateTime getUpdateTime() { return updateTime; } /** * @param updateTime the updateTime to set */ public void setUpdateTime(DateTime updateTime) { this.updateTime = updateTime; } private DateTime updateTime;
<<<<<<< ======= import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; >>>>>>> <<<<<<< ======= import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.media.ThumbnailUtils; import android.net.Uri; import android.os.AsyncTask; import android.util.TypedValue; >>>>>>> <<<<<<< ======= import com.owncloud.android.utils.Log_OC; >>>>>>> <<<<<<< private Context mContext; ======= private final Context mContext; >>>>>>> private Context mContext; <<<<<<< if (file.isImage() && file.getRemoteId() != null){ // Thumbnail in Cache? Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache( String.valueOf(file.getRemoteId()) ); if (thumbnail != null && !file.needsUpdateThumbnail()){ ======= if (file.isImage()) { // Thumbnail in Cache? Bitmap thumbnail = getBitmapFromDiskCache(String.valueOf(file.getRemoteId().hashCode())); if (thumbnail != null) { >>>>>>> if (file.isImage() && file.getRemoteId() != null){ // Thumbnail in Cache? Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache( String.valueOf(file.getRemoteId()) ); if (thumbnail != null && !file.needsUpdateThumbnail()){ <<<<<<< if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) { final ThumbnailsCacheManager.ThumbnailGenerationTask task = new ThumbnailsCacheManager.ThumbnailGenerationTask( fileIcon, mStorageManager ); if (thumbnail == null) { thumbnail = ThumbnailsCacheManager.mDefaultImg; } final AsyncDrawable asyncDrawable = new AsyncDrawable( mContext.getResources(), thumbnail, task ); ======= if (cancelPotentialWork(file, fileIcon)) { final ThumbnailGenerationTask task = new ThumbnailGenerationTask(fileIcon); final AsyncDrawable asyncDrawable = new AsyncDrawable(mContext.getResources(), defaultImg, task); >>>>>>> if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) { final ThumbnailsCacheManager.ThumbnailGenerationTask task = new ThumbnailsCacheManager.ThumbnailGenerationTask( fileIcon, mStorageManager ); if (thumbnail == null) { thumbnail = ThumbnailsCacheManager.mDefaultImg; } final AsyncDrawable asyncDrawable = new AsyncDrawable( mContext.getResources(), thumbnail, task ); <<<<<<< ======= public static boolean cancelPotentialWork(OCFile file, ImageView imageView) { final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView); if (bitmapWorkerTask != null) { final OCFile bitmapData = bitmapWorkerTask.file; // If bitmapData is not yet set or it differs from the new data if (bitmapData == null || bitmapData != file) { // Cancel previous task bitmapWorkerTask.cancel(true); } else { // The same work is already in progress return false; } } // No task associated with the ImageView, or an existing task was // cancelled return true; } private static ThumbnailGenerationTask getBitmapWorkerTask(ImageView imageView) { if (imageView != null) { final Drawable drawable = imageView.getDrawable(); if (drawable instanceof AsyncDrawable) { final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable; return asyncDrawable.getBitmapWorkerTask(); } } return null; } >>>>>>>
<<<<<<< import android.content.Intent; import android.content.ServiceConnection; ======= import android.content.SharedPreferences; >>>>>>> import android.content.Intent; import android.content.ServiceConnection; import android.content.SharedPreferences; <<<<<<< import android.os.IBinder; ======= import android.preference.PreferenceManager; >>>>>>> import android.os.IBinder; import android.preference.PreferenceManager; <<<<<<< import com.owncloud.android.services.observer.SyncedFolderObserverService; ======= import com.owncloud.android.ui.activity.Preferences; >>>>>>> import com.owncloud.android.services.observer.SyncedFolderObserverService; import com.owncloud.android.ui.activity.Preferences;
<<<<<<< ======= import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.ui.fragment.FileFragment; >>>>>>> import com.owncloud.android.datamodel.FileDataStorageManager;
<<<<<<< protected transient CUdeviceptr devicePointer; protected transient long devicePointerLength; protected transient Pointer hostPointer; protected transient ByteBuffer hostBuffer; ======= protected transient Pointer pinnedPointer; protected AtomicBoolean modified = new AtomicBoolean(false); >>>>>>> protected transient CUdeviceptr devicePointer; protected transient long devicePointerLength; protected transient Pointer hostPointer; protected transient ByteBuffer hostBuffer; protected AtomicBoolean modified = new AtomicBoolean(false); <<<<<<< if (dataType() == DataBuffer.Type.FLOAT) { ======= ensureNotFreed(); modified.set(true); if (dataType() == DataBuffer.FLOAT) { >>>>>>> modified.set(true); if (dataType() == DataBuffer.Type.FLOAT) { <<<<<<< ======= private void doCuda(int result) { if(result!=0) { //System.out.printf("getPointer %d\n",result); } } >>>>>>> <<<<<<< ======= ensureNotFreed(); modified.set(true); >>>>>>> modified.set(true); <<<<<<< JCublas.cublasScopy( getLength(), ======= JCublas.cublasScopy( length(), >>>>>>> JCublas.cublasScopy( getLength(), <<<<<<< ======= /* @Override protected void finalize() throws Throwable { super.finalize(); destroy(); } */ >>>>>>> <<<<<<< ======= ensureNotFreed(); modified.set(true); >>>>>>> modified.set(true); <<<<<<< public static void checkResult(int cuResult) { if (cuResult != CUresult.CUDA_SUCCESS) { throw new CudaException(CUresult.stringFor(cuResult)); ======= @Override public void destroy() { try { if(!freed.get()) { if (Nd4j.shouldInstrument) Nd4j.getInstrumentation().log(this, Instrumentation.DESTROYED); JCuda.cudaFreeHost(pinnedPointer); freed.set(true); Nd4j.getResourceManager().decrementCurrentAllocatedMemory(elementSize() * length()); references().clear(); } } catch (Exception e) { throw new RuntimeException(e); >>>>>>> public static void checkResult(int cuResult) { if (cuResult != CUresult.CUDA_SUCCESS) { throw new CudaException(CUresult.stringFor(cuResult));
<<<<<<< // URL Branding if (!mHostUrlInputEnabled) { mHostUrlInput.setText(getString(R.string.server_url)); mHostUrlInput.setVisibility(View.GONE); mCheckServerButton.setVisibility(View.VISIBLE); mCheckServerButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { checkOcServer(); } }); checkOcServer(); } ======= boolean refreshButtonEnabled = false; >>>>>>> boolean refreshButtonEnabled = false; // URL input configuration applied if (!mHostUrlInputEnabled) { mHostUrlInput.setText(getString(R.string.server_url)); findViewById(R.id.hostUrlFrame).setVisibility(View.GONE); mRefreshButton = findViewById(R.id.centeredRefreshButton); } else { mRefreshButton = findViewById(R.id.embeddedRefreshButton); } <<<<<<< mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0); mRefreshButtonEnabled = true; if (!mHostUrlInputEnabled){ mCheckServerButton.setVisibility(View.VISIBLE); } ======= /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0); mRefreshButtonEnabled = true;*/ mRefreshButton.setVisibility(View.VISIBLE); >>>>>>> mRefreshButton.setVisibility(View.VISIBLE); <<<<<<< mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); mRefreshButtonEnabled = false; if (!mHostUrlInputEnabled){ mCheckServerButton.setVisibility(View.INVISIBLE); } ======= /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); mRefreshButtonEnabled = false;*/ mRefreshButton.setVisibility(View.GONE); >>>>>>> mRefreshButton.setVisibility(View.GONE);
<<<<<<< Log_OC.d(TAG, "Phantom neutral button in dialog was clicked; dialog tag is " + callerTag); mCurrentDialog.dismiss(); mCurrentDialog = null; ======= Log.d(TAG, "Phantom neutral button in dialog was clicked; dialog tag is " + callerTag); >>>>>>> Log_OC.d(TAG, "Phantom neutral button in dialog was clicked; dialog tag is " + callerTag); <<<<<<< Log_OC.d(TAG, "Negative button in dialog was clicked; dialog tag is " + callerTag); mCurrentDialog.dismiss(); mCurrentDialog = null; ======= Log.d(TAG, "Negative button in dialog was clicked; dialog tag is " + callerTag); >>>>>>> Log_OC.d(TAG, "Negative button in dialog was clicked; dialog tag is " + callerTag);
<<<<<<< import com.owncloud.android.authentication.PinCheck; ======= import com.owncloud.android.datamodel.FileDataStorageManager; >>>>>>> import com.owncloud.android.authentication.PinCheck; import com.owncloud.android.datamodel.FileDataStorageManager;
<<<<<<< String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION); ======= String ocVersion = mAccountMgr.getUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION); String ocVersionString = mAccountMgr.getUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION_STRING); >>>>>>> String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION); String ocVersionString = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION_STRING); <<<<<<< mIsSharedSupported = Boolean.getBoolean(mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_SHARE_API)); ======= >>>>>>> <<<<<<< mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION, mDiscoveredVersion.toString()); mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL, mHostBaseUrl); mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SHARE_API, Boolean.toString(mIsSharedSupported)); ======= mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION, mDiscoveredVersion.getVersion()); mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString()); mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_BASE_URL, mHostBaseUrl); >>>>>>> mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION, mDiscoveredVersion.getVersion()); mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString()); mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL, mHostBaseUrl);
<<<<<<< ======= private ImageView mViewPasswordButton; >>>>>>> <<<<<<< if (savedInstanceState.getBoolean(KEY_PASSWORD_VISIBLE, false)) { showPassword(); } ======= >>>>>>> if (savedInstanceState.getBoolean(KEY_PASSWORD_VISIBLE, false)) { showPassword(); } <<<<<<< private void showViewPasswordButton() { //int drawable = android.R.drawable.ic_menu_view; int drawable = R.drawable.ic_view; if (isPasswordVisible()) { //drawable = android.R.drawable.ic_secure; drawable = R.drawable.ic_hide; } mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0); } private boolean isPasswordVisible() { return ((mPasswordInput.getInputType() & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); } private void hidePasswordButton() { mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } private void showPassword() { mPasswordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); showViewPasswordButton(); } private void hidePassword() { mPasswordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); showViewPasswordButton(); } ======= >>>>>>> private void showViewPasswordButton() { //int drawable = android.R.drawable.ic_menu_view; int drawable = R.drawable.ic_view; if (isPasswordVisible()) { //drawable = android.R.drawable.ic_secure; drawable = R.drawable.ic_hide; } mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0); } private boolean isPasswordVisible() { return ((mPasswordInput.getInputType() & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); } private void hidePasswordButton() { mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } private void showPassword() { mPasswordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); showViewPasswordButton(); } private void hidePassword() { mPasswordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); showViewPasswordButton(); } <<<<<<< ======= >>>>>>> <<<<<<< private int fuzz = 75; ======= private int fuzz = 10; >>>>>>> private int fuzz = 75; <<<<<<< } if (rightDrawable != null) { final int x = (int) event.getX(); final int y = (int) event.getY(); final Rect bounds = rightDrawable.getBounds(); if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz) && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) { return onDrawableTouch(event); ======= if (rightDrawable != null) { final int x = (int) event.getX(); final int y = (int) event.getY(); final Rect bounds = rightDrawable.getBounds(); if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz) && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) { return onDrawableTouch(event); } >>>>>>> } if (rightDrawable != null) { final int x = (int) event.getX(); final int y = (int) event.getY(); final Rect bounds = rightDrawable.getBounds(); if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz) && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) { return onDrawableTouch(event);
<<<<<<< public INDArray[] tear(INDArray tensor, int... dimensions) { return null; } ======= /** * Create from an in memory numpy pointer * * @param pointer the pointer to the * numpy array * @return an ndarray created from the in memory * numpy pointer */ @Override public INDArray createFromNpyPointer(Pointer pointer) { Pointer dataPointer = nativeOps.dataPointForNumpy(pointer); int dataBufferElementSize = nativeOps.elementSizeForNpyArray(pointer); DataBuffer data = null; Pointer shapeBufferPointer = nativeOps.shapeBufferForNumpy(pointer); int length = nativeOps.lengthForShapeBufferPointer(shapeBufferPointer); IntPointer intPointer = new IntPointer(shapeBufferPointer); DataBuffer shapeBuffer = Nd4j.createBuffer(shapeBufferPointer, DataBuffer.Type.INT,length,new IntRawIndexer(intPointer)); if(dataBufferElementSize == (Float.SIZE / 8)) { data = Nd4j.createBuffer(dataPointer, DataBuffer.Type.FLOAT, Shape.length(shapeBuffer), new FloatRawIndexer(new FloatPointer(dataPointer))); } else if(dataBufferElementSize == (Double.SIZE / 8)) { data = Nd4j.createBuffer(dataPointer, DataBuffer.Type.DOUBLE, Shape.length(shapeBuffer), new DoubleRawIndexer(new DoublePointer(dataPointer))); } INDArray ret = Nd4j.create(data,Shape.shape(shapeBuffer), Shape.strideArr(shapeBuffer),Shape.offset(shapeBuffer),Shape.order(shapeBuffer)); return ret; } /** * Create from a given numpy file. * * @param file the file to create the ndarray from * @return the created ndarray */ @Override public INDArray createFromNpyFile(File file) { Pointer pointer = nativeOps.numpyFromFile(new BytePointer(file.getAbsolutePath().getBytes())); return createFromNpyPointer(pointer); } >>>>>>> /** * Create from an in memory numpy pointer * * @param pointer the pointer to the * numpy array * @return an ndarray created from the in memory * numpy pointer */ @Override public INDArray createFromNpyPointer(Pointer pointer) { Pointer dataPointer = nativeOps.dataPointForNumpy(pointer); int dataBufferElementSize = nativeOps.elementSizeForNpyArray(pointer); DataBuffer data = null; Pointer shapeBufferPointer = nativeOps.shapeBufferForNumpy(pointer); int length = nativeOps.lengthForShapeBufferPointer(shapeBufferPointer); IntPointer intPointer = new IntPointer(shapeBufferPointer); DataBuffer shapeBuffer = Nd4j.createBuffer(shapeBufferPointer, DataBuffer.Type.INT,length,new IntRawIndexer(intPointer)); if(dataBufferElementSize == (Float.SIZE / 8)) { data = Nd4j.createBuffer(dataPointer, DataBuffer.Type.FLOAT, Shape.length(shapeBuffer), new FloatRawIndexer(new FloatPointer(dataPointer))); } else if(dataBufferElementSize == (Double.SIZE / 8)) { data = Nd4j.createBuffer(dataPointer, DataBuffer.Type.DOUBLE, Shape.length(shapeBuffer), new DoubleRawIndexer(new DoublePointer(dataPointer))); } INDArray ret = Nd4j.create(data,Shape.shape(shapeBuffer), Shape.strideArr(shapeBuffer),Shape.offset(shapeBuffer),Shape.order(shapeBuffer)); return ret; } /** * Create from a given numpy file. * * @param file the file to create the ndarray from * @return the created ndarray */ @Override public INDArray createFromNpyFile(File file) { Pointer pointer = nativeOps.numpyFromFile(new BytePointer(file.getAbsolutePath().getBytes())); return createFromNpyPointer(pointer); } public INDArray[] tear(INDArray tensor, int... dimensions) { return null; }
<<<<<<< /** * Converts an HSL color value to RGB. Conversion formula * adapted from http://en.wikipedia.org/wiki/HSL_color_space. * Assumes h, s, and l are contained in the set [0, 1] and * returns r, g, and b in the set [0, 255]. * from: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c * * @param integer h The hue * @param Integer s The saturation * @param Integer l The lightness * @return Array The RGB representation */ public static int[] hslToRgb(Double h, Double s, Double l){ Double r, g, b; if(s == 0){ r = g = b = l; // achromatic } else { Double q = l < 0.5 ? l * (1 + s) : l + s - l * s; Double p = 2 * l - q; r = hue2rgb(p, q, h + 1/3) * 255; g = hue2rgb(p, q, h) * 255; b = hue2rgb(p, q, h - 1/3) * 255; } int[] array = {r.intValue(), g.intValue(), b.intValue()}; return array; } private static Double hue2rgb(Double p, Double q, Double t){ if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } ======= /** * Checks if file passed is an image * @param file * @return true/false */ public static boolean isImage(File file) { Uri selectedUri = Uri.fromFile(file); String fileExtension = MimeTypeMap.getFileExtensionFromUrl(selectedUri.toString().toLowerCase()); String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension); return (mimeType != null && mimeType.startsWith("image/")); } >>>>>>> /** * Converts an HSL color value to RGB. Conversion formula * adapted from http://en.wikipedia.org/wiki/HSL_color_space. * Assumes h, s, and l are contained in the set [0, 1] and * returns r, g, and b in the set [0, 255]. * from: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c * * @param integer h The hue * @param Integer s The saturation * @param Integer l The lightness * @return Array The RGB representation */ public static int[] hslToRgb(Double h, Double s, Double l){ Double r, g, b; if(s == 0){ r = g = b = l; // achromatic } else { Double q = l < 0.5 ? l * (1 + s) : l + s - l * s; Double p = 2 * l - q; r = hue2rgb(p, q, h + 1/3) * 255; g = hue2rgb(p, q, h) * 255; b = hue2rgb(p, q, h - 1/3) * 255; } int[] array = {r.intValue(), g.intValue(), b.intValue()}; return array; } private static Double hue2rgb(Double p, Double q, Double t){ if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } /** * Checks if file passed is an image * @param file * @return true/false */ public static boolean isImage(File file) { Uri selectedUri = Uri.fromFile(file); String fileExtension = MimeTypeMap.getFileExtensionFromUrl(selectedUri.toString().toLowerCase()); String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension); return (mimeType != null && mimeType.startsWith("image/")); }
<<<<<<< import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; ======= import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.lib.common.utils.Log_OC; >>>>>>> import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; import com.owncloud.android.lib.common.utils.Log_OC;
<<<<<<< ======= >>>>>>> <<<<<<< import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.utils.Log_OC; ======= import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.operations.CreateFolderOperation; import com.owncloud.android.ui.dialog.CreateFolderDialogFragment; import com.owncloud.android.ui.dialog.LoadingDialog; import com.owncloud.android.utils.CopyTmpFileAsyncTask; >>>>>>> import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.operations.CreateFolderOperation; import com.owncloud.android.ui.dialog.CreateFolderDialogFragment; import com.owncloud.android.ui.dialog.LoadingDialog; import com.owncloud.android.utils.CopyTmpFileAsyncTask; <<<<<<< Vector<OCFile> tmpfiles = mStorageManager.getFolderContent(mFile, false); ======= Vector<OCFile> tmpfiles = getStorageManager().getFolderContent(mFile); >>>>>>> Vector<OCFile> tmpfiles = getStorageManager().getFolderContent(mFile, false); <<<<<<< Vector<OCFile> files = mStorageManager.getFolderContent(mFile, false); ======= Vector<OCFile> files = getStorageManager().getFolderContent(mFile); >>>>>>> Vector<OCFile> files = getStorageManager().getFolderContent(mFile, false); <<<<<<< new int[] {R.id.drawer_username}); setListAdapter(sa); Button btn = (Button) findViewById(R.id.uploader_choose_folder); btn.setOnClickListener(this); getListView().setOnItemClickListener(this); ======= new int[] {R.id.textView1}); mListView.setAdapter(sa); Button btnChooseFolder = (Button) findViewById(R.id.uploader_choose_folder); btnChooseFolder.setOnClickListener(this); Button btnNewFolder = (Button) findViewById(R.id.uploader_new_folder); btnNewFolder.setOnClickListener(this); mListView.setOnItemClickListener(this); >>>>>>> new int[] {R.id.textView1}); mListView.setAdapter(sa); Button btnChooseFolder = (Button) findViewById(R.id.uploader_choose_folder); btnChooseFolder.setOnClickListener(this); Button btnNewFolder = (Button) findViewById(R.id.uploader_new_folder); btnNewFolder.setOnClickListener(this); mListView.setOnItemClickListener(this);
<<<<<<< import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation; ======= import com.owncloud.android.oc_framework.operations.remote.RemoveRemoteFileOperation; >>>>>>> import com.owncloud.android.oc_framework.operations.remote.ReadRemoteFileOperation; import com.owncloud.android.oc_framework.operations.remote.RemoveRemoteFileOperation; <<<<<<< /** * Access to the library method to Read a File or Folder (PROPFIND DEPTH 1) * @param remotePath * * @return */ public RemoteOperationResult readFile(String remotePath) { ReadRemoteFileOperation readOperation= new ReadRemoteFileOperation(remotePath); RemoteOperationResult result = readOperation.execute(mClient); return result; } ======= /** * Access to the library method to Remove a File or Folder * * @param remotePath Remote path of the file or folder in the server. * @return */ public RemoteOperationResult removeFile(String remotePath) { RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath); RemoteOperationResult result = removeOperation.execute(mClient); return result; } >>>>>>> /** * Access to the library method to Remove a File or Folder * * @param remotePath Remote path of the file or folder in the server. * @return */ public RemoteOperationResult removeFile(String remotePath) { RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath); RemoteOperationResult result = removeOperation.execute(mClient); return result; } /** * Access to the library method to Read a File or Folder (PROPFIND DEPTH 1) * @param remotePath * * @return */ public RemoteOperationResult readFile(String remotePath) { ReadRemoteFileOperation readOperation= new ReadRemoteFileOperation(remotePath); RemoteOperationResult result = readOperation.execute(mClient); return result; }
<<<<<<< private static final int VIRTUAL = 9; ======= private static final int ARBITRARY_DATA = 9; >>>>>>> private static final int ARBITRARY_DATA = 9; private static final int VIRTUAL = 10; <<<<<<< case VIRTUAL: count = db.delete(ProviderTableMeta.VIRTUAL_TABLE_NAME, where, whereArgs); break; ======= case ARBITRARY_DATA: count = db.delete(ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME, where, whereArgs); break; >>>>>>> case ARBITRARY_DATA: count = db.delete(ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME, where, whereArgs); break; case VIRTUAL: count = db.delete(ProviderTableMeta.VIRTUAL_TABLE_NAME, where, whereArgs); break; <<<<<<< case VIRTUAL: Uri insertedVirtualUri; long virtualId = db.insert(ProviderTableMeta.VIRTUAL_TABLE_NAME, null, values); if (virtualId > 0) { insertedVirtualUri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_VIRTUAL, virtualId); } else { throw new SQLException("ERROR " + uri); } return insertedVirtualUri; ======= case ARBITRARY_DATA: Uri insertedArbitraryDataUri = null; long arbitraryDataId = db.insert(ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME, null, values); if (arbitraryDataId > 0) { insertedArbitraryDataUri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA, arbitraryDataId); } else { throw new SQLException("ERROR " + uri); } return insertedArbitraryDataUri; >>>>>>> case ARBITRARY_DATA: Uri insertedArbitraryDataUri = null; long arbitraryDataId = db.insert(ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME, null, values); if (arbitraryDataId > 0) { insertedArbitraryDataUri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA, arbitraryDataId); } else { throw new SQLException("ERROR " + uri); } return insertedArbitraryDataUri; case VIRTUAL: Uri insertedVirtualUri; long virtualId = db.insert(ProviderTableMeta.VIRTUAL_TABLE_NAME, null, values); if (virtualId > 0) { insertedVirtualUri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_VIRTUAL, virtualId); } else { throw new SQLException("ERROR " + uri); } return insertedVirtualUri; <<<<<<< mUriMatcher.addURI(authority, "virtual", VIRTUAL); ======= mUriMatcher.addURI(authority, "arbitrary_data", ARBITRARY_DATA); >>>>>>> mUriMatcher.addURI(authority, "arbitrary_data", ARBITRARY_DATA); mUriMatcher.addURI(authority, "virtual", VIRTUAL); <<<<<<< case VIRTUAL: sqlQuery.setTables(ProviderTableMeta.VIRTUAL_TABLE_NAME); if (uri.getPathSegments().size() > 1) { sqlQuery.appendWhere(ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1)); } break; ======= case ARBITRARY_DATA: sqlQuery.setTables(ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME); if (uri.getPathSegments().size() > 1) { sqlQuery.appendWhere(ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1)); } break; >>>>>>> case ARBITRARY_DATA: sqlQuery.setTables(ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME); if (uri.getPathSegments().size() > 1) { sqlQuery.appendWhere(ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1)); } break; case VIRTUAL: sqlQuery.setTables(ProviderTableMeta.VIRTUAL_TABLE_NAME); if (uri.getPathSegments().size() > 1) { sqlQuery.appendWhere(ProviderTableMeta._ID + "=" + uri.getPathSegments().get(1)); } break; <<<<<<< case VIRTUAL: order = ProviderTableMeta.VIRTUAL_TYPE; break; ======= case ARBITRARY_DATA: order = ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID; break; >>>>>>> case ARBITRARY_DATA: order = ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID; break; case VIRTUAL: order = ProviderTableMeta.VIRTUAL_TYPE; break; <<<<<<< // Create virtual table createVirtualTable(db); ======= // Create arbitrary data table createArbitraryData(db); >>>>>>> // Create arbitrary data table createArbitraryData(db); // Create virtual table createVirtualTable(db); <<<<<<< if (oldVersion < 20 && newVersion >= 20) { Log_OC.i(SQL, "Adding virtual table"); db.beginTransaction(); try { createVirtualTable(db); upgraded = true; db.setTransactionSuccessful(); } finally { db.endTransaction(); } } if (!upgraded) { Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion)); } ======= if (oldVersion < 20 && newVersion >= 20) { Log_OC.i(SQL, "Adding arbitrary data table"); db.beginTransaction(); try { createArbitraryData(db); upgraded = true; db.setTransactionSuccessful(); } finally { db.endTransaction(); } } if (!upgraded) { Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion)); } >>>>>>> if (oldVersion < 20 && newVersion >= 20) { Log_OC.i(SQL, "Adding arbitrary data table"); db.beginTransaction(); try { createArbitraryData(db); upgraded = true; db.setTransactionSuccessful(); } finally { db.endTransaction(); } } if (!upgraded) { Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion)); } if (oldVersion < 21 && newVersion >= 21) { Log_OC.i(SQL, "Adding virtual table"); db.beginTransaction(); try { createVirtualTable(db); upgraded = true; db.setTransactionSuccessful(); } finally { db.endTransaction(); } } if (!upgraded) { Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion)); } <<<<<<< private void createVirtualTable(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + ProviderTableMeta.VIRTUAL_TABLE_NAME + "(" + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " // id + ProviderTableMeta.VIRTUAL_TYPE + " TEXT, " // type + ProviderTableMeta.VIRTUAL_OCFILE_ID + " INTEGER )" // file id ); } ======= private void createArbitraryData(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME + "(" + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " // id + ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " TEXT, " // cloud id (account name + FQDN) + ProviderTableMeta.ARBITRARY_DATA_KEY + " TEXT, " // key + ProviderTableMeta.ARBITRARY_DATA_VALUE + " TEXT) " // value ); } >>>>>>> private void createArbitraryData(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + ProviderTableMeta.ARBITRARY_DATA_TABLE_NAME + "(" + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " // id + ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " TEXT, " // cloud id (account name + FQDN) + ProviderTableMeta.ARBITRARY_DATA_KEY + " TEXT, " // key + ProviderTableMeta.ARBITRARY_DATA_VALUE + " TEXT) " // value ); } private void createVirtualTable(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + ProviderTableMeta.VIRTUAL_TABLE_NAME + "(" + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " // id + ProviderTableMeta.VIRTUAL_TYPE + " TEXT, " // type + ProviderTableMeta.VIRTUAL_OCFILE_ID + " INTEGER )" // file id ); }
<<<<<<< import java.sql.Time; import java.text.SimpleDateFormat; ======= import java.net.IDN; >>>>>>> import java.net.IDN; <<<<<<< import android.content.Context; import android.text.format.DateFormat; import android.text.format.DateUtils; ======= import android.annotation.TargetApi; import android.os.Build; import com.owncloud.android.MainApp; >>>>>>> import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.text.format.DateFormat; import android.text.format.DateUtils; import com.owncloud.android.MainApp; <<<<<<< public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution, long transitionResolution, int flags){ if (time > System.currentTimeMillis()){ return DisplayUtils.unixTimeToHumanReadable(time); } else if ((System.currentTimeMillis() - time) < 60000) { return c.getString(R.string.file_list_seconds_ago) + ", " + DateFormat.getTimeFormat(c).format(new Date(time)); } else { return DateUtils.getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags); } } ======= /** * Converts an internationalized domain name (IDN) in an URL to and from ASCII/Unicode. * @param url the URL where the domain name should be converted * @param toASCII if true converts from Unicode to ASCII, if false converts from ASCII to Unicode * @return the URL containing the converted domain name */ @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static String convertIdn(String url, boolean toASCII) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { // Find host name after '//' or '@' int hostStart = 0; if (url.indexOf("//") != -1) { hostStart = url.indexOf("//") + "//".length(); } else if (url.indexOf("@") != -1) { hostStart = url.indexOf("@") + "@".length(); } int hostEnd = url.substring(hostStart).indexOf("/"); // Handle URL which doesn't have a path (path is implicitly '/') hostEnd = (hostEnd == -1 ? url.length() : hostStart + hostEnd); String host = url.substring(hostStart, hostEnd); host = (toASCII ? IDN.toASCII(host) : IDN.toUnicode(host)); return url.substring(0, hostStart) + host + url.substring(hostEnd); } else { return url; } } >>>>>>> /** * Converts an internationalized domain name (IDN) in an URL to and from ASCII/Unicode. * @param url the URL where the domain name should be converted * @param toASCII if true converts from Unicode to ASCII, if false converts from ASCII to Unicode * @return the URL containing the converted domain name */ @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static String convertIdn(String url, boolean toASCII) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { // Find host name after '//' or '@' int hostStart = 0; if (url.indexOf("//") != -1) { hostStart = url.indexOf("//") + "//".length(); } else if (url.indexOf("@") != -1) { hostStart = url.indexOf("@") + "@".length(); } int hostEnd = url.substring(hostStart).indexOf("/"); // Handle URL which doesn't have a path (path is implicitly '/') hostEnd = (hostEnd == -1 ? url.length() : hostStart + hostEnd); String host = url.substring(hostStart, hostEnd); host = (toASCII ? IDN.toASCII(host) : IDN.toUnicode(host)); return url.substring(0, hostStart) + host + url.substring(hostEnd); } else { return url; } } public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution, long transitionResolution, int flags){ if (time > System.currentTimeMillis()){ return DisplayUtils.unixTimeToHumanReadable(time); } else if ((System.currentTimeMillis() - time) < 60000) { return c.getString(R.string.file_list_seconds_ago) + ", " + DateFormat.getTimeFormat(c).format(new Date(time)); } else { return DateUtils.getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags); } }
<<<<<<< import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; ======= import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; >>>>>>> import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; <<<<<<< mTransferServiceGetter = transferServiceGetter; ======= mTransferServiceGetter = transferServiceGetter; >>>>>>> mTransferServiceGetter = transferServiceGetter; <<<<<<< mSortOrder = mAppPreferences .getInt("sortOrder", 0); mSortAscending = mAppPreferences.getBoolean("sortAscending", true); ======= FileStorageUtils.mSortOrder = mAppPreferences.getInt("sortOrder", 0); FileStorageUtils.mSortAscending = mAppPreferences.getBoolean("sortAscending", true); >>>>>>> FileStorageUtils.mSortOrder = mAppPreferences.getInt("sortOrder", 0); FileStorageUtils.mSortAscending = mAppPreferences.getBoolean("sortAscending", true); <<<<<<< } ======= } public void setGridMode(boolean gridMode) { mGridMode = gridMode; } >>>>>>> } public void setGridMode(boolean gridMode) { mGridMode = gridMode; }
<<<<<<< import com.owncloud.android.oc_framework.network.webdav.OnDatatransferProgressListener; import com.owncloud.android.oc_framework.operations.OnRemoteOperationListener; import com.owncloud.android.oc_framework.operations.RemoteOperation; import com.owncloud.android.oc_framework.operations.RemoteOperationResult; import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; ======= import com.owncloud.android.operations.OnRemoteOperationListener; import com.owncloud.android.operations.RemoteOperation; import com.owncloud.android.operations.RemoteOperationResult; >>>>>>> import com.owncloud.android.oc_framework.network.webdav.OnDatatransferProgressListener; import com.owncloud.android.oc_framework.operations.OnRemoteOperationListener; import com.owncloud.android.oc_framework.operations.RemoteOperation; import com.owncloud.android.oc_framework.operations.RemoteOperationResult; import com.owncloud.android.oc_framework.operations.RemoteOperationResult.ResultCode; <<<<<<< ======= import eu.alefzero.webdav.OnDatatransferProgressListener; >>>>>>>
<<<<<<< .setExecutionModel(Configuration.ExecutionModel.ASYNCHRONOUS) .setAllocationModel(Configuration.AllocationModel.CACHE_ALL) .setMaximumSingleDeviceAllocation(1024 * 1024 * 1024L) .setMaximumBlockSize(128) .setMaximumGridSize(256) .enableDebug(false) .setVerbose(false); ======= .setAllocationModel(Configuration.AllocationModel.DIRECT) .setExecutionModel(Configuration.ExecutionModel.SEQUENTIAL) .setMaximumBlockSize(64) .enableDebug(true) .setVerbose(true); >>>>>>> .setExecutionModel(Configuration.ExecutionModel.ASYNCHRONOUS) .setAllocationModel(Configuration.AllocationModel.CACHE_ALL) .setMaximumSingleDeviceAllocation(1024 * 1024 * 1024L) .setMaximumBlockSize(128) .setMaximumGridSize(256) .enableDebug(false) .setVerbose(false); <<<<<<< @Test public void testSignXZ(){ double[] d = {1.0, -1.1, 1.2, 1.3, -1.4, -1.5, 1.6, -1.7, -1.8, -1.9, -1.01, -1.011}; double[] e = {1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0}; INDArray arrF = Nd4j.create(d,new int[]{4,3},'f'); INDArray arrC = Nd4j.create(new int[]{4,3},'c').assign(arrF); INDArray exp = Nd4j.create(e, new int[]{4,3}, 'f'); //First: do op with just x (inplace) INDArray arrFCopy = arrF.dup('f'); INDArray arrCCopy = arrC.dup('c'); Nd4j.getExecutioner().exec(new Sign(arrFCopy)); Nd4j.getExecutioner().exec(new Sign(arrCCopy)); assertEquals(exp, arrFCopy); assertEquals(exp, arrCCopy); //Second: do op with both x and z: INDArray zOutFC = Nd4j.create(new int[]{4,3},'c'); INDArray zOutFF = Nd4j.create(new int[]{4,3},'f'); INDArray zOutCC = Nd4j.create(new int[]{4,3},'c'); INDArray zOutCF = Nd4j.create(new int[]{4,3},'f'); Nd4j.getExecutioner().exec(new Sign(arrF, zOutFC)); Nd4j.getExecutioner().exec(new Sign(arrF, zOutFF)); Nd4j.getExecutioner().exec(new Sign(arrC, zOutCC)); Nd4j.getExecutioner().exec(new Sign(arrC, zOutCF)); assertEquals(exp, zOutFC); //fails assertEquals(exp, zOutFF); //pass assertEquals(exp, zOutCC); //pass assertEquals(exp, zOutCF); //fails } ======= @Test public void testSoftmax1D_1() throws Exception { INDArray input1T = Nd4j.create(new double[]{ -0.75, 0.58, 0.42, 1.03, -0.61, 0.19, -0.37, -0.40, -1.42, -0.04}).transpose(); INDArray input1 = Nd4j.create(new double[]{ -0.75, 0.58, 0.42, 1.03, -0.61, 0.19, -0.37, -0.40, -1.42, -0.04}); INDArray input2 = Nd4j.zerosLike(input1); Nd4j.copy(input1, input2); INDArray output1 = Nd4j.create(1, 10); INDArray output1T = Nd4j.create(1, 10); System.out.println("FA --------------------"); Nd4j.getExecutioner().exec(new SoftMax(input1, output1)); Nd4j.getExecutioner().exec(new SoftMax(input1T, output1T)); System.out.println("FB --------------------"); System.out.println("Softmax = " + output1); INDArray output2 = Nd4j.create(1,10); Nd4j.getExecutioner().exec(new SoftMaxDerivative(input2, output2)); System.out.println("Softmax Derivative = " + output2); INDArray assertion1 = Nd4j.create(new double[]{0.04, 0.16, 0.14, 0.26, 0.05, 0.11, 0.06, 0.06, 0.02, 0.09}); assertArrayEquals(assertion1.data().asFloat(), output1.data().asFloat(), 0.01f); assertArrayEquals(assertion1.data().asFloat(), output1T.data().asFloat(), 0.01f); } >>>>>>> @Test public void testSignXZ(){ double[] d = {1.0, -1.1, 1.2, 1.3, -1.4, -1.5, 1.6, -1.7, -1.8, -1.9, -1.01, -1.011}; double[] e = {1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0}; INDArray arrF = Nd4j.create(d,new int[]{4,3},'f'); INDArray arrC = Nd4j.create(new int[]{4,3},'c').assign(arrF); INDArray exp = Nd4j.create(e, new int[]{4,3}, 'f'); //First: do op with just x (inplace) INDArray arrFCopy = arrF.dup('f'); INDArray arrCCopy = arrC.dup('c'); Nd4j.getExecutioner().exec(new Sign(arrFCopy)); Nd4j.getExecutioner().exec(new Sign(arrCCopy)); assertEquals(exp, arrFCopy); assertEquals(exp, arrCCopy); //Second: do op with both x and z: INDArray zOutFC = Nd4j.create(new int[]{4,3},'c'); INDArray zOutFF = Nd4j.create(new int[]{4,3},'f'); INDArray zOutCC = Nd4j.create(new int[]{4,3},'c'); INDArray zOutCF = Nd4j.create(new int[]{4,3},'f'); Nd4j.getExecutioner().exec(new Sign(arrF, zOutFC)); Nd4j.getExecutioner().exec(new Sign(arrF, zOutFF)); Nd4j.getExecutioner().exec(new Sign(arrC, zOutCC)); Nd4j.getExecutioner().exec(new Sign(arrC, zOutCF)); assertEquals(exp, zOutFC); //fails assertEquals(exp, zOutFF); //pass assertEquals(exp, zOutCC); //pass assertEquals(exp, zOutCF); //fails } @Test public void testSoftmax1D_1() throws Exception { INDArray input1T = Nd4j.create(new double[]{ -0.75, 0.58, 0.42, 1.03, -0.61, 0.19, -0.37, -0.40, -1.42, -0.04}).transpose(); INDArray input1 = Nd4j.create(new double[]{ -0.75, 0.58, 0.42, 1.03, -0.61, 0.19, -0.37, -0.40, -1.42, -0.04}); INDArray input2 = Nd4j.zerosLike(input1); Nd4j.copy(input1, input2); INDArray output1 = Nd4j.create(1, 10); INDArray output1T = Nd4j.create(1, 10); System.out.println("FA --------------------"); Nd4j.getExecutioner().exec(new SoftMax(input1, output1)); Nd4j.getExecutioner().exec(new SoftMax(input1T, output1T)); System.out.println("FB --------------------"); System.out.println("Softmax = " + output1); INDArray output2 = Nd4j.create(1,10); Nd4j.getExecutioner().exec(new SoftMaxDerivative(input2, output2)); System.out.println("Softmax Derivative = " + output2); INDArray assertion1 = Nd4j.create(new double[]{0.04, 0.16, 0.14, 0.26, 0.05, 0.11, 0.06, 0.06, 0.02, 0.09}); assertArrayEquals(assertion1.data().asFloat(), output1.data().asFloat(), 0.01f); assertArrayEquals(assertion1.data().asFloat(), output1T.data().asFloat(), 0.01f); }
<<<<<<< import com.owncloud.android.ui.TextDrawable; ======= import com.owncloud.android.ui.NavigationDrawerItem; >>>>>>> import com.owncloud.android.ui.NavigationDrawerItem; import com.owncloud.android.ui.TextDrawable; <<<<<<< rb.setTextColor(Color.BLACK); rb.setEllipsize(TextUtils.TruncateAt.MIDDLE); rb.setSingleLine(); rb.setCompoundDrawablePadding(30); ======= rb.setContentDescription(account.name); >>>>>>> rb.setContentDescription(account.name); rb.setTextColor(Color.BLACK); rb.setEllipsize(TextUtils.TruncateAt.MIDDLE); rb.setSingleLine(); rb.setCompoundDrawablePadding(30);
<<<<<<< import com.owncloud.android.Log_OC; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.FileHandler; import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder; import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.operations.OnRemoteOperationListener; import com.owncloud.android.operations.RemoteOperation; import com.owncloud.android.operations.RemoveFileOperation; import com.owncloud.android.operations.RenameFileOperation; import com.owncloud.android.operations.SynchronizeFileOperation; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.activity.TransferServiceGetter; import com.owncloud.android.ui.adapter.FileListListAdapter; import com.owncloud.android.ui.dialog.EditNameDialog; import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener; import com.owncloud.android.ui.fragment.ConfirmationDialogFragment.ConfirmationDialogFragmentListener; import com.owncloud.android.ui.preview.PreviewImageFragment; import com.owncloud.android.ui.preview.PreviewMediaFragment; import android.accounts.Account; ======= >>>>>>> import android.accounts.Account; <<<<<<< import android.media.MediaScannerConnection; ======= import android.content.Intent; >>>>>>> import android.content.Intent; import android.media.MediaScannerConnection; <<<<<<< /** * Interface to implement by any Activity that includes some instance of FileListFragment * * @author David A. Velasco */ public interface ContainerActivity extends TransferServiceGetter, OnRemoteOperationListener, FileHandler { /** * Callback method invoked when a the user browsed into a different folder through the list of files * * @param file */ public void onBrowsedDownTo(OCFile folder); public void startDownloadForPreview(OCFile file); public void startMediaPreview(OCFile file, int i, boolean b); public void startImagePreview(OCFile file); public void startSyncFolderOperation(OCFile folder); /** * Getter for the current DataStorageManager in the container activity */ public FileDataStorageManager getStorageManager(); /** * Callback method invoked when a the 'transfer state' of a file changes. * * This happens when a download or upload is started or ended for a file. * * This method is necessary by now to update the user interface of the double-pane layout in tablets * because methods {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and {@link FileUploaderBinder#isUploading(Account, OCFile)} * won't provide the needed response before the method where this is called finishes. * * TODO Remove this when the transfer state of a file is kept in the database (other thing TODO) * * @param file OCFile which state changed. * @param downloading Flag signaling if the file is now downloading. * @param uploading Flag signaling if the file is now uploading. */ public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading); } @Override public void onDismiss(EditNameDialog dialog) { if (dialog.getResult()) { String newFilename = dialog.getNewFilename(); Log_OC.d(TAG, "name edit dialog dismissed with new name " + newFilename); RemoteOperation operation = new RenameFileOperation(mTargetFile, AccountUtils.getCurrentOwnCloudAccount(getActivity()), newFilename, mContainerActivity.getStorageManager()); operation.execute(AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity()), getSherlockActivity(), mContainerActivity, mHandler, getSherlockActivity()); ((FileDisplayActivity) getActivity()).showLoadingDialog(); } } @Override public void onConfirmation(String callerTag) { if (callerTag.equals(FileDetailFragment.FTAG_CONFIRMATION)) { if (mContainerActivity.getStorageManager().getFileById(mTargetFile.getFileId()) != null) { String path = new File(mTargetFile.getStoragePath()).getParent(); RemoteOperation operation = new RemoveFileOperation( mTargetFile, true, mContainerActivity.getStorageManager()); operation.execute(AccountUtils.getCurrentOwnCloudAccount(getSherlockActivity()), getSherlockActivity(), mContainerActivity, mHandler, getSherlockActivity()); ((FileDisplayActivity) getActivity()).showLoadingDialog(); triggerMediaScan(path); } } } @Override public void onNeutral(String callerTag) { String path = new File(mTargetFile.getStoragePath()).getParent(); mContainerActivity.getStorageManager().removeFile(mTargetFile, false, true); // TODO perform in background task / new thread triggerMediaScan(path); listDirectory(); mContainerActivity.onTransferStateChanged(mTargetFile, false, false); } @Override public void onCancel(String callerTag) { Log_OC.d(TAG, "REMOVAL CANCELED"); } private void triggerMediaScan(String path){ MediaScannerConnection.scanFile( getActivity().getApplicationContext(), new String[]{path}, null,null); } ======= >>>>>>> private void triggerMediaScan(String path){ MediaScannerConnection.scanFile( getActivity().getApplicationContext(), new String[]{path}, null,null); }
<<<<<<< /** * Scans the default location for saving local copies of files searching for * a 'lost' file with the same full name as the {@link OCFile} received as * parameter. * * @param file File to associate a possible 'lost' local file. */ private void searchForLocalFileInDefaultPath(OCFile file) { if (file.getStoragePath() == null && !file.isFolder()) { File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file)); if (f.exists()) { file.setStoragePath(f.getAbsolutePath()); file.setLastSyncDateForData(f.lastModified()); } } } /** * Sends a message to any application component interested in the progress of the synchronization. * * @param inProgress 'True' when the synchronization progress is not finished. * @param dirRemotePath Remote path of a folder that was just synchronized (with or without success) */ private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) { Intent i = new Intent(FileSyncService.getSyncMessage()); i.putExtra(FileSyncService.IN_PROGRESS, inProgress); i.putExtra(FileSyncService.ACCOUNT_NAME, mAccount.name); if (dirRemotePath != null) { i.putExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH, dirRemotePath); } if (result != null) { i.putExtra(FileSyncService.SYNC_RESULT, result); } mContext.sendStickyBroadcast(i); } public boolean getRemoteFolderChanged() { return mRemoteFolderChanged; } ======= >>>>>>> /** * Scans the default location for saving local copies of files searching for * a 'lost' file with the same full name as the {@link OCFile} received as * parameter. * * @param file File to associate a possible 'lost' local file. */ private void searchForLocalFileInDefaultPath(OCFile file) { if (file.getStoragePath() == null && !file.isFolder()) { File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file)); if (f.exists()) { file.setStoragePath(f.getAbsolutePath()); file.setLastSyncDateForData(f.lastModified()); } } } /** * Sends a message to any application component interested in the progress of the synchronization. * * @param inProgress 'True' when the synchronization progress is not finished. * @param dirRemotePath Remote path of a folder that was just synchronized (with or without success) */ private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) { Intent i = new Intent(FileSyncService.getSyncMessage()); i.putExtra(FileSyncService.IN_PROGRESS, inProgress); i.putExtra(FileSyncService.ACCOUNT_NAME, mAccount.name); if (dirRemotePath != null) { i.putExtra(FileSyncService.SYNC_FOLDER_REMOTE_PATH, dirRemotePath); } if (result != null) { i.putExtra(FileSyncService.SYNC_RESULT, result); } mContext.sendStickyBroadcast(i); } public boolean getRemoteFolderChanged() { return mRemoteFolderChanged; }
<<<<<<< ======= // This account must exists on the simulator / device String accountHost = "beta.owncloud.com"; String accountUser = "testandroid"; String accountName = accountUser + "@"+ accountHost; String accountPass = "testandroid"; String accountType = "owncloud"; >>>>>>> <<<<<<< // if (mAccount == null) { // mAccount = new Account(accountName, mAccountType); // am.addAccountExplicitly(mAccount, mAccountPass, null); // am.setUserData(mAccount, "oc_version", "5.0.14"); // am.setUserData(mAccount, "oc_base_url", "http://beta.owncloud.com/owncloud"); // } else { // Log.d(TAG, "oc_version --->"+ am.getUserData(mAccount, "oc_version") ); // Log.d(TAG, "oc_base_url --->"+ am.getUserData(mAccount, "oc_base_url") ); // } ======= // Get the WebDavClient AuthTask task = new AuthTask(); task.execute(this.getApplicationContext()); >>>>>>> // Get the WebDavClient AuthTask task = new AuthTask(); task.execute(this.getApplicationContext()); <<<<<<< /** * Access to the library method to Rename a File or Folder * @param oldName Old name of the file. * @param oldRemotePath Old remote path of the file. For folders it starts and ends by "/" * @param newName New name to set as the name of file. * @param newRemotePath New remote path to move the file, for folders it starts and ends by "/" * * @return */ public RemoteOperationResult renameFile(String oldName, String oldRemotePath, String newName, String newRemotePath) { RenameRemoteFileOperation renameOperation = new RenameRemoteFileOperation(oldName, oldRemotePath, newName, newRemotePath); RemoteOperationResult result = renameOperation.execute(mClient); return result; } ======= private class AuthTask extends AsyncTask<Context, Void, WebdavClient> { @Override protected WebdavClient doInBackground(Context... params) { WebdavClient client = null; try { client = OwnCloudClientFactory.createOwnCloudClient(mAccount, (Context) params[0] ); } catch (OperationCanceledException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (AuthenticatorException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (AccountNotFoundException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (IOException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (IllegalStateException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } return client; } @Override protected void onPostExecute(WebdavClient result) { // TODO Auto-generated method stub super.onPostExecute(result); mClient = result; } } >>>>>>> /** * Access to the library method to Rename a File or Folder * @param oldName Old name of the file. * @param oldRemotePath Old remote path of the file. For folders it starts and ends by "/" * @param newName New name to set as the name of file. * @param newRemotePath New remote path to move the file, for folders it starts and ends by "/" * * @return */ public RemoteOperationResult renameFile(String oldName, String oldRemotePath, String newName, String newRemotePath) { RenameRemoteFileOperation renameOperation = new RenameRemoteFileOperation(oldName, oldRemotePath, newName, newRemotePath); RemoteOperationResult result = renameOperation.execute(mClient); return result; } private class AuthTask extends AsyncTask<Context, Void, WebdavClient> { @Override protected WebdavClient doInBackground(Context... params) { WebdavClient client = null; try { client = OwnCloudClientFactory.createOwnCloudClient(mAccount, (Context) params[0] ); } catch (OperationCanceledException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (AuthenticatorException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (AccountNotFoundException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (IOException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } catch (IllegalStateException e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); e.printStackTrace(); } return client; } @Override protected void onPostExecute(WebdavClient result) { // TODO Auto-generated method stub super.onPostExecute(result); mClient = result; } }
<<<<<<< mSortAscending = mAppPreferences.getBoolean("sortAscending", true); ======= FileStorageUtils.mSortAscending = mAppPreferences.getBoolean("sortAscending", true); >>>>>>> FileStorageUtils.mSortAscending = mAppPreferences.getBoolean("sortAscending", true); <<<<<<< /** * Local Folder size * @param dir File * @return Size in bytes */ private long getFolderSize(File dir) { if (dir.exists()) { long result = 0; File[] fileList = dir.listFiles(); for(int i = 0; i < fileList.length; i++) { if(fileList[i].isDirectory()) { result += getFolderSize(fileList[i]); } else { result += fileList[i].length(); } } return result; } return 0; } ======= >>>>>>> /** * Local Folder size * @param dir File * @return Size in bytes */ private long getFolderSize(File dir) { if (dir.exists()) { long result = 0; File[] fileList = dir.listFiles(); for(int i = 0; i < fileList.length; i++) { if(fileList[i].isDirectory()) { result += getFolderSize(fileList[i]); } else { result += fileList[i].length(); } } return result; } return 0; } <<<<<<< } ======= } >>>>>>> }
<<<<<<< private enum ViewType {LIST_ITEM, GRID_IMAGE, GRID_ITEM }; private Integer mSortOrder; public static final Integer SORT_NAME = 0; public static final Integer SORT_DATE = 1; public static final Integer SORT_SIZE = 2; private Boolean mSortAscending; ======= >>>>>>> private enum ViewType {LIST_ITEM, GRID_IMAGE, GRID_ITEM }; <<<<<<< file = mFiles.get(position); } // Find out which layout should be displayed ViewType viewType; if (!fileView){ viewType = ViewType.LIST_ITEM; } else if (file.isImage()){ viewType = ViewType.GRID_IMAGE; } else { viewType = ViewType.GRID_ITEM; } // Create View switch (viewType){ case GRID_IMAGE: view = inflator.inflate(R.layout.grid_image, null); break; case GRID_ITEM: view = inflator.inflate(R.layout.grid_item, null); break; case LIST_ITEM: view = inflator.inflate(R.layout.list_item, null); break; } view.invalidate(); if (file != null){ ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail); TextView fileName; String name; switch (viewType){ case LIST_ITEM: TextView fileSizeV = (TextView) view.findViewById(R.id.file_size); TextView lastModV = (TextView) view.findViewById(R.id.last_mod); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); lastModV.setVisibility(View.VISIBLE); lastModV.setText(showRelativeTimestamp(file)); checkBoxV.setVisibility(View.GONE); fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); if (!file.isFolder()) { GridView parentList = (GridView)parent; if (parentList.getChoiceMode() == GridView.CHOICE_MODE_NONE) { checkBoxV.setVisibility(View.GONE); } else { if (parentList.isItemChecked(position)) { checkBoxV.setImageResource(android.R.drawable.checkbox_on_background); } else { checkBoxV.setImageResource(android.R.drawable.checkbox_off_background); } checkBoxV.setVisibility(View.VISIBLE); } } else { //Folder fileSizeV.setVisibility(View.INVISIBLE); } case GRID_ITEM: // filename fileName = (TextView) view.findViewById(R.id.Filename); name = file.getFileName(); fileName.setText(name); case GRID_IMAGE: // sharedIcon ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); if (file.isShareByLink()) { sharedIconV.setVisibility(View.VISIBLE); sharedIconV.bringToFront(); } else { sharedIconV.setVisibility(View.GONE); } // local state ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator); localStateView.bringToFront(); FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) { localStateView.setImageResource(R.drawable.downloading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) { localStateView.setImageResource(R.drawable.uploading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (file.isDown()) { localStateView.setImageResource(R.drawable.local_file_indicator); localStateView.setVisibility(View.VISIBLE); } else { localStateView.setVisibility(View.INVISIBLE); } // share with me icon if (!file.isFolder()) { ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon); sharedWithMeIconV.bringToFront(); if (checkIfFileIsSharedWithMe(file)) { sharedWithMeIconV.setVisibility(View.VISIBLE); } else { sharedWithMeIconV.setVisibility(View.GONE); } } break; ======= OCFile file = mFiles.get(position); TextView fileName = (TextView) view.findViewById(R.id.Filename); String name = file.getFileName(); fileName.setText(name); ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1); fileIcon.setTag(file.getFileId()); ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon); sharedWithMeIconV.setVisibility(View.GONE); ImageView localStateView = (ImageView) view.findViewById(R.id.imageView2); localStateView.bringToFront(); FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); boolean downloading = (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)); OperationsServiceBinder opsBinder = mTransferServiceGetter.getOperationsServiceBinder(); downloading |= (opsBinder != null && opsBinder.isSynchronizing(mAccount, file.getRemotePath())); if (downloading) { localStateView.setImageResource(R.drawable.downloading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) { localStateView.setImageResource(R.drawable.uploading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (file.isDown()) { localStateView.setImageResource(R.drawable.local_file_indicator); localStateView.setVisibility(View.VISIBLE); } else { localStateView.setVisibility(View.INVISIBLE); >>>>>>> file = mFiles.get(position); } // Find out which layout should be displayed ViewType viewType; if (!fileView){ viewType = ViewType.LIST_ITEM; } else if (file.isImage()){ viewType = ViewType.GRID_IMAGE; } else { viewType = ViewType.GRID_ITEM; } // Create View switch (viewType){ case GRID_IMAGE: view = inflator.inflate(R.layout.grid_image, null); break; case GRID_ITEM: view = inflator.inflate(R.layout.grid_item, null); break; case LIST_ITEM: view = inflator.inflate(R.layout.list_item, null); break; } view.invalidate(); if (file != null){ ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail); fileIcon.setTag(file.getFileId()); TextView fileName; String name; switch (viewType){ case LIST_ITEM: TextView fileSizeV = (TextView) view.findViewById(R.id.file_size); TextView lastModV = (TextView) view.findViewById(R.id.last_mod); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); lastModV.setVisibility(View.VISIBLE); lastModV.setText(showRelativeTimestamp(file)); checkBoxV.setVisibility(View.GONE); fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); if (!file.isFolder()) { GridView parentList = (GridView)parent; if (parentList.getChoiceMode() == GridView.CHOICE_MODE_NONE) { checkBoxV.setVisibility(View.GONE); } else { if (parentList.isItemChecked(position)) { checkBoxV.setImageResource(android.R.drawable.checkbox_on_background); } else { checkBoxV.setImageResource(android.R.drawable.checkbox_off_background); } checkBoxV.setVisibility(View.VISIBLE); } } else { //Folder fileSizeV.setVisibility(View.INVISIBLE); } case GRID_ITEM: // filename fileName = (TextView) view.findViewById(R.id.Filename); name = file.getFileName(); fileName.setText(name); case GRID_IMAGE: // sharedIcon ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); if (file.isShareByLink()) { sharedIconV.setVisibility(View.VISIBLE); sharedIconV.bringToFront(); } else { sharedIconV.setVisibility(View.GONE); } // local state ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator); localStateView.bringToFront(); FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); boolean downloading = (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)); OperationsServiceBinder opsBinder = mTransferServiceGetter.getOperationsServiceBinder(); downloading |= (opsBinder != null && opsBinder.isSynchronizing(mAccount, file.getRemotePath())); if (downloading) { localStateView.setImageResource(R.drawable.downloading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) { localStateView.setImageResource(R.drawable.uploading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (file.isDown()) { localStateView.setImageResource(R.drawable.local_file_indicator); localStateView.setVisibility(View.VISIBLE); } else { localStateView.setVisibility(View.INVISIBLE); } // share with me icon if (!file.isFolder()) { ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon); sharedWithMeIconV.bringToFront(); if (checkIfFileIsSharedWithMe(file)) { sharedWithMeIconV.setVisibility(View.VISIBLE); } else { sharedWithMeIconV.setVisibility(View.GONE); } } break;
<<<<<<< /** * Creates and populates a new {@link OCFile} object with the data read from the server. * * @param remote remote file read from the server (remote file or folder). * @return New OCFile instance representing the remote resource described by we. */ public static OCFile fillOCFile(RemoteFile remote) { OCFile file = new OCFile(remote.getRemotePath()); file.setCreationTimestamp(remote.getCreationTimestamp()); file.setFileLength(remote.getLength()); file.setMimetype(remote.getMimeType()); file.setModificationTimestamp(remote.getModifiedTimestamp()); file.setEtag(remote.getEtag()); return file; } ======= /** * Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}. * * @param oCFile OCFile * @return New RemoteFile instance representing the resource described by ocFile. */ public static RemoteFile fillRemoteFile(OCFile ocFile){ RemoteFile file = new RemoteFile(ocFile.getRemotePath()); file.setCreationTimestamp(ocFile.getCreationTimestamp()); file.setLength(ocFile.getFileLength()); file.setMimeType(ocFile.getMimetype()); file.setModifiedTimestamp(ocFile.getModificationTimestamp()); file.setEtag(ocFile.getEtag()); return file; } >>>>>>> /** * Creates and populates a new {@link OCFile} object with the data read from the server. * * @param remote remote file read from the server (remote file or folder). * @return New OCFile instance representing the remote resource described by we. */ public static OCFile fillOCFile(RemoteFile remote) { OCFile file = new OCFile(remote.getRemotePath()); file.setCreationTimestamp(remote.getCreationTimestamp()); file.setFileLength(remote.getLength()); file.setMimetype(remote.getMimeType()); file.setModificationTimestamp(remote.getModifiedTimestamp()); file.setEtag(remote.getEtag()); return file; } /** * Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}. * * @param oCFile OCFile * @return New RemoteFile instance representing the resource described by ocFile. */ public static RemoteFile fillRemoteFile(OCFile ocFile){ RemoteFile file = new RemoteFile(ocFile.getRemotePath()); file.setCreationTimestamp(ocFile.getCreationTimestamp()); file.setLength(ocFile.getFileLength()); file.setMimeType(ocFile.getMimetype()); file.setModifiedTimestamp(ocFile.getModificationTimestamp()); file.setEtag(ocFile.getEtag()); return file; }
<<<<<<< import android.accounts.OperationCanceledException; ======= >>>>>>> <<<<<<< Log_OC.e(TAG, "onResume() start"); if (PinCheck.checkIfPinEntry()){ Intent i = new Intent(MainApp.getAppContext(), PinCodeActivity.class); i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "FileDisplayActivity"); startActivity(i); } ======= >>>>>>> if (PinCheck.checkIfPinEntry()){ Intent i = new Intent(MainApp.getAppContext(), PinCodeActivity.class); i.putExtra(PinCodeActivity.EXTRA_ACTIVITY, "FileDisplayActivity"); startActivity(i); } <<<<<<< PinCheck.setUnlockTimestamp(); Log_OC.d(TAG, "onPause() end"); ======= >>>>>>> PinCheck.setUnlockTimestamp();
<<<<<<< import android.graphics.PorterDuff; ======= import android.content.Intent; >>>>>>> import android.graphics.PorterDuff; import android.content.Intent; <<<<<<< @BindView(R.id.contacts_header_restore) public TextView contactsRestoreHeader; @BindView(R.id.contacts_header_backup) public TextView contactsBackupHeader; ======= >>>>>>> @BindView(R.id.contacts_header_backup) public TextView contactsBackupHeader;
<<<<<<< import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; import com.owncloud.android.lib.common.accounts.AccountUtils.Constants; ======= import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; >>>>>>> import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; import com.owncloud.android.lib.common.accounts.AccountUtils.Constants; <<<<<<< /** * Retry uploading a failed or cancelled upload with force. */ public void retryUpload(UploadDbObject upload) { Account account = mFileActivity.getAccount(); FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (uploaderBinder != null) { upload.removeAllUploadRestrictions(); //only this object, upload DB stays untouched. uploaderBinder.retry(account, upload); } else { Log_OC.w(TAG, "uploaderBinder not set. Cannot remove " + upload.getOCFile()); } } /** * Remove upload from upload list. */ public void removeUploadFromList(UploadDbObject upload) { Account account = mFileActivity.getAccount(); FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (uploaderBinder != null) { uploaderBinder.remove(account, upload.getOCFile()); } else { Log_OC.w(TAG, "uploaderBinder not set. Cannot remove " + upload.getOCFile()); } } ======= /** * Cancel the transference in downloads (files/folders) and file uploads * @param file OCFile */ >>>>>>> /** * Retry uploading a failed or cancelled upload with force. */ public void retryUpload(UploadDbObject upload) { Account account = mFileActivity.getAccount(); FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (uploaderBinder != null) { upload.removeAllUploadRestrictions(); //only this object, upload DB stays untouched. uploaderBinder.retry(account, upload); } else { Log_OC.w(TAG, "uploaderBinder not set. Cannot remove " + upload.getOCFile()); } } /** * Remove upload from upload list. */ public void removeUploadFromList(UploadDbObject upload) { Account account = mFileActivity.getAccount(); FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (uploaderBinder != null) { uploaderBinder.remove(account, upload.getOCFile()); } else { Log_OC.w(TAG, "uploaderBinder not set. Cannot remove " + upload.getOCFile()); } } /** * Cancel the transference in downloads (files/folders) and file uploads * @param file OCFile */ <<<<<<< FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (downloaderBinder != null) { if (downloaderBinder.isDownloading(account, file)) { // Remove etag for parent, if file is a keep_in_sync if (file.keepInSync()) { OCFile parent = mFileActivity.getStorageManager().getFileById(file.getParentId()); parent.setEtag(""); mFileActivity.getStorageManager().saveFile(parent); } downloaderBinder.cancel(account, file); } else { Log_OC.d(TAG, "Download for " + file + " not in progress. Cannot cancel " + file); } } if (uploaderBinder != null) { if (uploaderBinder.isUploading(account, file)) { uploaderBinder.cancel(account, file); } else { Log_OC.d(TAG, "Upload for " + file + " not in progress. Cannot cancel."); } } if(downloaderBinder == null && uploaderBinder == null) { Log_OC.w(TAG, "Neither downloaderBinder nor uploaderBinder set. Cannot cancel."); ======= FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (downloaderBinder != null && downloaderBinder.isDownloading(account, file)) { downloaderBinder.cancel(account, file); // TODO - review why is this here, and solve in a better way // Remove etag for parent, if file is a favorite if (file.isFavorite()) { OCFile parent = mFileActivity.getStorageManager().getFileById(file.getParentId()); parent.setEtag(""); mFileActivity.getStorageManager().saveFile(parent); } } else if (uploaderBinder != null && uploaderBinder.isUploading(account, file)) { uploaderBinder.cancel(account, file); >>>>>>> FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder(); if (downloaderBinder != null) { if (downloaderBinder.isDownloading(account, file)) { // Remove etag for parent, if file is a keep_in_sync if (file.isFavorite()) { OCFile parent = mFileActivity.getStorageManager().getFileById(file.getParentId()); parent.setEtag(""); mFileActivity.getStorageManager().saveFile(parent); } downloaderBinder.cancel(account, file); } else { Log_OC.d(TAG, "Download for " + file + " not in progress. Cannot cancel " + file); } } if (uploaderBinder != null) { if (uploaderBinder.isUploading(account, file)) { uploaderBinder.cancel(account, file); } else { Log_OC.d(TAG, "Upload for " + file + " not in progress. Cannot cancel."); } } if(downloaderBinder == null && uploaderBinder == null) { Log_OC.w(TAG, "Neither downloaderBinder nor uploaderBinder set. Cannot cancel.");
<<<<<<< import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector; import org.apache.http.HttpStatus; ======= >>>>>>> import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector; import org.apache.http.HttpStatus; <<<<<<< ======= import com.owncloud.android.files.services.FileDownloader; >>>>>>> import com.owncloud.android.files.services.FileDownloader; <<<<<<< import com.owncloud.android.lib.common.operations.RemoteOperation; ======= import com.owncloud.android.lib.common.operations.OperationCancelledException; >>>>>>> import com.owncloud.android.lib.common.operations.OperationCancelledException; import com.owncloud.android.lib.common.operations.RemoteOperation; <<<<<<< import com.owncloud.android.lib.resources.files.FileUtils; ======= >>>>>>> import com.owncloud.android.lib.resources.files.FileUtils; <<<<<<< import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation; import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.syncadapter.FileSyncAdapter; ======= import com.owncloud.android.operations.common.SyncOperation; import com.owncloud.android.services.OperationsService; >>>>>>> import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation; import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.syncadapter.FileSyncAdapter; import com.owncloud.android.operations.common.SyncOperation; import com.owncloud.android.services.OperationsService; <<<<<<< if (result.isSuccess()) { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { mChildren = mStorageManager.getFolderContent(mLocalFolder, false); ======= try { // get locally cached information about folder mLocalFolder = getStorageManager().getFileByPath(mRemotePath); result = checkForChanges(client); if (result.isSuccess()) { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { prepareOpsFromLocalKnowledge(); } if (result.isSuccess()) { syncContents(client); } >>>>>>> try { // get locally cached information about folder mLocalFolder = getStorageManager().getFileByPath(mRemotePath); result = checkForChanges(client); if (result.isSuccess()) { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { prepareOpsFromLocalKnowledge(); } if (result.isSuccess()) { syncContents(client); } <<<<<<< List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder, false); ======= List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder); >>>>>>> List<OCFile> localFiles = storageManager.getFolderContent(mLocalFolder, true);
<<<<<<< import java.io.File; import java.lang.ref.WeakReference; import java.util.Collections; import java.util.Comparator; ======= >>>>>>> import java.io.File; import java.util.Collections; import java.util.Comparator; <<<<<<< import android.content.SharedPreferences; import android.content.res.Resources; ======= >>>>>>> import android.content.SharedPreferences; <<<<<<< import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.media.ThumbnailUtils; import android.os.AsyncTask; import android.preference.PreferenceManager; import android.util.TypedValue; ======= >>>>>>> import android.preference.PreferenceManager; <<<<<<< appPreferences = PreferenceManager .getDefaultSharedPreferences(mContext); // Read sorting order, default to sort by name ascending sortOrder = appPreferences .getInt("sortOrder", 0); sortAscending = appPreferences.getBoolean("sortAscending", true); defaultImg = BitmapFactory.decodeResource(mContext.getResources(), DisplayUtils.getResourceId("image/png", "default.png")); ======= >>>>>>> appPreferences = PreferenceManager .getDefaultSharedPreferences(mContext); // Read sorting order, default to sort by name ascending sortOrder = appPreferences .getInt("sortOrder", 0); sortAscending = appPreferences.getBoolean("sortAscending", true); <<<<<<< static class AsyncDrawable extends BitmapDrawable { private final WeakReference<ThumbnailGenerationTask> bitmapWorkerTaskReference; public AsyncDrawable(Resources res, Bitmap bitmap, ThumbnailGenerationTask bitmapWorkerTask) { super(res, bitmap); bitmapWorkerTaskReference = new WeakReference<ThumbnailGenerationTask>(bitmapWorkerTask); } public ThumbnailGenerationTask getBitmapWorkerTask() { return bitmapWorkerTaskReference.get(); } } class ThumbnailGenerationTask extends AsyncTask<OCFile, Void, Bitmap> { private final WeakReference<ImageView> imageViewReference; private OCFile file; public ThumbnailGenerationTask(ImageView imageView) { // Use a WeakReference to ensure the ImageView can be garbage collected imageViewReference = new WeakReference<ImageView>(imageView); } // Decode image in background. @Override protected Bitmap doInBackground(OCFile... params) { Bitmap thumbnail = null; try { file = params[0]; final String imageKey = String.valueOf(file.getRemoteId()); // Check disk cache in background thread thumbnail = getBitmapFromDiskCache(imageKey); // Not found in disk cache if (thumbnail == null || file.needsUpdateThumbnail()) { // Converts dp to pixel Resources r = mContext.getResources(); int px = (int) Math.round(TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 150, r.getDisplayMetrics() )); if (file.isDown()){ Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile( file.getStoragePath(), px, px); if (bitmap != null) { thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px); // Add thumbnail to cache addBitmapToCache(imageKey, thumbnail); file.setNeedsUpdateThumbnail(false); mStorageManager.saveFile(file); } } } } catch (Throwable t) { // the app should never break due to a problem with thumbnails Log_OC.e(TAG, "Generation of thumbnail for " + file + " failed", t); if (t instanceof OutOfMemoryError) { System.gc(); } } return thumbnail; } protected void onPostExecute(Bitmap bitmap){ if (isCancelled()) { bitmap = null; } if (imageViewReference != null && bitmap != null) { final ImageView imageView = imageViewReference.get(); final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView); if (this == bitmapWorkerTask && imageView != null) { imageView.setImageBitmap(bitmap); } } } } public void addBitmapToCache(String key, Bitmap bitmap) { synchronized (thumbnailDiskCacheLock) { if (mThumbnailCache != null) { mThumbnailCache.put(key, bitmap); } } } public Bitmap getBitmapFromDiskCache(String key) { synchronized (thumbnailDiskCacheLock) { // Wait while disk cache is started from background thread while (mThumbnailCacheStarting) { try { thumbnailDiskCacheLock.wait(); } catch (InterruptedException e) {} } if (mThumbnailCache != null) { return (Bitmap) mThumbnailCache.getBitmap(key); } } return null; } ======= >>>>>>> <<<<<<< public static boolean cancelPotentialWork(OCFile file, ImageView imageView) { final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView); if (bitmapWorkerTask != null) { final OCFile bitmapData = bitmapWorkerTask.file; // If bitmapData is not yet set or it differs from the new data if (bitmapData == null || bitmapData != file) { // Cancel previous task bitmapWorkerTask.cancel(true); } else { // The same work is already in progress return false; } } // No task associated with the ImageView, or an existing task was cancelled return true; } private static ThumbnailGenerationTask getBitmapWorkerTask(ImageView imageView) { if (imageView != null) { final Drawable drawable = imageView.getDrawable(); if (drawable instanceof AsyncDrawable) { final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable; return asyncDrawable.getBitmapWorkerTask(); } } return null; } /** * Local Folder size in human readable format * @param path String * @return Size in human readable format */ private String getFolderSizeHuman(String path) { File dir = new File(path); if(dir.exists()) { long bytes = getFolderSize(dir); if (bytes < 1024) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(1024)); String pre = ("KMGTPE").charAt(exp-1) + ""; return String.format("%.1f %sB", bytes / Math.pow(1024, exp), pre); } return "0 B"; } /** * Local Folder size * @param dir File * @return Size in bytes */ private long getFolderSize(File dir) { if (dir.exists()) { long result = 0; File[] fileList = dir.listFiles(); for(int i = 0; i < fileList.length; i++) { if(fileList[i].isDirectory()) { result += getFolderSize(fileList[i]); } else { result += fileList[i].length(); } } return result; } return 0; } ======= >>>>>>> /** * Local Folder size in human readable format * @param path String * @return Size in human readable format */ private String getFolderSizeHuman(String path) { File dir = new File(path); if(dir.exists()) { long bytes = getFolderSize(dir); if (bytes < 1024) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(1024)); String pre = ("KMGTPE").charAt(exp-1) + ""; return String.format("%.1f %sB", bytes / Math.pow(1024, exp), pre); } return "0 B"; } /** * Local Folder size * @param dir File * @return Size in bytes */ private long getFolderSize(File dir) { if (dir.exists()) { long result = 0; File[] fileList = dir.listFiles(); for(int i = 0; i < fileList.length; i++) { if(fileList[i].isDirectory()) { result += getFolderSize(fileList[i]); } else { result += fileList[i].length(); } } return result; } return 0; }
<<<<<<< public static final String VIRTUAL_TABLE_NAME = "virtual"; ======= public static final String ARBITRARY_DATA_TABLE_NAME = "arbitrary_data"; >>>>>>> public static final String ARBITRARY_DATA_TABLE_NAME = "arbitrary_data"; public static final String VIRTUAL_TABLE_NAME = "virtual"; <<<<<<< public static final Uri CONTENT_URI_VIRTUAL = Uri.parse(CONTENT_PREFIX + MainApp.getAuthority() + "/virtual"); ======= public static final Uri CONTENT_URI_ARBITRARY_DATA = Uri.parse(CONTENT_PREFIX + MainApp.getAuthority() + "/arbitrary_data"); >>>>>>> public static final Uri CONTENT_URI_ARBITRARY_DATA = Uri.parse(CONTENT_PREFIX + MainApp.getAuthority() + "/arbitrary_data"); public static final Uri CONTENT_URI_VIRTUAL = Uri.parse(CONTENT_PREFIX + MainApp.getAuthority() + "/virtual"); <<<<<<< // Columns of virtual public static final String VIRTUAL_TYPE = "type"; public static final String VIRTUAL_OCFILE_ID = "ocfile_id"; ======= // Columns of arbitrary data table public static final String ARBITRARY_DATA_CLOUD_ID = "cloud_id"; public static final String ARBITRARY_DATA_KEY = "key"; public static final String ARBITRARY_DATA_VALUE = "value"; >>>>>>> // Columns of arbitrary data table public static final String ARBITRARY_DATA_CLOUD_ID = "cloud_id"; public static final String ARBITRARY_DATA_KEY = "key"; public static final String ARBITRARY_DATA_VALUE = "value"; // Columns of virtual public static final String VIRTUAL_TYPE = "type"; public static final String VIRTUAL_OCFILE_ID = "ocfile_id";
<<<<<<< super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); ======= requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid >>>>>>> requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid <<<<<<< getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to work around bug in its implementation ======= OCFile currFile = getFile(); if (mStorageManager != null) { while(currFile != null && currFile.getFileName() != OCFile.PATH_SEPARATOR) { if (currFile.isDirectory()) { mDirectories.add(currFile.getFileName()); } currFile = mStorageManager.getFileById(currFile.getParentId()); } } mDirectories.add(OCFile.PATH_SEPARATOR); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to workaround bug in its implementation >>>>>>> getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation setSupportProgressBarIndeterminateVisibility(false); // always AFTER setContentView(...) ; to work around bug in its implementation <<<<<<< mDirectories.clear(); OCFile fileIt = file; while(fileIt != null && fileIt.getFileName() != OCFile.PATH_SEPARATOR) { if (fileIt.isDirectory()) { mDirectories.add(fileIt.getFileName()); } fileIt = mStorageManager.getFileById(fileIt.getParentId()); } mDirectories.add(OCFile.PATH_SEPARATOR); if (!stateWasRecovered) { ======= if (findViewById(android.R.id.content) != null && !stateWasRecovered) { >>>>>>> mDirectories.clear(); OCFile fileIt = file; while(fileIt != null && fileIt.getFileName() != OCFile.PATH_SEPARATOR) { if (fileIt.isDirectory()) { mDirectories.add(fileIt.getFileName()); } fileIt = mStorageManager.getFileById(fileIt.getParentId()); } mDirectories.add(OCFile.PATH_SEPARATOR); if (!stateWasRecovered) { <<<<<<< ======= >>>>>>> <<<<<<< ======= @Override protected void onStart() { super.onStart(); FileFragment second = getSecondFragment(); updateFragmentsVisibility(second != null); updateNavigationElementsInActionBar((second == null) ? null : second.getFile()); } >>>>>>> <<<<<<< ======= // List current directory OCFileListFragment listOfFiles = getListOfFilesFragment(); if (listOfFiles != null) { listOfFiles.listDirectory(getCurrentDir()); // TODO we should find the way to avoid the need of this (maybe it's not necessary yet; to check) } >>>>>>> <<<<<<< ======= /** * {@inheritDoc} */ @Override public OCFile getInitialDirectory() { return getCurrentDir(); } >>>>>>>
<<<<<<< OCFileListFragment.ContainerActivity, FileFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, OnRemoteOperationListener { ======= OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, OnRemoteOperationListener, EditNameDialogListener { >>>>>>> OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNavigationListener, OnSslValidatorListener, OnRemoteOperationListener, EditNameDialogListener { <<<<<<< case R.id.action_create_dir: { showDialog(DIALOG_CREATE_DIR); break; ======= case R.id.createDirectoryItem: { //showDialog(DIALOG_CREATE_DIR); EditNameDialog dialog = EditNameDialog.newInstance(getString(R.string.uploader_info_dirname), "", this); dialog.show(getSupportFragmentManager(), "createdirdialog"); >>>>>>> case R.id.action_create_dir: { EditNameDialog dialog = EditNameDialog.newInstance(getString(R.string.uploader_info_dirname), "", this); dialog.show(getSupportFragmentManager(), "createdirdialog"); break; <<<<<<< @Override public void showFragmentWithDetails(OCFile file) { if (mDualPane) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG); transaction.commit(); } else { Intent showDetailsIntent = new Intent(this, FileDetailActivity.class); showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, file); showDetailsIntent.putExtra(FileDetailFragment.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this)); showDetailsIntent.putExtra(FileDetailActivity.EXTRA_MODE, FileDetailActivity.MODE_DETAILS); startActivity(showDetailsIntent); } } ======= @Override public void onDismiss(EditNameDialog dialog) { //dialog.dismiss(); if (dialog.getResult()) { String newDirectoryName = dialog.getNewFilename().trim(); Log.d(TAG, "'create directory' dialog dismissed with new name " + newDirectoryName); if (newDirectoryName.length() > 0) { String path; if (mCurrentDir == null) { // this is just a patch; we should ensure that mCurrentDir never is null if (!mStorageManager.fileExists(OCFile.PATH_SEPARATOR)) { OCFile file = new OCFile(OCFile.PATH_SEPARATOR); mStorageManager.saveFile(file); } mCurrentDir = mStorageManager.getFileByPath(OCFile.PATH_SEPARATOR); } path = FileDisplayActivity.this.mCurrentDir.getRemotePath(); // Create directory path += newDirectoryName + OCFile.PATH_SEPARATOR; Thread thread = new Thread(new DirectoryCreator(path, AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this), new Handler())); thread.start(); showDialog(DIALOG_SHORT_WAIT); } } } >>>>>>> @Override public void showFragmentWithDetails(OCFile file) { if (mDualPane) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.file_details_container, new FileDetailFragment(file, AccountUtils.getCurrentOwnCloudAccount(this)), FileDetailFragment.FTAG); transaction.commit(); } else { Intent showDetailsIntent = new Intent(this, FileDetailActivity.class); showDetailsIntent.putExtra(FileDetailFragment.EXTRA_FILE, file); showDetailsIntent.putExtra(FileDetailFragment.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(this)); showDetailsIntent.putExtra(FileDetailActivity.EXTRA_MODE, FileDetailActivity.MODE_DETAILS); startActivity(showDetailsIntent); } } public void onDismiss(EditNameDialog dialog) { //dialog.dismiss(); if (dialog.getResult()) { String newDirectoryName = dialog.getNewFilename().trim(); Log.d(TAG, "'create directory' dialog dismissed with new name " + newDirectoryName); if (newDirectoryName.length() > 0) { String path; if (mCurrentDir == null) { // this is just a patch; we should ensure that mCurrentDir never is null if (!mStorageManager.fileExists(OCFile.PATH_SEPARATOR)) { OCFile file = new OCFile(OCFile.PATH_SEPARATOR); mStorageManager.saveFile(file); } mCurrentDir = mStorageManager.getFileByPath(OCFile.PATH_SEPARATOR); } path = FileDisplayActivity.this.mCurrentDir.getRemotePath(); // Create directory path += newDirectoryName + OCFile.PATH_SEPARATOR; Thread thread = new Thread(new DirectoryCreator(path, AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this), new Handler())); thread.start(); showDialog(DIALOG_SHORT_WAIT); } } }
<<<<<<< ======= import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Stack; import java.util.Vector; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.operations.RefreshFolderOperation; >>>>>>> <<<<<<< import android.annotation.SuppressLint; ======= import android.accounts.AuthenticatorException; import android.app.AlertDialog; import android.app.AlertDialog.Builder; >>>>>>> import android.accounts.AuthenticatorException; import android.annotation.SuppressLint; <<<<<<< import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; ======= >>>>>>> import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountAuthenticator; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.common.utils.Log_OC; <<<<<<< import com.owncloud.android.operations.UploadFileOperation; ======= import com.owncloud.android.syncadapter.FileSyncAdapter; import com.owncloud.android.ui.adapter.UploaderAdapter; >>>>>>> import com.owncloud.android.operations.RefreshFolderOperation; import com.owncloud.android.operations.UploadFileOperation; import com.owncloud.android.syncadapter.FileSyncAdapter; import com.owncloud.android.ui.adapter.UploaderAdapter; <<<<<<< List<HashMap<String, Object>> data = new LinkedList<HashMap<String, Object>>(); ======= List<HashMap<String, OCFile>> data = new LinkedList<HashMap<String,OCFile>>(); >>>>>>> List<HashMap<String, OCFile>> data = new LinkedList<HashMap<String,OCFile>>(); <<<<<<< SimpleAdapter sa = new SimpleAdapter(this, data, R.layout.uploader_list_item_layout, new String[]{"dirname"}, new int[]{R.id.filename}); ======= UploaderAdapter sa = new UploaderAdapter(this, data, R.layout.uploader_list_item_layout, new String[] {"dirname"}, new int[] {R.id.filename}, getStorageManager(), getAccount()); >>>>>>> UploaderAdapter sa = new UploaderAdapter(this, data, R.layout.uploader_list_item_layout, new String[] {"dirname"}, new int[] {R.id.filename}, getStorageManager(), getAccount()); <<<<<<< String mimeType = getContentResolver().getType(uri); if (mimeType.contains("image")) { String[] CONTENT_PROJECTION = {Images.Media.DATA, Images.Media.DISPLAY_NAME, Images.Media.MIME_TYPE, Images.Media.SIZE}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Images.Media.DATA); data = c.getString(index); filePath = mUploadPath + c.getString(c.getColumnIndex(Images.Media.DISPLAY_NAME)); } else if (mimeType.contains("video")) { String[] CONTENT_PROJECTION = {Video.Media.DATA, Video.Media.DISPLAY_NAME, Video.Media.MIME_TYPE, Video.Media.SIZE, Video.Media.DATE_MODIFIED}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Video.Media.DATA); data = c.getString(index); filePath = mUploadPath + c.getString(c.getColumnIndex(Video.Media.DISPLAY_NAME)); } else if (mimeType.contains("audio")) { String[] CONTENT_PROJECTION = {Audio.Media.DATA, Audio.Media.DISPLAY_NAME, Audio.Media.MIME_TYPE, Audio.Media.SIZE}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Audio.Media.DATA); data = c.getString(index); filePath = mUploadPath + c.getString(c.getColumnIndex(Audio.Media.DISPLAY_NAME)); } else { Cursor cursor = getContentResolver().query(uri, new String[]{MediaStore.MediaColumns.DISPLAY_NAME}, null, null, null); cursor.moveToFirst(); int nameIndex = cursor.getColumnIndex(cursor.getColumnNames()[0]); if (nameIndex >= 0) { filePath = mUploadPath + cursor.getString(nameIndex); } } ======= String mimeType = getContentResolver().getType(uri); if (mimeType.contains("image")) { String[] CONTENT_PROJECTION = { Images.Media.DATA, Images.Media.DISPLAY_NAME, Images.Media.MIME_TYPE, Images.Media.SIZE}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Images.Media.DATA); data = c.getString(index); local.add(data); remote.add(mUploadPath + c.getString(c.getColumnIndex(Images.Media.DISPLAY_NAME))); } else if (mimeType.contains("video")) { String[] CONTENT_PROJECTION = { Video.Media.DATA, Video.Media.DISPLAY_NAME, Video.Media.MIME_TYPE, Video.Media.SIZE, Video.Media.DATE_MODIFIED }; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Video.Media.DATA); data = c.getString(index); local.add(data); remote.add(mUploadPath + c.getString(c.getColumnIndex(Video.Media.DISPLAY_NAME))); } else if (mimeType.contains("audio")) { String[] CONTENT_PROJECTION = { Audio.Media.DATA, Audio.Media.DISPLAY_NAME, Audio.Media.MIME_TYPE, Audio.Media.SIZE }; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Audio.Media.DATA); data = c.getString(index); local.add(data); remote.add(mUploadPath + c.getString(c.getColumnIndex(Audio.Media.DISPLAY_NAME))); } else { filePath = Uri.decode(uri.toString()).replace(uri.getScheme() + "://", ""); // cut everything whats before mnt. It occured to me that sometimes apps send // their name into the URI if (filePath.contains("mnt")) { String splitedFilePath[] = filePath.split("/mnt"); filePath = splitedFilePath[1]; } final File file = new File(filePath); local.add(file.getAbsolutePath()); remote.add(mUploadPath + file.getName()); } >>>>>>> String mimeType = getContentResolver().getType(uri); if (mimeType.contains("image")) { String[] CONTENT_PROJECTION = {Images.Media.DATA, Images.Media.DISPLAY_NAME, Images.Media.MIME_TYPE, Images.Media.SIZE}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Images.Media.DATA); data = c.getString(index); filePath = mUploadPath + c.getString(c.getColumnIndex(Images.Media.DISPLAY_NAME)); } else if (mimeType.contains("video")) { String[] CONTENT_PROJECTION = {Video.Media.DATA, Video.Media.DISPLAY_NAME, Video.Media.MIME_TYPE, Video.Media.SIZE, Video.Media.DATE_MODIFIED}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Video.Media.DATA); data = c.getString(index); filePath = mUploadPath + c.getString(c.getColumnIndex(Video.Media.DISPLAY_NAME)); } else if (mimeType.contains("audio")) { String[] CONTENT_PROJECTION = {Audio.Media.DATA, Audio.Media.DISPLAY_NAME, Audio.Media.MIME_TYPE, Audio.Media.SIZE}; Cursor c = getContentResolver().query(uri, CONTENT_PROJECTION, null, null, null); c.moveToFirst(); int index = c.getColumnIndex(Audio.Media.DATA); data = c.getString(index); filePath = mUploadPath + c.getString(c.getColumnIndex(Audio.Media.DISPLAY_NAME)); } else { Cursor cursor = getContentResolver().query(uri, new String[]{MediaStore.MediaColumns.DISPLAY_NAME}, null, null, null); cursor.moveToFirst(); int nameIndex = cursor.getColumnIndex(cursor.getColumnNames()[0]); if (nameIndex >= 0) { filePath = mUploadPath + cursor.getString(nameIndex); } }
<<<<<<< import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder; import com.owncloud.android.oc_framework.network.webdav.OnDatatransferProgressListener; import com.owncloud.android.ui.fragment.FileFragment; ======= >>>>>>> import com.owncloud.android.oc_framework.network.webdav.OnDatatransferProgressListener;
<<<<<<< import java.io.File; import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.FileNameMap; import java.net.URLConnection; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; ======= >>>>>>> import java.io.File; import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.FileNameMap; import java.net.URLConnection; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; <<<<<<< import com.owncloud.android.utils.FileStorageUtils; ======= import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import java.io.File; import java.io.InputStream; import java.lang.ref.WeakReference; >>>>>>> import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; import java.io.File; import java.io.InputStream; import java.lang.ref.WeakReference; import com.owncloud.android.utils.FileStorageUtils; <<<<<<< public static Bitmap addVideoOverlay(Bitmap thumbnail){ Bitmap playButton = BitmapFactory.decodeResource(MainApp.getAppContext().getResources(), R.drawable.view_play); Bitmap resizedPlayButton = Bitmap.createScaledBitmap(playButton, (int) (thumbnail.getWidth() * 0.3), (int) (thumbnail.getHeight() * 0.3), true); Bitmap resultBitmap = Bitmap.createBitmap(thumbnail.getWidth(), thumbnail.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(resultBitmap); // compute visual center of play button, according to resized image int x1 = resizedPlayButton.getWidth(); int y1 = resizedPlayButton.getHeight() / 2; int x2 = 0; int y2 = resizedPlayButton.getWidth(); int x3 = 0; int y3 = 0; double ym = ( ((Math.pow(x3,2) - Math.pow(x1,2) + Math.pow(y3,2) - Math.pow(y1,2)) * (x2 - x1)) - (Math.pow(x2,2) - Math.pow(x1,2) + Math.pow(y2,2) - Math.pow(y1,2)) * (x3 - x1) ) / (2 * ( ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1)) )); double xm = ( (Math.pow(x2,2) - Math.pow(x1,2)) + (Math.pow(y2,2) - Math.pow(y1,2)) - (2*ym*(y2 - y1)) ) / (2*(x2 - x1)); // offset to top left double ox = - xm; double oy = thumbnail.getHeight() - ym; c.drawBitmap(thumbnail, 0, 0, null); Paint p = new Paint(); p.setAlpha(230); c.drawBitmap(resizedPlayButton, (float) ((thumbnail.getWidth() / 2) + ox), (float) ((thumbnail.getHeight() / 2) - ym), p); return resultBitmap; } public static class AsyncDrawable extends BitmapDrawable { ======= public static AvatarGenerationTask getAvatarWorkerTask(Object callContext) { if (callContext instanceof ImageView) return getAvatarWorkerTask(((ImageView)callContext).getDrawable()); else if (callContext instanceof MenuItem) return getAvatarWorkerTask(((MenuItem)callContext).getIcon()); return null; } private static AvatarGenerationTask getAvatarWorkerTask(Drawable drawable) { if (drawable instanceof AsyncAvatarDrawable) { final AsyncAvatarDrawable asyncDrawable = (AsyncAvatarDrawable) drawable; return asyncDrawable.getAvatarWorkerTask(); } return null; } public static class AsyncThumbnailDrawable extends BitmapDrawable { >>>>>>> public static Bitmap addVideoOverlay(Bitmap thumbnail){ Bitmap playButton = BitmapFactory.decodeResource(MainApp.getAppContext().getResources(), R.drawable.view_play); Bitmap resizedPlayButton = Bitmap.createScaledBitmap(playButton, (int) (thumbnail.getWidth() * 0.3), (int) (thumbnail.getHeight() * 0.3), true); Bitmap resultBitmap = Bitmap.createBitmap(thumbnail.getWidth(), thumbnail.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(resultBitmap); // compute visual center of play button, according to resized image int x1 = resizedPlayButton.getWidth(); int y1 = resizedPlayButton.getHeight() / 2; int x2 = 0; int y2 = resizedPlayButton.getWidth(); int x3 = 0; int y3 = 0; double ym = ( ((Math.pow(x3,2) - Math.pow(x1,2) + Math.pow(y3,2) - Math.pow(y1,2)) * (x2 - x1)) - (Math.pow(x2,2) - Math.pow(x1,2) + Math.pow(y2,2) - Math.pow(y1,2)) * (x3 - x1) ) / (2 * ( ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1)) )); double xm = ( (Math.pow(x2,2) - Math.pow(x1,2)) + (Math.pow(y2,2) - Math.pow(y1,2)) - (2*ym*(y2 - y1)) ) / (2*(x2 - x1)); // offset to top left double ox = - xm; double oy = thumbnail.getHeight() - ym; c.drawBitmap(thumbnail, 0, 0, null); Paint p = new Paint(); p.setAlpha(230); c.drawBitmap(resizedPlayButton, (float) ((thumbnail.getWidth() / 2) + ox), (float) ((thumbnail.getHeight() / 2) - ym), p); return resultBitmap; } public static AvatarGenerationTask getAvatarWorkerTask(Object callContext) { if (callContext instanceof ImageView) return getAvatarWorkerTask(((ImageView)callContext).getDrawable()); else if (callContext instanceof MenuItem) return getAvatarWorkerTask(((MenuItem)callContext).getIcon()); return null; } private static AvatarGenerationTask getAvatarWorkerTask(Drawable drawable) { if (drawable instanceof AsyncAvatarDrawable) { final AsyncAvatarDrawable asyncDrawable = (AsyncAvatarDrawable) drawable; return asyncDrawable.getAvatarWorkerTask(); } return null; } public static class AsyncThumbnailDrawable extends BitmapDrawable {
<<<<<<< ======= private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation, RemoteOperationResult result) { boolean inDisplayActivity = getActivity() instanceof FileDisplayActivity; getActivity().dismissDialog((inDisplayActivity)? FileDisplayActivity.DIALOG_SHORT_WAIT : FileDetailActivity.DIALOG_SHORT_WAIT); if (!result.isSuccess()) { if (result.getCode() == ResultCode.SYNC_CONFLICT) { Intent i = new Intent(getActivity(), ConflictsResolveActivity.class); i.putExtra(ConflictsResolveActivity.EXTRA_FILE, mFile); i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount); startActivity(i); } else { Toast msg = Toast.makeText(getActivity(), R.string.sync_file_fail_msg, Toast.LENGTH_LONG); msg.show(); } if (mFile.isDown()) { setButtonsForDown(); } else { setButtonsForRemote(); } } else { if (operation.transferWasRequested()) { mContainerActivity.onFileStateChanged(); // this is not working; FileDownloader won't do NOTHING at all until this method finishes, so // checking the service to see if the file is downloading results in FALSE } else { Toast msg = Toast.makeText(getActivity(), R.string.sync_file_nothing_to_do_msg, Toast.LENGTH_LONG); msg.show(); if (mFile.isDown()) { setButtonsForDown(); } else { setButtonsForRemote(); } } } } >>>>>>> private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation, RemoteOperationResult result) { boolean inDisplayActivity = getActivity() instanceof FileDisplayActivity; getActivity().dismissDialog((inDisplayActivity)? FileDisplayActivity.DIALOG_SHORT_WAIT : FileDetailActivity.DIALOG_SHORT_WAIT); if (!result.isSuccess()) { if (result.getCode() == ResultCode.SYNC_CONFLICT) { Intent i = new Intent(getActivity(), ConflictsResolveActivity.class); i.putExtra(ConflictsResolveActivity.EXTRA_FILE, mFile); i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount); startActivity(i); } else { Toast msg = Toast.makeText(getActivity(), R.string.sync_file_fail_msg, Toast.LENGTH_LONG); msg.show(); } if (mFile.isDown()) { setButtonsForDown(); } else { setButtonsForRemote(); } } else { if (operation.transferWasRequested()) { mContainerActivity.onFileStateChanged(); // this is not working; FileDownloader won't do NOTHING at all until this method finishes, so // checking the service to see if the file is downloading results in FALSE } else { Toast msg = Toast.makeText(getActivity(), R.string.sync_file_nothing_to_do_msg, Toast.LENGTH_LONG); msg.show(); if (mFile.isDown()) { setButtonsForDown(); } else { setButtonsForRemote(); } } } }
<<<<<<< String targetKey = buildRemoteName(account, file); ======= if (account == null || file == null) return false; String targetKey = buildRemoteName(account, file); >>>>>>> if (account == null || file == null) return false; String targetKey = buildRemoteName(account, file); <<<<<<< ======= /// prepare client object to send the request to the ownCloud server if (mDownloadClient == null || !mLastAccount.equals(mCurrentDownload.getAccount())) { mLastAccount = mCurrentDownload.getAccount(); mStorageManager = new FileDataStorageManager(mLastAccount, getContentResolver()); mDownloadClient = OwnCloudClientUtils.createOwnCloudClient(mLastAccount, getApplicationContext()); } /// perform the download >>>>>>>
<<<<<<< import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; ======= import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; >>>>>>> import com.owncloud.android.files.services.FileUploadService.FileUploaderBinder; import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
<<<<<<< cvRequest.setCidrBlock(getCidrBlock()); setVpcId(client.createVpc(cvRequest).getVpc().getVpcId()); addReferable(new BeamContextKey("vpc-id"), new BeamLiteral(getVpcId())); ======= CreateVpcResponse response = client.createVpc(request); setVpcId(response.vpc().vpcId()); addReferable(new BeamContextKey(null, "vpc-id"), new BeamLiteral(getVpcId())); >>>>>>> CreateVpcResponse response = client.createVpc(request); setVpcId(response.vpc().vpcId()); addReferable(new BeamContextKey("vpc-id"), new BeamLiteral(getVpcId()));
<<<<<<< validateOptionArguments(node, "exclude", 0, 1); ======= validateOptionArguments(node, "merge", 0, 1); boolean merge = Optional.ofNullable(getOptionArgument(scope, node, "merge", Boolean.class, 0)) .orElse(false); >>>>>>> validateOptionArguments(node, "exclude", 0, 1); validateOptionArguments(node, "merge", 0, 1); boolean merge = Optional.ofNullable(getOptionArgument(scope, node, "merge", Boolean.class, 0)) .orElse(false); <<<<<<< Set<String> excludes = Optional.ofNullable(getOptionArgument(scope, node, "exclude", Set.class, 0)) .orElse(Collections.emptySet()); sourceMap.entrySet() .stream() .filter(e -> !excludes.contains(e.getKey())) .forEach(e -> scope.put(e.getKey(), merge(scope.get(e.getKey()), e.getValue()))); ======= if (merge) { sourceMap.forEach((key, value) -> scope.put(key, merge(scope.get(key), value))); } else { sourceMap.forEach(scope::putIfAbsent); } >>>>>>> Set<String> excludes = Optional.ofNullable(getOptionArgument(scope, node, "exclude", Set.class, 0)) .orElse(Collections.emptySet()); Stream<Map.Entry<String, Object>> entryStream = sourceMap.entrySet() .stream() .filter(e -> !excludes.contains(e.getKey())); if (merge) { entryStream.forEach(e -> scope.put(e.getKey(), merge(scope.get(e.getKey()), e.getValue()))); } else { entryStream.forEach(e -> scope.putIfAbsent(e.getKey(), e.getValue())); }