All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.reandroid.dex.sections.SpecialSection Maven / Gradle / Ivy

The newest version!
/*
 *  Copyright (C) 2022 github.com/REAndroid
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.reandroid.dex.sections;

import com.reandroid.arsc.item.IntegerReference;
import com.reandroid.arsc.item.NumberIntegerReference;
import com.reandroid.dex.base.DexPositionAlign;
import com.reandroid.dex.base.IntegerPair;
import com.reandroid.dex.base.ParallelIntegerPair;
import com.reandroid.dex.base.ParallelReference;

public class SpecialSection extends Section {

    public SpecialSection(IntegerReference offset, SectionType sectionType) {
        this(IntegerPair.of(
                new NumberIntegerReference(),
                new ParallelReference(offset)),
                sectionType);
    }
    public SpecialSection(IntegerPair countAndOffset, SectionType sectionType) {
        super(sectionType, new SpecialSectionArray<>(
                new ParallelIntegerPair(countAndOffset),
                sectionType));
    }

    @Override
    int clearUnused() {
        return 0;
    }
    @Override
    void clearUsageTypes() {
    }

    @Override
    void onRefreshed(int position){
        updateItemOffsets(position);
    }
    private void updateItemOffsets(int position){
        SpecialSectionArray array = getItemArray();
        position = array.updatePositionedItemOffsets(position);
        updateNextSection(position);
    }
    @Override
    void alignSection(DexPositionAlign positionAlign, int position){
        positionAlign.setAlignment(4);
        positionAlign.align(position);
    }
    public ParallelIntegerPair getCountAndOffset(){
        return getItemArray().getCountAndOffset();
    }

    @Override
    public SpecialSectionArray getItemArray() {
        return (SpecialSectionArray) super.getItemArray();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy