コード例 #1
2
  @SuppressLint("JavascriptInterface")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    Activity activity = this.getActivity();
    appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
    Intent i_getvalue = activity.getIntent();
    String action = i_getvalue.getAction();

    if (Intent.ACTION_VIEW.equals(action)) {
      Uri uri = i_getvalue.getData();
      if (uri != null) {
        String title = uri.getQueryParameter("title");
        postid = uri.getQueryParameter("postid");
        appBarLayout.setTitle(title); // 设置文章标题
      }
    } else if (getArguments().containsKey(ARG_ITEM_ID)) {
      // Load the models rawData specified by the fragment
      // arguments. In a real-world scenario, use a Loader
      // to load rawData from a rawData provider.
      postid = getArguments().getString(ARG_ITEM_ID);
      String title = getArguments().getString(ARG_POST_TITLE);
      appBarLayout.setTitle(title); // 设置文章标题
      SinglePostActivity.shareTitle = title;
    }
  }
コード例 #2
0
  public static Intent passEntry(Activity activity, Intent intent) {
    String action = activity.getIntent().getAction();
    if (action != null && action.equals(Intent.ACTION_MAIN)) {
      intent.setAction(Intent.ACTION_MAIN);
      intent.putExtra(
          Analytics.EXTRA_ENTRY_FROM,
          activity.getIntent().getStringExtra(Analytics.EXTRA_ENTRY_FROM));
    }

    return intent;
  }
コード例 #3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (DEBUG) Log.e(TAG, "onCreate");
    setHasOptionsMenu(true);
    setRetainInstance(false);
    mThreadLoaderCallback = new ThreadDataCallback();

    final Activity activity = getActivity();
    mContentResolver = activity.getContentResolver();
    Intent intent = activity.getIntent();

    mReplyType = intent.getIntExtra(Constants.EDITING, -999);
    mPostId = intent.getIntExtra(Constants.REPLY_POST_ID, 0);
    mThreadId = intent.getIntExtra(Constants.REPLY_THREAD_ID, 0);

    boolean badRequest = false;
    if (mReplyType < 0 || mThreadId == 0) {
      // we always need a valid type and thread ID
      badRequest = true;
    } else if (mPostId == 0
        && (mReplyType == AwfulMessage.TYPE_EDIT || mReplyType == AwfulMessage.TYPE_QUOTE)) {
      // edits and quotes always need a post ID too
      badRequest = true;
    }

    if (badRequest) {
      activity.finish();
    } else {
      loadReply(mReplyType, mThreadId, mPostId);
    }
  }
コード例 #4
0
ファイル: HistoryManager.java プロジェクト: Shazam14/Ik2
  public void addHistoryItem(Result result, ResultHandler handler) {
    // Do not save this item to the history if the preference is turned off, or the contents are
    // considered secure.
    if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true)
        || handler.areContentsSecure()
        || !enableHistory) {
      return;
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
      deletePrevious(result.getText());
    }

    ContentValues values = new ContentValues();
    values.put(DBHelper.TEXT_COL, result.getText());
    values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
    values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
    values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

    SQLiteOpenHelper helper = new DBHelper(activity);
    SQLiteDatabase db = null;
    try {
      db = helper.getWritableDatabase();
      // Insert the new entry into the DB.
      db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
    } finally {
      close(null, db);
    }
  }
コード例 #5
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   parseIntent(activity.getIntent());
   downLoadHelper = DownLoadHelper.getInstance(activity.getApplicationContext());
   dm = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE);
 }
