setVisibility ( )源码实例Demo

android.widget.ProgressBar#setVisibility ( )源码实例Demo

下面列出了android.widget.ProgressBar#setVisibility ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: panoramagl   文件: PLManager.java
/**
 * This event is fired when GLSurfaceView is created
 *
 * @param glSurfaceView current GLSurfaceView
 */
@SuppressWarnings("deprecation")
protected View onGLSurfaceViewCreated(GLSurfaceView glSurfaceView) {
    for (int i = 0; i < kMaxTouches; i++)
        mInternalTouches.add(new UITouch(glSurfaceView, new CGPoint(0.0f, 0.0f)));
    mContentLayout = new RelativeLayout(context);
    mContentLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    mContentLayout.addView(glSurfaceView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    progressBarLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    mProgressBar = new ProgressBar(context);
    mProgressBar.setIndeterminate(true);
    mProgressBar.setVisibility(View.GONE);
    mContentLayout.addView(mProgressBar, progressBarLayoutParams);
    return this.onContentViewCreated(mContentLayout);
}
 
private void updateProgress(StepProgress progress, View progressStepContainer) {
    ProgressBar progBar = Ui.findView(progressStepContainer, R.id.spinner);
    ImageView checkmark = Ui.findView(progressStepContainer, R.id.checkbox);

    // don't show the spinner again if we've already shown the checkmark,
    // regardless of the underlying state that might hide
    if (checkmark.getVisibility() == View.VISIBLE) {
        return;
    }

    progressStepContainer.setVisibility(View.VISIBLE);

    if (progress.status == StepProgress.STARTING) {
        checkmark.setVisibility(View.GONE);

        progBar.setProgressDrawable(tintedSpinner);
        progBar.setVisibility(View.VISIBLE);

    } else {
        progBar.setVisibility(View.GONE);

        checkmark.setImageDrawable(tintedCheckmark);
        checkmark.setVisibility(View.VISIBLE);
    }
}
 
/**
 * Takes the input from the user and generates the required heatmap.
 * Called when a search query is submitted
 */
public void submit(View view) {
    if ("YOUR_KEY_HERE".equals(API_KEY)) {
        Toast.makeText(this, "Please sign up for a Places API key and add it to HeatmapsPlacesDemoActivity.API_KEY",
            Toast.LENGTH_LONG).show();
        return;
    }
    EditText editText = findViewById(R.id.input_text);
    String keyword = editText.getText().toString();
    if (mOverlays.contains(keyword)) {
        Toast.makeText(this, "This keyword has already been inputted :(", Toast.LENGTH_SHORT).show();
    } else if (mOverlaysRendered == MAX_CHECKBOXES) {
        Toast.makeText(this, "You can only input " + MAX_CHECKBOXES + " keywords. :(", Toast.LENGTH_SHORT).show();
    } else if (keyword.length() != 0) {
        mOverlaysInput++;
        ProgressBar progressBar = findViewById(R.id.progress_bar);
        progressBar.setVisibility(View.VISIBLE);
        new MakeOverlayTask().execute(keyword);
        editText.setText("");

        InputMethodManager imm = (InputMethodManager) getSystemService(
                Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
    }
}
 
源代码4 项目: imsdk-android   文件: DefaultMessageProcessor.java
@Override
public void processErrorSendingView(ProgressBar progressBar, ImageView errImgView, IMessageItem item) {
    if(progressBar!=null && errImgView !=null){

        if(MessageStatus.isExistStatus (item.getMessage().getMessageState(),MessageStatus.LOCAL_STATUS_SUCCESS )){
            progressBar.setVisibility(View.GONE);
            errImgView.setVisibility(View.GONE);
        }else if(MessageStatus.isExistStatus (item.getMessage().getMessageState(),MessageStatus.LOCAL_STATUS_PROCESSION )){
            progressBar.setVisibility(View.VISIBLE);
            errImgView.setVisibility(View.GONE);
        }else {
            progressBar.setVisibility(View.GONE);
            errImgView.setVisibility(View.VISIBLE);
        }

    }
}
 
源代码5 项目: Mobike   文件: PRTHeader.java
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);
}
 
