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);
}
});
}
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);
}
});
}
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));
}
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);
}
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);
}
Aggregations