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:com.chess.genesis.activity.GameListOnlineFrag.java

@Override
public boolean handleMessage(final Message msg) {
    switch (msg.what) {
    case DeleteArchiveDialog.MSG:
    case ReadAllMsgsDialog.MSG:
        updateGameList();/* w w w  . j  a  v  a2s .c  om*/
        break;
    case NewOnlineGameDialog.MSG:
        Bundle data = (Bundle) msg.obj;

        if (data.getInt("opponent") == Enums.INVITE) {
            new InviteOptionsDialog(act, handle, data).show();
            return true;
        }
        progress.setText("Sending Newgame Request");
        String gametype = Enums.GameType(data.getInt("gametype"));

        net.join_game(gametype);
        new Thread(net).start();
        break;
    case RematchConfirm.MSG:
        data = (Bundle) msg.obj;
        progress.setText("Sending Newgame Request");

        final String opponent = data.getString("opp_name");
        String color = Enums.ColorType(data.getInt("color"));
        gametype = Enums.GameType(data.getInt("gametype"));

        net.new_game(opponent, gametype, color);
        new Thread(net).start();
        break;
    case NudgeConfirm.MSG:
        progress.setText("Sending Nudge");

        final String gameid = (String) msg.obj;
        net.nudge_game(gameid);
        new Thread(net).start();
        break;
    case InviteOptionsDialog.MSG:
        data = (Bundle) msg.obj;
        progress.setText("Sending Newgame Request");

        gametype = Enums.GameType(data.getInt("gametype"));
        color = Enums.ColorType(data.getInt("color"));

        net.new_game(data.getString("opp_name"), gametype, color);
        new Thread(net).start();
        break;
    case SyncClient.MSG:
    case NetworkClient.JOIN_GAME:
        JSONObject json = (JSONObject) msg.obj;
        try {
            if (json.getString("result").equals("error")) {
                progress.remove();
                Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show();
                return true;
            }
            if (msg.what == SyncClient.MSG || msg.what == NetworkClient.JOIN_GAME) {
                progress.setText("Checking Game Pool");
                updateGameList();
                GenesisNotifier.clearNotification(act,
                        GenesisNotifier.YOURTURN_NOTE | GenesisNotifier.NEWMGS_NOTE);
                net.pool_info();
                new Thread(net).start();
            } else {
                progress.remove();
            }
        } catch (final JSONException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        break;
    case NetworkClient.POOL_INFO:
        json = (JSONObject) msg.obj;
        try {
            if (json.getString("result").equals("error")) {
                progress.remove();
                Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show();
                return true;
            }
            final JSONArray games = json.getJSONArray("games");
            final PrefEdit pref = new PrefEdit(act);
            pref.putString(R.array.pf_poolinfo, games.toString());
            pref.commit();

            act.findViewById(R.id.game_search).setVisibility((games.length() == 0) ? View.GONE : View.VISIBLE);

            progress.remove();
        } catch (final JSONException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        break;
    case NetworkClient.NEW_GAME:
    case NetworkClient.NUDGE_GAME:
        json = (JSONObject) msg.obj;
        try {
            if (json.getString("result").equals("error")) {
                progress.remove();
                Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show();
                return true;
            }
            progress.setText("Updating Game List");
            final SyncClient sync = new SyncClient(act, handle);
            new Thread(sync).start();
        } catch (final JSONException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        break;
    }
    return true;
}

From source file:fr.bmartel.android.dotti.DottiActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dotti);

    // Use this check to determine whether BLE is supported on the device. Then
    // you can selectively disable BLE-related features.
    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
        Toast.makeText(this, "Bluetooth Smart is not supported on your device", Toast.LENGTH_SHORT).show();
        finish();/*from   www  .j a  v a2 s. c om*/
    }

    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    if (!mBluetoothAdapter.isEnabled()) {
        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
    }

    final ProgressBar progress_bar = (ProgressBar) findViewById(R.id.scanningProgress);

    if (progress_bar != null)
        progress_bar.setEnabled(false);

    final Button button_stop_scanning = (Button) findViewById(R.id.stop_scanning_button);

    if (button_stop_scanning != null)
        button_stop_scanning.setEnabled(false);

    final TextView scanText = (TextView) findViewById(R.id.scanText);

    if (scanText != null)
        scanText.setText("");

    registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());

    button_stop_scanning.setEnabled(false);

    final Button button_find_accessory = (Button) findViewById(R.id.scanning_button);

    button_stop_scanning.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            if (currentService != null && currentService.isScanning()) {

                currentService.stopScan();

                if (progress_bar != null) {
                    progress_bar.setEnabled(false);
                    progress_bar.setVisibility(View.GONE);
                }

                if (scanText != null)
                    scanText.setText("");

                if (button_stop_scanning != null)
                    button_stop_scanning.setEnabled(false);
            }
        }
    });

    button_find_accessory.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            triggerNewScan();
        }
    });

    if (mBluetoothAdapter.isEnabled()) {

        Intent intent = new Intent(this, DottiBtService.class);

        // bind the service to current activity and create it if it didnt exist before
        startService(intent);
        bound = bindService(intent, mServiceConnection, BIND_AUTO_CREATE);
    }
}

