org.androidannotations.annotations.UiThread Java Examples

The following examples show how to use org.androidannotations.annotations.UiThread. 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: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 6 votes vote down vote up
@UiThread(delay = 100)
public void refresh() {
    if (listView != null) {
        renderMenu();
        int childCount = listView.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View convertView = listView.getChildAt(i);
            if (convertView instanceof LinearLayout && convertView.getTag() instanceof Media[]) {
                LinearLayout linearLayout = (LinearLayout) convertView;
                for (int j = 0; j < linearLayout.getChildCount(); j++) {
                    renderImageView(linearLayout.getChildAt(j), false);
                }
            }
        }
        for (View headerView : attachedHeaderViews) {
            renderHeader(headerView);
        }
        renderHeader(listView.getFloatingSectionHeader());
    }
    if (selectedMedia.isEmpty()) {
        getSupportActionBar().setTitle(null);
    } else {
        getSupportActionBar().setTitle("" + selectedMedia.size());
    }
}
 
Example #2
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 #3
Source File: CommonFragment.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@UiThread
void handleServerError(final ActionBarActivity ctx, final ServerOnChangeListener listener){
    if( !ensureActivityAvailable(ctx) )
        return;
    UIHelper.getDialog().dismiss();
    String[] server = ctx.getResources().getStringArray(R.array.server);
    SpinnerDialog spinner = new SpinnerDialog(ctx, Arrays.asList(server));
    spinner.setDefaultSelectPosition(AppContext.getServer() - 1);
    spinner.setMessage(ctx.getString(R.string.tips_edu_server_error));
    spinner.setDialogListener(new SpinnerDialog.DialogListener() {
        @Override
        public void select(int n) {
            AppContext.setServer(n + 1);
            listener.onChangeServer();
        }
    });
    spinner.createBuilder().create().show();
}
 
Example #4
Source File: MapViewFragment.java    From IndiaSatelliteWeather with GNU General Public License v2.0 6 votes vote down vote up
@UiThread
void renderImage() {
    final String mapFileName = AppConstants.getMapType(pageNumber, mapType.value);
    String imageFile = StorageUtils.getAppSpecificFolder() + File.separator + mapFileName + ".jpg";

    if (!StorageUtils.fileExists(imageFile)) {
        Log.e("File not exists: " + pageNumber);
        noImageBanner.setVisibility(View.VISIBLE);
        map_updated_time.setVisibility(View.GONE);
        activityContext.initiateDownload();
        return;
    }

    map_updated_time.setVisibility(View.VISIBLE);
    if (mapViewState != null) {
        touchImage.setImageFile(imageFile, mapViewState);
    } else {
        touchImage.setScaleAndCenter(2f, touchImage.getCenter());
        touchImage.setImageFile(imageFile);
    }
    touchImage.setMaxScale(7f);
    touchImage.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);

    Log.d("Map refreshed");
    updateLastModifiedTime(mapFileName);
}
 
Example #5
Source File: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 6 votes vote down vote up
@UiThread
void renderListView() {
    if (listView != null) {
        swipeContainer.setRefreshing(false);
        if (listView.getAdapter() == null) {
            listView.setDividerHeight(0);
            listView.setAdapter(photoAdapter);
            listView.setFastScrollEnabled(true);
        } else {
            photoAdapter.notifyDataSetChanged();
        }
        if (medias != null && medias.isEmpty()) {
            message.setVisibility(View.VISIBLE);
            if (Utils.loadMedia(false).isEmpty()) {
                message.setText("No media found");
            } else {
                message.setText("No media matching your filter");
            }
        } else {
            message.setVisibility(View.GONE);
        }
    }
}
 
Example #6
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 #7
Source File: CommonActivity.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 处理服务器错误的情况。
 *
 * @param ctx
 * @param listener
 */
@UiThread
void handleServerError(final ActionBarActivity ctx, final ServerOnChangeListener listener){
    if( !ensureActivityAvailable(ctx) )
        return;
    String[] server = ctx.getResources().getStringArray(R.array.server);
    SpinnerDialog spinner = new SpinnerDialog(ctx, Arrays.asList(server));
    spinner.setDefaultSelectPosition(AppContext.getServer() - 1);
    spinner.setMessage(ctx.getString(R.string.tips_edu_server_error));
    spinner.setDialogListener(new SpinnerDialog.DialogListener() {
        @Override
        public void select(int n) {
            AppContext.setServer(n + 1);
            listener.onChangeServer();
        }
    });
    spinner.createBuilder().create().show();
}
 
