Java Code Examples for android.widget.ProgressBar

The following examples show how to use android.widget.ProgressBar. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: NetEasyNews   Source File: WebViewActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void initTitle() {
    StatusBarUtil.setColor(this, CommonUtils.getColor(R.color.colorTheme),0);
    mProgressBar = (ProgressBar) findViewById(R.id.pb_progress);
    webView = (WebView) findViewById(R.id.webview_detail);
    videoFullView = (FrameLayout) findViewById(R.id.video_fullView);
    mTitleToolBar = (Toolbar) findViewById(R.id.title_tool_bar);
    setSupportActionBar(mTitleToolBar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.icon_back);
    }
    setTitle(mTitle);
    mTitleToolBar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
}
 
Example 2
private void saveRssToFile(final ProgressBar progressBar, ObtainRssData obtainRssData, String fileStr) {
	/*
	 * save RSS data and position coordinate to file.
	 */
	mainAty.runOnUiThread(new Runnable() {
		
		@Override
		public void run() {
			progressBar.setVisibility(View.GONE);
			Toast.makeText(mainAty, "saving", Toast.LENGTH_SHORT).show();
		}
	});
	
	try {
		FileOperation.appendToFile(record_data.toString(), fileStr); 
		acquireSignalNum = 0;
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
Example 3
Source Project: MediaPlayer-Extended   Source File: VideoViewActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_videoview);
    Utils.setActionBarSubtitleEllipsizeMiddle(this);

    mVideoView = (VideoView) findViewById(R.id.vv);
    mProgress = (ProgressBar) findViewById(R.id.progress);

    mMediaPlayerControl = mVideoView; //new MediaPlayerDummyControl();
    mMediaController = new MediaController(this);
    mMediaController.setAnchorView(findViewById(R.id.container));
    mMediaController.setMediaPlayer(mMediaPlayerControl);
    mMediaController.setEnabled(false);

    mProgress.setVisibility(View.VISIBLE);

    // Init video playback state (will eventually be overwritten by saved instance state)
    mVideoUri = getIntent().getData();
    mVideoPosition = 0;
    mVideoPlaybackSpeed = 1;
    mVideoPlaying = false;
}
 
Example 4
Source Project: FastAccess   Source File: ColorPickerDialog.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("InflateParams") @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.color_picker_dialog, null, false);
    final Activity activity = getActivity();
    mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
    mPalette = (ColorPickerPalette) view.findViewById(R.id.color_picker);
    mPalette.init(mSize, mColumns, this);

    if (mColors != null) {
        showPaletteView();
    }

    mAlertDialog = new AlertDialog.Builder(activity)
            .setTitle(mTitleResId)
            .setView(view)
            .create();
    mAlertDialog.setCanceledOnTouchOutside(true);
    return mAlertDialog;
}
 
Example 5
Source Project: ColorPicker   Source File: ColorPickerDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Activity activity = getActivity();

    View view = LayoutInflater.from(getActivity()).inflate(R.layout.color_picker_dialog, null);
    mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
    mPalette = (ColorPickerPalette) view.findViewById(R.id.color_picker);
    mPalette.init(mSize, mColumns, this, mBackwardsOrder);

    if (mColors != null) {
        showPaletteView();
    }

    mAlertDialog = new AlertDialog.Builder(activity)
            .setTitle(mTitleResId)
            .setView(view)
            .create();
    mAlertDialog.setCanceledOnTouchOutside(true);
    return mAlertDialog;
}
 
Example 6
Source Project: zhangshangwuda   Source File: NewsFragmentWithTopic.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 初始化View
 */
private void InitView() {
	// System.out.println("InitViewPager");
	// 设置首页
	// loadMoreButton = getLoadMoreButton();
	newsList = new ArrayList<Map<String, String>>();
	ListView = (PullToRefreshListView) rootView
			.findViewById(R.id.news_all_ListView);
	PB = (ProgressBar) rootView
			.findViewById(R.id.news_all_ListView_progressBar);
	ListView.setOnItemClickListener(new ListViewItemClickListener());
	ListView.setOnRefreshListener(new PullToRefreshListView.OnRefreshListener() {
		public void onRefresh() {
			refreshData();
		}
	});
	ListView.setOnLoadMoreListener(new PullToRefreshListView.OnLoadMoreListener() {

		@Override
		public void onLoadMore() {
			loadMore();
		}
	});
}
 
