当前位置: 首页>>代码示例>>Java>>正文


Java AppDotNetClient类代码示例

本文整理汇总了Java中com.alwaysallthetime.adnlib.AppDotNetClient的典型用法代码示例。如果您正苦于以下问题:Java AppDotNetClient类的具体用法?Java AppDotNetClient怎么用?Java AppDotNetClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AppDotNetClient类属于com.alwaysallthetime.adnlib包,在下文中一共展示了AppDotNetClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deactivateChannel

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
/**
 * Deactivate a private Channel (may be an Action Channel) and remove the persisted copy.
 *
 * @param client the AppDotNetClient to use for the request
 * @param channel the Channel to deactivate
 * @param handler the response handler
 */
public static void deactivateChannel(final AppDotNetClient client, final Channel channel, final PrivateChannelHandler handler) {
    client.deactivateChannel(channel.getId(), new ChannelResponseHandler() {
        @Override
        public void onSuccess(Channel responseData) {
            String actionChannelType = AnnotationUtility.getActionChannelType(channel);
            String targetChannelId = AnnotationUtility.getTargetChannelId(channel);
            if(actionChannelType == null || targetChannelId == null) {
                sChannels.remove(channel.getType());
                ADNSharedPreferences.deletePrivateChannel(channel);
            } else {
                getOrCreateActionChannelsMap(targetChannelId).remove(actionChannelType);
                ADNSharedPreferences.deleteActionChannel(actionChannelType, targetChannelId);
                handler.onResponse(responseData);
            }
            handler.onResponse(responseData);
        }

        @Override
        public void onError(Exception error) {
            super.onError(error);
            handler.onError(error);
        }
    });
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:32,代码来源:PrivateChannelUtility.java

示例2: retrieveChannel

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
private static void retrieveChannel(AppDotNetClient client, final String channelType, final PrivateChannelHandler handler) {
    QueryParameters params = new QueryParameters();
    params.put("channel_types", channelType);
    client.retrieveCurrentUserSubscribedChannels(params, new ChannelListResponseHandler() {
        @Override
        public void onSuccess(ChannelList responseData) {
            Channel theChannel = getOldestPrivateChannel(responseData);

            if(theChannel != null) {
                ADNSharedPreferences.savePrivateChannel(theChannel);
            }
            sChannels.put(channelType, theChannel);
            handler.onResponse(theChannel);
        }

        @Override
        public void onError(Exception error) {
            handler.onError(error);
        }
    });
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:22,代码来源:PrivateChannelUtility.java

示例3: retrieveActionChannel

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
private static void retrieveActionChannel(AppDotNetClient client, final String actionType, final String targetChannelId, final PrivateChannelHandler handler) {
    QueryParameters params = new QueryParameters(GeneralParameter.INCLUDE_CHANNEL_ANNOTATIONS);
    params.put("channel_types", CHANNEL_TYPE_ACTION);
    client.retrieveCurrentUserSubscribedChannels(params, new ChannelListResponseHandler() {
        @Override
        public void onSuccess(ChannelList responseData) {
            Channel theChannel = getOldestActionChannel(responseData, actionType, targetChannelId);

            if(theChannel != null) {
                ADNSharedPreferences.saveActionChannel(theChannel, actionType, targetChannelId);
                getOrCreateActionChannelsMap(targetChannelId).put(actionType, theChannel);
            }
            handler.onResponse(theChannel);
        }

        @Override
        public void onError(Exception error) {
            handler.onError(error);
        }
    });
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:22,代码来源:PrivateChannelUtility.java

示例4: createActionChannel

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
private static void createActionChannel(final AppDotNetClient client, final String actionType, final String targetChannelId, final PrivateChannelHandler handler) {
    ArrayList<Annotation> channelAnnotations = new ArrayList<Annotation>(1);
    Annotation metadata = new Annotation(CHANNEL_ANNOTATION_TYPE_METADATA);
    HashMap<String, Object> value = new HashMap<String, Object>(2);
    value.put(ACTION_METADATA_KEY_ACTION_TYPE, actionType);
    value.put(ACTION_METADATA_KEY_TARGET_CHANNEL_ID, targetChannelId);
    metadata.setValue(value);
    channelAnnotations.add(metadata);

    createChannel(client, CHANNEL_TYPE_ACTION, channelAnnotations, new PrivateChannelHandler() {
        @Override
        public void onResponse(Channel channel) {
            getOrCreateActionChannelsMap(targetChannelId).put(actionType, channel);
            ADNSharedPreferences.saveActionChannel(channel, actionType, targetChannelId);
            handler.onResponse(channel);
        }

        @Override
        public void onError(Exception error) {
            handler.onError(error);
        }
    });
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:24,代码来源:PrivateChannelUtility.java

示例5: updateConfiguration

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
/**
 * Update the Configuration if due.
 *
 * http://developers.app.net/docs/resources/config/#how-to-use-the-configuration-object
 *
 * @param client the AppDotNetClient to use for the request
 * @return true if the configuration is being fetched, false otherwise.
 */
public static boolean updateConfiguration(AppDotNetClient client) {
    Date configurationSaveDate = ADNSharedPreferences.getConfigurationSaveDate();
    boolean fetchNewConfig = configurationSaveDate == null;
    if(!fetchNewConfig) {
        Calendar cal1 = Calendar.getInstance();
        Calendar cal2 = Calendar.getInstance();
        cal1.setTime(configurationSaveDate);
        cal2.setTime(new Date());
        boolean sameDay = cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) &&
                cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR);
        fetchNewConfig = !sameDay;
    }
    if(fetchNewConfig) {
        client.retrieveConfiguration(new ConfigurationResponseHandler() {
            @Override
            public void onSuccess(Configuration responseData) {
                ADNSharedPreferences.saveConfiguration(responseData);
            }
        });
    }
    return fetchNewConfig;
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:31,代码来源:ConfigurationUtility.java

示例6: FileManager

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
private FileManager(AppDotNetClient client) {
    mClient = client;
    mContext = ADNApplication.getContext();
    mDatabase = ADNDatabase.getInstance(mContext);
    mFilesInProgress = Collections.synchronizedSet(new HashSet<String>(1));

    IntentFilter intentFilter = new IntentFilter(FileUploadService.INTENT_ACTION_FILE_UPLOAD_COMPLETE);
    mContext.registerReceiver(fileUploadReceiver, intentFilter);
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:10,代码来源:FileManager.java

示例7: MessageManager

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
public MessageManager(AppDotNetClient client, MessageManagerConfiguration configuration) {
    mContext = ADNApplication.getContext();
    mClient = client;
    mConfiguration = configuration;
    mDatabase = ADNDatabase.getInstance(mContext);

    mMessages = new HashMap<String, TreeMap<Long, MessagePlus>>();
    mUnsentMessages = new HashMap<String, TreeMap<Long, MessagePlus>>();
    mMinMaxPairs = new HashMap<String, MinMaxPair>();
    mParameters = new HashMap<String, QueryParameters>();
    mMessagesNeedingPendingFiles = new HashMap<String, Set<String>>();

    IntentFilter intentFilter = new IntentFilter(FileUploadService.INTENT_ACTION_FILE_UPLOAD_COMPLETE);
    mContext.registerReceiver(fileUploadReceiver, intentFilter);
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:16,代码来源:MessageManager.java

示例8: createChannel

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
private static void createChannel(final AppDotNetClient client, final String channelType, final PrivateChannelHandler handler) {
    createChannel(client, channelType, new ArrayList<Annotation>(0), new PrivateChannelHandler() {
        @Override
        public void onResponse(Channel channel) {
            sChannels.put(channelType, channel);
            ADNSharedPreferences.savePrivateChannel(channel);
            handler.onResponse(channel);
        }

        @Override
        public void onError(Exception error) {
            handler.onError(error);
        }
    });
}
 
开发者ID:rrbrambley,项目名称:MessageBeast-Android,代码行数:16,代码来源:PrivateChannelUtility.java

示例9: AppDotNetApiUploadRequest

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
public AppDotNetApiUploadRequest(AppDotNetResponseHandler handler, String filename, byte[] image, int offset,
                                     int count, QueryParameters queryParameters, String... pathComponents) {
    super(handler, AppDotNetClient.METHOD_POST, queryParameters, pathComponents);

    hasBody = true;
    bodyFilename = filename;
    bodyBytes = image;
    bodyOffset = offset;
    bodyCount = count;
}
 
开发者ID:alwaysallthetime,项目名称:ADNLib,代码行数:11,代码来源:AppDotNetApiUploadRequest.java

示例10: setClient

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
public synchronized void setClient(AppDotNetClient client) {
    this.client = client;
    if(retrieveCount == 0) {
       retrieveCount = DEFAULT_RETRIEVE_COUNT;
    }
    if(objects == null) {
        objects = new TreeMap<String, IPageableAppDotNetObject>(new PageableObjectIdComparator());
        objectPaginationIdsForIds = new HashMap<String, String>(0);
    }
}
 
开发者ID:alwaysallthetime,项目名称:ADNLib,代码行数:11,代码来源:ResourceStream.java

示例11: attemptLogin

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
/**
     * Attempts to sign in or register the account specified by the login form.
     * If there are form errors (invalid email, missing fields, etc.), the
     * errors are presented and no actual login attempt is made.
     */
    public void attemptLogin() {
        String clientID = AccessKeys.CLIENT_ID;
        String pwGrantSecret = AccessKeys.PASSWORD_GRANT_SECRET;
        AppDotNetClient client = new AppDotNetClient(clientID, pwGrantSecret);
        final LoginActivity closure = this;

        mUser = mUserView.getText().toString();
        mPassword = mPasswordView.getText().toString();
        showProgress(true); // Switch!

        client.authenticateWithPassword(mUser, mPassword, SCOPE, new LoginResponseHandler() {
                @Override
                public void onSuccess(String accessToken, Token token) {
                    // The access token has already been set on the client; you don't need to call setToken() here.
                    // This also happens on the main thread.

                    Log.d("onSuccess", "got token?");
                    Log.d("onSuccess", accessToken);
                    SettingsDAO dao = new SettingsDAO(closure);
                    dao.open();
//                    Settings settings = dao.getSettings();
                    Settings settings = new Settings();
                    settings.setClientID( accessToken );
                    dao.save( settings );
                    dao.close();
                    // the settings object should now have an id!
                    Log.d("Settings ID", settings.getColumnId().toString());
                    // Let's redirect to the main thing now.
                    Intent mainActivity = new Intent(getApplicationContext(), MainActivity.class);
                    // Could set some things up here to pass it forwards.
                    startActivity(mainActivity);
                    finish();
                }
//                @Override
//                public void onError() {
//                    Log.d("error!", "error");
//                }
            });


    }
 
开发者ID:aurynn,项目名称:fantail,代码行数:47,代码来源:LoginActivity.java

示例12: onCreate

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
            // We can also trigger a refresh in here?
            Log.d("Change page", "happening");
            // Yes, this is when we refresh
            StreamFragment fm = (StreamFragment) mSectionsPagerAdapter.getItem(position);
            // if it's not been refreshed before
            // refresh it, but only when it's been switched to for the first time.
            if (!fm.hasLoaded()) {
                fm.refresh();
            }
            mSectionsPagerAdapter.setCurrentPosition(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar.addTab(
                actionBar.newTab()
                        .setText(mSectionsPagerAdapter.getPageTitle(i))
                        .setTabListener(this));
    }
    client = new AppDotNetClient( (String) getSettings().getClientId() );
    mainThread = new Handler();
}
 
开发者ID:aurynn,项目名称:fantail,代码行数:52,代码来源:MainActivity.java

示例13: getClient

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
public AppDotNetClient getClient() {
    return client;
}
 
开发者ID:aurynn,项目名称:fantail,代码行数:4,代码来源:MainActivity.java

示例14: AppDotNetFormRequest

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
protected AppDotNetFormRequest(AppDotNetResponseHandler handler, Uri baseUri, List<? extends NameValuePair> body, String... pathComponents) {
    super(handler, false, AppDotNetClient.METHOD_POST, null, baseUri, pathComponents);
    setBody(URLEncodedUtils.format(body, "UTF-8"));
}
 
开发者ID:alwaysallthetime,项目名称:ADNLib,代码行数:5,代码来源:AppDotNetFormRequest.java

示例15: AppDotNetApiRequest

import com.alwaysallthetime.adnlib.AppDotNetClient; //导入依赖的package包/类
public AppDotNetApiRequest(AppDotNetResponseHandler handler, QueryParameters queryParameters, String... pathComponents) {
    this(handler, AppDotNetClient.METHOD_GET, queryParameters, pathComponents);
}
 
开发者ID:alwaysallthetime,项目名称:ADNLib,代码行数:4,代码来源:AppDotNetApiRequest.java


注:本文中的com.alwaysallthetime.adnlib.AppDotNetClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。