Search in sources :

Example 11 with Toolbar

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);
}
Also used : BillingProcessor(com.anjlab.android.iab.v3.BillingProcessor) Toolbar(androidx.appcompat.widget.Toolbar)

Example 12 with Toolbar

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();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) TimelineFragment(com.keylesspalace.tusky.components.timeline.TimelineFragment) Fragment(androidx.fragment.app.Fragment) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 13 with Toolbar

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);
}
Also used : AdBlockWebViewClient(io.github.hidroh.materialistic.widget.AdBlockWebViewClient) CacheableWebView(io.github.hidroh.materialistic.widget.CacheableWebView) NestedScrollView(androidx.core.widget.NestedScrollView) CacheableWebView(io.github.hidroh.materialistic.widget.CacheableWebView) WebView(android.webkit.WebView) ProgressBar(android.widget.ProgressBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 14 with Toolbar

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);
}
Also used : MenuItem(android.view.MenuItem) Toolbar(androidx.appcompat.widget.Toolbar)

Example 15 with Toolbar

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());
}
Also used : Matrix(android.graphics.Matrix) Random(java.util.Random) Drawable(android.graphics.drawable.Drawable) MenuItem(android.view.MenuItem) OnPhotoTapListener(com.github.chrisbanes.photoview.OnPhotoTapListener) OnSingleFlingListener(com.github.chrisbanes.photoview.OnSingleFlingListener) PhotoView(com.github.chrisbanes.photoview.PhotoView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)271 View (android.view.View)110 TextView (android.widget.TextView)55 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)42 NonNull (androidx.annotation.NonNull)36 Intent (android.content.Intent)34 Fragment (androidx.fragment.app.Fragment)32 ActionBar (androidx.appcompat.app.ActionBar)29 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)29 Nullable (androidx.annotation.Nullable)28 BarPainter (com.xabber.android.ui.color.BarPainter)26 R (org.thoughtcrime.securesms.R)26 ViewGroup (android.view.ViewGroup)25 Context (android.content.Context)24 EditText (android.widget.EditText)22 MenuItem (android.view.MenuItem)21 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20 Drawable (android.graphics.drawable.Drawable)18