Example 7
Source Project: Passbook   Source File: HomeActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void startSync(boolean animationOn) {
    Resources r = getResources();
    int[] strRes = {R.string.sync_none, R.string.sync_gpg, R.string.sync_gdrive};
    mButtonContainer = findViewById(R.id.btn_container);
    if(animationOn) {
        mButtonContainer.animate().scaleY(0.0f).setListener(this);
    }
    else {
        mButtonContainer.setVisibility(View.INVISIBLE);
    }
    mSyncText = findViewById(R.id.sync_hint);
    mSyncText.setText(r.getString(R.string.contacting,
            r.getString(strRes[Application.Options.mSync])));
    ProgressBar pb = findViewById(R.id.pb);
    if(animationOn) {
        pb.animate().alpha(1.0f).setStartDelay(300);
        mSyncText.animate().alpha(1.0f).setStartDelay(300);
    }
    else {
        pb.setAlpha(1.0f);
        mSyncText.setAlpha(1.0f);
    }
    SyncService ss = SyncService.getInstance(Application.Options.mSync);
    ss.initialize(this).setListener(this).connect(this, 0);
}
 
Example 8
/**
 * 初始化布局控件
 */
protected void initView() {
    pb = (ProgressBar) findViewById(R.id.pb);
    wv = (QuickWebView) findViewById(R.id.wv);

    //初始化控制器
    control = new WebloaderControl(this, bean, wv);


    //设置错误状态页点击事件
    pageControl.getStatusPage().setClickButton(getString(R.string.status_page_reload),new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //加载历史记录最近一页
            control.loadLastPage(true);
        }
    });

    //加载页面
    control.loadPage();
}
 
Example 9
/**
 *  First time loading of the LoaderImageView
 *  Sets up the LayoutParams of the view, you can change these to
 *  get the required effects you want
 */
private void instantiate(final Context context, final String imageUrl) {
	mContext = context;
	
	mImage = new ImageView(mContext);
	
	mImage.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	
	mSpinner = new ProgressBar(mContext);
	mSpinner.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		
	mSpinner.setIndeterminate(true);
	
	addView(mSpinner);
	addView(mImage);
	
	if(imageUrl == null){
		spin();
	}else{
		setImageDrawable(imageUrl);
	}
}
 
Example 10
Source Project: InteractiveChart   Source File: ChartActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 数据开始加载
 *
 * @param loadingType 加载框出现类型
 */
public void loadBegin(int loadingType, ProgressBar bar, Chart chart) {
  this.constraintSet.setVisibility(bar.getId(), VISIBLE);
  this.constraintSet.connect(bar.getId(), ConstraintSet.START, chart.getId(),
      ConstraintSet.START, Utils.dpTopx(this, 30));
  this.constraintSet.connect(bar.getId(), ConstraintSet.END, chart.getId(),
      ConstraintSet.END, Utils.dpTopx(this, 30));
  switch (loadingType) {
    case LEFT_LOADING:
      this.constraintSet.clear(bar.getId(), ConstraintSet.END);
      break;
    case RIGHT_LOADING:
      this.constraintSet.clear(bar.getId(), ConstraintSet.START);
      break;
  }
  this.chartLayout.setConstraintSet(constraintSet);
}
 
Example 11
Source Project: RxTools-master   Source File: ActivityWebView.java    License: Apache License 2.0 6 votes vote down vote up
private void initView() {
    // TODO Auto-generated method stub
    mRxTextAutoZoom = (RxTextAutoZoom) findViewById(R.id.afet_tv_title);
    llIncludeTitle = (LinearLayout) findViewById(R.id.ll_include_title);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    pbWebBase = (ProgressBar) findViewById(R.id.pb_web_base);
    webBase = (WebView) findViewById(R.id.web_base);
    ivFinish = (ImageView) findViewById(R.id.iv_finish);
    ivFinish.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (webBase.canGoBack()) {
                webBase.goBack();
            } else {
                finish();
            }
        }
    });

    initAutoFitEditText();
}
 
Example 12
Source Project: iBeebo   Source File: ReadWorker.java    License: GNU General Public License v3.0 6 votes vote down vote up
public ReadWorker(IWeiboDrawable view, String url, FileLocationMethod method, boolean isMultiPictures) {

        this(view.getImageView(), url, method, false);
        this.IWeiboDrawable = view;
        this.pbWeakReference = new WeakReference<ProgressBar>(view.getProgressBar());
        view.setGifFlag(false);
        if (SettingUtils.getEnableBigPic()) {
            if (view.getProgressBar() != null) {
                view.getProgressBar().setVisibility(View.VISIBLE);
                view.getProgressBar().setProgress(0);
            }
        } else {
            if (view.getProgressBar() != null) {
                view.getProgressBar().setVisibility(View.INVISIBLE);
                view.getProgressBar().setProgress(0);
            }
        }
        this.isMultiPictures = isMultiPictures;

    }
 
