com.devspark.appmsg.AppMsg Java Examples

The following examples show how to use com.devspark.appmsg.AppMsg. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZenContentActivity.java    From zen4android with MIT License 6 votes vote down vote up
@JavascriptInterface
public void OnOpenVideo(String url) {
	System.out.println("OnOpenVideo:" + url);
	if (url != null) {
		String videoUrl = ZenVideoParser.parser(url);
		System.out.println("OnOpenVideo: after parser" + videoUrl);
		if (videoUrl != null) {
			mHandler.post(new ZenOpenChrome(ZenContentActivity.this, videoUrl));
		}
		else {
			mHandler.post(new Runnable() {
				
				@Override
				public void run() {
					AppMsg appmsg = AppMsg.makeText(ZenContentActivity.this,
							"��ʱ��֧�ָ���Ƶ��ʽ", AppMsg.STYLE_ALERT);
					appmsg.show();
				}
			});
		}
		
	}
}
 
Example #2
Source File: ZenContentActivity.java    From zen4android with MIT License 6 votes vote down vote up
private void comment() {
	if (mModel.threadData.subject == null) {
		AppMsg appMsg = AppMsg.makeText(this, "���Ӽ�����ɺ��������", AppMsg.STYLE_ALERT);
		appMsg.show();
		return;
	}
	if (isLogin()) {
		Intent intent = new Intent(this, ZenPostActivity.class);
		intent.putExtra("type", ZenPostActivity.ZEN_TYPE_COMMENT);
		intent.putExtra("title", mModel.threadData.subject);
		intent.putExtra("fid", mFid);
		intent.putExtra("tid", mTid);
		intent.putExtra("subject", mModel.threadData.subject);
		intent.putExtra("pid", "");
		startActivity(intent);
	}
}
 
Example #3
Source File: SearchBook.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@UiThread
void showSuccessResult(BookModel.BookList l){

    // new search
    if(bookadapter == null){
        count = l.getCount();
        setListViewAdapter(l.getBooks());
        String tips = getString(R.string.tips_searchbook_count) + count;
        swipe_refresh.setRefreshing(false);
        AppMsg.makeText(getSherlockActivity(),tips,AppMsg.STYLE_INFO).show();
    }else{
        // next page;
        bookadapter.addAll(l.getBooks());
        pullListView.onRefreshComplete();

        bookadapter.notifyDataSetChanged();
        adapter.notifyDataSetChanged();
    }
}
 
Example #4
Source File: ZenNotificationActivity.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
	System.out.println("Receive Notification: " + intent.getAction());
	String action = intent.getAction();
	mLoadingView.hide();
	if (action.equals(ZenNotificationModel.ZEN_NEW_NOTIFICATION)) {
		mAdapter.setNotifications(model.notifications);
		mAdapter.notifyDataSetChanged();
	}
	else if (action.equals(ZenNotificationModel.ZEN_NOTIFICATION_EMPTY)) {
		mAdapter.clear();
	}
	else if (action.equals(ZenNotificationModel.ZEN_LOAD_NOTIFICATION_FAILED)) {
		AppMsg appmsg = AppMsg.makeText(ZenNotificationActivity.this, "�볡���Ѽ���ʧ��", AppMsg.STYLE_ALERT);
		appmsg.show();
	}
}
 
Example #5
Source File: ZenThreadsFragment.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
	// model finished load threads
	Log.d("zen", "onReceive");
	ZenMainActivity ac = (ZenMainActivity)mContext;
	ac.showLoadingView(false);
	mThreadsListView.onRefreshComplete();
	String action = intent.getAction();
	if (action.equals(ZenThreadsModel.DidFinishedLoad)) {
		
		mThreadsAdapter.array = mModel.threads;
		mThreadsAdapter.notifyDataSetChanged();
		mList.scrollTo(0, 0);
	}
	else if(action.equals(ZenThreadsModel.DidFailedLoad)) {
		AppMsg appmsg = AppMsg.makeText(ac, "����ʧ��...", AppMsg.STYLE_ALERT);
		appmsg.show();
	}
}
 
Example #6
Source File: Card.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@UiThread
void showSuccessResult(CardRecordModel.RecordList l){

    // new search
    if(cardadapter == null){
        count = l.getCount();
        setListViewAdapter(l.getRecords());
        String tips = getString(R.string.tips_card_record_count) + count;
        AppMsg.makeText(getSherlockActivity(),tips,AppMsg.STYLE_INFO).show();
        UIHelper.getDialog().dismiss();
    }else{
        // next page;
        cardadapter.addAll(l.getRecords());
        pullListView.onRefreshComplete();
        cardadapter.notifyDataSetChanged();
        adapter.notifyDataSetChanged();
        pullListView.setRefreshing(false);
    }

    ActionBar actionBar = getSherlockActivity().getSupportActionBar();
    actionBar.setSubtitle(getString(R.string.title_sub_card) + l.getAmount());
}
 
