use of androidx.appcompat.app.ActionBar in project J2ME-Loader by nikita36078.
the class SettingsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
setTitle(R.string.action_settings);
}
use of androidx.appcompat.app.ActionBar in project J2ME-Loader by nikita36078.
the class KeyMapperActivity method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getDataString();
if (path == null) {
Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
finish();
return;
}
setContentView(R.layout.activity_keymapper);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.pref_map_keys);
}
params = ProfilesManager.loadConfig(new File(path));
keyMapperLayer = findViewById(R.id.keyMapperLayer);
popupLayout = findViewById(R.id.keyMapperPopup);
popupMsg = findViewById(R.id.keyMapperPopupMsg);
setupButton(R.id.virtual_key_left_soft, Canvas.KEY_SOFT_LEFT);
setupButton(R.id.virtual_key_right_soft, Canvas.KEY_SOFT_RIGHT);
setupButton(R.id.virtual_key_d, Canvas.KEY_SEND);
setupButton(R.id.virtual_key_c, Canvas.KEY_END);
setupButton(R.id.virtual_key_left, Canvas.KEY_LEFT);
setupButton(R.id.virtual_key_right, Canvas.KEY_RIGHT);
setupButton(R.id.virtual_key_up, Canvas.KEY_UP);
setupButton(R.id.virtual_key_down, Canvas.KEY_DOWN);
setupButton(R.id.virtual_key_f, Canvas.KEY_FIRE);
setupButton(R.id.virtual_key_1, Canvas.KEY_NUM1);
setupButton(R.id.virtual_key_2, Canvas.KEY_NUM2);
setupButton(R.id.virtual_key_3, Canvas.KEY_NUM3);
setupButton(R.id.virtual_key_4, Canvas.KEY_NUM4);
setupButton(R.id.virtual_key_5, Canvas.KEY_NUM5);
setupButton(R.id.virtual_key_6, Canvas.KEY_NUM6);
setupButton(R.id.virtual_key_7, Canvas.KEY_NUM7);
setupButton(R.id.virtual_key_8, Canvas.KEY_NUM8);
setupButton(R.id.virtual_key_9, Canvas.KEY_NUM9);
setupButton(R.id.virtual_key_0, Canvas.KEY_NUM0);
setupButton(R.id.virtual_key_star, Canvas.KEY_STAR);
setupButton(R.id.virtual_key_pound, Canvas.KEY_POUND);
setupButton(R.id.virtual_key_a, KeyMapper.SE_KEY_SPECIAL_GAMING_A);
setupButton(R.id.virtual_key_b, KeyMapper.SE_KEY_SPECIAL_GAMING_B);
setupButton(R.id.virtual_key_menu, KeyMapper.KEY_OPTIONS_MENU);
if (savedInstanceState == null) {
SparseIntArray keyMap = params.keyMappings;
androidToMIDP = keyMap == null ? defaultKeyMap.clone() : keyMap.clone();
} else {
String save = savedInstanceState.getString(KEY_SAVE);
if (save == null) {
androidToMIDP = defaultKeyMap.clone();
} else if (save.isEmpty()) {
SparseIntArray keyMap = params.keyMappings;
androidToMIDP = keyMap == null ? defaultKeyMap.clone() : keyMap.clone();
} else {
androidToMIDP = new GsonBuilder().registerTypeAdapter(SparseIntArray.class, new SparseIntArrayAdapter()).create().fromJson(save, SparseIntArray.class);
}
}
}
use of androidx.appcompat.app.ActionBar in project J2ME-Loader by nikita36078.
the class DonationsActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donations);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.donate);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
DonationsFragment donationsFragment;
if (BuildConfig.DONATIONS_GOOGLE) {
donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, true, GOOGLE_PUBKEY, GOOGLE_CATALOG, getResources().getStringArray(R.array.donation_google_catalog_values), false, null, null, null, false, null, null, false, null);
} else {
donationsFragment = DonationsFragment.newInstance(BuildConfig.DEBUG, false, null, null, null, true, PAYPAL_USER, PAYPAL_CURRENCY_CODE, getString(R.string.donation_paypal_item), false, null, null, false, null);
}
ft.replace(R.id.donations_activity_container, donationsFragment, "donationsFragment");
ft.commit();
}
use of androidx.appcompat.app.ActionBar in project J2ME-Loader by nikita36078.
the class ProfilesActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profiles);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
setTitle(R.string.profiles);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
ArrayList<Profile> profiles = ProfilesManager.getProfiles();
ListView listView = findViewById(R.id.list_view);
TextView emptyView = findViewById(R.id.empty_view);
listView.setEmptyView(emptyView);
registerForContextMenu(listView);
adapter = new ProfilesAdapter(this, profiles);
listView.setAdapter(adapter);
final String def = preferences.getString(PREF_DEFAULT_PROFILE, null);
if (def != null) {
for (int i = profiles.size() - 1; i >= 0; i--) {
Profile profile = profiles.get(i);
if (profile.getName().equals(def)) {
adapter.setDefault(profile);
break;
}
}
}
listView.setOnItemClickListener(this);
}
use of androidx.appcompat.app.ActionBar in project CircleIndicator by ongakuer.
the class SampleActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
initToolbar();
Fragment demoFragment = getSupportFragmentManager().getFragmentFactory().instantiate(getClassLoader(), SampleListFragment.class.getName());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, demoFragment);
fragmentTransaction.commit();
getSupportFragmentManager().addOnBackStackChangedListener(() -> {
int count = getSupportFragmentManager().getBackStackEntryCount();
ActionBar actionbar = getSupportActionBar();
if (actionbar != null) {
actionbar.setDisplayHomeAsUpEnabled(count > 0);
actionbar.setDisplayShowHomeEnabled(count > 0);
}
});
}
Aggregations