源代码6 项目: AnotherRSS   文件: VideocastActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_videoweb);
    VideoView videoView = (VideoView) findViewById(R.id.videoView);
    WebView webView = (WebView) findViewById(R.id.webView);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    Intent intent = getIntent();
    Uri uri = intent.getData();
    if (uri != null) {
        String url = uri.toString();
        if (url.endsWith(".mp4")) {
            webView.setVisibility(View.GONE);
            progressBar.setVisibility(View.GONE);
            videoView.setVisibility(View.VISIBLE);
            videoView.setMediaController(AnotherRSS.mediaController);
            videoView.setVideoURI(uri);
            videoView.requestFocus();
            videoView.start();
        } else {
            webView.setVisibility(View.VISIBLE);
            progressBar.setVisibility(View.VISIBLE);
            videoView.setVisibility(View.GONE);
            webView.setWebViewClient(new MyWebClient());
            webView.getSettings().setJavaScriptEnabled(true);
            webView.getSettings().setLoadWithOverviewMode(true);
            webView.getSettings().setUseWideViewPort(true);
            webView.loadUrl(url);
        }
    }
}
 
源代码7 项目: fingerpoetry-android   文件: PRTHeader.java
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);
}
 
源代码8 项目: XPrivacy   文件: ActivityMain.java
@Override
@SuppressWarnings("unchecked")
protected void publishResults(CharSequence constraint, FilterResults results) {
	if (results != null) {
		clear();
		TextView tvStats = (TextView) findViewById(R.id.tvStats);
		TextView tvState = (TextView) findViewById(R.id.tvState);
		ProgressBar pbFilter = (ProgressBar) findViewById(R.id.pbFilter);
		pbFilter.setVisibility(ProgressBar.GONE);
		tvStats.setVisibility(TextView.VISIBLE);

		runOnUiThread(new Runnable() {
			@Override
			public void run() {
				setProgress(getString(R.string.title_restrict), 0, 1);
			}
		});

		// Adjust progress state width
		RelativeLayout.LayoutParams tvStateLayout = (RelativeLayout.LayoutParams) tvState.getLayoutParams();
		tvStateLayout.addRule(RelativeLayout.LEFT_OF, R.id.tvStats);

		if (results.values == null)
			notifyDataSetInvalidated();
		else {
			addAll((ArrayList<ApplicationInfoEx>) results.values);
			notifyDataSetChanged();
		}
		AppListAdapter.this.showStats();
	}
}
 
源代码9 项目: your-local-weather   文件: MainActivity.java
private void setUpdateButtonState(boolean isUpdate) {
    if (mToolbarMenu != null) {
        MenuItem updateItem = mToolbarMenu.findItem(R.id.main_menu_refresh);
        ProgressBar progressUpdate = (ProgressBar) findViewById(R.id.toolbar_progress_bar);
        if (isUpdate) {
            updateItem.setVisible(false);
            progressUpdate.setVisibility(View.VISIBLE);
        } else {
            progressUpdate.setVisibility(View.GONE);
            updateItem.setVisible(true);
        }
    }
}
 
源代码10 项目: YiZhi   文件: PRTHeader.java
public PRTHeader(Context context) {
	super(context);
	int[] size = ResHelper.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 = ResHelper.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 = ResHelper.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);
}
 
源代码11 项目: Plumble   文件: PublicServerListFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_public_server_list, container, false);
    mServerGrid = (GridView) view.findViewById(R.id.server_list_grid);
    mServerGrid.setOnItemClickListener(this);
    if(mServerAdapter != null)
        mServerGrid.setAdapter(mServerAdapter);
    mServerProgress = (ProgressBar) view.findViewById(R.id.serverProgress);
    mServerProgress.setVisibility(mServerAdapter == null ? View.VISIBLE : View.GONE);
    return view;
}
 
源代码12 项目: RePlugin-GameSdk   文件: FunRegistActivity.java
@Override
protected void onPreExecute() {
	super.onPreExecute();
	registProgressBar = new ProgressBar(FunRegistActivity.this, null,
			android.R.attr.progressBarStyle);
	registProgressBar.setVisibility(View.VISIBLE);

	LayoutParams progressBarParams = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	progressBarParams.addRule(RelativeLayout.CENTER_IN_PARENT);
	registRelativeLayout.addView(registProgressBar, progressBarParams);
}
 
