Example usage for android.content Intent ACTION_TIME_TICK

List of usage examples for android.content Intent ACTION_TIME_TICK

Introduction

In this page you can find the example usage for android.content Intent ACTION_TIME_TICK.

Prototype

String ACTION_TIME_TICK

To view the source code for android.content Intent ACTION_TIME_TICK.

Click Source Link

Document

Broadcast Action: The current time has changed.

Usage

From source file:Main.java

public static void registerBackReceiver() {
    IntentFilter filter = new IntentFilter(Intent.ACTION_TIME_TICK);
    //      MyBroadcastReceiver receiver = new MyBroadcastReceiver(); 
    //      registerReceiver(receiver, filter); 
}

From source file:com.mygeopay.wallet.ui.ExchangeRateLoader.java

@Override
protected void onStartLoading() {
    super.onStartLoading();

    config.registerOnSharedPreferenceChangeListener(this);

    final IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    intentFilter.addAction(Intent.ACTION_TIME_TICK);
    context.registerReceiver(broadcastReceiver, intentFilter);

    forceLoad();/*from  ww  w .j a  v  a  2 s  .  co m*/
}

From source file:com.coinomi.wallet.ui.ExchangeRateLoader.java

@Override
protected void onStartLoading() {
    super.onStartLoading();

    refreshUri(config.getExchangeCurrencyCode());

    config.registerOnSharedPreferenceChangeListener(this);

    final IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    intentFilter.addAction(Intent.ACTION_TIME_TICK);
    context.registerReceiver(broadcastReceiver, intentFilter);

    forceLoad();//from   w w  w  . ja va 2 s . c  o  m
}

From source file:com.feathercoin.wallet.feathercoin.ui.BlockListFragment.java

@Override
public void onResume() {
    super.onResume();

    activity.registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));

    adapter.notifyDataSetChanged();//w w  w  .ja  v  a 2  s  . c om
}

From source file:net.bither.fragment.hot.BlockListFragment.java

@Override
public void onResume() {
    super.onResume();
    if (!isRegister) {
        activity.registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
        isRegister = true;/* w w w .  j  a  v a  2s . co  m*/
    }
    loaderManager.initLoader(ID_TRANSACTION_LOADER, null, transactionLoaderCallbacks);

    adapter.notifyDataSetChanged();
}

From source file:cc.mintcoin.wallet.ui.BlockListFragment.java

@Override
public void onResume() {
    super.onResume();

    activity.registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));

    loaderManager.initLoader(ID_TRANSACTION_LOADER, null, transactionLoaderCallbacks);

    adapter.notifyDataSetChanged();//from w  ww  . j a v  a2  s .com
}

From source file:biz.wiz.android.wallet.ui.BlockListFragment.java

@Override
public void onResume() {
    super.onResume();

    activity.registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
    loaderManager.initLoader(ID_TRANSACTION_LOADER, null, transactionLoaderCallbacks);

    adapter.notifyDataSetChanged();/*ww  w.  j  av  a  2  s  .co m*/

    resumed = true;
}

From source file:com.matthewmitchell.peercoin_android_wallet.ui.BlockListFragment.java

@Override
public void onResume() {
    super.onResume();

    activity.registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
    adapter.notifyDataSetChanged();//w w w . j a  v  a2 s  .co  m
    resumed = true;

    this.activity.runAfterLoad(new Runnable() {

        @Override
        public void run() {
            loaderManager.initLoader(ID_TRANSACTION_LOADER, null, transactionLoaderCallbacks);
        }

    });

}

From source file:com.supremainc.biostar2.main.MainFragment.java

protected void registerBroadcast() {
    if (mReceiverTick == null) {
        mReceiverTick = new BroadcastReceiver() {
            @Override//w  w w.jav a  2 s  .  c  o  m
            public void onReceive(Context context, Intent intent) {
                if (mIsDestroy) {
                    return;
                }
                final String action = intent.getAction();

                if (action.equals(Intent.ACTION_TIME_TICK)) {
                    setTime();
                }
            }
        };
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_TIME_TICK);
        getActivity().registerReceiver(mReceiverTick, intentFilter);
    }
    if (mReceiver == null) {
        mReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (isInValidCheck(null)) {
                    return;
                }
                String action = intent.getAction();
                if (action.equals(Setting.BROADCAST_REROGIN)) {
                    applyPermission();
                } else if (action.equals(Setting.BROADCAST_ALARM_UPDATE)) {
                    if (mLayout != null) {
                        mLayout.setAlarmCount();
                    }
                }
            }
        };
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Setting.BROADCAST_REROGIN);
        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mReceiver, intentFilter);
    }
}

From source file:com.example.maciej.mytask.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_main);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);//from w  w  w.j a  v a2  s .  c  o  m

    createNotification();

    mDateTimeTextView = (TextView) findViewById(R.id.dateTimeTextView);
    //      final Button addTaskBtn = (Button) findViewById(R.id.addTaskBtn);
    final ListView listview = (ListView) findViewById(R.id.taskListview);
    //      final CheckedTextView listitem = (CheckedTextView) findViewById(R.id.checkedTextView1);
    mNameList = new ArrayList<String>();
    mDescriptionList = new ArrayList<String>();
    mDateList = new ArrayList<String>();

    String savedNameList = getSharedPreferences(PREFS_TASKS, MODE_PRIVATE).getString(KEY_NAME_LIST, null);
    if (savedNameList != null) {
        String[] name_items = savedNameList.split(",");
        mNameList = new ArrayList<String>(Arrays.asList(name_items));
    }

    String savedDescriptionList = getSharedPreferences(PREFS_TASKS, MODE_PRIVATE)
            .getString(KEY_DESCRIPTION_LIST, null);
    if (savedDescriptionList != null) {
        String[] description_items = savedDescriptionList.split(",");
        mDescriptionList = new ArrayList<String>(Arrays.asList(description_items));
    }

    String savedDateList = getSharedPreferences(PREFS_TASKS, MODE_PRIVATE).getString(KEY_DATE_LIST, null);
    if (savedDateList != null) {
        String[] date_items = savedDateList.split(",");
        mDateList = new ArrayList<String>(Arrays.asList(date_items));
    }

    mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, mNameList);
    listview.setAdapter(mAdapter);
    listview.setItemsCanFocus(false);
    listview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

    listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            CheckedTextView item = (CheckedTextView) view;
            if (item.isChecked()) {
                Toast.makeText(getApplicationContext(), getString(R.string.checked), Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(getApplicationContext(), getString(R.string.unchecked), Toast.LENGTH_SHORT)
                        .show();
            }
        }
    });

    listview.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            descriptionClicked(view);
            return true;
        }
    });

    mTickReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
                mDateTimeTextView.setText(getCurrentTimeStamp());
            }
        }
    };

}