Java Code Examples for android.widget.Button#setAlpha()

The following examples show how to use android.widget.Button#setAlpha() . 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 check out the related API usage on the sidebar.
Example 1
Source File: X8GimbalItemController.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void setViewEnabled(boolean isEnabled) {
    if (this.rlFcItem != null) {
        float f;
        this.btnHorizontalTrim.setEnabled(isEnabled);
        this.sbPitchSpeed.setViewEnable(isEnabled);
        this.vsbGimbalGain.setViewEnable(isEnabled);
        boolean isOngroud = StateManager.getInstance().getX8Drone().isOnGround();
        Button button = this.btnRestParams;
        boolean z = isOngroud && isEnabled;
        button.setEnabled(z);
        button = this.btnRestParams;
        if (isOngroud && isEnabled) {
            f = 1.0f;
        } else {
            f = 0.4f;
        }
        button.setAlpha(f);
        if (isEnabled) {
            this.btnHorizontalTrim.setAlpha(1.0f);
        } else {
            this.btnHorizontalTrim.setAlpha(0.4f);
        }
    }
}
 
Example 2
Source File: OverlayShowingService.java    From VoIpUSSD with Apache License 2.0 5 votes vote down vote up
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent.hasExtra(EXTRA))
        tittle = intent.getStringExtra(EXTRA);
    wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    Point size = new Point();
    wm.getDefaultDisplay().getSize(size);
    int LAYOUT_FLAG;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        LAYOUT_FLAG = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
    } else {
        LAYOUT_FLAG = WindowManager.LayoutParams.TYPE_PHONE;
    }
    overlayedButton = new Button(this);
    overlayedButton.setText(tittle);
    overlayedButton.setAlpha(0.7f);
    overlayedButton.setBackgroundColor(0xFFFFFFFF);
    overlayedButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 26);

    WindowManager.LayoutParams params =
            new WindowManager.LayoutParams
                    (WindowManager.LayoutParams.MATCH_PARENT,
                            size.y - 200,
                            LAYOUT_FLAG
                            , WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
                            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                            PixelFormat.TRANSLUCENT);

    params.gravity = Gravity.CENTER | Gravity.CENTER;
    wm.addView(overlayedButton, params);
    return START_STICKY;
}
 
Example 3
Source File: MainActivity.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
private void endIt() {
    GridLayout grid = (GridLayout) findViewById(R.id.grid);
    TextView now = (TextView) findViewById(R.id.nowScore);
    TextView highS = (TextView) findViewById(R.id.bestScore);
    TextView highN = (TextView) findViewById(R.id.bestName);
    TextView End = (TextView) findViewById(R.id.Ended);
    TextView high1 = (TextView) findViewById(R.id.newHighS);
    TextView high2 = (TextView) findViewById(R.id.newHighS2);
    EditText edit = (EditText) findViewById(R.id.EditS);
    Button btn = (Button) findViewById(R.id.button);
    int Now = Integer.parseInt(now.getText() + "");
    int HighS = Integer.parseInt(highS.getText() + "");
    End.setVisibility(View.VISIBLE);
    End.setAlpha(0f);
    End.animate().alpha(0.5f).setDuration(1000);
    khalas = false;
    if (Now >= HighS) {
        grid.setClickable(false);
        grid.setEnabled(false);
        high1.setVisibility(View.VISIBLE);
        high1.setAlpha(0f);
        high1.animate().alpha(0.5f).setDuration(1000);
        high2.setVisibility(View.VISIBLE);
        high2.setAlpha(0f);
        high2.animate().alpha(0.5f).setDuration(1000);
        edit.setVisibility(View.VISIBLE);
        edit.setAlpha(0f);
        edit.animate().alpha(0.5f).setDuration(1000);
        btn.setVisibility(View.VISIBLE);
        btn.setAlpha(0f);
        btn.animate().alpha(0.5f).setDuration(1000);
    }
}
 
