Example usage for android.view View GONE

List of usage examples for android.view View GONE

Introduction

In this page you can find the example usage for android.view View GONE.

Prototype

int GONE

To view the source code for android.view View GONE.

Click Source Link

Document

This view is invisible, and it doesn't take any space for layout purposes.

Usage

From source file:net.naonedbus.fragment.CustomInfiniteListFragement.java

@Override
public void onLoadFinished(final Loader<AsyncResult<ListAdapter>> loader,
        final AsyncResult<ListAdapter> result) {

    if (result == null) {
        showMessage(mMessageEmptyTitleId, mMessageEmptySummaryId, mMessageEmptyDrawableId);
        return;//w w  w . ja  va 2 s. c o  m
    }

    final Exception exception = result.getException();

    if (exception == null) {
        if (result.getResult() == null || result.getResult().getCount() == 0) {
            showMessage(mMessageEmptyTitleId, mMessageEmptySummaryId, mMessageEmptyDrawableId);
        } else {
            if (getListAdapter() == null) {
                setListAdapter(result.getResult());
                showContent();
            }
            resetNextUpdate();
        }
    } else {
        Log.e(getClass().getSimpleName(), "Erreur de chargement.", exception);

        int titleRes = R.string.error_title;
        int messageRes = R.string.error_summary;
        int drawableRes = R.drawable.warning;

        // Erreur rseau ou interne ?
        if (exception instanceof IOException) {
            titleRes = R.string.error_title_network;
            messageRes = R.string.error_summary_network;
            drawableRes = R.drawable.ic_thunderstorm;
        } else if (exception instanceof JSONException) {
            titleRes = R.string.error_title_webservice;
            messageRes = R.string.error_summary_webservice;
        }

        if (getListAdapter() == null || getListAdapter().isEmpty()) {
            showMessage(titleRes, messageRes, drawableRes);
        } else {
            if (mLastCrouton != null) {
                mLastCrouton.cancel();
            }
            mLastCrouton = Crouton.makeText(getActivity(), titleRes, Style.ALERT, (ViewGroup) getView());
            mLastCrouton.show();
        }

        mHasError = true;
        mLoaderView.setVisibility(View.GONE);
    }

    onPostExecute();
}

From source file:fm.smart.r1.activity.CreateItemActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ExceptionHandler.register(this);
    setContentView(R.layout.create_item);
    final Intent queryIntent = getIntent();
    Bundle extras = queryIntent.getExtras();
    list_id = (String) extras.get("list_id");
    cue = (String) extras.get("cue");
    response = (String) extras.get("response");
    cue_language = (String) extras.get("cue_language");
    response_language = (String) extras.get("response_language");
    character_cue = (String) extras.get("character_cue");
    character_response = (String) extras.get("character_response");
    pos = (String) extras.get("pos");

    Button button = (Button) findViewById(R.id.create_item_submit);
    button.setOnClickListener(this);

    TextView cue_text = (TextView) findViewById(R.id.cue);
    if (!TextUtils.isEmpty(cue)) {
        cue_text.setText(cue);/*from w w w.ja va 2  s .co m*/
    }
    TextView response_text = (TextView) findViewById(R.id.response);
    if (!TextUtils.isEmpty(response)) {
        response_text.setText(response);
    }
    TextView cue_character_text = (TextView) findViewById(R.id.cue_character);
    if (!TextUtils.isEmpty(character_cue)) {
        cue_character_text.setText(character_cue);
    }
    TextView response_character_text = (TextView) findViewById(R.id.response_character);
    if (!TextUtils.isEmpty(character_response)) {
        response_character_text.setText(character_response);
    }

    TextView cue_legend = (TextView) findViewById(R.id.create_item_cue_legend);
    cue_legend.setText(Utils.INV_LANGUAGE_MAP.get(cue_language) + " Term");
    TextView response_legend = (TextView) findViewById(R.id.create_item_response_legend);
    response_legend.setText(Utils.INV_LANGUAGE_MAP.get(response_language) + " Term");
    TextView cue_character_textView = (TextView) findViewById(R.id.create_item_cue_character);
    cue_character_textView.setText(Utils.INV_LANGUAGE_MAP.get(cue_language) + " Character Text");
    TextView response_character_textView = (TextView) findViewById(R.id.create_item_response_character);
    response_character_textView.setText(Utils.INV_LANGUAGE_MAP.get(response_language) + " Character Text");

    List<String> pos_list = new Vector<String>(Utils.POS_MAP.keySet());
    Collections.sort(pos_list);

    ArrayAdapter<String> pos_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            pos_list);
    // .simple_spinner_item
    Spinner pos_textView = (Spinner) findViewById(R.id.pos);
    pos_textView.setAdapter(pos_adapter);
    if (!TextUtils.isEmpty(pos)) {
        pos_textView.setSelection(pos_list.indexOf(pos));
    } else {
        pos_textView.setSelection(pos_list.indexOf("Noun"));
    }

    EditText cue_character_input_textView = (EditText) findViewById(R.id.cue_character);
    if (!Utils.isIdeographicLanguage(Main.search_lang)) {
        cue_character_textView.setVisibility(View.GONE);
        cue_character_input_textView.setVisibility(View.GONE);
    } else if (!TextUtils.isEmpty(character_cue)) {
        cue_character_input_textView.setText(character_cue);
    }

    EditText response_character_input_textView = (EditText) findViewById(R.id.response_character);
    if (!Utils.isIdeographicLanguage(Main.result_lang)) {
        response_character_textView.setVisibility(View.GONE);
        response_character_input_textView.setVisibility(View.GONE);
    } else if (!TextUtils.isEmpty(character_response)) {
        response_character_input_textView.setText(character_response);
    }

}

