當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。