Android Open Source - DashNotifier Click Intent Activity






From Project

Back to project page DashNotifier.

License

The source code is released under:

MIT License

If you think the Android project DashNotifier listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.umang.dashnotifier;
// w  w w.j a va2s. c o m
import com.google.android.apps.dashclock.configuration.AppChooserPreference;
import com.umang.dashnotifier.provider.NotifSQLiteHelper;
import com.umang.dashnotifier.provider.NotificationProvider;

import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;


public class ClickIntentActivity extends Activity {

  SharedPreferences preferences;
  SharedPreferences.Editor editor;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
    String packageName = getIntent().getStringExtra("packageName");
    String extNumber = getIntent().getStringExtra("extNumber");
    Intent clickIntent = new Intent();
    try {
      int count = getContentResolver().delete(
          NotificationProvider.CONTENT_URI,
          NotifSQLiteHelper.COL_PNAME + " = ? AND "
              + NotifSQLiteHelper.COL_NOTIF_ID + " = ? ",
          new String[] { packageName,
              Integer.toString(1) });
      Log.v("ClickIntentActivity", "Deleted: " + Integer.toString(count));
      //restore from backup fr always_show extensions
      if (preferences.getBoolean("always_show"+ extNumber, false)){
        if (!TextUtils.isEmpty(preferences.getString("iconExt_default_"+extNumber, "")))
          editor.putString("iconExt"+extNumber, preferences.getString("iconExt_default_"+extNumber, ""));
        else{
          editor.remove("iconExt"+extNumber);
          editor.putString("icon_preference"+extNumber, preferences.getString("icon_preference_default_"+extNumber, ""));
        }
          
        editor.commit();
      }
      try {
        clickIntent = getPackageManager().getLaunchIntentForPackage(packageName)
            .addCategory(Intent.CATEGORY_DEFAULT);
      } catch (NullPointerException npe) {
        clickIntent.setAction(Intent.ACTION_MAIN);
        clickIntent.addCategory(Intent.CATEGORY_HOME);
        clickIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      } finally {
        clickIntent = AppChooserPreference.getIntentValue(
            preferences.getString("click_intent" + extNumber, ""),
            clickIntent);
      }
      startActivity(clickIntent);
      finish();
    } catch (Exception e) {

      Log.e("ClickIntentActivity", e.getClass().getName());
      e.printStackTrace();
    }
    
  }

  

}




Java Source Code List

com.google.android.apps.dashclock.configuration.AppChooserPreference.java
com.google.android.apps.dashclock.ui.SimplePagedTabsHelper.java
com.umang.dashnotifier.AbstractSettings.java
com.umang.dashnotifier.AppListFragment.java
com.umang.dashnotifier.AppSelectActivity.java
com.umang.dashnotifier.ClickIntentActivity.java
com.umang.dashnotifier.Commons.java
com.umang.dashnotifier.DashNotificationListenerAcc.java
com.umang.dashnotifier.DashNotificationListener.java
com.umang.dashnotifier.DashNotifierExtension10.java
com.umang.dashnotifier.DashNotifierExtension11.java
com.umang.dashnotifier.DashNotifierExtension2.java
com.umang.dashnotifier.DashNotifierExtension3.java
com.umang.dashnotifier.DashNotifierExtension4.java
com.umang.dashnotifier.DashNotifierExtension5.java
com.umang.dashnotifier.DashNotifierExtension6.java
com.umang.dashnotifier.DashNotifierExtension7.java
com.umang.dashnotifier.DashNotifierExtension8.java
com.umang.dashnotifier.DashNotifierExtension9.java
com.umang.dashnotifier.DashNotifierExtension.java
com.umang.dashnotifier.DashNotifierSettingsActivity10.java
com.umang.dashnotifier.DashNotifierSettingsActivity11.java
com.umang.dashnotifier.DashNotifierSettingsActivity2.java
com.umang.dashnotifier.DashNotifierSettingsActivity3.java
com.umang.dashnotifier.DashNotifierSettingsActivity4.java
com.umang.dashnotifier.DashNotifierSettingsActivity5.java
com.umang.dashnotifier.DashNotifierSettingsActivity6.java
com.umang.dashnotifier.DashNotifierSettingsActivity7.java
com.umang.dashnotifier.DashNotifierSettingsActivity8.java
com.umang.dashnotifier.DashNotifierSettingsActivity9.java
com.umang.dashnotifier.DashNotifierSettingsActivity.java
com.umang.dashnotifier.HelpUtils.java
com.umang.dashnotifier.IconPicker.java
com.umang.dashnotifier.PackageAdapter.java
com.umang.dashnotifier.PackageItem.java
com.umang.dashnotifier.PrefsFragment.java
com.umang.dashnotifier.UnlockReceiver.java
com.umang.dashnotifier.provider.NotifSQLiteHelper.java
com.umang.dashnotifier.provider.NotificationProvider.java
com.umang.dashnotifier.provider.NotificationStore.java