android.os.bundle Java Examples

The following examples show how to use android.os.bundle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrackingUtil.java    From Augendiagnose with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Send timing information.
 *
 * @param category The event category.
 * @param variable The variable.
 * @param label    The label.
 * @param duration The duration.
 */
public static void sendTiming(final Category category, final String variable, final String label, final long duration) {
	getDefaultFirebaseAnalytics();

	Bundle params = new Bundle();
	params.putString("category", category.toString());
	params.putString("variable", variable);
	if (label == null) {
		params.putString("label", variable);
	}
	else {
		params.putString("label", variable + " - " + label);
	}
	params.putLong("value", duration);
	mFirebaseAnalytics.logEvent("Timing", params);
}
 
Example #2
Source File: DropInActivityUnitTest.java    From braintree-android-drop-in with MIT License 6 votes vote down vote up
@Test
public void onSaveInstanceState_savesDeviceData() throws NoSuchFieldException,
        IllegalAccessException {
    mActivityController.setup();
    setField(DropInActivity.class, mActivity, "mDeviceData", "device-data-string");

    Bundle bundle = new Bundle();
    mActivityController.saveInstanceState(bundle)
            .pause()
            .stop()
            .destroy();

    mActivityController = Robolectric.buildActivity(DropInUnitTestActivity.class);
    mActivity = (DropInUnitTestActivity) mActivityController.get();
    mActivityController.setup(bundle);

    assertEquals("device-data-string", getField(DropInActivity.class, mActivity, "mDeviceData"));
}
 
Example #3
Source File: AreaPickerDialogFragment.java    From AndroidNavigation with MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_area_picker, container, false);
    root.findViewById(R.id.iv_cancel).setOnClickListener(v -> {
        hideDialog();
    });
    root.findViewById(R.id.tv_finish).setOnClickListener(v -> {
        int[] items = wheelOptions.getCurrentItems();
        String text = areaUtils.getOptions1Items().get(items[0]) + "-"
                + areaUtils.getOptions2Items().get(items[0]).get(items[1]) + "-"
                + areaUtils.getOptions3Items().get(items[0]).get(items[1]).get(items[2]);
        Bundle data = new Bundle();
        data.putString(KEY_SELECTED_AREA, text);
        setResult(Activity.RESULT_OK, data);
        hideDialog();
    });

    wheelOptions = new WheelOptions<>(root, true);
    return root;
}
 
Example #4
Source File: SplashActivity.java    From ReadMark with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
            , WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_splash);
    mLoadingAnimView = (LoadingAnimView) findViewById(R.id.loading_anim_view);
    mLoadingAnimView.setOnViewAnimEndListener(new LoadingAnimView.OnViewAnimEndListener() {
        @Override
        public void onViewAnimEnd() {
            Intent intent = new Intent(SplashActivity.this, MainActivity.class);
            SplashActivity.this.startActivity(intent);
            SplashActivity.this.finish();
        }
    });
    //mLoadingAnimView.startAnim();
}
 
Example #5
Source File: CatalogueFragment.java    From Jreader with GNU General Public License v2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_catalogue, container, false);
    catalogueListView = (ListView)view.findViewById(R.id.catalogue);
    catalogueListView.setOnItemClickListener(this);
    Bundle bundle = getArguments();
    if (bundle != null) {
        mArgument = bundle.getString(ARGUMENT);
    }
    bookCatalogueList = new ArrayList<>();
    bookCatalogueList = DataSupport.where("bookpath = ?", mArgument).find(BookCatalogue.class);
    CatalogueAdapter catalogueAdapter = new CatalogueAdapter(getActivity(),bookCatalogueList);
    catalogueListView.setAdapter(catalogueAdapter);
    return view;
}
 
Example #6
Source File: MainActivity.java    From android-BasicManagedProfile with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_real);
    if (savedInstanceState == null) {
        DevicePolicyManager manager = (DevicePolicyManager)
                getSystemService(Context.DEVICE_POLICY_SERVICE);
        if (manager.isProfileOwnerApp(getApplicationContext().getPackageName())) {
            // If the managed profile is already set up, we show the main screen.
            showMainFragment();
        } else {
            // If not, we show the set up screen.
            showSetupProfile();
        }
    }
}
 
