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;
}
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();
}
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);
}
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;
}
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.
}
}
Aggregations