Example 4
Source File: ImportTokenActivity.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
private void displayImportAction()
{
    Token token = viewModel.getImportToken();
    Button importTickets = findViewById(R.id.import_ticket);
    importTickets.setVisibility(View.VISIBLE);
    importTickets.setAlpha(1.0f);

    MagicLinkData data = viewModel.getSalesOrder();
    //Customise button text
    View baseView = findViewById(android.R.id.content);

    switch (data.contractType)
    {
        case spawnable:
            importTickets.setText(R.string.action_import);
            if (token != null) 
                tokenView.displayTicketHolder(token, ticketRange, viewModel.getAssetDefinitionService());
            break;
        case currencyLink:
            importTickets.setText(R.string.action_import);
            break;
        default:
            importTxt.setText(R.string.ticket_import_valid);
            if (token != null) 
                tokenView.displayTicketHolder(token, ticketRange, viewModel.getAssetDefinitionService());
            break;
    }
}
 
Example 5
Source File: VhostsActivity.java    From Virtual-Hosts with GNU General Public License v3.0 5 votes vote down vote up
private void setButton(boolean enable) {
    final SwitchButton vpnButton = (SwitchButton) findViewById(R.id.button_start_vpn);
    final Button selectHosts = (Button) findViewById(R.id.button_select_hosts);
    if (enable) {
        vpnButton.setChecked(false);
        selectHosts.setAlpha(1.0f);
        selectHosts.setClickable(true);
    } else {
        vpnButton.setChecked(true);
        selectHosts.setAlpha(.5f);
        selectHosts.setClickable(false);
    }
}
 
Example 6
Source File: MainActivity.java    From ssj with GNU General Public License v3.0 5 votes vote down vote up
public void onStartPressed(View v)
    {
        Button btn = (Button) findViewById(R.id.btn_start);
        btn.setAlpha(0.5f);
        btn.setEnabled(false);
        getCacheDir().getAbsolutePath();

        AssetManager am = getApplicationContext().getAssets();
        getAssets();
        TextView text = (TextView) findViewById(R.id.txt_ssj);

        if(_pipe == null || !_pipe.isRunning())
        {
            text.setText(_ssj_version + " - starting");



            GraphView graph = (GraphView) findViewById(R.id.graph);
            graph.removeAllSeries();
//            graph.getSecondScale().removeAllSeries(); //not implemented in GraphView 4.0.1
            GraphView graph2 = (GraphView) findViewById(R.id.graph2);
            graph2.removeAllSeries();
//            graph2.getSecondScale().removeAllSeries(); //not implemented in GraphView 4.0.1

            GraphView graphs[] = new GraphView[]{graph, graph2};

            _pipe = new PipelineRunner(this, graphs);
            _pipe.setExceptionHandler(this);
            _pipe.start();
        }
        else
        {
            text.setText(_ssj_version + " - stopping");
            _pipe.terminate();
        }
    }
 
Example 7
Source File: X8RcItemController.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onDroneConnected(boolean b) {
    float f = 1.0f;
    if (this.isShow) {
        boolean isOpenRockerModer;
        if (this.thApModule != null) {
            boolean canSet;
            float f2;
            if (b && StateManager.getInstance().getX8Drone().isOnGround()) {
                canSet = true;
            } else {
                canSet = false;
            }
            X8TabItem x8TabItem = this.thApModule;
            if (canSet) {
                f2 = 1.0f;
            } else {
                f2 = 0.4f;
            }
            x8TabItem.setAlpha(f2);
            this.thApModule.setEnabled(canSet);
        }
        if (b && StateManager.getInstance().getX8Drone().isInSky()) {
            isOpenRockerModer = false;
        } else {
            isOpenRockerModer = true;
        }
        if (this.btnRockerMode != null) {
            Button button = this.btnRockerMode;
            if (!isOpenRockerModer) {
                f = 0.4f;
            }
            button.setAlpha(f);
            this.btnRockerMode.setEnabled(isOpenRockerModer);
        }
        if (StateManager.getInstance().getRelayState().getApModel() == 0) {
            this.currAPModel = 1;
        } else {
            this.currAPModel = 0;
        }
        this.thApModule.setSelect(this.currAPModel);
    }
}
 
