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


Java Utils类代码示例

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


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

示例1: getRequest

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
/**
 * Make a /GET request to the nimbus API server
 * @param target		the target endpoint
 * @param params		the request params
 * @param handler		the async response handler
 */
public static void getRequest(String target, RequestParams params, JsonHttpResponseHandler handler){
    // Get Fully Formed URL
    String fullURL = getApiUrl(target);

    Utils.log(TAG, "Get Request: " + fullURL);

    // Pre-emptively cache URI Parsing
    try{
        URI.create(fullURL);
    } catch(IllegalArgumentException e){
        e.printStackTrace();
        handler.onFailure(e, new JSONObject());
        return;
    }

    // Make get request
    if(params != null){
        _client.get(fullURL, params, handler);
    }else
        _client.get(fullURL, handler);
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:28,代码来源:APIClient.java

示例2: onCreate

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_viewer);
    ButterKnife.inject(this);

    // Get the status bar colors to interpolate between
    int primary = getResources().getColor(R.color.primaryDark);
    int secondary = getResources().getColor(R.color.accent);

    // Build the slidr config
    SlidrConfig config = new SlidrConfig.Builder()
            .primaryColor(primary)
            .secondaryColor(secondary)
            .position(SlidrPosition.LEFT)
            .touchSize(Utils.dpToPx(this, 32))
            .build();

    // Attach the Slidr Mechanism to this activity
    Slidr.attach(this, config);

    setSupportActionBar(mToolbar);
    getSupportActionBar().setTitle("");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mOS = getIntent().getParcelableExtra(EXTRA_OS);
    if(savedInstanceState != null) mOS = savedInstanceState.getParcelable(EXTRA_OS);

    // Set layout contents
    mTitle.setText(mOS.name);
    mDescription.setText(mOS.description);
    mDate.setText(String.valueOf(mOS.year));
    mVersion.setText(mOS.version);
    mSdk.setText(String.valueOf(mOS.sdk_int));

    // Load header image
    Picasso.with(this)
            .load(mOS.image_url)
            .into(mCover);
}
 
开发者ID:azimkhan917,项目名称:Slide-Master,代码行数:40,代码来源:ViewerActivity.java

示例3: onActivityCreated

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Load listview
    mList = (ListView) getActivity().findViewById(R.id.license_list);

    // Look for saved licences file
    if(savedInstanceState != null){
        int savedConfigId = savedInstanceState.getInt("config_file", -1);
        if(savedConfigId != -1){
            mConfigFile = savedConfigId;
        }
    }

    // Safety
    if(mConfigFile == 0){
        Utils.log(TAG, "No valid config file for the LicenceFragment");
        getFragmentManager().popBackStack();
        return;
    }

    // Parse Configuration
    mLibraries = parseConfigFile();

    // Create adapter
    mAdapter = new LibraryListAdapter(getActivity(), R.layout.layout_library_item, mLibraries);
    mList.setAdapter(mAdapter);

    // Set action listener if available
    if(mActionListener != null){
        mAdapter.setActionListener(mActionListener);
    }

}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:36,代码来源:LicenseFragment.java

示例4: postRequest

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
/**
 * Make a /POST request to the nimbus API server with nothing but
 * request parameters
 * @param target		the target endpoint
 * @param params		the request params
 * @param handler		the async response handler
 */