Example 13
@SuppressWarnings("unchecked")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    ArrayList<QBUser> qbUsers = (ArrayList<QBUser>) getIntent().getExtras().getSerializable(EXTRA_QB_USERS);
    chatDialog = new QBChatDialog(DIALOG_ID);

    messagesListView = (RecyclerView) findViewById(R.id.list_chat_messages);
    progressBar = (ProgressBar) findViewById(R.id.progress_chat);
    audioLayout = (LinearLayout) findViewById(R.id.layout_chat_audio_container);
    recordButton = (QBRecordAudioButton) findViewById(R.id.button_chat_record_audio);
    recordChronometer = (Chronometer) findViewById(R.id.chat_audio_record_chronometer);
    bucketView = (ImageView) findViewById(R.id.chat_audio_record_bucket_imageview);
    audioRecordTextView = (TextView) findViewById(R.id.chat_audio_record_textview);
    vibro = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

    requestPermission();
    initAudioRecorder();
    recordButton.setRecordTouchListener(new RecordTouchListenerImpl());

    loadChatHistory(qbUsers);
}
 
Example 14
private void blockUI(boolean shouldBlock){
    if (shouldBlock) {
        selectBtn.setEnabled(false);
        recyclerView.suppressLayout(true);
        uploadToNsBtn.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(R.drawable.ic_cancel), null, null);
        uploadToNsBtn.setText(R.string.interrupt_btn);
        uploadToNsBtn.setOnClickListener(e -> stopService(new Intent(this, CommunicationsService.class)));
        progressBarMain.setVisibility(ProgressBar.VISIBLE);
        progressBarMain.setIndeterminate(true);//TODO
        uploadToNsBtn.setEnabled(true);
        return;
    }
    selectBtn.setEnabled(true);
    recyclerView.suppressLayout(false);
    uploadToNsBtn.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(R.drawable.ic_upload_btn), null, null);
    uploadToNsBtn.setText(R.string.upload_btn);
    uploadToNsBtn.setOnClickListener(e -> this.uploadFiles() );
    progressBarMain.setVisibility(ProgressBar.INVISIBLE);
    this.updateUploadBtnState();
}
 
Example 15
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    vContainer = inflater.inflate(R.layout.fragment_qr_code_single_page, null);
    flQrContainer = (FrameLayout) vContainer.findViewById(R.id.fl_qr_container);
    ivQr = (ImageView) vContainer.findViewById(R.id.iv_qrcode);
    ivAvatar = (ImageView) vContainer.findViewById(R.id.iv_avatar);
    pb = (ProgressBar) vContainer.findViewById(R.id.pb);
    ivQr.getLayoutParams().height = ivQr.getLayoutParams().width = QrCodeSize;
    ivAvatar.getLayoutParams().height = ivAvatar.getLayoutParams().width = (int) (QrCodeSize
            * FancyQrCodeThread.AvatarSizeRate);
    vContainer.setOnClickListener(clickListener);
    if (AppSharedPreference.getInstance().hasUserAvatar() && isShowAvatar) {
        ivAvatar.setVisibility(View.VISIBLE);
    } else {
        ivAvatar.setVisibility(View.GONE);
    }
    configureImages();
    configureVanityAddress();
    return vContainer;
}
 
Example 16
Source Project: green_android   Source File: WordsFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
                         final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_onboarding_words, container, false);

    // Get arguments: words and offset
    final Bundle b = this.getArguments();
    if (b == null)
        return view;
    final List<String> words = b.getStringArrayList("words");
    final int offset = b.getInt("offset");
    final int index = offset / 6;

    final ProgressBar progressBar = UI.find(view, R.id.progressBar);
    progressBar.setProgress(25+index*25);

    // Setup words recyclerview
    final WordsViewAdapter wordsViewAdapter = new WordsViewAdapter(getContext(), words, offset);
    final RecyclerView wordsRecyclerView = UI.find(view, R.id.wordsRecyclerView);
    wordsRecyclerView.setHasFixedSize(true);
    wordsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    wordsRecyclerView.setAdapter(wordsViewAdapter);
    return view;
}
 
Example 17
Source Project: letv   Source File: ListFragment.java    License: Apache License 2.0 6 votes vote down vote up
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Context context = getActivity();
    FrameLayout root = new FrameLayout(context);
    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(1);
    pframe.setVisibility(8);
    pframe.setGravity(17);
    pframe.addView(new ProgressBar(context, null, 16842874), new LayoutParams(-2, -2));
    root.addView(pframe, new LayoutParams(-1, -1));
    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);
    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(17);
    lframe.addView(tv, new LayoutParams(-1, -1));
    ListView lv = new ListView(getActivity());
    lv.setId(16908298);
    lv.setDrawSelectorOnTop(false);
    lframe.addView(lv, new LayoutParams(-1, -1));
    root.addView(lframe, new LayoutParams(-1, -1));
    root.setLayoutParams(new LayoutParams(-1, -1));
    return root;
}
 