Example 8
Source File: X8RcItemController.java    From FimiX8-RE with MIT License 4 votes vote down vote up
private void setViewEnabled(boolean isEnabled) {
    float f;
    float f2 = 1.0f;
    this.btnRockerMode.setEnabled(isEnabled);
    this.btnRcCode.setEnabled(isEnabled);
    this.btnFiveKeyUp.setEnabled(isEnabled);
    this.btnFiveKeyDown.setEnabled(isEnabled);
    this.btnFiveKeyLeft.setEnabled(isEnabled);
    this.btnFiveKeyRight.setEnabled(isEnabled);
    this.btnFiveKeyCenter.setEnabled(isEnabled);
    this.btnRockerMode.setAlpha(isEnabled ? 1.0f : 0.4f);
    Button button = this.btnRcCode;
    if (isEnabled) {
        f = 1.0f;
    } else {
        f = 0.4f;
    }
    button.setAlpha(f);
    button = this.btnFiveKeyUp;
    if (isEnabled) {
        f = 1.0f;
    } else {
        f = 0.4f;
    }
    button.setAlpha(f);
    button = this.btnFiveKeyDown;
    if (isEnabled) {
        f = 1.0f;
    } else {
        f = 0.4f;
    }
    button.setAlpha(f);
    button = this.btnFiveKeyLeft;
    if (isEnabled) {
        f = 1.0f;
    } else {
        f = 0.4f;
    }
    button.setAlpha(f);
    button = this.btnFiveKeyRight;
    if (isEnabled) {
        f = 1.0f;
    } else {
        f = 0.4f;
    }
    button.setAlpha(f);
    Button button2 = this.btnFiveKeyCenter;
    if (!isEnabled) {
        f2 = 0.4f;
    }
    button2.setAlpha(f2);
}
 
Example 9
Source File: X8FcItemController.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onDroneConnected(boolean b) {
    if (this.isShow) {
        boolean isCheck;
        float f;
        if (this.rlFcItem != null) {
            if (b) {
                reuqestUiValue();
                if (StateManager.getInstance().getX8Drone().getCtrlMode() == 7 || StateManager.getInstance().getX8Drone().getCtrlMode() == 8) {
                    this.vsbRTHeightLimit.setEnabled(false);
                    this.vsbRTHeightLimit.setViewEnableByMode(false);
                } else {
                    this.vsbRTHeightLimit.setEnabled(true);
                    this.vsbRTHeightLimit.setViewEnableByMode(true);
                }
            } else {
                defaultVal();
            }
        }
        if (!b) {
            this.isRequest = false;
        }
        if (StateManager.getInstance().getX8Drone().getFcSingal() != null) {
            showSingal(StateManager.getInstance().getX8Drone().getFcSingal());
        }
        if (b && StateManager.getInstance().getX8Drone().isOnGround()) {
            isCheck = true;
        } else {
            isCheck = false;
        }
        this.btnImuCheck.setEnabled(isCheck);
        Button button = this.btnImuCheck;
        if (isCheck) {
            f = 1.0f;
        } else {
            f = 0.4f;
        }
        button.setAlpha(f);
        getDroneState();
        if (this.isConect && this.isInSky) {
            this.iBtnReturnDrone.setAlpha(1.0f);
            this.iBtnReturnDrone.setEnabled(true);
            this.iBtnReturnPerson.setAlpha(1.0f);
            this.iBtnReturnPerson.setEnabled(true);
        } else {
            this.iBtnReturnDrone.setAlpha(0.4f);
            this.iBtnReturnDrone.setEnabled(false);
            this.iBtnReturnPerson.setAlpha(0.4f);
            this.iBtnReturnPerson.setEnabled(false);
        }
        if (this.vsbRTHeightLimit == null) {
            return;
        }
        if (StateManager.getInstance().getX8Drone().getTaskMode() == X8Task.VCM_RTH.ordinal()) {
            this.vsbRTHeightLimit.setEnableClick(false);
        } else if (this.swbNoviceMode == null || this.swbNoviceMode.getToggleOn()) {
            this.vsbRTHeightLimit.setEnableClick(false);
        } else {
            this.vsbRTHeightLimit.setEnableClick(true);
        }
    }
}
 