Example #7
Source File: SplashActivity.java    From polling-station-app with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Creates a splash screen
 * @param savedInstanceState
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);
    thisActivity = this;

    downloadProgressText = (TextView) findViewById(R.id.download_progress_text);
    currentTask = (TextView) findViewById(R.id.progress_current_task);
    downloadProgressBar = (ProgressBar) findViewById(R.id.download_progress_bar);

    if (savedInstanceState == null) {
        try {
            blockChain = BlockChain.getInstance(getApplicationContext());
            handler = new Handler();
            initTextHandler = new Handler();
            initTextHandler.post(initTextUpdater);
            handler.post(startBlockChain);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #8
Source File: SuperSettingsActivity.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ViewUtils.inject(this);
    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    String[] tabs = getResources().getStringArray(R.array.super_setting);
    String uid = AppSPUtils.getUid(this);
    Fragment[] fragments = {new SuperSettingCommonFragment(), new SuperSettingUserFragment()};
    viewPager.setAdapter(new SimplePagerAdapter(getSupportFragmentManager(), tabs, fragments));




    SlidingTabLayout indicator = (SlidingTabLayout) findViewById(R.id.slidingIndicator);
    indicator.setDividerColors(0);
    indicator.setSelectedIndicatorColors(ThemeUtils.getThemeColor(this));
    indicator.setViewPager(viewPager);

    setCurr(indicator);

}
 
Example #9
Source File: BaseMusicFragment.java    From vk_music_android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    currentAudioCallback = new Observable.OnPropertyChangedCallback() {
        @Override
        public void onPropertyChanged(Observable observable, int i) {
            onCurrentAudioChanged(currentAudio.get());
        }
    };
    currentAlbumArtCallback = new Observable.OnPropertyChangedCallback() {
        @Override
        public void onPropertyChanged(Observable observable, int i) {
            getActivity().runOnUiThread(() -> {
                onCurrentAlbumArtChanged(currentAlbumArt.get());
            });
        }
    };
}
 
Example #10
Source File: NotificationCompat.java    From letv with Apache License 2.0 6 votes vote down vote up
public Builder extend(Builder builder) {
    Bundle wearableBundle = new Bundle();
    if (this.mFlags != 1) {
        wearableBundle.putInt(KEY_FLAGS, this.mFlags);
    }
    if (this.mInProgressLabel != null) {
        wearableBundle.putCharSequence(KEY_IN_PROGRESS_LABEL, this.mInProgressLabel);
    }
    if (this.mConfirmLabel != null) {
        wearableBundle.putCharSequence(KEY_CONFIRM_LABEL, this.mConfirmLabel);
    }
    if (this.mCancelLabel != null) {
        wearableBundle.putCharSequence(KEY_CANCEL_LABEL, this.mCancelLabel);
    }
    builder.getExtras().putBundle(EXTRA_WEARABLE_EXTENSIONS, wearableBundle);
    return builder;
}
 
Example #11
Source File: SearchActivity.java    From jellyfin-androidtv with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    boolean isSpeechEnabled = SpeechRecognizer.isRecognitionAvailable(this);

    // Determine fragment to use
    Fragment searchFragment = isSpeechEnabled
            ? new LeanbackSearchFragment()
            : new TextSearchFragment();

    // Add fragment
    getSupportFragmentManager()
            .beginTransaction()
            .replace(android.R.id.content, searchFragment)
            .commit();
}
 
Example #12
Source File: HeadItemFiveDontCloseOnChangeActivity.java    From AdvancedMaterialDrawer with Apache License 2.0 6 votes vote down vote up
@Override
public void init(Bundle savedInstanceState) {

    drawer = this;

    // add head Item (menu will be loaded automatically)
    this.addHeadItem(getHeadItem1());
    this.addHeadItem(getHeadItem2());
    this.addHeadItem(getHeadItem3());
    this.addHeadItem(getHeadItem4());
    this.addHeadItem(getHeadItem5());

    // load menu
    this.loadMenu(getCurrentHeadItem().getMenu());

    // load the MaterialItemSectionFragment, from the given startIndex
    this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
}
 
