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


Java ResourceHelper类代码示例

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


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

示例1: onAttach

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    context = activity;

    // initialize our resource helper so that we can get layouts, drawables, ect. This is required
    // so that the launcher can get resources from different packages, using R.string.example or
    // R.drawable.example won't work correctly because it will try to grab the resource that the launcher
    // holds at that position, not the resource that this package holds.
    resHelper = new ResourceHelper(getActivity(), Utils.PACKAGE_NAME);


    // get the cards the user has selected and add them to the list
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    cardList = new ArrayList<Card>();

    for (int i = 0; i < sharedPrefs.getInt("launcher_number_of_cards", 0); i++) {
        String pack = sharedPrefs.getString("launcher_card_package_name_" + i, "");
        String path =  sharedPrefs.getString("launcher_card_class_path_" + i, "");

        cardList.add(new Card(pack, path));
    }
}
 
开发者ID:klinker24,项目名称:Blur-Extension-Examples,代码行数:24,代码来源:LauncherFragment.java

示例2: setUpCardLayout

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
/**
 * Creates the layout for the card and sets the components
 */
@Override
public void setUpCardLayout() {
    // remember that we need the resource helper since this will be running from a different package
    helper = new ResourceHelper(getContext(), Utils.PACKAGE_NAME);

    // get the time formatter from the system
    timeFormatter = android.text.format.DateFormat.getTimeFormat(getContext());

    // get the root view layout
    View root = helper.getLayout("card_alarm");

    // the children to display the event info
    time = (TextView) root.findViewById(helper.getId("time"));

    addView(root);

    // settings will let them choose what app to open
    showSettings(true);

    onRefresh();
    refreshCardLayout();
}
 
开发者ID:klinker24,项目名称:Blur-Extension-Examples,代码行数:26,代码来源:NextAlarmCard.java

示例3: setUpCardLayout

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
/**
 * Creates the layout for the card and sets the components
 */
@Override
public void setUpCardLayout() {
    // remember that we need the resource helper since this will be running from a different package
    helper = new ResourceHelper(getContext(), Utils.PACKAGE_NAME);

    // get the time formatter from the system
    timeFormatter = android.text.format.DateFormat.getTimeFormat(getContext());

    // get the root view layout
    View root = helper.getLayout("card_next_event");

    // the children to display the event info
    title = (TextView) root.findViewById(helper.getId("title"));
    timestamp = (TextView) root.findViewById(helper.getId("timestamp"));
    image = (ImageView) root.findViewById(helper.getId("cal_image"));

    // the layouts for the parts of the card
    eventLayout = (LinearLayout) root.findViewById(helper.getId("event_layout"));
    eventSettingsLayout = (LinearLayout) root.findViewById(helper.getId("event_settings_layout"));

    addView(root);

    showSettings(true);

    onRefresh();
    refreshCardLayout();
}
 
开发者ID:klinker24,项目名称:Blur-Extension-Examples,代码行数:31,代码来源:NextEventCard.java

示例4: onAttach

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    context = activity;

    // initialize our resource helper so that we can get layouts, drawables, ect. This is required
    // so that the launcher can get resources from different packages, using R.string.example or
    // R.drawable.example won't work correctly because it will try to grab the resource that the launcher
    // holds at that position, not the resource that this package holds.
    resHelper = new ResourceHelper(getActivity(), Utils.PACKAGE_NAME);

    syntaxError = resHelper.getString("syntax_error");
}
 
开发者ID:klinker24,项目名称:Blur-Extension-Examples,代码行数:14,代码来源:LauncherFragment.java

示例5: onAttach

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    context = activity;

    // initialize a utils object
    utils = new Utils(activity);

    // initialize our resource helper so that we can get layouts, drawables, ect. This is required
    // so that the launcher can get resources from different packages, using R.string.example or
    // R.drawable.example won't work correctly because it will try to grab the resource that the launcher
    // holds at that position, not the resource that this package holds.
    resHelper = new ResourceHelper(activity, Utils.PACKAGE_NAME);
}
 
开发者ID:klinker24,项目名称:Blur-Hello-World-Page,代码行数:15,代码来源:LauncherFragment.java

示例6: setUpCardLayout

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
/**
 * Creates a view for the card, just a blank view 200dp tall
 */
@Override
public void setUpCardLayout() {
    resHelper = new ResourceHelper(getContext(), PACKAGE_NAME);

    // Use the res helper to create your layout
    View v = resHelper.getLayout("hello_layout");

    // add this view to the linear layout to display
    addView(v);

    shouldShow(true);
    showSettings(false);
}
 
开发者ID:klinker24,项目名称:Blur-Hello-World-Card,代码行数:17,代码来源:HelloCard.java

示例7: createAppAdapter

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
public AppAdapter createAppAdapter(Context context, List<ResolveInfo> installedAppsInfo){
    mPackageManager = context.getPackageManager();
    helper = new ResourceHelper(context, Utils.PACKAGE_NAME);
    return new AppAdapter(context, installedAppsInfo);
}
 
开发者ID:klinker24,项目名称:Blur-Extension-Examples,代码行数:6,代码来源:ApplicationsDialog.java

示例8: setUpCardLayout

import com.klinker.android.launcher.api.ResourceHelper; //导入依赖的package包/类
/**
 * Creates a view for the card, inflated from the card_weather xml file
 */
@Override
public void setUpCardLayout() {
    // remember that we need the resource helper since this will be running from a different package
    helper = new ResourceHelper(getContext(), Utils.PACKAGE_NAME);
    sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());

    // get the root view layout
    View root = helper.getLayout("card_weather");

    // views for the settings on the card
    weatherLayout = (LinearLayout) root.findViewById(helper.getId("weather_layout"));
    settingsLayout = (LinearLayout) root.findViewById(helper.getId("settings_layout"));
    question = (TextView) root.findViewById(helper.getId("question"));
    ans1 = (TextView) root.findViewById(helper.getId("answer_1"));
    ans2 = (TextView) root.findViewById(helper.getId("answer_2"));

    // get the text views for the weather data
    location = (TextView) root.findViewById(helper.getId("location"));
    temperature = (TextView) root.findViewById(helper.getId("temp"));
    todayHigh = (TextView) root.findViewById(helper.getId("today_high"));
    todayLow = (TextView) root.findViewById(helper.getId("today_low"));
    weatherDepiction = (ImageView) root.findViewById(helper.getId("image"));

    futureHigh = new TextView[4];
    futureLow = new TextView[4];
    futureDay = new TextView[4];
    futurePic = new ImageView[4];

    // get the views for the future forecast
    for (int i = 0; i < 4; i++) {
        futureHigh[i] = (TextView) root.findViewById(helper.getId("forecast_" + (i+1) + "_high"));
        futureLow[i] = (TextView) root.findViewById(helper.getId("forecast_" + (i+1) + "_low"));
        futurePic[i] = (ImageView) root.findViewById(helper.getId("forecast_" + (i+1) + "_pic"));
        futureDay[i] = (TextView) root.findViewById(helper.getId("day_" + (i+1)));
    }

    // add this view to the linear layout to display
    addView(root);

    showSettings(true);

    new Thread(new Runnable() {
        @Override
        public void run() {
            onRefresh();
        }
    }).start();
}
 
开发者ID:klinker24,项目名称:Blur-Extension-Examples,代码行数:52,代码来源:WeatherCard.java


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