From source file:it.gulch.linuxday.android.activities.TrackScheduleEventActivity.java

private void setCustomProgressVisibility(boolean isVisible) {
    progress.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}

From source file:fr.bmartel.android.iotf.app.NotificationActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notifications);
    initNv();//from   w ww  .  j av  a 2  s  . c  o  m

    String filterList = sharedpreferences.getString(StorageConst.STORAGE_FILTER_LIST, "[]");

    try {
        JSONArray filterListObj = new JSONArray(filterList);
        for (int i = 0; i < filterListObj.length(); i++) {

            JSONObject item = (JSONObject) filterListObj.get(i);

            if (item.has(StorageConst.STORAGE_NOTIFICATION_BODY)
                    && item.has(StorageConst.STORAGE_NOTIFICATION_MESSAGE)) {
                messageBodyFilterList
                        .add(new NotificationFilter(item.getString(StorageConst.STORAGE_NOTIFICATION_BODY),
                                item.getString(StorageConst.STORAGE_NOTIFICATION_MESSAGE)));
            }
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    fragmentManager = getSupportFragmentManager();

    final TextView noNotificationTv = (TextView) findViewById(R.id.no_notification_tv);

    IotSingleton.getInstance(this).setInternalCb(new IMessageCallback() {
        @Override
        public void connectionLost(Throwable cause) {

            if (!IotSingleton.getInstance(NotificationActivity.this).isAutoReconnect()) {
                Toast.makeText(NotificationActivity.this, "disconnected from server", Toast.LENGTH_SHORT)
                        .show();
                finish();
            }
        }

        @Override
        public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {

            final IncomingMessage message = new IncomingMessage(new Date(),
                    topic.substring(topic.indexOf("id/") + 6, topic.indexOf("/evt")),
                    new String(mqttMessage.getPayload()));

            if (init) {
                init = false;
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        noNotificationTv.setVisibility(View.GONE);
                        notificationListview.setVisibility(View.VISIBLE);
                        initListview();
                    }
                });

            }

            notificationItems.add(0, message);

            runOnUiThread(new Runnable() {
                @Override
                public void run() {

                    notificationAdapter.notifyDataSetChanged();

                    for (int i = 0; i < messageBodyFilterList.size(); i++) {
                        if (message.getMessage().contains(messageBodyFilterList.get(i).getFilter())) {
                            Log.i(TAG, "launch phone notification : filter found in message body");
                            triggerNotification(messageBodyFilterList.get(i).getNotificationMessage());
                            return;
                        }
                    }
                }
            });
        }

        @Override
        public void deliveryComplete(IMqttDeliveryToken messageToken) {

        }

        @Override
        public void onConnectionSuccess(IMqttToken token) {

        }

        @Override
        public void onConnectionFailure(IMqttToken token, Throwable cause) {

        }

        @Override
        public void onDisconnectionSuccess(IMqttToken token) {
            Toast.makeText(NotificationActivity.this, "disconnected from server", Toast.LENGTH_SHORT).show();
            finish();
        }

        @Override
        public void onDisconnectionFailure(IMqttToken token, Throwable cause) {

        }
    });

    notificationListview = (ListView) findViewById(R.id.notification_list);

}