コード例 #6
0
  public static void init(final Activity activity) {
    final ApplicationInfo applicationInfo = activity.getApplicationInfo();

    initListener();

    try {
      // Get the lib_name from AndroidManifest.xml metadata
      ActivityInfo ai =
          activity
              .getPackageManager()
              .getActivityInfo(activity.getIntent().getComponent(), PackageManager.GET_META_DATA);
      if (null != ai.metaData) {
        String lib_name = ai.metaData.getString(META_DATA_LIB_NAME);
        if (null != lib_name) {
          System.loadLibrary(lib_name);
        } else {
          System.loadLibrary(DEFAULT_LIB_NAME);
        }
      }
    } catch (PackageManager.NameNotFoundException e) {
      throw new RuntimeException("Error getting activity info", e);
    }

    Cocos2dxHelper.sPackageName = applicationInfo.packageName;
    Cocos2dxHelper.sFileDirectory = activity.getFilesDir().getAbsolutePath();
    // Cocos2dxHelper.nativeSetApkPath(applicationInfo.sourceDir);

    Cocos2dxHelper.sCocos2dMusic = new Cocos2dxMusic(activity);
    Cocos2dxHelper.sCocos2dSound = new Cocos2dxSound(activity);
    Cocos2dxHelper.sAssetManager = activity.getAssets();

    // Cocos2dxHelper.nativeSetAssetManager(sAssetManager);
    Cocos2dxBitmap.setContext(activity);
    sActivity = activity;
  }
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    Bundle args = activity.getIntent().getExtras();
    forecastsArray = args.getString("Forecasts");

    JSONArray forecasts;
    ForecastItem f = null;
    forecastItems = new ArrayList<ForecastItem>();

    try {
      forecasts = new JSONArray(forecastsArray);
      int numForecasts = forecasts.length();
      for (int i = 0; i < numForecasts; i++) {
        JSONObject forecast = forecasts.getJSONObject(i);
        f = new ForecastItem();
        f.setDay(forecast.getString("Day"));
        f.setForecastText(forecast.getString("ForecastText"));
        f.setWeatherIcon(forecast.getInt("weather_icon"));
        forecastItems.add(f);
      }
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
コード例 #8
0
    // load from settings/instanceState
    private void loadSettingsAndInstanceState(Activity context, Bundle savedInstanceState) {
      SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
      this.mCurrentPath = sharedPref.getString(STATE_CurrentPath, this.mCurrentPath);
      this.mDirQueryID = sharedPref.getInt(STATE_DirQueryID, this.getDirQueryID());
      this.mSortID = sharedPref.getInt(STATE_SortID, this.mSortID);
      this.mSortAscending = sharedPref.getBoolean(STATE_SortAscending, this.mSortAscending);
      this.mCurrentLatLon.get(
          DirectoryFormatter.parseLatLon(sharedPref.getString(STATE_LAT_LON, null)));

      // instance state overrides settings
      if (savedInstanceState != null) {
        this.mCurrentPath = savedInstanceState.getString(STATE_CurrentPath, this.mCurrentPath);
        this.mDirQueryID = savedInstanceState.getInt(STATE_DirQueryID, this.getDirQueryID());
        this.mSortID = savedInstanceState.getInt(STATE_SortID, this.mSortID);
        this.mSortAscending =
            savedInstanceState.getBoolean(STATE_SortAscending, this.mSortAscending);
        this.mFilter = savedInstanceState.getParcelable(STATE_Filter);
        this.mCurrentLatLon.get(
            DirectoryFormatter.parseLatLon(savedInstanceState.getString(STATE_LAT_LON)));

        this.mUseLatLon = savedInstanceState.getBoolean(STATE_LAT_LON_ACTIVE, this.mUseLatLon);
      }

      if (this.mFilter == null) {
        this.mFilter = new GalleryFilterParameterParcelable();
        mFilter.loadSettings(sharedPref);
      }
      // extra parameter
      this.mGalleryContentQuery = context.getIntent().getParcelableExtra(EXTRA_QUERY);
      if (this.mGalleryContentQuery == null)
        this.mGalleryContentQuery = FotoSql.getQuery(FotoSql.QUERY_TYPE_DEFAULT);
    }
コード例 #9
0
ファイル: FeedActivity.java プロジェクト: praetore/Donaid
 @Override
 protected String doInBackground(String... params) {
   String feedUrl = context.getIntent().getExtras().getString("Feed"); // feed als parameter
   RssAtomFeedRetriever feedRetriever = new RssAtomFeedRetriever();
   feed = feedRetriever.getMostRecentNews(feedUrl);
   return null;
 }
コード例 #10
0
 public static void startSplash(Activity activity) {
   int flags = activity.getIntent().getFlags();
   if ((flags & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) == 0) {
     Intent intent = new Intent(activity, SplashScreenActivity.class);
     activity.startActivity(intent);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Activity activity = getActivity();
    Intent intent = activity.getIntent();

    String key = SignedInUser.class.getSimpleName();
    SignedInUser user = (SignedInUser) intent.getSerializableExtra(key);

    android.util.Log.w(this.getClass().getSimpleName(), user.getUserRole().name());

    int layoutId = 0;

    switch (user.getUserRole()) {
      case EDITOR:
      case TEST_EDITOR:
        layoutId = R.layout.fragment_mission_statement_editor;
        break;

      case READER:
      case TEST_READER:
        layoutId = R.layout.fragment_mission_statement_reader;
        break;
    }

    View topLevelView = inflater.inflate(layoutId, container, false);

    View missionStatementView = initializeMissionStatement(topLevelView, user);
    initializeSaveButton(topLevelView, user, missionStatementView);

    return topLevelView;
  }
コード例 #12
0
  public void onCreate(Activity activity, Handler handler, AbsListView list) {

    mMusicManager = ManagerFactory.getMusicManager(this);
    mControlManager = ManagerFactory.getControlManager(this);

    ((ISortableManager) mMusicManager).setSortKey(AbstractManager.PREF_SORT_KEY_ALBUM);
    ((ISortableManager) mMusicManager)
        .setPreferences(activity.getPreferences(Context.MODE_PRIVATE));

    final String sdError = ImportUtilities.assertSdCard();
    mLoadCovers = sdError == null;

    if (!isCreated()) {
      super.onCreate(activity, handler, list);

      if (!mLoadCovers) {
        Toast toast =
            Toast.makeText(
                activity, sdError + " Displaying place holders only.", Toast.LENGTH_LONG);
        toast.show();
      }

      mArtist = (Artist) activity.getIntent().getSerializableExtra(ListController.EXTRA_ARTIST);
      mGenre = (Genre) activity.getIntent().getSerializableExtra(ListController.EXTRA_GENRE);
      activity.registerForContextMenu(mList);

      mFallbackBitmap =
          BitmapFactory.decodeResource(activity.getResources(), R.drawable.default_album);
      setupIdleListener();

      mList.setOnItemClickListener(
          new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
              if (isLoading()) return;
              Intent nextActivity;
              final Album album =
                  (Album) mList.getAdapter().getItem(((ThreeLabelsItemView) view).position);
              nextActivity = new Intent(view.getContext(), ListActivity.class);
              nextActivity.putExtra(ListController.EXTRA_LIST_CONTROLLER, new SongListController());
              nextActivity.putExtra(ListController.EXTRA_ALBUM, album);
              mActivity.startActivity(nextActivity);
            }
          });
      mList.setOnKeyListener(new ListControllerOnKeyListener<Album>());
      fetch();
    }
  }
