use of android.content.IntentFilter in project Talon-for-Twitter by klinker24.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
UpdateUtils.checkUpdate(this);
MainActivity.sendHandler = new Handler();
context = this;
sContext = this;
sharedPrefs = context.getSharedPreferences("com.klinker.android.twitter_world_preferences", 0);
DrawerActivity.settings = AppSettings.getInstance(context);
try {
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
} catch (Exception e) {
}
sharedPrefs.edit().putBoolean("refresh_me", getIntent().getBooleanExtra("from_notification", false)).commit();
setUpTheme();
setUpWindow();
setContentView(R.layout.main_activity);
mViewPager = (ViewPager) findViewById(R.id.pager);
setUpDrawer(0, getResources().getString(R.string.timeline));
MainActivity.sendLayout = (LinearLayout) findViewById(R.id.send_layout);
MainActivity.sendHandler.postDelayed(showSend, 1000);
MainActivity.sendButton = (ImageButton) findViewById(R.id.send_button);
MainActivity.sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent compose = new Intent(context, ComposeActivity.class);
startActivity(compose);
}
});
actionBar = getActionBar();
if (!settings.isTwitterLoggedIn) {
Intent login = new Intent(context, LoginActivity.class);
startActivity(login);
}
mSectionsPagerAdapter = new TimelinePagerAdapter(getFragmentManager(), context, sharedPrefs, getIntent().getBooleanExtra("from_launcher", false));
int currAccount = sharedPrefs.getInt("current_account", 1);
int defaultPage = sharedPrefs.getInt("default_timeline_page_" + currAccount, 0);
actionBar.setTitle(mSectionsPagerAdapter.getPageTitle(defaultPage));
mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrollStateChanged(int state) {
}
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (!actionBar.isShowing()) {
actionBar.show();
if (translucent) {
statusBar.setVisibility(View.VISIBLE);
}
}
MainActivity.sendHandler.post(showSend);
}
public void onPageSelected(int position) {
String title = "" + mSectionsPagerAdapter.getPageTitle(position);
MainDrawerArrayAdapter.setCurrent(context, position);
drawerList.invalidateViews();
actionBar.setTitle(title);
}
});
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER);
mViewPager.setCurrentItem(defaultPage);
MainDrawerArrayAdapter.setCurrent(this, defaultPage);
drawerList.invalidateViews();
if (getIntent().getBooleanExtra("from_launcher", false)) {
actionBar.setTitle(mSectionsPagerAdapter.getPageTitle(getIntent().getIntExtra("launcher_page", 0)));
}
mViewPager.setOffscreenPageLimit(TimelinePagerAdapter.MAX_EXTRA_PAGES);
if (getIntent().getBooleanExtra("tutorial", false) && !sharedPrefs.getBoolean("done_tutorial", false)) {
getIntent().putExtra("tutorial", false);
sharedPrefs.edit().putBoolean("done_tutorial", true).commit();
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try {
Log.v("tutorial_activity", "close drawer");
mDrawerLayout.closeDrawer(Gravity.LEFT);
unregisterReceiver(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}, new IntentFilter(TutorialActivity.ACTION_CLOSE_DRAWER));
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try {
Log.v("tutorial_activity", "open drawer");
mDrawerLayout.openDrawer(Gravity.LEFT);
unregisterReceiver(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}, new IntentFilter(TutorialActivity.ACTION_OPEN_DRAWER));
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try {
Log.v("tutorial_activity", "page left");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1, true);
unregisterReceiver(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}, new IntentFilter(TutorialActivity.ACTION_PAGE_LEFT));
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try {
Log.v("tutorial_activity", "page right");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, true);
unregisterReceiver(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}, new IntentFilter(TutorialActivity.ACTION_PAGE_RIGHT));
startActivity(new Intent(context, TutorialActivity.class));
overridePendingTransition(0, 0);
}
setLauncherPage();
if (getIntent().getBooleanExtra("from_drawer", false)) {
mViewPager.setCurrentItem(getIntent().getIntExtra("page_to_open", 1));
}
}
use of android.content.IntentFilter in project Shuttle by timusus.
the class PlayerActivity method onStart.
@Override
protected void onStart() {
super.onStart();
mStatusListener = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action != null) {
switch(action) {
case MusicService.InternalIntents.META_CHANGED:
updateTrackInfo();
setPauseButtonImage();
queueNextRefresh(1);
break;
case MusicService.InternalIntents.PLAY_STATE_CHANGED:
setPauseButtonImage();
break;
case MusicService.InternalIntents.REPEAT_CHANGED:
setRepeatButtonImage();
break;
case MusicService.InternalIntents.SHUFFLE_CHANGED:
setShuffleButtonImage();
break;
}
}
}
};
final IntentFilter filter = new IntentFilter();
filter.addAction(MusicService.InternalIntents.PLAY_STATE_CHANGED);
filter.addAction(MusicService.InternalIntents.META_CHANGED);
filter.addAction(MusicService.InternalIntents.SHUFFLE_CHANGED);
filter.addAction(MusicService.InternalIntents.REPEAT_CHANGED);
registerReceiver(mStatusListener, new IntentFilter(filter));
}
use of android.content.IntentFilter in project Shuttle by timusus.
the class QCircleActivity method registerIntentReceiver.
private void registerIntentReceiver() {
IntentFilter filter = new IntentFilter();
// Add QCircle intent to the intent filter
filter.addAction(ACTION_ACCESSORY_COVER_EVENT);
// Register a broadcast receiver with the system
mContext.registerReceiver(mIntentReceiver, filter);
}
use of android.content.IntentFilter in project Shuttle by timusus.
the class AlbumFragment method onResume.
@Override
public void onResume() {
super.onResume();
IntentFilter filter = new IntentFilter();
filter.addAction("restartLoader");
getActivity().registerReceiver(receiver, filter);
refreshAdapterItems();
}
use of android.content.IntentFilter in project Shuttle by timusus.
the class EqualizerService method onCreate.
@Override
public void onCreate() {
super.onCreate();
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
IntentFilter audioFilter = new IntentFilter();
audioFilter.addAction(ACTION_OPEN_EQUALIZER_SESSION);
audioFilter.addAction(ACTION_CLOSE_EQUALIZER_SESSION);
registerReceiver(mAudioSessionReceiver, audioFilter);
saveDefaults();
}
Aggregations