VersCreativeUK / FACETS

An open tracker repository for the development team to manage the FACETS project.
0 stars 0 forks source link

[ISSUE] IllegalStateException on View Activity #23

Closed davcpas1234 closed 5 years ago

davcpas1234 commented 5 years ago

Application Version

0.0.5 (0.0.6)

Issue Description

Application crash is observed when attempting to view an Activity.

Steps to Reproduce

  1. Go to Activity Diary
  2. Click on an Activity
  3. Crash

Stack Trace

Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
        at androidx.appcompat.app.AppCompatDelegateImpl.setSupportActionBar(AppCompatDelegateImpl.java:345)
        at androidx.appcompat.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:130)
        at uk.ac.bournemouth.facets.Activities.ActivityDiary.ViewActivityActivity.onCreate(ViewActivityActivity.java:76)

Expected Behaviour

View Activity should open

davcpas1234 commented 5 years ago

Caused when getting user's custom theme. Code is not calling .NoActionBar style, this caused a conflict here:

setSupportActionBar(toolbar)

As the application uses a custom Toolbar implementation in View Activity.

davcpas1234 commented 5 years ago

Change:

    @Override
    public Resources.Theme getTheme() {
        [...]
            String themeStringFull = getPackageName()+":style/"+themeString;
        }else{
            String themeStringFull = getPackageName()+":style/AppTheme";
        [...]
    }

to:

    @Override
    public Resources.Theme getTheme() {
        [...]
            String themeStringFull = getPackageName()+":style/"+themeString+".NoActionBar";
        }else{
            String themeStringFull = getPackageName()+":style/AppTheme.NoActionBar";
        [...]
    }