Android Open Source - BluetoothGlass Overlay View






From Project

Back to project page BluetoothGlass.

License

The source code is released under:

GNU General Public License

If you think the Android project BluetoothGlass listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.vicmns.bluetoothglass.client.views;
/*  w  w  w . j  av a  2  s  .  c om*/
import android.content.Context;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.vicmns.bluetoothglass.client.R;

/**
 * Created by Victor Cervantes on 3/14/14.
 */
public class OverlayView {
    public static final int HIDDEN = 0;
    public static final int LOADING = 1;

    Context mContext;
    View mContent;
    View mOverlay;
    TextView mMessage;
    ProgressBar mProgressIndicator;

    public OverlayView(Context context, View overlay, View content,
                           int initialState) {

        mContext = context;
        mContent = content;
        mOverlay = overlay;

        mMessage = (TextView) mOverlay.findViewById(R.id.overlay_text_message);
        mProgressIndicator = (ProgressBar) mOverlay
                .findViewById(R.id.overlay_progress);

        switch (initialState) {
            case HIDDEN:
                hide();
                break;
            case LOADING:
                showLoading();
                break;
        }

    }

    public OverlayView(Context context, View overlay, int initialState) {
        this(context, overlay, null, initialState);
    }

    public boolean isLoading() {
        return mProgressIndicator.getVisibility() == View.VISIBLE
                && mOverlay.getVisibility() == View.VISIBLE;
    }

    public void show() {
        mOverlay.setVisibility(View.VISIBLE);
        if (mContent != null)
            mContent.setVisibility(View.GONE);
    }

    public void hide() {
        mOverlay.setVisibility(View.GONE);
        if (mContent != null)
            mContent.setVisibility(View.VISIBLE);
    }

    public void showMessage(String message) {
        mMessage.setVisibility(View.VISIBLE);
        mMessage.setText(message);

        mProgressIndicator.setVisibility(View.GONE);
        show();
    }

    public void showMessageWithLoading(String message) {
        mProgressIndicator.setVisibility(View.VISIBLE);
        mMessage.setVisibility(View.VISIBLE);
        mMessage.setText(message);

        show();
    }

    public void showLoading() {
        mMessage.setVisibility(View.GONE);
        mProgressIndicator.setVisibility(View.VISIBLE);
        show();
    }

    public void showWithMessageLoading() {
        mMessage.setVisibility(View.VISIBLE);
        mProgressIndicator.setVisibility(View.VISIBLE);
        show();
    }

}




Java Source Code List

com.vicmns.bluetoothglass.client.MainApplication.java
com.vicmns.bluetoothglass.client.activities.BluetoothClient.java
com.vicmns.bluetoothglass.client.activities.MainActivity.java
com.vicmns.bluetoothglass.client.adapters.BluetoothDevicesAdapter.java
com.vicmns.bluetoothglass.client.bluetooth.SendFileToDeviceTask.java
com.vicmns.bluetoothglass.client.callbacks.CardScrollCallBacks.java
com.vicmns.bluetoothglass.client.data.BluetoothParametersHolder.java
com.vicmns.bluetoothglass.client.models.BluetoothDeviceModel.java
com.vicmns.bluetoothglass.client.services.GoogleVoiceTriggerService.java
com.vicmns.bluetoothglass.client.services.SendPictureToDevice.java
com.vicmns.bluetoothglass.client.tools.FileExtensionFilter.java
com.vicmns.bluetoothglass.client.views.CameraView.java
com.vicmns.bluetoothglass.client.views.OverlayView.java
com.vicmns.bluetoothglass.server.MainActivity.java
com.vicmns.bluetoothglass.server.MainApplication.java
com.vicmns.bluetoothglass.server.data.BluetoothParametersHolder.java
com.vicmns.bluetoothglass.server.handlers.BluetoothConnectionHandler.java
com.vicmns.bluetoothglass.server.handlers.BluetoothReadFromSocketHandler.java
com.vicmns.bluetoothglass.server.receivers.DeviceBootReceiver.java
com.vicmns.bluetoothglass.server.service.BluetoothService.java