From source file:com.gokuai.yunkuandroidsdk.compat.v2.UrlTouchImageView.java

@SuppressWarnings("deprecation")
protected void init() {

    mImageView = new TouchImageView(mContext);

    LayoutParams params = new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.FILL_PARENT);
    mImageView.setLayoutParams(params);/*  w  w  w.java 2 s .  co m*/
    this.addView(mImageView);

    mImageView.setVisibility(GONE);

    mProgressBar = new ProgressBar(mContext, null, android.R.attr.progressBarStyleInverse);
    params = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    mProgressBar.setLayoutParams(params);
    mProgressBar.setIndeterminate(false);
    this.addView(mProgressBar);

    mTextView = new TextView(mContext);
    params = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    mTextView.setLayoutParams(params);
    int left = getResources().getDimensionPixelSize(R.dimen.gallery_percent_tv_padding_left);
    int top = getResources().getDimensionPixelSize(R.dimen.gallery_percent_tv_padding_top);
    int right = getResources().getDimensionPixelSize(R.dimen.gallery_percent_tv_padding_right);
    int bottom = getResources().getDimensionPixelSize(R.dimen.gallery_percent_tv_padding_bottom);
    mTextView.setPadding(left, top, right, bottom);
    mTextView.setGravity(Gravity.CENTER);
    mTextView.setTextColor(Color.WHITE);
    mTextView.setText(R.string.tip_is_preparing_for_data);
    mTextView.setVisibility(View.GONE);
    this.addView(mTextView);

    mButton = new Button(mContext);
    params = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
            android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.CENTER_IN_PARENT);
    mButton.setLayoutParams(params);
    mButton.setGravity(Gravity.CENTER);
    mButton.setText(R.string.tip_image_button);
    mButton.setTextColor(Color.WHITE);
    mButton.setBackgroundResource(R.drawable.btn_check_image);
    mButton.setVisibility(View.GONE);
    this.addView(mButton);

    mButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            mImageUrlTask = new AsyncTask<Void, Integer, Bitmap>() {

                @Override
                protected Bitmap doInBackground(Void... voids) {
                    if (mFileData != null) {
                        FileData fileData = FileDataManager.getInstance()
                                .getFileInfoSync(mFileData.getFullpath());

                        return getOriImage(fileData, new ParamsCallBack() {
                            @Override
                            public void callBack(Object obj) {
                                publishProgress((int) obj);
                            }
                        });

                    } else {
                        return null;
                    }

                }

                @Override
                protected void onProgressUpdate(Integer... values) {
                    super.onProgressUpdate(values);
                    mButton.setVisibility(GONE);
                    mTextView.setVisibility(VISIBLE);
                    mProgressBar.setVisibility(VISIBLE);
                    if (values[0] == -1) {
                        mTextView.setText(mContext.getString(R.string.tip_is_loading));
                    } else {
                        mTextView.setText(values[0] + " %");
                    }
                }

                @Override
                protected void onPostExecute(Bitmap bitmap) {
                    super.onPostExecute(bitmap);

                    if (mImageView != null && mProgressBar != null) {
                        if (bitmap != null) {
                            mButton.setVisibility(GONE);
                            mImageView.setScaleType(ScaleType.MATRIX);
                            mImageView.setImageBitmap(bitmap);

                            mTextView.setVisibility(View.GONE);
                            mImageView.setVisibility(VISIBLE);
                            mProgressBar.setVisibility(GONE);

                        } else {
                            mButton.setVisibility(GONE);
                            mTextView.setVisibility(VISIBLE);
                            mTextView.setText(R.string.tip_open_image_failed);
                            mProgressBar.setVisibility(View.VISIBLE);
                        }
                    }

                }
            }.execute();
        }
    });

}

