Search in sources :

Example 1 with MaterialToolbar

use of com.google.android.material.appbar.MaterialToolbar in project fdroidclient by f-droid.

the class ManageReposActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    FDroidApp fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.repo_list_activity);
    MaterialToolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {
            if (menuItem.getItemId() == R.id.action_add_repo) {
                showAddRepo();
                return true;
            }
            return false;
        }
    });
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent upIntent = NavUtils.getParentActivityIntent(ManageReposActivity.this);
            if (NavUtils.shouldUpRecreateTask(ManageReposActivity.this, upIntent) || isTaskRoot()) {
                TaskStackBuilder.create(ManageReposActivity.this).addNextIntentWithParentStack(upIntent).startActivities();
            } else {
                NavUtils.navigateUpTo(ManageReposActivity.this, upIntent);
            }
        }
    });
    final ListView repoList = (ListView) findViewById(R.id.list);
    repoAdapter = new RepoAdapter(this);
    repoAdapter.setEnabledListener(this);
    repoList.setAdapter(repoAdapter);
    repoList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Repo repo = new Repo((Cursor) repoList.getItemAtPosition(position));
            editRepo(repo);
        }
    });
}
Also used : FDroidApp(org.fdroid.fdroid.FDroidApp) MenuItem(android.view.MenuItem) Intent(android.content.Intent) Cursor(android.database.Cursor) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) MaterialToolbar(com.google.android.material.appbar.MaterialToolbar) ListView(android.widget.ListView) Repo(org.fdroid.fdroid.data.Repo) AdapterView(android.widget.AdapterView) Toolbar(androidx.appcompat.widget.Toolbar) MaterialToolbar(com.google.android.material.appbar.MaterialToolbar)

Example 2 with MaterialToolbar

use of com.google.android.material.appbar.MaterialToolbar in project fdroidclient by f-droid.

the class RepoDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    FDroidApp fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_repo_details);
    MaterialToolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    repoView = findViewById(R.id.repo_view);
    repoId = getIntent().getLongExtra(ARG_REPO_ID, 0);
    repo = RepoProvider.Helper.findById(this, repoId);
    TextView inputUrl = findViewById(R.id.input_repo_url);
    inputUrl.setText(repo.address);
    RecyclerView officialMirrorListView = findViewById(R.id.official_mirror_list);
    officialMirrorListView.setLayoutManager(new LinearLayoutManager(this));
    adapterToNotify = new MirrorAdapter(repo, repo.mirrors);
    officialMirrorListView.setAdapter(adapterToNotify);
    RecyclerView userMirrorListView = findViewById(R.id.user_mirror_list);
    userMirrorListView.setLayoutManager(new LinearLayoutManager(this));
    userMirrorListView.setAdapter(new MirrorAdapter(repo, repo.userMirrors));
    if (repo.address.startsWith("content://")) {
        // no need to show a QR Code, it is not shareable
        return;
    }
    Uri uri = Uri.parse(repo.address);
    uri = uri.buildUpon().appendQueryParameter("fingerprint", repo.fingerprint).build();
    String qrUriString = uri.toString();
    disposable = Utils.generateQrBitmap(this, qrUriString).subscribe(bitmap -> {
        final ImageView qrCode = findViewById(R.id.qr_code);
        if (qrCode != null) {
            qrCode.setImageBitmap(bitmap);
        }
    });
}
Also used : Arrays(java.util.Arrays) Bundle(android.os.Bundle) DateUtils(android.text.format.DateUtils) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) ImageView(android.widget.ImageView) NfcNotEnabledActivity(org.fdroid.fdroid.NfcNotEnabledActivity) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) Locale(java.util.Locale) View(android.view.View) Button(android.widget.Button) RecyclerView(androidx.recyclerview.widget.RecyclerView) ContextCompat(androidx.core.content.ContextCompat) TargetApi(android.annotation.TargetApi) NdefMessage(android.nfc.NdefMessage) NavUtils(androidx.core.app.NavUtils) RepoTable(org.fdroid.fdroid.data.Schema.RepoTable) IntentFilter(android.content.IntentFilter) BroadcastReceiver(android.content.BroadcastReceiver) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) RepoProvider(org.fdroid.fdroid.data.RepoProvider) Disposable(io.reactivex.rxjava3.disposables.Disposable) ContentValues(android.content.ContentValues) MaterialToolbar(com.google.android.material.appbar.MaterialToolbar) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) NfcAdapter(android.nfc.NfcAdapter) UpdateService(org.fdroid.fdroid.UpdateService) Context(android.content.Context) AlertDialog(androidx.appcompat.app.AlertDialog) TextInputLayout(com.google.android.material.textfield.TextInputLayout) Intent(android.content.Intent) LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager) Utils(org.fdroid.fdroid.Utils) MenuItem(android.view.MenuItem) HashSet(java.util.HashSet) R(org.fdroid.fdroid.R) Toast(android.widget.Toast) Menu(android.view.Menu) NfcHelper(org.fdroid.fdroid.NfcHelper) Build(android.os.Build) DialogInterface(android.content.DialogInterface) Parcelable(android.os.Parcelable) CompoundButton(android.widget.CompoundButton) LayoutInflater(android.view.LayoutInflater) TextUtils(android.text.TextUtils) FDroidApp(org.fdroid.fdroid.FDroidApp) EditText(android.widget.EditText) Repo(org.fdroid.fdroid.data.Repo) MaterialToolbar(com.google.android.material.appbar.MaterialToolbar) FDroidApp(org.fdroid.fdroid.FDroidApp) TextView(android.widget.TextView) RecyclerView(androidx.recyclerview.widget.RecyclerView) ImageView(android.widget.ImageView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Uri(android.net.Uri)

Example 3 with MaterialToolbar

use of com.google.android.material.appbar.MaterialToolbar in project fdroidclient by f-droid.

the class AppDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    FDroidApp fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.app_details2);
    MaterialToolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    // clear title
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    supportPostponeEnterTransition();
    String packageName = getPackageNameFromIntent(getIntent());
    if (!resetCurrentApp(packageName)) {
        finish();
        return;
    }
    bluetoothAdapter = getBluetoothAdapter();
    localBroadcastManager = LocalBroadcastManager.getInstance(this);
    recyclerView = (RecyclerView) findViewById(R.id.rvDetails);
    adapter = new AppDetailsRecyclerViewAdapter(this, app, this);
    LinearLayoutManager lm = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    lm.setStackFromEnd(false);
    // Has to be invoked after AppDetailsRecyclerViewAdapter is created.
    refreshStatus();
    recyclerView.setLayoutManager(lm);
    recyclerView.setAdapter(adapter);
    recyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {
            supportStartPostponedEnterTransition();
            return true;
        }
    });
    // Load the feature graphic, if present
    final FeatureImage featureImage = (FeatureImage) findViewById(R.id.feature_graphic);
    RequestOptions displayImageOptions = new RequestOptions();
    String featureGraphicUrl = app.getFeatureGraphicUrl(this);
    featureImage.loadImageAndDisplay(displayImageOptions, featureGraphicUrl, app.getIconUrl(this));
}
Also used : MaterialToolbar(com.google.android.material.appbar.MaterialToolbar) FeatureImage(org.fdroid.fdroid.views.apps.FeatureImage) RequestOptions(com.bumptech.glide.request.RequestOptions) FDroidApp(org.fdroid.fdroid.FDroidApp) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ViewTreeObserver(android.view.ViewTreeObserver)

