当前位置: 首页>>代码示例>>Java>>正文


Java Tile类代码示例

本文整理汇总了Java中android.service.quicksettings.Tile的典型用法代码示例。如果您正苦于以下问题:Java Tile类的具体用法?Java Tile怎么用?Java Tile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Tile类属于android.service.quicksettings包,在下文中一共展示了Tile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStartListening

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onStartListening() {
    c = getApplicationContext();
    sp = getSharedPreferences(TAG2, Context.MODE_PRIVATE);
    sp.registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
            tile = getQsTile();
            if(sp.getBoolean(TAG2,false)){
                tile.setState(Tile.STATE_ACTIVE);
            } else {
                tile.setState(Tile.STATE_INACTIVE);
            }
            tile.updateTile();
        }
    });

    tile = getQsTile();
    Log.i(TAG,String.valueOf(tile.getState()));
}
 
开发者ID:ShreyanshLodha,项目名称:BlueBolt-Kernel-Tweaking-app,代码行数:21,代码来源:QSTileService.java

示例2: onClick

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
    super.onClick();
    if (Objects.equals(Settings.getString(Settings.Mode.SELECTION, Settings.Mode.NONE), Settings.Mode.NONE)) {
        intentGuideActivity();
    } else {
        switch (tile.getState()) {
            case Tile.STATE_ACTIVE:
                setDisableTile();
                setAction(ACTION_FLOAT_VIEW_SERVICE_STOP);
                break;
            case Tile.STATE_INACTIVE:
                setEnableTile();
                setAction(ACTION_FLOAT_VIEW_SERVICE_START);
                break;
        }
        StatusBarUtils.collapseStatusBar(this);
    }
    tile.updateTile();
}
 
开发者ID:Omico,项目名称:CurrentActivity,代码行数:21,代码来源:CurrentActivityTileService.java

示例3: updateTileState

import android.service.quicksettings.Tile; //导入依赖的package包/类
private void updateTileState(int state) {
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setState(state);
        Icon icon = tile.getIcon();
        switch (state) {
            case Tile.STATE_ACTIVE:
                icon.setTint(Color.WHITE);
                break;
            case Tile.STATE_INACTIVE:
            case Tile.STATE_UNAVAILABLE:
            default:
                icon.setTint(Color.GRAY);
                break;
        }
        tile.updateTile();
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:19,代码来源:ServerService.java

示例4: onClick

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
    super.onClick();

    Tile tile = getQsTile();
    switch (tile.getState()) {
        case Tile.STATE_INACTIVE:
            startServer();
            updateTileState(Tile.STATE_ACTIVE);
            break;
        case Tile.STATE_ACTIVE:
            stopServer();
        default:
            updateTileState(Tile.STATE_INACTIVE);
            break;
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:18,代码来源:ServerService.java

示例5: onClick

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
    int state = getQsTile().getState();

    if (state == Tile.STATE_ACTIVE) {
        getQsTile().setState(Tile.STATE_INACTIVE);
        FeatureHelper.writeSimulateColorSpace(this,
                        FeatureHelper.ACCESSIBILITY_DISPLAY_DALTONIZER_DISABLE);
    } else {
        getQsTile().setState(Tile.STATE_ACTIVE);
        FeatureHelper.writeSimulateColorSpace(this,
                        FeatureHelper.ACCESSIBILITY_DISPLAY_DALTONIZER_MONOCHROMACY);
    }

    getQsTile().updateTile();
}
 
开发者ID:YorekLiu,项目名称:YLOnePlusTools,代码行数:17,代码来源:MonoTile.java

示例6: getTileState

import android.service.quicksettings.Tile; //导入依赖的package包/类
private void getTileState() {
    Tile tile = getQsTile();

    // Check if permissions are granted
    if (!ImmersiveModeUtils.hasSecureSettingsPermission(this.getApplicationContext())) {
        tile.setState(Tile.STATE_UNAVAILABLE);
        tile.updateTile();
        return;
    }

    // Update tile based on PolicyControl
    if (ImmersiveModeUtils.isImmersiveModeActive(this.getApplicationContext())) {
        tile.setState(Tile.STATE_ACTIVE);
    } else {
        tile.setState(Tile.STATE_INACTIVE);
    }
    tile.updateTile();
}
 
开发者ID:kz,项目名称:immersify,代码行数:19,代码来源:ImmersifyTileService.java

示例7: onClick

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
    super.onClick();
    Icon icon;

    if (toggleState == 1) {
        toggleState = 0;
        // Hide/unmount Magisk root
        Shell.su("setprop magisk.root 0");
        icon =  Icon.createWithResource(getApplicationContext(), R.drawable.ic_root_off);
        getQsTile().setIcon(icon);
        getQsTile().setState(Tile.STATE_INACTIVE);
        getQsTile().updateTile();
    } else {
        toggleState = 1;
        // Mount Magisk root
        Shell.su("setprop magisk.root 1");
        icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_root);
        getQsTile().setIcon(icon);
        getQsTile().setState(Tile.STATE_ACTIVE);
        getQsTile().updateTile();
    }
}
 