From source file:com.pursuer.reader.easyrss.WebpageItemViewCtrl.java

@SuppressLint("SetJavaScriptEnabled")
public WebpageItemViewCtrl(final DataMgr dataMgr, final Context context, final String uid,
        final boolean isMobilized) {
    super(dataMgr, R.layout.webpage_item, context);

    this.item = dataMgr.getItemByUid(uid, ITEM_PROJECTION);
    this.theme = new SettingTheme(dataMgr).getData();
    this.fontSize = new SettingFontSize(dataMgr).getData();
    // Disable hardware acceleration on Android 3.0-4.1 devices.
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1
            && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }/*from w  ww .j a v  a  2s  .  c om*/

    {
        mobilizedView = (WebView) view.findViewById(R.id.MobilizedContent);
        mobilizedView.setBackgroundColor(context.getResources().getColor(
                theme == SettingTheme.THEME_NORMAL ? R.color.NormalBackground : R.color.DarkBackground));
        mobilizedView.setFocusable(false);
        final WebSettings settings = mobilizedView.getSettings();
        settings.setDefaultTextEncodingName(HTTP.UTF_8);
        settings.setJavaScriptEnabled(false);
        settings.setDefaultFontSize(fontSize);
    }
    {
        originalView = (WebView) view.findViewById(R.id.OriginalContent);
        originalView.setFocusable(false);
        originalView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        final WebSettings settings = originalView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        originalView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(final WebView webView, final String url) {
                view.findViewById(R.id.OriginalProgress).setVisibility(View.GONE);
            }

            @Override
            public void onPageStarted(final WebView webView, final String url, final Bitmap favicon) {
                if (!showMobilized) {
                    view.findViewById(R.id.OriginalProgress).setVisibility(View.VISIBLE);
                }
            }

            @Override
            public boolean shouldOverrideUrlLoading(final WebView webView, final String url) {
                webView.loadUrl(url);
                return false;
            }
        });
    }

    if (isMobilized) {
        showMobilizedPage();
    } else {
        showOriginalPage();
    }

    view.findViewById(R.id.BtnMobilzedPage).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            showMobilizedPage();
        }
    });
    view.findViewById(R.id.BtnOriginalPage).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            showOriginalPage();
        }
    });
    view.findViewById(R.id.BtnClose).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            if (listener != null) {
                listener.onBackNeeded();
            }
        }
    });
}

From source file:com.app.jdy.ui.CallBackPasswordActivity.java

/**
 * //from   w  w w .  java  2  s  .c om
 * @author Owater
 * @createtime 2015-1-13 ?6:04:53
 * @Decription ??
 * 
 */
