Example usage for android.view View refreshDrawableState

List of usage examples for android.view View refreshDrawableState

Introduction

In this page you can find the example usage for android.view View refreshDrawableState.

Prototype

public void refreshDrawableState() 

Source Link

Document

Call this to force a view to update its drawable state.

Usage

From source file:com.nokia.example.pepperfarm.client.PepperFarmMainScreenActivity.java

/**
 * Sets up the UI container for the Pepper Farm Main Screen
 * <p/>/* ww w .  j  av a 2s.  c om*/
 * As part of the set up, we use the Nokia In App Payment Library to request
 * the Enabler to return pricing data for each in app purchasable item we are selling.
 * For simplicity, this is done on the Main (UI) thread. Ideally you could spawn a new thread to set up
 * the NPayProductPricepoint objects and make the product data request to the library.
 */
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(LOG_TAG, "Pepper Farm Main Screen Activity Created");
    Config.setVersiontitle(this);

    setContentView(R.layout.pepper_farm_main_view);

    Button buyPepperButton = (Button) findViewById(R.id.buy_button);
    buyPepperButton.setVisibility(View.INVISIBLE);

    View product_list = findViewById(R.id.product_list);
    product_list.refreshDrawableState();

    //Listener for the Purchase Requisition button
    buyPepperButton.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent("android.intent.action.PRODUCT_LIST");
            startActivity(intent);
        }
    });

    Button resetPurchases = (Button) findViewById(R.id.reset_purchases);
    resetPurchases.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            Log.i("resetPurchases", "Consuming all items");
            for (Product product : Content.ITEMS) {
                product.consumeItem();
            }
            if (MainScreenPepperListFragment.reference.adapter != null) {
                MainScreenPepperListFragment.reference.adapter.clear();
                MainScreenPepperListFragment.reference.adapter.notifyDataSetChanged();
            }
        }

    });

    Button fetchRestorables = (Button) findViewById(R.id.fetch_restorable_products);
    fetchRestorables.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            Log.i("fetchRestorables", "Fetching all restorable items");
            purchaseHandler.getPurchases(true);
        }
    });

}

From source file:ca.mimic.apphangar.Settings.java

static protected void launchContribute(Context context) {
    Contribute contribute = new Contribute(context);
    View mContribute = contribute.getView();
    mContribute.refreshDrawableState();
    new AlertDialog.Builder(context).setTitle(R.string.contribute_title).setIcon(R.drawable.ic_logo)
            .setView(mContribute).setPositiveButton(R.string.contribute_accept_button, null).show();
}

From source file:org.alfresco.mobile.android.application.fragments.sync.SyncCursorAdapter.java

@Override
public void bindView(View view, Context context, Cursor cursor) {
    // int[] layouts = GridAdapterHelper.getGridLayoutId(context,
    // (GridFragment) fragmentRef.get());
    if (view.findViewById(R.id.app_grid_progress) == null) {
        // ((ViewGroup) view).removeAllViews();
        view.invalidate();/*from  www  .  jav a  2 s . c  o m*/
        view.refreshDrawableState();
        return;
    }
    TwoLinesProgressViewHolder vh = (TwoLinesProgressViewHolder) view.getTag();
    updateControls(vh, cursor);
}

From source file:ca.mimic.apphangar.Settings.java

protected void launchLicense() {
    License license = new License(this);
    View mLicense = license.getView();
    mLicense.refreshDrawableState();
    new AlertDialog.Builder(Settings.this).setTitle(R.string.license_title).setIcon(R.drawable.ic_logo)
            .setView(mLicense).setPositiveButton(R.string.license_accept_button, null).show();
}

From source file:ca.mimic.apphangar.Settings.java

protected void launchChangelog() {
    ChangeLog changelog = new ChangeLog(this);
    View mChg = changelog.getView();
    mChg.refreshDrawableState();
    new AlertDialog.Builder(Settings.this).setTitle(R.string.changelog_title).setIcon(R.drawable.ic_logo)
            .setView(mChg)/*from ww w  .j a v  a2s.c o m*/
            .setNegativeButton(R.string.changelog_donate_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    launchDonate();

                    dialog.dismiss();
                }

            }).setNeutralButton(R.string.changelog_contribute_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    launchContribute(Settings.this);

                    dialog.dismiss();
                }

            }).setPositiveButton(R.string.changelog_accept_button, null).show();
}

From source file:ca.mimic.apphangar.Settings.java

protected void launchDonate() {
    final Donate donate = new Donate(this);
    donate.bindServiceConn();//from   w  w  w.ja v a2  s . c o  m
    View mDonate = donate.getView(mContext);
    mDonate.refreshDrawableState();
    AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this).setTitle(R.string.donate_title)
            .setIcon(R.drawable.ic_logo).setView(mDonate)
            .setPositiveButton(R.string.donate_accept_button, null);
    AlertDialog alert = builder.show();
    alert.setOnDismissListener(new AlertDialog.OnDismissListener() {
        public void onDismiss(DialogInterface dialog) {
            donate.unbindServiceConn();
        }
    });
    donate.setAlert(alert);
}