源代码13 项目: Mizuu   文件: ActorBrowserTvFragment.java
public void onViewCreated(View v, Bundle savedInstanceState) {
	super.onViewCreated(v, savedInstanceState);

	mProgressBar = (ProgressBar) v.findViewById(R.id.progress);
	if (mActors.size() > 0)
		mProgressBar.setVisibility(View.GONE); // Hack to remove the ProgressBar on orientation change

	mAdapter = new ImageAdapter(getActivity());

	mGridView = (GridView) v.findViewById(R.id.gridView);
	mGridView.setAdapter(mAdapter);

	// Calculate the total column width to set item heights by factor 1.5
	mGridView.getViewTreeObserver().addOnGlobalLayoutListener(
			new ViewTreeObserver.OnGlobalLayoutListener() {
				@Override
				public void onGlobalLayout() {
					final int numColumns = (int) Math.floor(
							mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing));
					if (numColumns > 0) {
						mGridView.setNumColumns(numColumns);
					}
				}
			});
	mGridView.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
               ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), arg1.findViewById(R.id.cover), "cover");
               ActivityCompat.startActivity(getActivity(), IntentUtils.getActorIntent(getActivity(), mActors.get(arg2)), options.toBundle());
		}
	});
	
	TextView title = (TextView) v.findViewById(R.id.empty_library_title);
	title.setText(R.string.no_actors);
	
	TextView description = (TextView) v.findViewById(R.id.empty_library_description);
	description.setText(R.string.no_actors_description);
	
	mGridView.setEmptyView(v.findViewById(R.id.empty_library_layout));
}
 
源代码14 项目: Aurora   文件: CacheFragment.java
private void showDownload(int position) {
    VideoDownLoadInfo item = data.get(position);
    item.setDownLoading(true);
    adapter.setDownPosition(position);
    ProgressBar seekBar = (ProgressBar) adapter.getViewByPosition(position, R.id.sb_progress);
    TextView size = (TextView) adapter.getViewByPosition(position, R.id.tv_pause);
    size.setText(StringUtils.getPrintSize(item.getCurrentBytes() == null ? 0 : item.getCurrentBytes(), false) + "/" + StringUtils.getPrintSize(item.getContentLength() == null ? 0 : item.getContentLength(), true));
    seekBar.setVisibility(View.VISIBLE);
    seekBar.setIndeterminate(false);
    seekBar.setProgress(data.get(position).getPercent());
}
 
源代码15 项目: LQRWeChat   文件: PRTHeader.java
public PRTHeader(Context context) {
	super(context);
	int[] size = ResHelper.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 = ResHelper.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 = ResHelper.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);
}
 
源代码16 项目: Ouroboros   文件: CatalogNetworkFragment.java
@Override
protected void onPostExecute(Void aVoid) {
    catalogAdapter.changeCursor(infiniteDbHelper.getCatalogCursor(SettingsHelper.getSortByMethod(getContext())));
    swipeRefreshLayout = (SwipeRefreshLayout) activity.findViewById(R.id.catalog_swipe_container);
    ProgressBar progressBar = (ProgressBar) activity.findViewById(R.id.progress_bar);
    if(swipeRefreshLayout != null) {
        swipeRefreshLayout.setRefreshing(false);
    }
    if (progressBar != null){
        progressBar.setVisibility(View.INVISIBLE);
    }
}
 
源代码17 项目: Social   文件: PRTHeader.java
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);
}
 
源代码18 项目: XPrivacy   文件: ActivityMain.java
private void applyFilter() {
	if (mAppAdapter != null) {
		ProgressBar pbFilter = (ProgressBar) findViewById(R.id.pbFilter);
		TextView tvStats = (TextView) findViewById(R.id.tvStats);
		TextView tvState = (TextView) findViewById(R.id.tvState);

		// Get settings
		int userId = Util.getUserId(Process.myUid());
		boolean fUsed = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUsed, false);
		boolean fInternet = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFInternet, false);
		boolean fRestriction = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestriction, false);
		boolean fRestrictionNot = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestrictionNot,
				false);
		boolean fPermission = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFPermission, true);
		boolean fOnDemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemand, false);
		boolean fOnDemandNot = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemandNot, false);
		boolean fUser = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUser, true);
		boolean fSystem = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFSystem, false);

		String filter = String.format("%s\n%b\n%b\n%b\n%b\n%b\n%b\n%b\n%b\n%b", searchQuery, fUsed, fInternet,
				fRestriction, fRestrictionNot, fPermission, fOnDemand, fOnDemandNot, fUser, fSystem);
		pbFilter.setVisibility(ProgressBar.VISIBLE);
		tvStats.setVisibility(TextView.GONE);

		// Adjust progress state width
		RelativeLayout.LayoutParams tvStateLayout = (RelativeLayout.LayoutParams) tvState.getLayoutParams();
		tvStateLayout.addRule(RelativeLayout.LEFT_OF, R.id.pbFilter);

		mAppAdapter.getFilter().filter(filter);
	}
}
 