コード例 #13
0
 @Override
 public Intent getIntent() {
   if (mFrom == DLConstants.FROM_INTERNAL) {
     return super.getIntent();
   } else {
     return mProxyActivity.getIntent();
   }
 }
コード例 #14
0
ファイル: Preffrag.java プロジェクト: Nilpo/AmazeFileManager
 public static void restartPC(final Activity activity) {
   if (activity == null) return;
   final int enter_anim = android.R.anim.fade_in;
   final int exit_anim = android.R.anim.fade_out;
   activity.overridePendingTransition(enter_anim, exit_anim);
   activity.finish();
   activity.overridePendingTransition(enter_anim, exit_anim);
   activity.startActivity(activity.getIntent());
 }
コード例 #15
0
 public DetailAddressModel(Activity Context) {
   this.mContext = Context;
   Bundle bundle = new Bundle();
   bundle = mContext.getIntent().getExtras();
   this.ROAD = bundle.getString("ROAD");
   this.UNIT_NAME = bundle.getString("UNIT_NAME");
   this.CUS_DOM = bundle.getString("CUS_DOM");
   this.CUS_DY = bundle.getString("CUS_DY");
 }
コード例 #16
0
ファイル: et.java プロジェクト: eFOIA-12/eFOIA
 private static boolean c(Activity var0) throws et.a {
   Intent var1 = var0.getIntent();
   if (!var1.hasExtra("com.google.android.gms.ads.internal.purchase.useClientJar")) {
     throw new et.a("InAppPurchaseManager requires the useClientJar flag in intent extras.");
   } else {
     return var1.getBooleanExtra(
         "com.google.android.gms.ads.internal.purchase.useClientJar", false);
   }
 }