public static void postRequest(String target, RequestParams params, JsonHttpResponseHandler handler){
    // Get Fully Formed URL
    String fullURL = getApiUrl(target);

    // Make Post request
    if(params != null){
        // Post Request
        _client.post(fullURL, params, handler);
    }else
        _client.post(fullURL, handler);

    // Log
    Utils.log(TAG, "Posting Server Request!");
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:22,代码来源:APIClient.java

示例5: savePrescriptions

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
/**
 * Save the user to disk
 * @param ctx   application context
 * @return      result of the operation (IO_FAIL, IO_SUCCESS)
 */
public synchronized int savePrescriptions(Context ctx){
    long pre = System.currentTimeMillis();
    int result = FileUtils.IO_FAIL;
    if(mPrescriptions != null){
        result = FileUtils.writeObjectToInternal(ctx, "PRESC_CACHE", mPrescriptions);
        long post = System.currentTimeMillis();
        Utils.log(TAG, "[" + result + "] User Data cached in " + (post - pre));
    }
    return result;
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:16,代码来源:UserSession.java

示例6: loadPrescriptions

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
/**
 * Load the user data from the disk
 * @param ctx   application context
 * @return      result of the operation (IO_FAIL, IO_SUCCESS)
 */
public synchronized int loadPrescriptions(Context ctx){
    long pre = System.currentTimeMillis();
    int result = FileUtils.IO_FAIL;

    ArrayList<Prescription> cacheUser = (ArrayList<Prescription>) FileUtils.readObject(ctx, "PRESC_CACHE");
    if(cacheUser != null){
        mPrescriptions = new ArrayList<Prescription>(cacheUser);
        result = FileUtils.IO_SUCCESS;
        long post = System.currentTimeMillis();
        Utils.log(TAG, "[" + result + "] User Data loaded in "  + (post - pre));
    }
    return result;
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:19,代码来源:UserSession.java

示例7: onSuccess

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onSuccess(JSONObject response) {
    Utils.log("PARH", response.toString());

    super.onSuccess(response);


    String error = response.optString("error", "SUCCESS");
    if(error.equalsIgnoreCase("SUCCESS")){
        onRequestSuccess(response);
    }else{
        onRequestFailure(error);
    }

}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:16,代码来源:PillAlarmResponseHandler.java

示例8: onCompletion

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onCompletion(MediaPlayer mp) {
	Utils.log(TAG, "Media Player has reached Completion");
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:5,代码来源:AudioPlayer.java

示例9: onSeekComplete

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onSeekComplete(MediaPlayer mp) {
	Utils.log(TAG, "Media Player Seek Complete [" + mp.getCurrentPosition() + ", " + mp.getDuration() + "]");
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:5,代码来源:AudioPlayer.java

示例10: onInfo

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
	Utils.log(TAG, "Media Player Info[" + what + ", " + extra + "]");
	return false;
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:6,代码来源:AudioPlayer.java

示例11: onError

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
	Utils.log(TAG, "Media Player Error[" + what + ", " + extra + "]");
	STATE = ERROR;
	return false;
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:7,代码来源:AudioPlayer.java

示例12: onError

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onError(MediaRecorder mr, int what, int extra) {
	Utils.log(TAG, "Recording Error[" + what + ", " + extra + "]");
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:5,代码来源:AudioRecorder.java

示例13: onInfo

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onInfo(MediaRecorder mr, int what, int extra) {
	Utils.log(TAG, "Recorder Info[" + what + ", " + extra + "]");
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:5,代码来源:AudioRecorder.java

示例14: onFailure

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
@Override
public void onFailure(Throwable e, JSONObject errorResponse) {
    Utils.log("PARH", "FAILED API REQUEST");
    super.onFailure(e, errorResponse);
    onRequestFailure(e.getMessage());
}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:7,代码来源:PillAlarmResponseHandler.java

示例15: openNewPrescriptionLayer

import com.r0adkll.deadskunk.utils.Utils; //导入依赖的package包/类
/**
 *
 */
public void openNewPrescriptionLayer(){
    // Create new scheduling
    Schedule addItem = new Schedule();
    mSchedules = new ArrayList<Schedule>();
    mSchedules.add(addItem);

    // Re-set views
    mEtName.getText().clear();
    mEtQuantity.getText().clear();
    mEtDose.getText().clear();
    mEtTag.getText().clear();
    chosenDate = null;
    mDateTextView.setText("Prescription start date.");

    // Re-Create adapter
    mAdapter = new ScheduleListAdapter(getActivity(), R.layout.layout_schedule_item, mSchedules);
    mScheduleList.setAdapter(mAdapter);
    mScheduleList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            final Schedule sched = mSchedules.get(i);

            Utils.log(getTag(), "Schedule Click: " + sched.toString());

            if(sched.isAddItem){

                // Get quantity
                int quant = -1;
                try{
                    quant = Integer.valueOf(mEtQuantity.getText().toString());
                } catch (NumberFormatException e){

                }

                if(quant != -1){

                    // Show the new Sched dialog
                    AddNewScheduleDialog diag = AddNewScheduleDialog.createInstance(quant);
                    diag.setAddActionListener(new AddNewScheduleDialog.OnAddActionListener() {
                        @Override
                        public void onScheduleOk(Schedule newSched) {
                            // Remove the add item
                            //mSchedules.remove(sched);

                            // add to list
                            mSchedules.add(mSchedules.size()-1, newSched);

                            // notify list
                            mAdapter.notifyDataSetChanged();

                        }

                        @Override
                        public void onCancelClick() {
                            // DO NOTHIZNANS
                        }
                    });
                    diag.show(getFragmentManager(), "ADD_SCHEDULE");

                }else{
                    DialogFactory.createAlertDialog(getActivity(), "Please enter a quantity first.", "Error");
                }

            }


        }
    });

    // Now show sliding layer
    mSlideLayer.openLayer(true);

}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:77,代码来源:HomeFragment.java


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