Example 4 with MaterialToolbar

use of com.google.android.material.appbar.MaterialToolbar in project fdroidclient by f-droid.

the class PanicPreferencesActivity method onCreate.

@Override
public void onCreate(Bundle bundle) {
    FDroidApp fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
    super.onCreate(bundle);
    setContentView(R.layout.activity_panic_settings);
    MaterialToolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Also used : MaterialToolbar(com.google.android.material.appbar.MaterialToolbar) FDroidApp(org.fdroid.fdroid.FDroidApp)

Example 5 with MaterialToolbar

use of com.google.android.material.appbar.MaterialToolbar in project fdroidclient by f-droid.

the class InstalledAppsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    FDroidApp fdroidApp = (FDroidApp) getApplication();
    fdroidApp.applyPureBlackBackgroundInDarkTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.installed_apps_layout);
    MaterialToolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    adapter = new InstalledAppListAdapter(this);
    appList = (RecyclerView) findViewById(R.id.app_list);
    appList.setHasFixedSize(true);
    appList.setLayoutManager(new LinearLayoutManager(this));
    appList.setAdapter(adapter);
    emptyState = (TextView) findViewById(R.id.empty_state);
}
Also used : MaterialToolbar(com.google.android.material.appbar.MaterialToolbar) FDroidApp(org.fdroid.fdroid.FDroidApp) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

MaterialToolbar (com.google.android.material.appbar.MaterialToolbar)7 FDroidApp (org.fdroid.fdroid.FDroidApp)7 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)4 Intent (android.content.Intent)2 MenuItem (android.view.MenuItem)2 View (android.view.View)2 TextView (android.widget.TextView)2 Repo (org.fdroid.fdroid.data.Repo)2 TargetApi (android.annotation.TargetApi)1 BroadcastReceiver (android.content.BroadcastReceiver)1 ContentValues (android.content.ContentValues)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 IntentFilter (android.content.IntentFilter)1 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 NdefMessage (android.nfc.NdefMessage)1 NfcAdapter (android.nfc.NfcAdapter)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1