public void initView() {
    mBackImg = (ImageView) findViewById(R.id.back_img);
    mBackImg.setVisibility(View.VISIBLE);
    title = (TextView) findViewById(R.id.title_tv);
    title.setText("?");
    back_password_username = (EditText) findViewById(R.id.back_password_username);
    get_back_password_code = (Button) findViewById(R.id.get_back_password_code);
    back_password_code = (EditText) findViewById(R.id.back_password_code);
    set_back_password_code = (Button) findViewById(R.id.set_back_password_code);
    get_code_linearlayout = (LinearLayout) findViewById(R.id.get_code_linearlayout);
    set_code_linearlayout = (LinearLayout) findViewById(R.id.set_code_linearlayout);
    find_password_ok_linearlayout = (LinearLayout) findViewById(R.id.find_password_ok_linearlayout);
    back_new_password = (EditText) findViewById(R.id.back_new_password);
    back_new_repassword = (EditText) findViewById(R.id.back_new_repassword);
    find_password_ok = (Button) findViewById(R.id.find_password_ok);
    back_login = (TextView) findViewById(R.id.back_login);
    pd = new ProgressDialog(this);
    handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case 0:
                Toast.makeText(CallBackPasswordActivity.this, Constants.NO_INTENT_TIPS, Toast.LENGTH_LONG)
                        .show();
                break;
            case 1:
                Toast.makeText(CallBackPasswordActivity.this, "????,?",
                        Toast.LENGTH_LONG).show();
                get_code_linearlayout.setVisibility(View.GONE);
                set_code_linearlayout.setVisibility(View.VISIBLE);
                break;
            case 2:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_SHORT).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            case 3:
                set_code_linearlayout.setVisibility(View.GONE);
                find_password_ok_linearlayout.setVisibility(View.VISIBLE);
                break;
            case 4:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_LONG).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            case 5:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_LONG).show();
                } catch (JSONException e1) {
                    e1.printStackTrace();
                }
                startActivity(new Intent(CallBackPasswordActivity.this, LoginActivity.class));
                finish();
                break;
            case 6:
                try {
                    Toast.makeText(CallBackPasswordActivity.this, jsonObject.getString("msg").toString(),
                            Toast.LENGTH_LONG).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                break;
            default:
                break;
            }
        }
    };
}

From source file:com.starwood.anglerslong.LicenseActivity.java

/******************************************************************************
 * Reads in all of the items in that should be populated.
 ******************************************************************************/
private void populateTabs(boolean isRestart) {
    try {/*from www .  j av a2  s  . c o  m*/
        JsonStorage jsonStorage = new JsonStorage(getApplicationContext());
        String wholeString = jsonStorage.loadTabs();
        if (!wholeString.equals(""))
            isLicensePopulated = true;
        populateLicense(wholeString, isRestart);
        if (numItems == 0) {
            isCreateTextViewSet = false;
            createTextView();
        } else {
            try {
                TextView tv = (TextView) findViewById(0);
                if (tv.getVisibility() == View.VISIBLE || numItems > 0) {
                    tv.setVisibility(View.GONE);
                    isCreateTextViewSet = false;
                }
            } catch (NullPointerException e) {
                Log.d("KENNY", "The text view was null.");
            }
        }

    } catch (IOException | JSONException e) {
        if (!isLicensePopulated)
            isArrayEmpty = true;
        createTextView();
        e.printStackTrace();
    }
}

From source file:fr.shywim.antoinedaniel.utils.Utils.java

/**
 * Second part of the click animation.//from  w  w  w  .j av a  2  s.  c om
 *
 * @param v View who will have the effect.
 * @param isRoot Whether the passed view is the ViewGroup parent.
 */
public static void clickAnimUp(View v, boolean isRoot) {
    RelativeLayout root;
    if (isRoot)
        root = (RelativeLayout) v;
    else
        root = (RelativeLayout) v.getParent();
    final View rectView = root.findViewById(R.id.rect_view_id);
    if (rectView != null) {
        AlphaAnimation rectAnim = new AlphaAnimation(0.4f, 0f);
        rectAnim.setFillAfter(true);
        rectAnim.setInterpolator(new DecelerateInterpolator());
        rectAnim.setDuration(150);
        rectAnim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                new Handler().post(new Runnable() {
                    @Override
                    public void run() {
                        ViewGroup parent = (ViewGroup) rectView.getParent();
                        rectView.setVisibility(View.GONE);
                        if (parent != null)
                            parent.removeView(rectView);
                    }
                });
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
        rectView.clearAnimation();
        rectView.startAnimation(rectAnim);
    }
}

From source file:com.lillicoder.newsblurry.feeds.FeedsListFragment.java

/**
 * Convenience method that shows the feeds list.
 *///from  w  w w . j a  v a 2 s . com
private void showFeedsList() {
    this._labeledProgresssBar.setVisibility(View.GONE);

    this._feedsList.setVisibility(View.VISIBLE);
}