Example #7
Source File: CheckUpdatesTask.java    From FaceSlim with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onPostExecute(String result) {
    try {
        result = result.trim();
        String[] parts = result.split(":");
        if (!parts[0].isEmpty() && !parts[1].isEmpty() && Integer.valueOf(parts[0]) > CURRENT_VERSION) {
            // there's a new version
            AppMsg appMsg = AppMsg.makeText(activity, activity.getString(R.string.new_version_detected)
                    + " (" + parts[1] + ")", new AppMsg.Style(AppMsg.LENGTH_LONG, R.color.colorAccent));
            appMsg.setLayoutGravity(Gravity.TOP);
            appMsg.setDuration(8000);  // 8 seconds
            appMsg.getView().setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(NOTES)));
                }
            });
            if (preferences.getBoolean("transparent_nav", false) && activity.getResources()
                    .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
                appMsg.setLayoutParams(Dimension.getParamsAppMsg(activity));
            }
            appMsg.show();
        }
        if (!parts[0].isEmpty())
            preferences.edit().putLong("latest_update_check", System.currentTimeMillis()).apply();
    } catch (Exception e) {
        Log.e(TAG, "Sad face... Error", e);
    } finally {
        activity = null;
        preferences = null;
    }
}
 
Example #8
Source File: Configuration.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Click
void btn_save(){
    int server = Integer.valueOf(param_server.getSelectedParam());
    boolean isFirstScreen = param_classTableAsFirstScreen.getYesOrNo();
    AppContext.server = server;
    config.eduServer().put(server);
    config.classTableAsFirstScreen().put(isFirstScreen);
    RingerMode[] modes = RingerMode.values();
    RingerMode duringMode = modes[param_ringer_mode_during_class.getWheel().getCurrentItem()];
    RingerMode afterMode = modes[param_ringer_mode_after_class.getWheel().getCurrentItem()];
    boolean needUpdateAlarm = false;
    if(RingerMode.isSet(config.duringClassRingerMode().get()) != RingerMode.isSet(duringMode.getValue())
            || RingerMode.isSet(config.afterClassRingerMode().get()) != RingerMode.isSet(afterMode.getValue())){
        needUpdateAlarm = true;
    }
    config.duringClassRingerMode().put(duringMode.getValue());
    config.afterClassRingerMode().put(afterMode.getValue());
    if(needUpdateAlarm){
        RingerMode.duringClassOn(getActivity(), duringMode, -1);
        RingerMode.afterClassOn(getActivity(), afterMode, 1);
    }
    if(RingerMode.isSet(duringMode.getValue()) || RingerMode.isSet(afterMode.getValue())){
        RingerMode.setDateChangedAlarm(getActivity());
    } else {
        RingerMode.cancelDateChangedAlarm(getActivity());
    }
    AudioManager audioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
    if(ClassUtil.isDuringClassNow(getActivity())){
        audioManager.setRingerMode(duringMode.getValue());
    } else {
        audioManager.setRingerMode(afterMode.getValue());
    }
    AppMsg.makeText(parentActivity(),R.string.tips_save_successfully,AppMsg.STYLE_INFO).show();
}
 
Example #9
Source File: Card.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRefresh(PullToRefreshBase refreshView) {
    if(page < Math.ceil(count/10)){
        page++;
        loadData(startAndEndDate);
    }else{
        AppMsg.makeText(getSherlockActivity(), R.string.tips_default_last, AppMsg.STYLE_CONFIRM).show();
        refreshView.setRefreshing(false);
    }
}
 
Example #10
Source File: CommonFragment.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 展示http请求异常结果
 *
 * @param requestCode
 */
@UiThread
void showErrorResult(ActionBarActivity ctx, int requestCode){
    if(ctx == null) return;
    UIHelper.getDialog().dismiss();
    if(requestCode == 404){
        AppMsg.makeText(ctx, tips_empty, AppMsg.STYLE_CONFIRM).show();
    }else{
        AppContext.showError(requestCode,ctx);
    }
}
 
Example #11
Source File: Main.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
private boolean ensureExisted(String targetString, int notExistedTipsString) {
    if (targetString == null || targetString.equals("")){
        AppMsg.makeText(this,notExistedTipsString,AppMsg.STYLE_ALERT).show();
        return true;
    }
    return false;
}
 
Example #12
Source File: CardParam.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 继续查询按钮点击事件;
 */