コード例 #17
0
 public void checkTalkBackModeOnResume(Intent intent) {
   if (accessibilityUtil.isAccessibilityEnabled() != wasInAccessibilityMode) {
     wasInAccessibilityMode = accessibilityUtil.isAccessibilityEnabled();
     Intent intent1 = intent;
     if (intent == null) {
       intent1 = activity.getIntent();
       activity.finish();
     }
     activity.startActivity(intent1);
   }
 }
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    Bundle args = activity.getIntent().getExtras();
    Date date = new Date(Long.parseLong(args.getString("AlertPublishDate")));
    mAlertPublishDate = displayDateFormat.format(date);
    mAlertDescription = args.getString("AlertDescription");
    mAlertFullText = args.getString("AlertFullText");
    mContent = formatText(mAlertPublishDate, mAlertDescription, mAlertFullText);
  }
コード例 #19
0
ファイル: TabDelegate.java プロジェクト: vadimtk/chrome4sdp
  /**
   * Creates a Tab to host the given WebContents asynchronously.
   *
   * @param asyncParams Parameters to create the Tab with, including the URL.
   * @param type Information about how the tab was launched.
   * @param parentId ID of the parent tab, if it exists.
   */
  public void createNewTab(AsyncTabCreationParams asyncParams, TabLaunchType type, int parentId) {
    assert asyncParams != null;

    // Tabs should't be launched in affiliated mode when a webcontents exists.
    assert !(type == TabLaunchType.FROM_LONGPRESS_BACKGROUND
        && asyncParams.getWebContents() != null);

    Context context = ApplicationStatus.getApplicationContext();
    Activity parentActivity = ActivityDelegate.getActivityForTabId(parentId);

    boolean mayLaunchDocumentActivity = isAllowedToLaunchDocumentActivity(context);
    assert mayLaunchDocumentActivity || (asyncParams.getWebContents() == null);

    if (FeatureUtilities.isDocumentMode(context) && mayLaunchDocumentActivity) {
      AsyncDocumentLauncher.getInstance().enqueueLaunch(mIsIncognito, parentId, asyncParams);
    } else {
      // TODO(dfalcantara): Is it possible to get rid of this conditional?
      int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
      AsyncTabCreationParamsManager.add(assignedTabId, asyncParams);

      Intent intent =
          new Intent(Intent.ACTION_VIEW, Uri.parse(asyncParams.getLoadUrlParams().getUrl()));
      intent.setClass(context, ChromeLauncherActivity.class);
      intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId);
      intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, mIsIncognito);
      intent.putExtra(IntentHandler.EXTRA_PARENT_TAB_ID, parentId);

      if (parentActivity != null && parentActivity.getIntent() != null) {
        intent.putExtra(IntentHandler.EXTRA_PARENT_INTENT, parentActivity.getIntent());
      }

      if (asyncParams.getRequestId() != null) {
        intent.putExtra(
            ServiceTabLauncher.LAUNCH_REQUEST_ID_EXTRA, asyncParams.getRequestId().intValue());
      }

      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      IntentHandler.startActivityForTrustedIntent(intent, context);
    }
  }
コード例 #20
0
 @SuppressLint("NewApi")
 public static final void recreateActivityCompat(final Activity a) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
     a.recreate();
   } else {
     final Intent intent = a.getIntent();
     intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
     a.finish();
     a.overridePendingTransition(0, 0);
     a.startActivity(intent);
     a.overridePendingTransition(0, 0);
   }
 }