Example #13
Source File: GlassBroadcastFragment.java    From kickflip-android-sdk with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    if (VERBOSE) Log.i(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    if (!Kickflip.readyToBroadcast()) {
        Log.e(TAG, "Kickflip not properly prepared by BroadcastFragment's onCreate. SessionConfig: " + Kickflip.getSessionConfig() + " key " + Kickflip.getApiKey() + " secret " + Kickflip.getApiSecret());
    } else {
        setupBroadcaster();
        mBroadcaster.startRecording();
    }
}
 
Example #14
Source File: AboutActivity.java    From Chimee with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_about);

	setupToolbar();
	setAppNameAndVersion();
}
 
Example #15
Source File: CameraActivity.java    From camerademo with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera);

    displaySfv = findViewById(R.id.sf_display_demo_camera);
    takePicBtn = findViewById(R.id.btn_take_picture_demo_camera);
    picFl = findViewById(R.id.fl_picture_demo_camera);
    picIV = findViewById(R.id.iv_picture_demo_camera);
    lightTV = findViewById(R.id.tv_light_demo_camera);
    takePicBtn.setOnClickListener(this);
    picFl.setOnClickListener(this);

    sensorManager = LightSensorUtil.getSenosrManager(this);
}
 
Example #16
Source File: MainActivity.java    From LifecycleFragment with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    logScroll = findViewById(R.id.log_scroll);
    log = findViewById(R.id.log);

    pager = findViewById(R.id.pager);
    pager.setAdapter(new FirstAdapter(getSupportFragmentManager()));

    tab = findViewById(R.id.tab);
    tab.setupWithViewPager(pager);
}
 
Example #17
Source File: SanityCheckRootTools.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
private void visualUpdate(int action, String text) {
    Message msg = mHandler.obtainMessage();
    Bundle bundle = new Bundle();
    bundle.putInt(TestHandler.ACTION, action);
    bundle.putString(TestHandler.TEXT, text);
    msg.setData(bundle);
    mHandler.sendMessage(msg);
}
 
Example #18
Source File: DownloadActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    boolean isOffTheRecord = DownloadUtils.shouldShowOffTheRecordDownloads(getIntent());
    ComponentName parentComponent = IntentUtils.safeGetParcelableExtra(
            getIntent(), IntentHandler.EXTRA_PARENT_COMPONENT);
    mDownloadManagerUi = new DownloadManagerUi(this, isOffTheRecord, parentComponent);
    setContentView(mDownloadManagerUi.getView());
    mIsOffTheRecord = isOffTheRecord;
    mDownloadManagerUi.addObserver(mUiObserver);
    // Call updateForUrl() to align with how DownloadPage interacts with DownloadManagerUi.
    mDownloadManagerUi.updateForUrl(UrlConstants.DOWNLOADS_URL);
}
 
Example #19
Source File: ChartOneDayFragment.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO: inflate a fragment view
    View rootView = super.onCreateView(inflater, container, savedInstanceState);
    unbinder = ButterKnife.bind(this, rootView);
    return rootView;
}
 
Example #20
Source File: LocalPlayer.java    From android-MediaRouter with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Be sure to call the super class.
    super.onCreate(savedInstanceState);

    // Inflate the layout.
    setContentView(R.layout.sample_media_router_presentation);

    // Set up the surface view.
    mPresentationSurfaceView = (SurfaceView)findViewById(R.id.surface_view);
    SurfaceHolder holder = mPresentationSurfaceView.getHolder();
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    holder.addCallback(SurfaceViewPlayer.this);
    Log.i(TAG, "Presentation created");
}
 
Example #21
Source File: LocationDelegate.java    From FastWaiMai with MIT License 5 votes vote down vote up
public static LocationDelegate create(String address) {
	final Bundle args = new Bundle();
	args.putString(ARGS_LOCATION_DETAIL, address);
	final LocationDelegate delegate = new LocationDelegate();
	delegate.setArguments(args);
	return delegate;
}
 