Example #8
Source File: Bus.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@UiThread(delay = 300)
void showLine(){
    UIHelper.getDialog().dismiss();

    // build line information;
    int i = 0;
    String[] line = new String[lineList.size()];
    for (BusLineModel r : lineList)  line[i++] = r.getLineNum();

    // build up wheel control;
    buildWheel(line);

    // add to view;
    layout_parent.addView(wheel_line,0);
    layout_parent.addView(wheel_direction,1);

}
 
Example #9
Source File: ErrorHandler.java    From MVPAndroidBootstrap with Apache License 2.0 6 votes vote down vote up
@UiThread
protected void showError(String s) {
    if (navigator.isInForeground()) {
        Snackbar errorSnack;
        if (snackBarBackgroundColor != null) {
            errorSnack = Snackbar.with(context)
                    .text(s)
                    .duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
                    .color(snackBarBackgroundColor);
        } else {
            errorSnack = Snackbar.with(context)
                    .text(s)
                    .duration(Snackbar.SnackbarDuration.LENGTH_SHORT);
        }

        SnackbarManager.show(errorSnack, navigator.getCurrentActivityOnScreen());
    }
}
 
Example #10
Source File: DrawerContentView.java    From flickr-uploader with GNU General Public License v2.0 6 votes vote down vote up
@UiThread
void renderButtons() {
	if (queueTabView.getCurrentItem() == TAB_UPLOADED_INDEX) {
		pauseBtn.setVisibility(View.GONE);
		clearBtn.setVisibility(View.GONE);
	} else if (queueTabView.getCurrentItem() == TAB_QUEUED_INDEX) {
		clearBtn.setVisibility(View.VISIBLE);
		pauseBtn.setVisibility(View.VISIBLE);
		if (isUploadManuallyPaused()) {
			pauseBtn.setText("Resume");
		} else {
			pauseBtn.setText("Pause");
		}
	} else if (queueTabView.getCurrentItem() == TAB_FAILED_INDEX) {
		clearBtn.setVisibility(View.VISIBLE);
		pauseBtn.setVisibility(View.VISIBLE);
		pauseBtn.setText("Retry all");
	}
}
 
Example #11
Source File: MainMapActivity.java    From IndiaSatelliteWeather with GNU General Public License v2.0 5 votes vote down vote up
@UiThread
public void startRefreshAnimation() {
    if (!isLoading) {
        AnimationUtil.startRefreshAnimation(this, refreshItem);
        isLoading = Boolean.TRUE;
    }
}
 
Example #12
Source File: Welcome.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@UiThread(delay = 2000)
void close(){
    if(hasSetAccount()){
        Main_.intent(this).start();
    }else{
        Login_.intent(this).runMainActivity(true).start();
    }
    finish();
}
 
Example #13
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 #14
Source File: BaseListFragment.java    From moVirt with Apache License 2.0 5 votes vote down vote up
@UiThread(propagation = UiThread.Propagation.REUSE)
public void setSearchBoxVisibility(boolean visible) {
    if (visible) {
        searchbox.setVisibility(View.VISIBLE);
    } else {
        searchbox.setVisibility(View.GONE);
    }
}
 
Example #15
Source File: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 5 votes vote down vote up
@UiThread
void showExistingSetDialog() {
    Utils.showExistingSetDialog(activity, new Callback<String>() {
        @Override
        public void onResult(String result) {
            enqueue(Lists.newArrayList(selectedMedia), result);
            clearSelection();
        }
    }, null);
}
 
Example #16
Source File: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 5 votes vote down vote up
@UiThread
void clearSelection() {
    selectedMedia.clear();
    for (Header header : headers) {
        header.selected = false;
    }
    refresh();
}
 
Example #17
Source File: Goal.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@UiThread
void showGPAInformation(double gpa,double total_credit_point){
    StringBuilder subTitle = new StringBuilder();
    DecimalFormat df = new DecimalFormat("#.00");
    subTitle.append(getString(R.string.tv_gpa) + df.format(gpa));
    subTitle.append(" ");
    subTitle.append(getString(R.string.total_credit_point)+ df.format(total_credit_point));
    getSherlockActivity().getSupportActionBar().setSubtitle(subTitle.toString());
}
 
