use of androidx.appcompat.widget.Toolbar in project Timber by naman14.
the class DonateActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donate);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Support development");
action = getIntent().getAction();
productListView = (LinearLayout) findViewById(R.id.product_list);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
status = (TextView) findViewById(R.id.donation_status);
if (action != null && action.equals("restore")) {
status.setText("Restoring purchases..");
}
bp = new BillingProcessor(this, getString(R.string.play_billing_license_key), this);
}
use of androidx.appcompat.widget.Toolbar in project Tusky by Vavassor.
the class ViewTagActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_tag);
String hashtag = getIntent().getStringExtra(HASHTAG);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setTitle(String.format(getString(R.string.title_tag), hashtag));
bar.setDisplayHomeAsUpEnabled(true);
bar.setDisplayShowHomeEnabled(true);
}
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
Fragment fragment = TimelineFragment.newHashtagInstance(Collections.singletonList(hashtag));
fragmentTransaction.replace(R.id.fragment_container, fragment);
fragmentTransaction.commit();
}
use of androidx.appcompat.widget.Toolbar in project materialistic by hidroh.
the class OfflineWebActivity method onCreate.
@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getStringExtra(EXTRA_URL);
if (TextUtils.isEmpty(url)) {
finish();
return;
}
setTitle(url);
setContentView(R.layout.activity_offline_web);
final NestedScrollView scrollView = (NestedScrollView) findViewById(R.id.nested_scroll_view);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setOnClickListener(v -> scrollView.smoothScrollTo(0, 0));
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
getSupportActionBar().setSubtitle(R.string.offline);
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress);
final WebView webView = (WebView) findViewById(R.id.web_view);
webView.setBackgroundColor(Color.TRANSPARENT);
webView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(this)) {
@Override
public void onPageFinished(WebView view, String url) {
setTitle(view.getTitle());
}
});
webView.setWebChromeClient(new CacheableWebView.ArchiveClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
progressBar.setVisibility(View.VISIBLE);
progressBar.setProgress(newProgress);
if (newProgress == 100) {
progressBar.setVisibility(View.GONE);
webView.setBackgroundColor(Color.WHITE);
webView.setVisibility(View.VISIBLE);
}
}
});
AppUtils.toggleWebViewZoom(webView.getSettings(), true);
webView.loadUrl(url);
}
use of androidx.appcompat.widget.Toolbar in project PhotoView by chrisbanes.
the class RotationSampleActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rotation_sample);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.rotation);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_rotate_10_right:
photo.setRotationBy(10);
return true;
case R.id.action_rotate_10_left:
photo.setRotationBy(-10);
return true;
case R.id.action_toggle_automatic_rotation:
toggleRotation();
return true;
case R.id.action_reset_to_0:
photo.setRotationTo(0);
return true;
case R.id.action_reset_to_90:
photo.setRotationTo(90);
return true;
case R.id.action_reset_to_180:
photo.setRotationTo(180);
return true;
case R.id.action_reset_to_270:
photo.setRotationTo(270);
return true;
}
return false;
}
});
photo = findViewById(R.id.iv_photo);
photo.setImageResource(R.drawable.wallpaper);
}
use of androidx.appcompat.widget.Toolbar in project PhotoView by chrisbanes.
the class SimpleSampleActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simple_sample);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("Simple Sample");
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
toolbar.inflateMenu(R.menu.main_menu);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.menu_zoom_toggle:
mPhotoView.setZoomable(!mPhotoView.isZoomable());
item.setTitle(mPhotoView.isZoomable() ? R.string.menu_zoom_disable : R.string.menu_zoom_enable);
return true;
case R.id.menu_scale_fit_center:
mPhotoView.setScaleType(ImageView.ScaleType.CENTER);
return true;
case R.id.menu_scale_fit_start:
mPhotoView.setScaleType(ImageView.ScaleType.FIT_START);
return true;
case R.id.menu_scale_fit_end:
mPhotoView.setScaleType(ImageView.ScaleType.FIT_END);
return true;
case R.id.menu_scale_fit_xy:
mPhotoView.setScaleType(ImageView.ScaleType.FIT_XY);
return true;
case R.id.menu_scale_scale_center:
mPhotoView.setScaleType(ImageView.ScaleType.CENTER);
return true;
case R.id.menu_scale_scale_center_crop:
mPhotoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
return true;
case R.id.menu_scale_scale_center_inside:
mPhotoView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
return true;
case R.id.menu_scale_random_animate:
case R.id.menu_scale_random:
Random r = new Random();
float minScale = mPhotoView.getMinimumScale();
float maxScale = mPhotoView.getMaximumScale();
float randomScale = minScale + (r.nextFloat() * (maxScale - minScale));
mPhotoView.setScale(randomScale, item.getItemId() == R.id.menu_scale_random_animate);
showToast(String.format(SCALE_TOAST_STRING, randomScale));
return true;
case R.id.menu_matrix_restore:
if (mCurrentDisplayMatrix == null)
showToast("You need to capture display matrix first");
else
mPhotoView.setDisplayMatrix(mCurrentDisplayMatrix);
return true;
case R.id.menu_matrix_capture:
mCurrentDisplayMatrix = new Matrix();
mPhotoView.getDisplayMatrix(mCurrentDisplayMatrix);
return true;
}
return false;
}
});
mPhotoView = findViewById(R.id.iv_photo);
mCurrMatrixTv = findViewById(R.id.tv_current_matrix);
Drawable bitmap = ContextCompat.getDrawable(this, R.drawable.wallpaper);
mPhotoView.setImageDrawable(bitmap);
// Lets attach some listeners, not required though!
mPhotoView.setOnMatrixChangeListener(new MatrixChangeListener());
mPhotoView.setOnPhotoTapListener(new PhotoTapListener());
mPhotoView.setOnSingleFlingListener(new SingleFlingListener());
}
Aggregations