public void onCreate(final Bundle savedInstanceState) { PrefsUtility.applyTheme(this); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); super.onCreate(savedInstanceState); final Intent intent = getIntent(); final String html = intent.getStringExtra("html"); final String title = intent.getStringExtra("title"); setTitle(title); if (html == null) { BugReportActivity.handleGlobalError(this, "No HTML"); } webView = WebViewFragment.newInstanceHtml(html); setContentView(View.inflate(this, R.layout.main_single, null)); getSupportFragmentManager().beginTransaction().add(R.id.main_single_frame, webView).commit(); }
@SuppressWarnings("deprecation") @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(new Bundle()); // XXX: Simple ugly fix. mGaInstance = GoogleAnalytics.getInstance(this); mGaTracker = mGaInstance.getTracker("UA-39295928-1"); setContentView(R.layout.activity_sign_listing); Display display = getWindowManager().getDefaultDisplay(); if (android.os.Build.VERSION.SDK_INT >= 13) { Point size = new Point(); display.getSize(size); screenWidth = size.x; screenHeight = size.y; } else { screenWidth = display.getWidth(); screenHeight = display.getHeight(); } screenSize = getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; switch (screenSize) { case Configuration.SCREENLAYOUT_SIZE_NORMAL: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; case Configuration.SCREENLAYOUT_SIZE_SMALL: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; default: break; } // Load local json new LoadHelper().execute(); getSupportFragmentManager() .beginTransaction() .add(R.id.fragment_container, new PagerFragment()) .commit(); // If we are on a tablet the details fragment should be added if (screenSize == Configuration.SCREENLAYOUT_SIZE_XLARGE || screenSize == Configuration.SCREENLAYOUT_SIZE_LARGE) { detFragment = new SignDetailFragment(); getSupportFragmentManager().beginTransaction().add(R.id.sign_detail, detFragment).commit(); } }
@Override public void onCreate(Bundle savedInstanceState) { mFirstRun = savedInstanceState == null; // This line restore instance state when we are change theme and // activity restarts savedInstanceState = instanceState(savedInstanceState); super.onCreate(savedInstanceState); mCreatedByThemeManager = getIntent().getBooleanExtra(ThemeManager.KEY_CREATED_BY_THEME_MANAGER, false); if (mCreatedByThemeManager) { mFirstRun = false; } if (savedInstanceState != null) { mDisableMusic = savedInstanceState.getBoolean(KEY_DISABLE_MUSIC, false); mCurrentPage = savedInstanceState.getInt(KEY_PAGE, 0); } final ActionBar ab = getSupportActionBar(); ab.setTitle(R.string.library_name); setContentView(R.layout.content); final SlidingMenuA addonSM = requireSlidingMenu(); final SlidingMenu sm = addonSM.getSlidingMenu(); View menu = findViewById(R.id.menu); if (menu == null) { // Phone mStaticSlidingMenu = true; ab.setDisplayHomeAsUpEnabled(true); addonSM.setBehindContentView(makeMenuView(savedInstanceState)); addonSM.setSlidingActionBarEnabled(true); sm.setBehindWidth(computeMenuWidth()); sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); sm.setSlidingEnabled(true); } else { // Tablet mStaticSlidingMenu = false; addonSM.setBehindContentView(new View(this)); // dummy view sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE); sm.setSlidingEnabled(false); prepareMenuView(menu, savedInstanceState); } getSupportFragmentManager().addOnBackStackChangedListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.dp.familyorganaizer.R.layout.family_journal); btn_new_msg = (Button) findViewById(com.dp.familyorganaizer.R.id.btn_new_msg); btn_new_msg.setOnClickListener(this); btn_edit_msg = (Button) findViewById(com.dp.familyorganaizer.R.id.btn_edit_msg); btn_edit_msg.setOnClickListener(this); btn_delete_msg = (Button) findViewById(com.dp.familyorganaizer.R.id.btn_delete_msg); btn_delete_msg.setOnClickListener(this); // txtview = (TextView) findViewById(com.dp.familyorganaizer.R.id.txtview); // txtview.setText("Hello there!"); // txtview.setOnClickListener(this); }
/** {@inheritDoc} */ @SuppressWarnings("deprecation") @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Title bar shows up in gingerbread, I'm too tired to figure out why. if (!ApolloUtils.hasHoneycomb()) { requestWindowFeature(Window.FEATURE_NO_TITLE); } // Initialze the theme resources mResources = new ThemeUtils(this); // Set the overflow style mResources.setOverflowStyle(this); // Fade it in overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); // Control the media volume setVolumeControlStream(AudioManager.STREAM_MUSIC); // Bind Apollo's service mToken = MusicUtils.bindToService(this, this); // Theme the action bar final ActionBar actionBar = getSupportActionBar(); mResources.themeActionBar(actionBar, getString(R.string.app_name)); actionBar.setDisplayHomeAsUpEnabled(true); // Set the layout setContentView(R.layout.grid_base); // Give the background a little UI final FrameLayout background = (FrameLayout) findViewById(R.id.grid_base_container); background.setBackgroundDrawable(getResources().getDrawable(R.drawable.pager_background)); // Get the query final String query = getIntent().getStringExtra(SearchManager.QUERY); mFilterString = !TextUtils.isEmpty(query) ? query : null; // Action bar subtitle mResources.setSubtitle("\"" + mFilterString + "\""); // Initialize the adapter mAdapter = new SearchAdapter(this); // Set the prefix mAdapter.setPrefix(mFilterString); // Initialze the list mGridView = (GridView) findViewById(R.id.grid_base); // Bind the data mGridView.setAdapter(mAdapter); // Recycle the data mGridView.setRecyclerListener(new RecycleHolder()); // Seepd up scrolling mGridView.setOnScrollListener(this); mGridView.setOnItemClickListener(this); if (ApolloUtils.isLandscape(this)) { mGridView.setNumColumns(TWO); } else { mGridView.setNumColumns(ONE); } // Prepare the loader. Either re-connect with an existing one, // or start a new one. getSupportLoaderManager().initLoader(0, null, this); }
@Override protected void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); getSupportActionBar().setTitle(R.string.post_captcha_title); super.onCreate(savedInstanceState); final LoadingView loadingView = new LoadingView(this, R.string.download_waiting, true, true); setContentView(loadingView); final RedditAccount selectedAccount = RedditAccountManager.getInstance(this).getAccount(getIntent().getStringExtra("username")); final CacheManager cm = CacheManager.getInstance(this); RedditAPI.newCaptcha( cm, new APIResponseHandler.NewCaptchaResponseHandler(this) { @Override protected void onSuccess(final String captchaId) { final URI captchaUrl = Constants.Reddit.getUri("/captcha/" + captchaId); cm.makeRequest( new CacheRequest( captchaUrl, RedditAccountManager.getAnon(), null, Constants.Priority.CAPTCHA, 0, CacheRequest.DownloadType.FORCE, Constants.FileType.CAPTCHA, false, false, true, CaptchaActivity.this) { @Override protected void onCallbackException(Throwable t) { BugReportActivity.handleGlobalError(CaptchaActivity.this, t); } @Override protected void onDownloadNecessary() {} @Override protected void onDownloadStarted() { loadingView.setIndeterminate(R.string.download_downloading); } @Override protected void onFailure( RequestFailureType type, Throwable t, StatusLine status, String readableMessage) { final RRError error = General.getGeneralErrorForFailure( CaptchaActivity.this, type, t, status, url.toString()); General.showResultDialog(CaptchaActivity.this, error); finish(); } @Override protected void onProgress(long bytesRead, long totalBytes) { loadingView.setProgress( R.string.download_downloading, (float) ((double) bytesRead / (double) totalBytes)); } @Override protected void onSuccess( final CacheManager.ReadableCacheFile cacheFile, long timestamp, UUID session, boolean fromCache, String mimetype) { final Bitmap image; try { image = BitmapFactory.decodeStream(cacheFile.getInputStream()); } catch (IOException e) { BugReportActivity.handleGlobalError(CaptchaActivity.this, e); return; } new Handler(Looper.getMainLooper()) .post( new Runnable() { public void run() { final LinearLayout ll = new LinearLayout(CaptchaActivity.this); ll.setOrientation(LinearLayout.VERTICAL); final ImageView captchaImg = new ImageView(CaptchaActivity.this); ll.addView(captchaImg); final LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) captchaImg.getLayoutParams(); layoutParams.setMargins(20, 20, 20, 20); layoutParams.height = General.dpToPixels(context, 100); captchaImg.setScaleType(ImageView.ScaleType.FIT_CENTER); final EditText captchaText = new EditText(CaptchaActivity.this); ll.addView(captchaText); ((LinearLayout.LayoutParams) captchaText.getLayoutParams()) .setMargins(20, 0, 20, 20); captchaText.setInputType( android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType .TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS); captchaImg.setImageBitmap(image); final Button submitButton = new Button(CaptchaActivity.this); submitButton.setText(R.string.post_captcha_submit_button); ll.addView(submitButton); ((LinearLayout.LayoutParams) submitButton.getLayoutParams()) .setMargins(20, 0, 20, 20); ((LinearLayout.LayoutParams) submitButton.getLayoutParams()) .gravity = Gravity.RIGHT; ((LinearLayout.LayoutParams) submitButton.getLayoutParams()).width = LinearLayout.LayoutParams.WRAP_CONTENT; submitButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { final Intent result = new Intent(); result.putExtra("captchaId", captchaId); result.putExtra( "captchaText", captchaText.getText().toString()); setResult(RESULT_OK, result); finish(); } }); final ScrollView sv = new ScrollView(CaptchaActivity.this); sv.addView(ll); setContentView(sv); } }); } }); } @Override protected void onCallbackException(Throwable t) { BugReportActivity.handleGlobalError(CaptchaActivity.this, t); } @Override protected void onFailure( RequestFailureType type, Throwable t, StatusLine status, String readableMessage) { final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type, t, status, null); General.showResultDialog(CaptchaActivity.this, error); finish(); } @Override protected void onFailure(APIFailureType type) { final RRError error = General.getGeneralErrorForFailure(CaptchaActivity.this, type); General.showResultDialog(CaptchaActivity.this, error); finish(); } }, selectedAccount, this); }