コード例 #21
0
  static boolean updateButtonBar(Activity a, int highlight) {
    final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar);
    boolean withtabs = false;
    Intent intent = a.getIntent();
    if (intent != null) {
      withtabs = intent.getBooleanExtra("withtabs", false);
    }

    if (highlight == 0 || !withtabs) {
      ll.setVisibility(View.GONE);
      return withtabs;
    } else if (withtabs) {
      ll.setVisibility(View.VISIBLE);
    }
    for (int i = ll.getChildCount() - 1; i >= 0; i--) {

      View v = ll.getChildAt(i);
      boolean isActive = (v.getId() == highlight);
      if (isActive) {
        ll.setCurrentTab(i);
        sActiveTabIndex = i;
      }
      v.setTag(i);
      v.setOnFocusChangeListener(
          new View.OnFocusChangeListener() {

            public void onFocusChange(View v, boolean hasFocus) {
              if (hasFocus) {
                for (int i = 0; i < ll.getTabCount(); i++) {
                  if (ll.getChildTabViewAt(i) == v) {
                    ll.setCurrentTab(i);
                    processTabClick(
                        (Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId());
                    break;
                  }
                }
              }
            }
          });

      v.setOnClickListener(
          new View.OnClickListener() {

            public void onClick(View v) {
              processTabClick(
                  (Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId());
            }
          });
    }
    return withtabs;
  }
コード例 #22
0
 /** Utility function for discerning an entry source from an activity's Intent. */
 public static String entrySource(Activity activity) {
   Intent intent = activity.getIntent();
   String action = intent.getAction();
   boolean main = action != null && action.equals(Intent.ACTION_MAIN);
   if (main) {
     String source = ENTRY_MAIN;
     Bundle extras = intent.getExtras();
     if (extras != null) {
       String extra = extras.getString(EXTRA_ENTRY_FROM);
       if (extra != null) source = extra;
     }
     return source;
   } else return null;
 }
コード例 #23
0
ファイル: OobeUtils.java プロジェクト: zst123/p201-packages
 public static void startSimEditor(SettingsPreferenceFragment fragment, Bundle extras) {
   Activity activity = fragment.getActivity();
   if (activity.getIntent().getBooleanExtra(EXTRA_IS_OOBE, false)) {
     Intent intent = new Intent(activity, SetupWizardForOobe.class);
     intent.putExtra(EXTRA_IS_OOBE, true);
     intent.putExtra(EXTRA_OOBE_SETTINGS, ID_SIM_INFO_EDITOR);
     intent.putExtra(
         OOBE_BASIC_STEP_TOTAL, activity.getIntent().getIntExtra(OOBE_BASIC_STEP_TOTAL, 1));
     intent.putExtra(
         OOBE_BASIC_STEP_INDEX, activity.getIntent().getIntExtra(OOBE_BASIC_STEP_INDEX, 0));
     intent.putExtras(extras);
     activity.startActivity(intent);
     activity.overridePendingTransition(R.anim.slide_right_in, R.anim.slide_left_out);
   } else {
     fragment.startFragment(
         fragment,
         SimInfoEditor.class.getCanonicalName(),
         -1,
         extras,
         R.string.gemini_sim_info_title);
     Xlog.i(TAG, "startFragment " + SimInfoEditor.class.getCanonicalName());
   }
 }
コード例 #24
0
ファイル: NfcScanner.java プロジェクト: jthurne/kanban-salad
  @Override
  public ScanableTag scan() {
    Intent intent = parentActivity.getIntent();
    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
      Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
      return rawToScanable(rawMsgs);
    }

    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) {
      return new EmptyTag();
    }

    return null;
  }
コード例 #25
0
  @Override
  public Map<String, Object> getConstants() {
    final Map<String, Object> constants = new HashMap<>();

    Intent intent = mActivity.getIntent();

    Bundle bundle = intent.getBundleExtra("notification");
    if (bundle != null) {
      bundle.putBoolean("foreground", false);
      String bundleString = convertJSON(bundle);
      constants.put("initialNotification", bundleString);
    }

    return constants;
  }
コード例 #26
0
  /**
   * Create a {@link FabTransform} from the supplied {@code activity} extras and set as its shared
   * element enter/return transition.
   */
  public static boolean setup(@NonNull Activity activity, @Nullable View target) {
    final Intent intent = activity.getIntent();
    if (!intent.hasExtra(EXTRA_FAB_COLOR) || !intent.hasExtra(EXTRA_FAB_ICON_RES_ID)) {
      return false;
    }

    final int color = intent.getIntExtra(EXTRA_FAB_COLOR, Color.TRANSPARENT);
    final int icon = intent.getIntExtra(EXTRA_FAB_ICON_RES_ID, -1);
    final FabTransform sharedEnter = new FabTransform(color, icon);
    if (target != null) {
      sharedEnter.addTarget(target);
    }
    activity.getWindow().setSharedElementEnterTransition(sharedEnter);
    return true;
  }
コード例 #27
0
ファイル: IrrcUsbDriver.java プロジェクト: sorako/kotemaru
 public static IrrcUsbDriver init(Activity activity, String permissionName) {
   IrrcUsbDriver driver = new IrrcUsbDriver(activity, permissionName);
   // USB_DEVICE_ATTACHEDから起動された場合は intent がデバイスを持っている。
   UsbDevice device = activity.getIntent().getParcelableExtra(UsbManager.EXTRA_DEVICE);
   if (device == null) {
     // LAUNCHER からの起動の場合は接続済デバイス一覧から検索する。
     device = findDevice(driver.usbManager, VENDER_ID, PRODUCT_ID);
   }
   /*
    * USB_DEVICE_ATTACHED で起動するように AndroidManifest.xml を記述すると
    * USB_DEVICE_ATTACHED で必ず onCreate() が呼ばれるので Activity から設定した Receiver は呼ばれない。
    * 従って、ここで onAttach() を呼ぶ。
    */
   driver.onAttach(device);
   return driver;
 }