Example 18
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log_OC.d(TAG, "onCreate() start");

    super.onCreate(savedInstanceState);

    setContentView(R.layout.files_folder_picker);

    if (savedInstanceState == null) {
        createFragments();
    }


    fpToolbar = (Toolbar) findViewById(R.id.toolbar);
    if (fpToolbar != null)
    {
        setSupportActionBar(fpToolbar);
    }
    // sets callback listeners for UI elements
    initControls();

    // Action bar setup
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    mProgressBar.setIndeterminateDrawable(
            getResources().getDrawable(
                    R.drawable.actionbar_progress_indeterminate_horizontal));
    mProgressBar.setIndeterminate(mSyncInProgress);
    // always AFTER setContentView(...) ; to work around bug in its implementation

    // sets message for empty list of folders
    setBackgroundText();

    Log_OC.d(TAG, "onCreate() end");
}
 
Example 19
Source Project: repay-android   Source File: FriendHistoryFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute()
{
	mList.setAdapter(null);
	mList.setVisibility(ListView.GONE);
	mNoDebtsMsg.setVisibility(TextView.GONE);
	mProgressBar.setVisibility(ProgressBar.VISIBLE);
}
 
Example 20
Source Project: MobileGuard   Source File: MsgSafeActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 1
 */
@Override
protected void initView() {
    setContentView(R.layout.activity_msg_safe);
    // bind view
    pbLoading = (ProgressBar) findViewById(R.id.pb_loading);
    tvNoData = (TextView) findViewById(R.id.tv_no_data);
    lvBlacklist = (ListView) findViewById(R.id.lv_blacklist);

}
 
Example 21
Source Project: JieCaoVideoPlayer-develop   Source File: JCVideoPlayerStandard.java    License: MIT License 5 votes vote down vote up
@Override
protected void init(Context context) {
    super.init(context);
    bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
    titleTextView = (TextView) findViewById(R.id.title);
    backButton = (ImageView) findViewById(R.id.back);
    thumbImageView = (ImageView) findViewById(R.id.thumb);
    coverImageView = (ImageView) findViewById(R.id.cover);
    loadingProgressBar = (ProgressBar) findViewById(R.id.loading);

    thumbImageView.setOnClickListener(this);
    backButton.setOnClickListener(this);

}
 
Example 22
Source Project: sctalk   Source File: BaseMsgRenderView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    portrait = (IMBaseImageView) findViewById(R.id.user_portrait);
    messageFailed = (ImageView) findViewById(R.id.message_state_failed);
    loadingProgressBar = (ProgressBar) findViewById(R.id.progressBar1);
    name = (TextView) findViewById(R.id.name);
}
 
Example 23
Source Project: WeexOne   Source File: WXPageActivity.java    License: MIT License 5 votes vote down vote up
private void initUIAndData() {

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(mUri.toString().substring(mUri.toString().lastIndexOf(File.separator) + 1));

    mContainer = (ViewGroup) findViewById(R.id.container);
    mProgressBar = (ProgressBar) findViewById(R.id.progress);
  }
 
Example 24
Source Project: aurora-imui   Source File: SelectPhotoView.java    License: MIT License 5 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    inflate(context, R.layout.layout_chatinput_selectphoto, this);
    mContext = context;

    mProgressBar = (ProgressBar) findViewById(R.id.aurora_progressbar_selectphoto);
    mRvPhotos = (RecyclerView) findViewById(R.id.aurora_recyclerview_selectphoto);
    mRvPhotos.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
    mRvPhotos.setHasFixedSize(true);
    mMediaHandler = new MediaHandler(this);
}
 
Example 25
private void bindViews(View view) {
    mSearch = (SearchView) view.findViewById(R.id.search_cities__search);
    mListGroup = view.findViewById(R.id.search_cities__list_group);
    mList = (ListView) view.findViewById(R.id.search_cities__list);
    mEmpty = (TextView) view.findViewById(R.id.search_cities__empty);
    mProgress = (ProgressBar) view.findViewById(R.id.search_cities__progress);
}
 