From source file:app.hacked.ProjectListFragment.java

private void getData() {
    if (null != progressBar)
        progressBar.setVisibility(View.VISIBLE);

    HackedIOProjects = new ArrayList<Project>();

    String url = "http://hackedioapp.networksaremadeofstring.co.uk/projects.php";

    JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null,
            new Response.Listener<JSONObject>() {

                @Override/* w  w w  .  ja v  a  2 s  .  c  o  m*/
                public void onResponse(JSONObject response) {
                    try {
                        if (response.has("success") && response.getBoolean("success")
                                && response.has("projects")) {
                            Log.e("response", response.toString());

                            JSONArray projects = response.getJSONArray("projects");
                            int size = projects.length();
                            for (int i = 0; i < size; i++) {
                                JSONObject projectJSON = projects.getJSONObject(i);

                                HackedIOProjects.add(new Project(projectJSON));
                            }

                            if (null != progressBar)
                                progressBar.setVisibility(View.GONE);

                            adapter = new ProjectListAdapter(getActivity(), HackedIOProjects);

                            setListAdapter(adapter);
                        } else {
                            Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT)
                                    .show();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT).show();
                    }

                }
            }, new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError error) {
                    // TODO Auto-generated method stub
                    Toast.makeText(getActivity(), "An Error Was encountered", Toast.LENGTH_SHORT).show();
                }
            });

    queue.add(jsObjRequest);
}

From source file:com.hybris.mobile.app.commerce.fragment.OrderDetailFragment.java

@Override
public void onResponse(Response<Order> response) {
    getView().findViewById(R.id.order_detail_fragment).setVisibility(View.VISIBLE);
    getView().findViewById(R.id.order_detail_not_found).setVisibility(View.GONE);
    populateOrder(response.getData());//from   w  w w.  j  ava  2s . co  m
}

From source file:com.csipsimple.wizards.impl.Sipgate.java

private void updateAccountInfos(final SipProfile acc) {
    if (acc != null && acc.id != SipProfile.INVALID_ID) {
        customWizard.setVisibility(View.GONE);
        accountBalanceHelper.launchRequest(acc);
    } else {/* ww  w  .  j  a  v  a  2  s . co  m*/
        // add a row to link 
        customWizard.setVisibility(View.GONE);

    }
}

From source file:com.sourcey.materiallogindemo.NotificationActivity.java

private void ConutNotification() {
    String url = getString(R.string.url) + "notification.php";
    notifications = master.GetCountNotification(user_id, url);
    if (notifications > 0) {
        badge.setVisibility(View.VISIBLE);
        badge.setText(String.valueOf(notifications));
    } else {/*  ww w. j ava 2 s  . c  o  m*/
        badge.setVisibility(View.GONE);
    }
}

From source file:ch.fixme.status.Widget.java

protected static void updateWidget(final Context ctxt, int widgetId, AppWidgetManager manager, Bitmap bitmap,
        String text) {//w  w w  .  j  a v  a  2  s  . c  om
    RemoteViews views = new RemoteViews(ctxt.getPackageName(), R.layout.widget);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctxt);
    Editor edit = prefs.edit();
    if (prefs.getBoolean(Prefs.KEY_WIDGET_TRANSPARENCY, Prefs.DEFAULT_WIDGET_TRANSPARENCY)) {
        views.setInt(R.id.widget_image, "setBackgroundResource", 0);
    } else {
        views.setInt(R.id.widget_image, "setBackgroundResource", android.R.drawable.btn_default_small);
    }
    if (bitmap != null) {
        views.setImageViewBitmap(R.id.widget_image, bitmap);
        edit.putBoolean(Main.PREF_FORCE_WIDGET + widgetId, false); // Don't
        // need
        // to
        // force
    } else {
        views.setImageViewResource(R.id.widget_image, android.R.drawable.ic_popup_sync);
        edit.putBoolean(Main.PREF_FORCE_WIDGET + widgetId, true); // Something
        // went
        // wrong
    }
    if (text != null) {
        views.setTextViewText(R.id.widget_status, text);
        views.setViewVisibility(R.id.widget_status, View.VISIBLE);
    } else {
        views.setViewVisibility(R.id.widget_status, View.GONE);
    }
    Intent clickIntent = new Intent(ctxt, Main.class);
    clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
    PendingIntent pendingIntent = PendingIntent.getActivity(ctxt, widgetId, clickIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);
    views.setOnClickPendingIntent(R.id.widget_image, pendingIntent);
    manager.updateAppWidget(widgetId, views);
    // Is initialized
    edit.putBoolean(Main.PREF_INIT_WIDGET + widgetId, true);
    edit.commit();
}