コード例 #28
0
    /**
     * Used by: plugin EditActivity.
     *
     * <p>Description as above.
     *
     * <p>This version also includes backwards compatibility with pre 4.2 Tasker versions. At some
     * point this function will be deprecated.
     *
     * @param editActivity the plugin edit activity, needed to test calling Tasker version
     * @see #setVariableReplaceKeys(Bundle, String[])
     */
    public static boolean hostSupportsOnFireVariableReplacement(Activity editActivity) {

      boolean supportedFlag =
          hostSupportsOnFireVariableReplacement(editActivity.getIntent().getExtras());

      if (!supportedFlag) {
        String callerPackage = editActivity.getCallingActivity().getPackageName();

        // Tasker only supporteed this from 1.0.10
        supportedFlag =
            (callerPackage.startsWith(BASE_KEY))
                && (getPackageVersionCode(editActivity.getPackageManager(), callerPackage)
                    > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION);
      }

      return supportedFlag;
    }
コード例 #29
0
  public void dispatchProxyToPlugin() {

    if (plugin.getBaseContext() != null) return;
    try {
      // Finals 修改以前的注入方式,采用原生的方式
      Instrumentation instrumentation = proxyRef.get("mInstrumentation");
      pluginRef.call(
          // 方法名
          "attach",
          // Context context
          proxy,
          // ActivityThread aThread
          proxyRef.get("mMainThread"),
          // Instrumentation instr
          new LPluginInstrument(instrumentation),
          // IBinder token
          proxyRef.get("mToken"),
          // int ident
          proxyRef.get("mEmbeddedID") == null ? 0 : proxyRef.get("mEmbeddedID"),
          // Application application
          app == null ? proxy.getApplication() : app,
          // Intent intent
          proxy.getIntent(),
          // ActivityInfo info
          proxyRef.get("mActivityInfo"),
          // CharSequence title
          proxy.getTitle(),
          // Activity parent
          proxy.getParent(),
          // String id
          proxyRef.get("mEmbeddedID"),
          // NonConfigurationInstances lastNonConfigurationInstances
          proxy.getLastNonConfigurationInstance(),
          // Configuration config
          proxyRef.get("mCurrentConfig"));

      pluginRef.set("mWindow", proxy.getWindow());
      plugin.getWindow().setCallback(plugin);
      Reflect.on(proxy.getBaseContext()).call("setOuterContext", plugin);

    } catch (ReflectException e) {
      System.out.println("gyb-->" + e);
      e.printStackTrace();
    }
  }
コード例 #30
0
  @ReactMethod
  public void start() {
    if (_initialized) {
      FeedbackManager.register(_activity, _token, null);

      CrashManager.register(_activity, _token, _crashManagerListener);

      int authenticationMode;
      switch (_authType) {
        case AUTHENTICATION_TYPE_EMAIL_SECRET:
          {
            authenticationMode = LoginManager.LOGIN_MODE_EMAIL_ONLY;
            break;
          }
        case AUTHENTICATION_TYPE_EMAIL_PASSWORD:
          {
            authenticationMode = LoginManager.LOGIN_MODE_EMAIL_PASSWORD;
            break;
          }
        case AUTHENTICATION_TYPE_DEVICE_UUID:
          {
            authenticationMode = LoginManager.LOGIN_MODE_VALIDATE;
            break;
          }
        case AUTHENTICATION_TYPE_WEB:
          {
            throw new IllegalArgumentException("Web authentication is not supported!");
          }
        case AUTHENTICATION_TYPE_ANONYMOUS:
        default:
          {
            authenticationMode = LoginManager.LOGIN_MODE_ANONYMOUS;
            break;
          }
      }

      LoginManager.register(_context, _token, _appSecret, authenticationMode, _activity.getClass());
      LoginManager.verifyLogin(_activity, _activity.getIntent());

      _crashManagerListener.deleteMetadataFileIfExists();
    }
  }