Example #18
Source File: ProductListActivity.java    From moserp with Apache License 2.0 5 votes vote down vote up
@UiThread
 void updateProductList(List<Product> products) {
    RecycleViewResourceAdapter<Product> adapter = new RecycleViewResourceAdapter<>(products, R.layout.product_list);
    adapter.setOnItemClickListener(new OnItemClickListener<Product>() {
        @Override
        public void onItemClick(int id, Product product) {
            startActivity(ProductDetailActivity.buildIntent(getApplicationContext(), product.getSelf().getHref()));
        }
    });
    productListBinding.productsList.setAdapter(adapter);
}
 
Example #19
Source File: UpdateDatabaseFragment.java    From Local-GSM-Backend with Apache License 2.0 5 votes vote down vote up
@UiThread
void setLastUpdateString(String string, boolean is_update) {
    if (isAdded()) {
        lastUpdate.setText(string);
        update.setText(is_update ? R.string.fragment_update_database_start_update : R.string.fragment_update_database_create_database);
    }
}
 
Example #20
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 #21
Source File: AppsFragment.java    From lockit with Apache License 2.0 5 votes vote down vote up
@Override
    @UiThread
    @IgnoredWhenDetached
    public void showAllApps(List<Application> allApps) {
        apps.setAdapter(appsAdapter(allApps));
        apps.setLayoutManager(new LinearLayoutManager(getActivity()));
//        ItemClickSupport.addTo(apps)
//                .setOnItemClickListener(
//                        (view, position, id) -> appSelected(appsAdapter.getItem(position)));
    }
 
Example #22
Source File: Main.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@UiThread(delay = 4000)
void showNotification(){
    String notification = MobclickAgent.getConfigParams(this, "notification");
    if(isConfigAble(notification)){
        // 今天显示过就不显示了
        if(!config.lastSeeNotificationDate().get().equals(dateUtil.getCurrentDateString()))
            Notification_.intent(this).notification(notification).start();
    }
}
 
Example #23
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 #24
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 #25
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 #26
Source File: Param.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 动态生成参数选择wheel控件;
 */
@UiThread
void showParams(){
    UIHelper.getDialog().dismiss();
    wheelList.clear();
    for(ParamModel p : paramList){
        ParamWidget paramWidget = buildParamViews(p.getKey(),p.getValue());
        linear_parent.addView(paramWidget);
    }
}
 
Example #27
Source File: ClassTable.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 使课程表上方的TAB移动到今天的位置,由于太早执行可能控件尚未绘制完成,导致getWidth() = 0,
 * 引发一系列BUG,这里延迟500ms执行;
 */
@UiThread(delay = 500)
void showTab(){
    int currentDay = dateUtil.getDayOfWeek() - 1;
    // 这句不能去掉,当日期为星期一时,就不重绘了,只有移动下它才重绘
    if(currentDay == 0)
        titles.changeWeekDay(1);
    pager.setCurrentItem(currentDay);
    titles.changeWeekDay(currentDay);
}
 
Example #28
Source File: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 5 votes vote down vote up
@UiThread
void checkPremium() {
    if (!Utils.isPremium() && !Utils.isTrial()) {
        Utils.showPremiumDialog(activity, new Callback<Boolean>() {
            @Override
            public void onResult(Boolean result) {
                renderMenu();
            }
        });
    }
}
 
Example #29
Source File: FlickrUploaderActivity.java    From flickr-uploader with GNU General Public License v2.0 5 votes vote down vote up
@UiThread
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (Utils.onActivityResult(requestCode, resultCode, data)) {
        return;
    }
    if (resultCode == FlickrWebAuthActivity.RESULT_CODE_AUTH) {
        if (FlickrApi.isAuthentified()) {
            Utils.showAutoUploadDialog(activity);
        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
Example #30
Source File: ClassTable.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 展示课程表,同时将课程表切换到今天.
 */
@UiThread()
void showClassTable(){

    // 以下是刷新日课表;
    int prevPosition = pager.getCurrentItem();

    UIHelper.getDialog().dismiss();
    listViews.clear();

    for (int i = 1; i <= 7; i++) {
        List<ClassModel> dayClassList = null;
        String chineseDay = dateUtil.numDayToChinese(i);

        if(config.classTableShowMode().get() == MODE_ALL){
            dayClassList = classHelper.getDayLesson(chineseDay);
        }else{
            dayClassList = classHelper.getDayLessonWithParams(chineseDay);
        }

        buildDayClassTableAdapter(dayClassList);
    }

    adapter.setViewList(listViews);
    pager.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    pager.setCurrentItem(prevPosition);
    onTabSelect();

    // 以下是刷新全周课表
    week_classtable.reload();
}