Example 26
Source Project: monolog-android   Source File: EaseChatRow.java    License: MIT License 5 votes vote down vote up
private void initView() {
    onInflatView();
    timeStampView = (TextView) findViewById(R.id.timestamp);
    userAvatarView = (ImageView) findViewById(R.id.iv_userhead);
    bubbleLayout = findViewById(R.id.bubble);
    usernickView = (TextView) findViewById(R.id.tv_userid);

    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    statusView = (ImageView) findViewById(R.id.msg_status);
    ackedView = (TextView) findViewById(R.id.tv_ack);
    deliveredView = (TextView) findViewById(R.id.tv_delivered);

    onFindViewById();
}
 
Example 27
Source Project: RePlugin-GameSdk   Source File: HWWebView.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
public HWWebView(Context context) {
	super(context);
	mMebView=this;
	this.mContext = context;

	int screenWidth = ((Activity) context).getWindowManager()
			.getDefaultDisplay().getWidth(); // 屏幕宽(像素,如:480px)
	int screenHeight = ((Activity) context).getWindowManager()
			.getDefaultDisplay().getHeight(); // 屏幕高(像素,如:800p)

	progressBar = new ProgressBar(context, null,
			android.R.attr.progressBarStyle);
	progressBar.setVisibility(View.GONE);

	AbsoluteLayout.LayoutParams progressBarParams = new AbsoluteLayout.LayoutParams(
			60, 60, (screenWidth - 60) / 2, (screenHeight - 60) / 2);

	this.addView(progressBar, progressBarParams);

	WebSettings set = this.getSettings();
	set.setSavePassword(false);
	set.setSaveFormData(false);
	set.setJavaScriptEnabled(true);
	set.setJavaScriptCanOpenWindowsAutomatically(true);

	this.setWebViewClient(new HWWebViewClient());
}
 
Example 28
Source Project: fingerpoetry-android   Source File: PRTHeader.java    License: Apache License 2.0 5 votes vote down vote up
public PRTHeader(Context context) {
	super(context);
	int[] size = R.getScreenSize(context);
	float screenWidth = size[0] < size[1] ? size[0] : size[1];
	float ratio = screenWidth / DESIGN_SCREEN_WIDTH;

	setOrientation(VERTICAL);

	LinearLayout llInner = new LinearLayout(context);
	LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_HORIZONTAL;
	addView(llInner, lp);

	ivArrow = new RotateImageView(context);
	int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr");
	if (resId > 0) {
		ivArrow.setImageResource(resId);
	}
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.topMargin = lp.bottomMargin = avataPadding;
	llInner.addView(ivArrow, lp);

	pbRefreshing = new ProgressBar(context);
	resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar");
	Drawable pbdrawable = context.getResources().getDrawable(resId);
	pbRefreshing.setIndeterminateDrawable(pbdrawable);
	llInner.addView(pbRefreshing, lp);
	pbRefreshing.setVisibility(View.GONE);

	tvHeader = new TextView(getContext());
	tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvHeader.setPadding(avataPadding, 0, avataPadding, 0);
	tvHeader.setTextColor(0xff09bb07);
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	llInner.addView(tvHeader, lp);
}
 
Example 29
Source Project: Swface   Source File: FaceDetailActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void showPictureDetail(int position) {
	String faceToken = getFaceTokenAndUrl(position).split("#")[0];
	showNormalDialog("人脸详情","正在玩命分析中...",true,new ProgressBar(this),false);
	DatabaseAdapter db = new DatabaseAdapter(this);
	Face face = db.findFaceByFaceToken_Faces(faceToken,myHandler);
	if(face!=null){
		dialog.dismiss();
		showDetailDialog(face);
	}
}
 
Example 30
Source Project: KJGallery   Source File: SamplePagerAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View instantiateItem(ViewGroup container, int position) {
    View root = View.inflate(aty, R.layout.item_pager, null);
    final PhotoView photoView = (PhotoView) root.findViewById(R.id.images);
    final GifImageView gifView = (GifImageView) root.findViewById(R.id.gifimage);
    final ProgressBar mProgressBar = (ProgressBar) root.findViewById(R.id.progress);

    GifRequest request = new GifRequest(imageUrls[position], new HttpCallBack() {
        @Override
        public void onPreStart() {
            super.onPreStart();
            mProgressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onSuccess(byte[] t) {
            super.onSuccess(t);
            //根据图片类型的不同选择不同的加载方案
            if (TYPE_GIF == getType(t)) {
                displayGif(gifView, t);
            } else {
                displayImage(photoView, t);
            }
        }

        @Override
        public void onFinish() {
            super.onFinish();
            mProgressBar.setVisibility(View.GONE);
        }
    });
    kjh.doRequest(request);

    container.addView(root, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams
            .MATCH_PARENT);
    return root;
}