源代码19 项目: glimmr   文件: AddToGroupDialogFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    mLayout = (LinearLayout) inflater.inflate(
            R.layout.add_to_group_fragment, container, false);

    mTitleView = (TextView) mLayout.findViewById(R.id.titleText);
    mTextUtils.setFont(mTitleView, TextUtils.FONT_ROBOTOBOLD);
    mProgressBar =
        (ProgressBar) mLayout.findViewById(R.id.progressIndicator);
    mProgressBar.setVisibility(View.VISIBLE);

    /* Nested fragments have to be added this way, not from xml */
    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    final boolean retainInstance = false;
    final PhotoStreamGridFragment frag =
        PhotoStreamGridFragment.newInstance(mOAuth.getUser(),
                retainInstance, ListView.CHOICE_MODE_MULTIPLE);
    ft.replace(R.id.photoStreamFragment, frag);
    ft.commit();

    /* When add button is clicked, get selected ids and add to queue */
    mLayout.findViewById(R.id.buttonAddToGroup).setOnClickListener(
            new View.OnClickListener() {
                public void onClick(View v) {
                    List<Photo> selectedPhotos = frag.getSelectedPhotos();
                    if (mRemaining < 0 || selectedPhotos.size() == 0) {
                        Log.e(TAG, "None or too many items selected");
                        return;
                    }
                    for (Photo photo : selectedPhotos) {
                        mQueue.add(new AddItemToGroupTask(mGroup.getId(),
                                photo.getId(), mOAuth));
                    }
                    mActivity.startService(new Intent(mActivity,
                                AddToGroupTaskQueueService.class));
                    dismiss();
                    Crouton.makeText(mActivity,
                        R.string.photos_will_be_added,
                        Style.CONFIRM).show();
                }
            });

    return mLayout;
}
 
源代码20 项目: NITKart   文件: IndividualProductSeller.java
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_individual_product_seller);

        progressBar = (ProgressBar) findViewById(R.id.individualProductPageProgressBarSeller);
        progressBar.setVisibility(View.VISIBLE);

        item = (ShoppingItem) getIntent().getSerializableExtra("product");
        quantity = item.getQuantity();

        removeProduct = (Button) findViewById(R.id.deleteProductSeller);

        myRef = database.getReference("sellers/" +
                FirebaseAuth.getInstance().getCurrentUser().getUid());

        removeProduct.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                myRef.addListenerForSingleValueEvent(new ValueEventListener() {
                    ArrayList<ShoppingItem> productList = new ArrayList<>();

                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        // for getting the list of products. shuold probably make this a new class tbh.
                        for (DataSnapshot snap : dataSnapshot.child("products").getChildren()) {
                            int itemPrice = -1;
                            try {
                                itemPrice = Integer.valueOf(NumberFormat.getCurrencyInstance()
                                        .parse(String.valueOf(snap.child("price").getValue()))
                                        .toString());
                            } catch (ParseException e) {
                                e.printStackTrace();
                            }

                            String productID = snap.child("productID").getValue().toString();

                            productList.add(new ShoppingItem(
                                    productID,
                                    snap.child("title").getValue().toString(),
                                    snap.child("type").getValue().toString(),
                                    snap.child("description").getValue().toString(),
                                    itemPrice,
                                    Integer.valueOf(snap.child("quantity").getValue().toString())
                            ));
                        }
                        for (ShoppingItem x : productList){
                            if(x.getProductID().equals(item.getProductID())){
                                productList.remove(x);
                                break;
                            }
                        }
                        if(productList.size() == 0){
                            myRef.child("isProdsEmpty").setValue(Boolean.TRUE.toString());
                            productList.add(new ShoppingItem("", "", "", "", -1, -1));
                        }

                        Map<String, Object> seller_products = new HashMap<>();
                        seller_products.put("products", productList);
                        myRef.updateChildren(seller_products);
                        Toast.makeText(getApplicationContext(), "Removed!", Toast.LENGTH_SHORT).show();
                        finish();
                    }

                    @Override
                    public void onCancelled(DatabaseError databaseError) {

                    }
                });
            }
        });

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarSeller);
        toolbar.setTitle("");
//        setSupportActionBar(toolbar);

        ip = getResources().getString(R.string.ip);

        name = (TextView) findViewById(R.id.productNameIndividualProductSeller);
        name.setText(item.getTitle());

        description = (TextView) findViewById(R.id.productDescriptionIndividualProductSeller);
        description.setText(item.getDescription());

        quantityView = (TextView) findViewById(R.id.quantityIndividualProductSeller);
        quantityView.setText(String.valueOf(quantity));

        ((TextView) findViewById(R.id.productPriceIndividualProductSeller))
                .setText(item.getPrice());

        productImage = (ImageView) findViewById(R.id.productImageIndividualProductSeller);
        Picasso.with(getApplicationContext())
                .load(ip + String.valueOf(item.getProductID()) + ".jpg")
                .fit()
                .into(productImage);

        progressBar.setVisibility(View.GONE);
    }