开发者ID:bpear,项目名称:Magisk-Quick-Toggle,代码行数:24,代码来源:RootTileService.java

示例8: updateTile

import android.service.quicksettings.Tile; //导入依赖的package包/类
protected static void updateTile(TileService context) {
    if(context == null) return;

    Tile tile = context.getQsTile();

    if (ki4aService.current_status == Util.STATUS_SOCKS) {
        tile.setLabel(context.getString(R.string.text_status_connected));
        tile.setState(Tile.STATE_ACTIVE);
    }
    else if (ki4aService.current_status == Util.STATUS_CONNECTING) {
        tile.setLabel(context.getString(R.string.text_status_connecting));
        tile.setState(Tile.STATE_INACTIVE);
    }
    else if (ki4aService.current_status == Util.STATUS_DISCONNECT) {
        tile.setLabel(context.getString(R.string.text_status_disconnected));
        tile.setState(Tile.STATE_INACTIVE);
    }

    tile.updateTile();
}
 
开发者ID:staf621,项目名称:ki4a,代码行数:21,代码来源:ki4aQuickSettingsService.java

示例9: updateState

import android.service.quicksettings.Tile; //导入依赖的package包/类
private void updateState() {
    Tile tile = getQsTile();
    if(tile != null) {
        SharedPreferences pref = U.getSharedPreferences(this);
        tile.setIcon(Icon.createWithResource(this, pref.getBoolean("app_drawer_icon", false)
                ? R.drawable.ic_system
                : R.drawable.ic_allapps));

        if(U.canDrawOverlays(this))
            tile.setState(U.isServiceRunning(this, NotificationService.class)
                    ? Tile.STATE_ACTIVE
                    : Tile.STATE_INACTIVE);
        else
            tile.setState(Tile.STATE_UNAVAILABLE);

        tile.updateTile();
    }
}
 
开发者ID:farmerbb,项目名称:Taskbar,代码行数:19,代码来源:QuickSettingsTileService.java

示例10: onStartListening

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onStartListening() {
    super.onStartListening();

    volumePollingSubscription = Observable.just(0l)
            .mergeWith(Observable.interval(500, TimeUnit.MILLISECONDS))
            .subscribe(t -> {
                int volume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
                int max = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);

                Tile tile = getQsTile();
                tile.setLabel(
                    getString(R.string.tile_level_label, (int) (volume * 100 / max))
                );
                tile.updateTile();
            });
}
 
开发者ID:urandom,项目名称:VolumeTile,代码行数:18,代码来源:Service.java

示例11: updateTileState

import android.service.quicksettings.Tile; //导入依赖的package包/类
public void updateTileState(final boolean active) {
    Handler handler = new Handler(Looper.getMainLooper());
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            Tile tile = getQsTile();
            if (tile != null) {
                tile.setLabel(active ? "ForceDoze on" : "ForceDoze off");
                tile.setState(active ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
                tile.updateTile();
            }
            if (active) {
                settings.edit().putBoolean("serviceEnabled", true).apply();
                sendBroadcastToApp(active);

            } else {
                settings.edit().putBoolean("serviceEnabled", false).apply();
                sendBroadcastToApp(active);
            }
        }
    }, 1500);
}
 
开发者ID:theblixguy,项目名称:ForceDoze,代码行数:23,代码来源:ForceDozeTileService.java

