Search in sources :

Example 81 with ActionBar

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);
}
Also used : ActionBar(androidx.appcompat.app.ActionBar)

Example 82 with ActionBar

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);
        }
    }
}
Also used : SparseIntArray(android.util.SparseIntArray) GsonBuilder(com.google.gson.GsonBuilder) Intent(android.content.Intent) File(java.io.File) ActionBar(androidx.appcompat.app.ActionBar) SparseIntArrayAdapter(ru.playsoftware.j2meloader.util.SparseIntArrayAdapter)

Example 83 with ActionBar

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();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) ActionBar(androidx.appcompat.app.ActionBar) DonationsFragment(org.sufficientlysecure.donations.DonationsFragment)

Example 84 with ActionBar

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);
}
Also used : ListView(android.widget.ListView) TextView(android.widget.TextView) ActionBar(androidx.appcompat.app.ActionBar)

Example 85 with ActionBar

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);
        }
    });
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) LoopRecyclerViewFragment(me.relex.circleindicator.sample.fragment.LoopRecyclerViewFragment) ResetAdapterFragment(me.relex.circleindicator.sample.fragment.ResetAdapterFragment) ViewPager2Fragment(me.relex.circleindicator.sample.fragment.ViewPager2Fragment) ChangeDrawableFragment(me.relex.circleindicator.sample.fragment.ChangeDrawableFragment) CustomAnimationFragment(me.relex.circleindicator.sample.fragment.CustomAnimationFragment) DynamicAdapterFragment(me.relex.circleindicator.sample.fragment.DynamicAdapterFragment) LoopViewPagerFragment(me.relex.circleindicator.sample.fragment.LoopViewPagerFragment) Fragment(androidx.fragment.app.Fragment) RecyclerViewFragment(me.relex.circleindicator.sample.fragment.RecyclerViewFragment) DefaultFragment(me.relex.circleindicator.sample.fragment.DefaultFragment) SnackbarBehaviorFragment(me.relex.circleindicator.sample.fragment.SnackbarBehaviorFragment) ActionBar(androidx.appcompat.app.ActionBar)

Aggregations

ActionBar (androidx.appcompat.app.ActionBar)139 View (android.view.View)30 Toolbar (androidx.appcompat.widget.Toolbar)29 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)26 TextView (android.widget.TextView)18 Intent (android.content.Intent)11 Bundle (android.os.Bundle)11 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)8 SuppressLint (android.annotation.SuppressLint)7 AdapterView (android.widget.AdapterView)7 ImageView (android.widget.ImageView)7 Uri (android.net.Uri)6 DefaultItemDecoration (com.yanzhenjie.recyclerview.widget.DefaultItemDecoration)6 SharedPreferences (android.content.SharedPreferences)5 ListView (android.widget.ListView)5 Spinner (android.widget.Spinner)5 Typeface (com.mta.tehreer.graphics.Typeface)5 File (java.io.File)5 MenuItem (android.view.MenuItem)4 Button (android.widget.Button)4