Example 10
Source File: ImportTokenActivity.java    From alpha-wallet-android with MIT License 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    AndroidInjection.inject(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_import_token);
    toolbar();

    setTitle(getString(R.string.toolbar_header_importing_tickets));

    importString = getIntent().getStringExtra(IMPORT_STRING);
    systemView = findViewById(R.id.system_view);
    priceETH = findViewById(R.id.textImportPrice);
    priceUSD = findViewById(R.id.textImportPriceUSD);
    priceUSDLabel = findViewById(R.id.fiat_price_txt);
    toolbarView = findViewById(R.id.toolbar);
    tokenView = findViewById(R.id.web3_tokenview);
    webWrapper = findViewById(R.id.layout_webwrapper);
    priceETH.setVisibility(View.GONE);
    priceUSD.setVisibility(View.GONE);
    priceUSDLabel.setVisibility(View.GONE);

    importTxt = findViewById(R.id.textImport);
    costLayout = findViewById(R.id.cost_layout);

    setTicket(false, true, false);

    Button importTickets = findViewById(R.id.import_ticket);
    importTickets.setOnClickListener(this);
    importTickets.setAlpha(0.4f);
    Button cancel = findViewById(R.id.cancel_button);
    cancel.setOnClickListener(this);

    viewModel = ViewModelProviders.of(this, importTokenViewModelFactory)
            .get(ImportTokenViewModel.class);

    viewModel.importRange().observe(this, this::onImportRange);
    viewModel.invalidRange().observe(this, this::invalidTicket);
    viewModel.invalidTime().observe(this, this::invalidTime);
    viewModel.newTransaction().observe(this, this::onTransaction);
    viewModel.error().observe(this, this::onError);
    viewModel.txError().observe(this, this::onTxError);
    viewModel.invalidLink().observe(this, this::onBadLink);
    viewModel.network().observe(this, this::onNetwork);
    viewModel.checkContractNetwork().observe(this, this::checkContractNetwork);
    viewModel.ticketNotValid().observe(this, this::onInvalidTicket);
    viewModel.feemasterAvailable().observe(this, this::onFeemasterAvailable);
    viewModel.sig().observe(this, sigData -> toolbarView.onSigData(sigData, this));
    viewModel.tickerUpdate().observe(this, this::onTickerUpdate);

    ticketRange = null;
}
 
Example 11
Source File: BindingAdapterUtils.java    From xDrip with GNU General Public License v3.0 4 votes vote down vote up
@BindingAdapter(value = {"button_indicate"})
public static void buttonIndicate(Button button, boolean set) {
    button.setAlpha(set ? 0.5f : 1.0f);
}
 
Example 12
Source File: BindingAdapterUtils.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
@BindingAdapter(value = {"button_indicate"})
public static void buttonIndicate(Button button, boolean set) {
    button.setAlpha(set ? 0.5f : 1.0f);
}
 
Example 13
Source File: OrderDetailFragment.java    From Pharmacy-Android with GNU General Public License v3.0 4 votes vote down vote up
private void disableButton(Button button) {
    button.setClickable(false);
    button.setAlpha(0.5f);
}
 
Example 14
Source File: OrderDetailFragment.java    From Pharmacy-Android with GNU General Public License v3.0 4 votes vote down vote up
private void enableButton(Button button) {
    button.setClickable(true);
    button.setAlpha(1f);
}