示例12: onClick

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
    Tile tile = getQsTile();
    App utils = (App) getApplicationContext();
    if (tile.getState() == Tile.STATE_ACTIVE) {
        if (utils.StartShowWin) {
            tile.setState(Tile.STATE_INACTIVE);
            FloatManageMethod.ShutDown(this);
        } else {
            tile.setState(Tile.STATE_INACTIVE);
        }
    } else if (tile.getState() == Tile.STATE_INACTIVE) {
        if (utils.StartShowWin) {
            tile.setState(Tile.STATE_ACTIVE);
        } else {
            if (QuickStartMethod.Launch(this)) {
                tile.setState(Tile.STATE_ACTIVE);
            }
        }
    }
    tile.updateTile();
    super.onClick();
}
 
开发者ID:XFY9326,项目名称:FloatText,代码行数:24,代码来源:QuickSettingService.java

示例13: onClick

import android.service.quicksettings.Tile; //导入依赖的package包/类
@Override
public void onClick() {
    super.onClick();
    Log("Clicked");
    initPrefs();
    Tile tile = getQsTile();
    if (tile != null) {
        switch (tile.getState()) {
            case Tile.STATE_ACTIVE:
                prefs.setBool(Prefs.KEYS.ENABLED.toString(), false);
                setCurrentState(Tile.STATE_INACTIVE);
                break;
            case Tile.STATE_INACTIVE:
                prefs.setBool(Prefs.KEYS.ENABLED.toString(), true);
                setCurrentState(Tile.STATE_ACTIVE);
                break;
            default:
                tile.setLabel(getString(R.string.quick_settings_title) + " " + (prefs.enabled ? getString(R.string.quick_settings_service_active) : getString(R.string.quick_settings_service_inactive)));
                Log("Active");
                break;
        }
    } else {
        Log("Tile is null");
    }
}
 
开发者ID:rosenpin,项目名称:AlwaysOnDisplayAmoled,代码行数:26,代码来源:QuickSettingsToggle.java

示例14: setCurrentState

import android.service.quicksettings.Tile; //导入依赖的package包/类
private void setCurrentState(int state) {
    initPrefs();
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setState(state);
        switch (state) {
            case Tile.STATE_ACTIVE:
                tile.setLabel(getString(R.string.quick_settings_title) + " " + getString(R.string.quick_settings_service_active));
                Log("Active");
                break;
            case Tile.STATE_INACTIVE:
                tile.setLabel(getString(R.string.quick_settings_title) + " " + getString(R.string.quick_settings_service_inactive));
                Log("Inactive");
                break;
            default:
                tile.setLabel(getString(R.string.quick_settings_title) + " " + (prefs.enabled ? getString(R.string.quick_settings_service_active) : getString(R.string.quick_settings_service_inactive)));
                Log("Active");
                break;
        }
        tile.updateTile();
    }
}
 
开发者ID:rosenpin,项目名称:AlwaysOnDisplayAmoled,代码行数:23,代码来源:QuickSettingsToggle.java

示例15: refreshTile

import android.service.quicksettings.Tile; //导入依赖的package包/类
/** <br> UI. */

    @RequiresApi(api = Build.VERSION_CODES.N)
    public static void refreshTile(Context context, Tile tile) {
        if (tile == null) {
            return;
        }
        Location location = DatabaseHelper.getInstance(context).readLocationList().get(0);
        location.weather = DatabaseHelper.getInstance(context).readWeather(location);
        if (location.weather != null) {
            boolean f = PreferenceManager.getDefaultSharedPreferences(context)
                    .getBoolean(context.getString(R.string.key_fahrenheit), false);
            tile.setIcon(
                    Icon.createWithResource(
                            context,
                            WeatherHelper.getNotificationWeatherIcon(
                                    location.weather.realTime.weatherKind,
                                    TimeManager.getInstance(context).isDayTime())));
            tile.setLabel(
                    ValueUtils.buildCurrentTemp(
                            location.weather.realTime.temp,
                            false,
                            f));
            tile.updateTile();
        }
    }
 
开发者ID:WangDaYeeeeee,项目名称:GeometricWeather,代码行数:27,代码来源:TileHelper.java


注:本文中的android.service.quicksettings.Tile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。