From source file:com.netatmo.weatherstation.sample.LoginActivity.java

private void netatmoLogin() {
    final String M = "netatmoLogin: ";
    Log.i(TAG, M);//from  w w w. j av a  2 s.c  om

    final SampleHttpClient httpClient = new SampleHttpClient(this);

    // NetatmoResponseHandler parses and handles the response.
    // You can also use JsonHttpResponseHandler and process the response as you wish.
    httpClient.login(mEmail, mPassword,
            new NetatmoResponseHandler(httpClient, NetatmoResponseHandler.REQUEST_LOGIN, null) {
                @Override
                public void onStart() {

                    Log.i(TAG, M + " onStart:");

                    super.onStart();

                    handler.post(new Runnable() {

                        @Override
                        public void run() {

                            setProgressBarIndeterminateVisibility(Boolean.TRUE);
                            mSignInButtonView.setVisibility(View.GONE);
                            mInProgress = true;
                        }
                    });

                }

                @Override
                public void onLoginResponse() {
                    Log.i(TAG, M + " onLoginResponse:");
                    setResult(RESULT_OK);
                    finish();
                }

                @Override
                public void onFailure(Throwable e, JSONObject errorResponse) {
                    Log.i(TAG, M + " onFailure:");

                    super.onFailure(e, errorResponse);

                    Log.i(TAG, M + " onFailure:");
                    handler.post(new Runnable() {

                        @Override
                        public void run() {

                            mEmailView.setError(getString(R.string.error_bad_credentials));
                            mEmailView.requestFocus();
                        }
                    });

                }

                @Override
                public void onFinish() {
                    Log.i(TAG, M + " onFinish:");

                    super.onFinish();

                    handler.post(new Runnable() {

                        @Override
                        public void run() {

                            setProgressBarIndeterminateVisibility(Boolean.FALSE);
                            mSignInButtonView.setVisibility(View.VISIBLE);
                            mInProgress = false;
                        }
                    });

                }
            });
}

From source file:com.android.idearse.Login.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login);/*from ww  w .ja  va 2 s . c om*/

    getWindow().getAttributes().windowAnimations = R.style.Fade;

    preferences = PreferenceManager.getDefaultSharedPreferences(this);

    loadima = (ImageView) findViewById(R.id.loading);
    rotation = AnimationUtils.loadAnimation(getApplicationContext(), R.drawable.rotate_loading);
    rotation.setRepeatCount(Animation.INFINITE);

    ActionBar actionBar = getSupportActionBar();

    setTitle("");
    getSupportActionBar().setIcon(R.drawable.title_logo);

    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME);

    username = (EditText) findViewById(R.id.username);
    password = (EditText) findViewById(R.id.password);

    preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    String user = preferences.getString("user", "");
    String pass = preferences.getString("password", "");

    username.setText(user);
    password.setText(pass);

    error_msg = (TextView) findViewById(R.id.error_msg);
    Button login = (Button) findViewById(R.id.login_btn);

    final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbtn);

    checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                SharedPreferences.Editor editor = preferences.edit();
                editor.putString("user", "");
                editor.putString("password", "");
                editor.commit();
                username.setText("");
                password.setText("");
            }
        }
    });

    if (user.length() != 0 && pass.length() != 0) {
        checkBox.setChecked(true);
    }

    login.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {
            InputMethodManager inputManager = (InputMethodManager) getSystemService(
                    Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);

            if (username.length() == 0 || password.length() == 0) {
                error_msg.setText("Completa los campos");
                error_msg.setVisibility(View.VISIBLE);
            } else {
                if (checkBox.isChecked()) {
                    SharedPreferences.Editor editor = preferences.edit();
                    editor.putString("user", username.getText().toString());
                    editor.putString("password", password.getText().toString());
                    editor.commit();
                }
                error_msg.setVisibility(View.GONE);
                loadima.startAnimation(rotation);
                loadima.setVisibility(View.VISIBLE);
                new LoginQuery().execute(getString(R.string.URL) + "conectar_mobil/user/login");
            }
        }
    });
}

From source file:com.code.android.vibevault.FeaturedShowsScreen.java

public void refreshSelectedShowsList() {
    featuredShowsList.setAdapter(new RatingsAdapter(this, R.layout.search_list_row, VibeVault.featuredShows));
    if (VibeVault.featuredShows.size() == 0) {
        getMoreShowsButton.setVisibility(View.GONE);
    } else {//w w  w  .  j  a v a 2  s  .co m
        getMoreShowsButton.setVisibility(View.VISIBLE);
    }
}