Search in sources :

Example 61 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project WeexErosFramework by bmfe.

the class WXCommonUtil method getSmartBarHeight.

private static int getSmartBarHeight(AppCompatActivity activity) {
    ActionBar actionbar = activity.getSupportActionBar();
    if (actionbar != null)
        try {
            Class c = Class.forName("com.android.internal.R$dimen");
            Object obj = c.newInstance();
            Field field = c.getField("mz_action_button_min_height");
            int height = Integer.parseInt(field.get(obj).toString());
            return activity.getResources().getDimensionPixelSize(height);
        } catch (Exception e) {
            e.printStackTrace();
            actionbar.getHeight();
        }
    return 0;
}
Also used : Field(java.lang.reflect.Field) ImmutableDomObject(com.taobao.weex.dom.ImmutableDomObject) ActionBar(android.support.v7.app.ActionBar)

Example 62 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project run-wallet-android by runplay.

the class UiManager method setActionBarBackOnly.

public static void setActionBarBackOnly(Activity activity, String title, ColorDrawable color) {
    final AppCompatActivity apact = (AppCompatActivity) activity;
    ActionBar ab = apact.getSupportActionBar();
    if (color != null) {
        ab.setBackgroundDrawable(color);
    }
    ab.setTitle(title);
    ab.setDisplayShowHomeEnabled(false);
    ab.setDisplayHomeAsUpEnabled(true);
    apact.supportInvalidateOptionsMenu();
    apact.supportInvalidateOptionsMenu();
    ab.show();
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Example 63 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project run-wallet-android by runplay.

the class NetworkNodesAddFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    listNodes.setLayoutManager(new RecyclerLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
    ((AppCompatActivity) getActivity()).setSupportActionBar(addNodeToolbar);
    setHasOptionsMenu(false);
    enterPod.setBackgroundColor(B.getColor(getActivity(), AppTheme.getSecondary()));
    addNodeToolbar.setNavigationIcon(getResources().getDrawable(R.drawable.md_nav_back));
    addNodeToolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    protocol.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            changeProtocol();
        }
    });
    addNodeBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Nodes.Node node = new Nodes.Node();
            node.ip = nodeAddress.getText().toString();
            node.port = Sf.toInt(port.getText().toString());
            node.protocol = protocol.getText().toString();
            node.ip = Utils.stripHttp(node.ip);
            if (node.ip.length() > 3 && node.ip.contains(".") && node.port > 0) {
                Store.addNode(getActivity(), node.ip, node.port, node.protocol);
                getActivity().onBackPressed();
            } else {
                addressLayout.setError(getString(R.string.messages_enter_neighbor_address));
            }
        }
    });
    nodeAddress.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            // nodeAddress.
            addressLayout.setError(null);
        }
    });
    adapter = new AddNodesListAdapter(getActivity(), this);
    listNodes.setAdapter(adapter);
}
Also used : AddNodesListAdapter(run.wallet.iota.ui.adapter.AddNodesListAdapter) AppCompatActivity(android.support.v7.app.AppCompatActivity) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListView(android.widget.ListView) Nodes(run.wallet.iota.model.Nodes) RecyclerLayoutManager(run.wallet.iota.ui.RecyclerLayoutManager) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 64 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project ToolBarLib by jjhesk.

the class BeastBar method withToolbar.

public static BeastBar withToolbar(AppCompatActivity res, Toolbar original, final Builder beastbuilder) {
    Display display = res.getWindowManager().getDefaultDisplay();
    res.setSupportActionBar(original);
    ActionBar actionbar = res.getSupportActionBar();
    actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionbar.setDisplayShowHomeEnabled(false);
    actionbar.setDefaultDisplayHomeAsUpEnabled(false);
    original.setBackgroundResource(beastbuilder.ic_background);
    View homeIcon = res.findViewById(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? android.R.id.home : android.R.id.home);
    // ((View) homeIcon.getParent()).setLayoutParams(new LinearLayout.LayoutParams(0, 0));
    //  ((View) homeIcon).setVisibility(View.GONE);
    final BeastBar bb = new BeastBar(res);
    bb.setToolBar(original);
    bb.setup = beastbuilder;
    display.getSize(bb.size);
    bb.init();
    return bb;
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) Display(android.view.Display)

Example 65 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project MovieGuide by esoxjem.

the class MovieDetailsFragment method setToolbar.

private void setToolbar() {
    collapsingToolbar.setContentScrimColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));
    collapsingToolbar.setTitle(getString(R.string.movie_details));
    collapsingToolbar.setCollapsedTitleTextAppearance(R.style.CollapsedToolbar);
    collapsingToolbar.setExpandedTitleTextAppearance(R.style.ExpandedToolbar);
    collapsingToolbar.setTitleEnabled(true);
    if (toolbar != null) {
        ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
        ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
    } else {
    // Don't inflate. Tablet is in landscape mode.
    }
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)99 View (android.view.View)43 ActionBar (android.support.v7.app.ActionBar)36 TextView (android.widget.TextView)28 RecyclerView (android.support.v7.widget.RecyclerView)21 ImageView (android.widget.ImageView)17 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 Toolbar (android.support.v7.widget.Toolbar)14 BindView (butterknife.BindView)11 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Transition (android.transition.Transition)7 MenuItem (android.view.MenuItem)7 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 Bundle (android.os.Bundle)4 FragmentManager (android.support.v4.app.FragmentManager)4