Search in sources :

Example 1 with StorageManager

use of com.benmu.framework.manager.StorageManager in project WeexErosFramework by bmfe.

the class EventSetHomePage method setHomePage.

@SuppressWarnings("WrongConstant")
public void setHomePage(Context context, String params) {
    StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
    storageManager.setData(context, Constant.SP.SP_HOMEPAGE_URL, params);
    String homePage = BMWXEnvironment.mPlatformConfig.getPage().getHomePage(context);
    RouterModel router = new RouterModel(homePage, Constant.ACTIVITIES_ANIMATION.ANIMATION_PUSH, null, null, false, null);
    Intent intent = performStartActivity(router, Constant.BMPAGE_CATEGORY);
    context.startActivity(intent);
// PendingIntent restartIntent = PendingIntent.getActivity(
// context.getApplicationContext(), 0, intent, Intent.FLAG_ACTIVITY_CLEAR_TASK);
// AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100,
// restartIntent);
}
Also used : RouterModel(com.benmu.framework.model.RouterModel) StorageManager(com.benmu.framework.manager.StorageManager) Intent(android.content.Intent)

Example 2 with StorageManager

use of com.benmu.framework.manager.StorageManager in project WeexErosFramework by bmfe.

the class EventDeleteData method deleteData.

public void deleteData(Context context, ArrayList<String> paramsList, JSCallback jscallback) {
    String key = paramsList.get(0);
    StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
    boolean result = storageManager.deleteData(context, key);
    if (result) {
        JsPoster.postSuccess(null, jscallback);
    } else {
        JsPoster.postFailed("删除" + key + "失败", jscallback);
    }
}
Also used : StorageManager(com.benmu.framework.manager.StorageManager)

Example 3 with StorageManager

use of com.benmu.framework.manager.StorageManager in project WeexErosFramework by bmfe.

the class EventGetData method getDataSync.

public Object getDataSync(Context context, ArrayList<String> list) {
    String key = list.get(0);
    StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
    String result = storageManager.getData(context, key);
    return result == null ? JsPoster.getFailed() : JsPoster.getSuccess(result);
}
Also used : StorageManager(com.benmu.framework.manager.StorageManager)

Example 4 with StorageManager

use of com.benmu.framework.manager.StorageManager in project WeexErosFramework by bmfe.

the class EventRemoveData method removeData.

public void removeData(Context context, JSCallback jscallback) {
    StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
    boolean result = storageManager.removeData(context);
    if (result) {
        JsPoster.postSuccess(null, jscallback);
    } else {
        JsPoster.postFailed(jscallback);
    }
}
Also used : StorageManager(com.benmu.framework.manager.StorageManager)

Example 5 with StorageManager

use of com.benmu.framework.manager.StorageManager in project WeexErosFramework by bmfe.

the class EventDeleteData method deleteDataSync.

public Object deleteDataSync(Context context, ArrayList<String> paramsList) {
    String key = paramsList.get(0);
    StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
    boolean result = storageManager.deleteData(context, key);
    return result ? JsPoster.getSuccess() : JsPoster.getFailed("删除" + key + "失败");
}
Also used : StorageManager(com.benmu.framework.manager.StorageManager)

Aggregations

StorageManager (com.benmu.framework.manager.StorageManager)9 Intent (android.content.Intent)1 RouterModel (com.benmu.framework.model.RouterModel)1