Example #22
Source File: MessageDialogFragment.java    From sms-ticket with Apache License 2.0 5 votes vote down vote up
public static MessageDialogFragment newInstance(String message) {
    MessageDialogFragment dialog = new MessageDialogFragment();
    Bundle args = new Bundle();
    args.putString("message", message);
    dialog.setArguments(args);
    return dialog;
}
 
Example #23
Source File: NeptuneInstrument.java    From Neptune with Apache License 2.0 5 votes vote down vote up
@Override
public void callActivityOnRestoreInstanceState(Activity activity, Bundle savedInstanceState) {
    if (activity instanceof TransRecoveryActivity1) {
        mRecoveryHelper.saveSavedInstanceState(activity, savedInstanceState);
        return;
    }
    if (IntentUtils.isIntentForPlugin(activity.getIntent())) {
        String pkgName = IntentUtils.parsePkgAndClsFromIntent(activity.getIntent())[0];
        PluginLoadedApk loadedApk = PluginManager.getPluginLoadedApkByPkgName(pkgName);
        if (loadedApk != null && savedInstanceState != null) {
            savedInstanceState.setClassLoader(loadedApk.getPluginClassLoader());
        }
    }
    mHostInstr.callActivityOnRestoreInstanceState(activity, savedInstanceState);
}
 
Example #24
Source File: BaseLogActivity.java    From Android-Pull-To-Refresh with Apache License 2.0 5 votes vote down vote up
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (showLifeInfo)
        CommonLog.e(TAG, "onRestoreInstanceState");
    logThreadInfo();
}
 
Example #25
Source File: VAccountManager.java    From container with GNU General Public License v3.0 5 votes vote down vote up
public void updateCredentials(IAccountManagerResponse response, Account account, String authTokenType, boolean expectActivityLaunch, Bundle loginOptions) {
	try {
		getRemote().updateCredentials(VUserHandle.myUserId(), response, account, authTokenType, expectActivityLaunch, loginOptions);
	} catch (RemoteException e) {
		e.printStackTrace();
	}
}
 
Example #26
Source File: IRKitVirtualProfileListFragment.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {

    mDBHelper = new IRKitDBHelper(getActivity());
    mVirtualProfileAdapter = new VirtualProfileAdapter(getActivity(), createDeviceContainers());
    View rootView = inflater.inflate(R.layout.fragment_profilelist, container, false);

    mListView = (ListView) rootView.findViewById(R.id.listview_devicelist);
    mListView.setItemsCanFocus(true);
    mListView.setAdapter(mVirtualProfileAdapter);
    return rootView;
}
 
Example #27
Source File: ReceiptViewActivity.java    From budget-watch with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    setContentView(R.layout.receipt_view_activity);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null)
    {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    final Bundle b = getIntent().getExtras();
    receiptFilename = b.getString("receipt");

    final WebView receiptView = (WebView) findViewById(R.id.imageView);
    receiptView.getSettings().setBuiltInZoomControls(true);
    receiptView.getSettings().setAllowFileAccess(true);

    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    String data = "<html><body>" +
            "<img width=\"" + size.x + "\" " +
            "src=\"file://" + receiptFilename + "\"/>" +
            "</body></html>";

    receiptView.loadDataWithBaseURL("", data, "text/html", "utf-8", null);
}
 
Example #28
Source File: MainFragment.java    From Cake-VPN with GNU General Public License v2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    binding = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);

    View view = binding.getRoot();
    initializeAll();

    return view;
}
 
Example #29
Source File: HarDetailActivity.java    From AndroidHttpCapture with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrolling);
    ButterKnife.bind(this);

    setupActionBar();

    try {
        initHarLog(getIntent().getIntExtra("pos", -1));
    } catch (Exception e) {
        e.printStackTrace();
        finish();
    }
}
 
Example #30
Source File: ServiceInterface.java    From letv with Apache License 2.0 5 votes vote down vote up
public static void a(Context context, String str) {
    if (context != null && !e(context)) {
        if (b() || !e.n) {
            a.a(context, str);
            return;
        }
        Intent intent = new Intent(context, PushService.class);
        Bundle bundle = new Bundle();
        bundle.putInt(z[1], 4);
        bundle.putString(z[0], str);
        intent.setAction(z[2]);
        intent.putExtras(bundle);
        context.startService(intent);
    }
}