@Click
void btn_continue(){
    try {
        if(isRightStartAndEndDate())
            startDetailFragment();
        else
            AppMsg.makeText(getSherlockActivity(),R.string.tips_card_date_wrong,AppMsg.STYLE_ALERT).show();
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
Example #13
Source File: CommonActivity.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 处理各种请求失败问题, 例如:
 *  查询的数据集为空,用户密码错误等等。
 *
 * @param requestCode
 */
@UiThread
void showErrorResult(ActionBarActivity ctx, int requestCode){
    if( !ensureActivityAvailable(ctx) )
        return;
    UIHelper.getDialog().dismiss();
    if(requestCode == 404){
        AppMsg.makeText(ctx, tips_empty, AppMsg.STYLE_CONFIRM).show();
    }else{
        AppContext.showError(requestCode,ctx);
    }
}
 
Example #14
Source File: CommonActivity.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 处理没有网络连接的情况。
 *
 * @param ctx
 */
@UiThread
void handleNoNetWorkError(ActionBarActivity ctx){
    if( !ensureActivityAvailable(ctx) )
        return;
    UIHelper.getDialog().dismiss();
    AppMsg.makeText(ctx, getString(R.string.tips_no_network), AppMsg.STYLE_ALERT).show();
}
 
Example #15
Source File: Notice.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRefresh(PullToRefreshBase refreshView) {
    if(page < Math.ceil(count/10)){
        page++;
        loadData();
    }else{
        AppMsg.makeText(getSherlockActivity(), R.string.tips_default_last, AppMsg.STYLE_CONFIRM).show();
        refreshView.setRefreshing(false);
    }
}
 
Example #16
Source File: ClassTable.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 展示网络加载异常结果
 * @param ctx
 * @param requestCode
 */
@Override
@UiThread
void showErrorResult(ActionBarActivity ctx, int requestCode){
    swipe_refresh.setRefreshing(false);
    if(requestCode == 404){
        AppMsg.makeText(ctx, R.string.tips_classtable_null, AppMsg.STYLE_ALERT).show();
    }else{
        app.showError(requestCode,ctx);
    }
}
 
Example #17
Source File: ClassEditor.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Click
void btn_modify(){

    // 判断开始节数是否大于结束节数;
    int startNote = Integer.parseInt(getWheelCurrentText(wheel_note_start,adapter_note_start));
    int endNote   = Integer.parseInt(getWheelCurrentText(wheel_note_end,  adapter_note_end));
    int startWeek = Integer.parseInt(getWheelCurrentText(wheel_week_start,adapter_week_start));
    int endWeek   = Integer.parseInt(getWheelCurrentText(wheel_week_end,adapter_week_end));
    if(endNote < startNote){
        AppMsg.makeText(this,R.string.tips_classtable_modify_note_start_bigger_end,AppMsg.STYLE_ALERT).show();
        return;
    }
    if(endWeek < startWeek){
        AppMsg.makeText(this,R.string.tips_classtable_modify_week_start_bigger_end,AppMsg.STYLE_ALERT).show();
        return;
    }

    // 生成节次信息;
    String[] notes = new String[endNote - startNote + 1];
    for(int note = startNote ; note <= endNote ; note++) notes[note-startNote] = String.valueOf(note);
    String strNote = stringHelper.join(",",notes);

    // 设置信息;
    model.setNode(strNote);
    model.setTeacher(edt_teacher.getText().toString().trim());
    model.setClassname(edt_classname.getText().toString().trim());
    model.setLocation(edt_place.getText().toString().trim());
    model.setDsz(getWheelCurrentText(wheel_dsz,adapter_dsz));
    model.setDay(getWheelCurrentText(wheel_weekday,adapter_weekday));
    model.setStrWeek(startWeek);
    model.setEndWeek(endWeek);

    Intent data = new Intent();
    data.putExtra("class",model);
    this.setResult(RESULT_OK, data);

    finish();
}
 
Example #18
Source File: Login.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@AfterViews
void setUpViews(){
    edt_userName.setText(app.userName);
    edt_eduSysPassword.setText(app.eduSysPassword);
    edt_libPassword.setText(app.libPassword);
    edt_cardPassword.setText(app.cardPassword);

    if (startTips != null){
        AppMsg.makeText(this, startTips, AppMsg.STYLE_INFO).show();
    }
}
 
Example #19
Source File: BookDetail.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 展示http请求异常结果
 * @param requestCode
 */
@UiThread
void showErroResult(int requestCode){
    UIHelper.getDialog().dismiss();
    if(requestCode == 404){
        AppMsg.makeText(this, getString(R.string.tips_bookdetail_null), AppMsg.STYLE_CONFIRM).show();
    }else{
        app.showError(requestCode,this);
    }
}
 
Example #20
Source File: AppContext.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 根据返回的requestCode,处理整个流程一般错误;
 * @param requestCode
 */
public static void showError(int requestCode,Activity act){
    try{
        AppException appException = new AppException();
        appException.parseException(requestCode,act);
    }catch (AppException e){
        AppMsg.makeText(act,e.getMessage(), AppMsg.STYLE_ALERT).show();
    }
}
 
Example #21
Source File: ZenPhotoActivity.java    From zen4android with MIT License 5 votes vote down vote up
private void save() {
	if (!isExternalStorageWritable()) {
		AppMsg appmsg = AppMsg.makeText(this, "����ʧ�ܣ������SD��",
				AppMsg.STYLE_ALERT);
		appmsg.show();
		return;
	}
	if (isGif) {
		saveGIF();
	} else {
		saveJPEG();
	}
}
 
Example #22
Source File: ZenContentActivity.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void OnSendClick(String content) {
	ZenLoginModel loginModel = ZenLoginModel.getInstance();
	String token = loginModel.userInfo.token;
	if (content.matches("")) {
		AppMsg appmsg = AppMsg.makeText(ZenContentActivity.this,
				"����������...", AppMsg.STYLE_ALERT);
		appmsg.show();
		return;
	}
	switch (mType) {
	case ZEN_TYPE_REPLY:
		mLoading.show("���ڷ���...");
		mCommentModel.comment(content, mReplyData.pid, token);
		break;
	case ZEN_TYPE_PM:
		mLoading.show("���ڷ���...");
		mCommentModel.send(content, "roger.qian");
		break;
	case ZEN_TYPE_COMMENT:
		mLoading.show("���ڷ���...");
		mCommentModel.comment(content, "", mModel.threadData.subject);
		break;
	case ZEN_TYPE_RECOMMEND:
		mLoading.show("���ڷ���...");
		mCommentModel.recommend(mModel.threadData.subject, content,
				token);
		break;
	}
}
 
Example #23
Source File: ZenContentActivity.java    From zen4android with MIT License 5 votes vote down vote up
private void hint() {
	String json = ZenJSONUtil.ReadJSONFromFile(ZEN_FILE);
	if (json == null || !json.contains("hint")) {
		AppMsg msg = AppMsg.makeText(this, "���ҳ�룬ҳ����ת������...", AppMsg.STYLE_INFO);
		msg.show();
	}
}
 
Example #24
Source File: SearchBook.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRefresh(PullToRefreshBase refreshView) {
    if(page < Math.ceil(count/10)){
        page++;
        loadData();
    }else{
        AppMsg.makeText(getSherlockActivity(), R.string.tips_default_last, AppMsg.STYLE_CONFIRM).show();
        refreshView.setRefreshing(false);
    }
}
 
Example #25
Source File: NoticeDetail.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 展示http请求异常结果
 * @param requestCode
 */
@UiThread
void showErroResult(int requestCode){
    if(requestCode == 404){
        AppMsg.makeText(this, getString(R.string.tips_default_null), AppMsg.STYLE_CONFIRM).show();
    }else{
        app.showError(requestCode,this);
    }
}
 
Example #26
Source File: Configuration.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Click
void btn_update(){
    AppMsg.makeText(getSherlockActivity(),
            app.getString(R.string.tips_checking_for_update)
            , AppMsg.STYLE_INFO).show();
    UmengUpdateAgent.setUpdateAutoPopup(false);
    UmengUpdateAgent.setUpdateListener(umengUpdateListener);
    UmengUpdateAgent.forceUpdate(getSherlockActivity());
}
 
Example #27
Source File: Bus.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * call relate method to refresh the site and bus
 */
@UiThread
void refreshSiteAndBus(){

    AppMsg.makeText(getSherlockActivity(),R.string.tips_bus_loading, AppMsg.STYLE_INFO).show();

    BusLineModel     _line = lineList.get(wheel_line.getWheel().getCurrentItem());
    String[] direction_eng = getDirectionEngByLine(_line);
    String            line = wheel_line.getSelectedParam();
    String       direction = direction_eng[wheel_direction.getWheel().getCurrentItem()];

    loadSite(line, direction);
    loadData(line, direction);
}
 
Example #28
Source File: ToastHelper.java    From AppCodeArchitecture with Apache License 2.0 4 votes vote down vote up
public static void showInfo(Activity context, String msg) {
    AppMsg.makeText(context, msg, AppMsg.STYLE_INFO).show();
}
 
Example #29
Source File: ToastHelper.java    From AppCodeArchitecture with Apache License 2.0 4 votes vote down vote up
public static void showInfo(Activity context, int resId) {
    AppMsg.makeText(context, resId, AppMsg.STYLE_INFO).show();
}
 
Example #30
Source File: ToastHelper.java    From AppCodeArchitecture with Apache License 2.0 4 votes vote down vote up
public static void showBottomInfo(Activity context, String msg) {
    AppMsg.makeText(context, msg, AppMsg.STYLE_INFO).setLayoutGravity(Gravity.BOTTOM).show();
}