• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SnackBar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onPostExecute

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
protected void onPostExecute(Void result) {
    // Only perform these actions if this is a regular DNS record update (not one called within addRecord)
    if (clickedDNSRecord != null) {
        // Hide loading circle
        findViewById(R.id.loading_circle).setVisibility(View.INVISIBLE);

        // Snackbar success status
        if (!success) {
            SnackBar snackBar = new SnackBar(AddEditDNSRecordActivity.this, "There was an error updating the DNS record.", null, null);
            snackBar.show();
            return;
        }

        // Go back to the DNS records fragment
        Intent intent = new Intent(getApplicationContext(), MainActivity.class);
        intent.putExtra("returnToFragment", "DNS Records");
        intent.putExtra("dnsRecordSuccess", true);
        startActivity(intent);
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:22,代码来源:AddEditDNSRecordActivity.java


示例2: actionDialog

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
/**
 * Dialog asking the user what should be done with the selected account.
 */
private void actionDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(AccountManagerActivity.this);
    builder.setTitle("Available actions").setItems(R.array.account_action_array, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            if (which == 0)
                editAccountDetails();
            if (which == 1) {
                // The user must have at least one account
                if (accounts.size() == 1) {
                    SnackBar snackBar = new SnackBar(AccountManagerActivity.this, "You cannot delete this account; you must have at least one active account.", null, null);
                    snackBar.show();
                }
                else
                    deleteAccount();
            }
        }
    });
    builder.create().show();
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:23,代码来源:AccountManagerActivity.java


示例3: deleteAccount

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
/**
 * Deletes the selected user account.
 */
public void deleteAccount() {
    // Delete the account
    String deleteAPIKey = clickedCloudFlareAccount.getApiKey();
    AccountConfig.deleteAccount(getApplicationContext(), deleteAPIKey);

    // Snackbar a confirmation
    SnackBar snackBar = new SnackBar(AccountManagerActivity.this, "Account successfully deleted!", null, null);
    snackBar.show();

    // Refresh list of accounts
    populateAccountsList();

    // If deleting this account deletes the current account, set the new current account to the first account in the list
    AccountConfig.setCurrentAccount(getApplicationContext(), accounts.get(0).getApiKey(), accounts.get(0).getEmail());
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:19,代码来源:AccountManagerActivity.java


示例4: onPostExecute

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
protected void onPostExecute(HashMap<String, Boolean> zoneNames) {
    // Dismiss loading circle
    findViewById(R.id.loading_circle).setVisibility(View.INVISIBLE);

    // Error if the account has no domains (why??)
    if (zoneNames.size() == 0) {
        SnackBar snackBar = new SnackBar(WelcomeActivity.this, getResources().getString(R.string.no_domains_error), null, null);
        snackBar.show();
        newAccount = null;
    }
    else {
        // Store API key and email address
        AccountConfig.addAccount(getApplicationContext(), newAccount.getApiKey(), newAccount.getEmail());
        AccountConfig.setCurrentAccount(getApplicationContext(), newAccount.getApiKey(), null);
        Log.d("Account data", AccountConfig.getAllAccounts(getApplicationContext()).toString());

        // Safe to use AccountConfig.getCurrentAccountAPIKey since it is set in the Login asynctask.
        AccountConfig.addDomains(getApplicationContext(), AccountConfig.getCurrentAccountAPIKey(getApplicationContext()), zoneNames);
        domainSelectDialog();
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:23,代码来源:WelcomeActivity.java


示例5: onActivityResult

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {

    // cancel handling if the request failed
    if (resultCode != Activity.RESULT_OK) {
        return;
    }

    switch (requestCode) {
        case Constants.REQUEST_IMAGE_CAPTURE:
            finishWithResult(Uri.fromFile(mFileTemp));
            break;
        case Constants.REQUEST_IMAGE_CHOOSE:
            String filePath = null;
            try {
                filePath = FileUtils.getPath(this, data.getData());
            } catch (NullPointerException e) {
                // no file selected, ignore exception
            }
            if (filePath == null) {
                SnackBar snackBar = new SnackBar(this, getString(R.string.error_remote_file));
                snackBar.show();
                // Toast.makeText(this, getString(R.string.error_remote_file), Toast.LENGTH_SHORT).show();
            } else {
                finishWithResult(Uri.parse(filePath));
            }
            break;
    }
}
 
开发者ID:Drakuwa,项目名称:Fridge,代码行数:30,代码来源:GalleryActivity.java


示例6: onPostExecute

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
protected void onPostExecute(Void result) {
    // Dismiss loading circle
    swipeLayout.setRefreshing(false);

    // Populate ListView with domains
    if (error) {
        SnackBar snackBar = new SnackBar(getActivity(), "There was an error logging in. Ensure that you have network connectivity and that your API key and email are correct.", null, null);
        snackBar.show();
    }
    else if (getView() != null) {
        ArrayAdapter<DNSRecord> adapter = new listAdapter();
        list = (ListView) getView().findViewById(R.id.dns_records_list);
        list.setAdapter(adapter);
        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            /**
             * Set on item click listener for each list view item. Assigns a DNSRecord object to the
             * clickedDNSRecord instance variable, for use later.
             */
            @Override
            public void onItemClick(AdapterView<?> parent, View viewClicked, int position, long id) {
                clickedDNSRecord = dnsRecordsList.get(position);
                actionDialog();
            }
        });
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:28,代码来源:DNSRecordsFragment.java


示例7: onPostExecute

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
protected void onPostExecute(HashMap<String, Boolean> zoneNames) {
    if (error) {
        SnackBar snackBar = new SnackBar(MainActivity.this, "There was an error logging in. Ensure that you have network connectivity and that your API key and email are correct.", null, null);
        snackBar.show();
    }
    else {
        // Update the user's domains
        AccountConfig.addDomains(getApplicationContext(), AccountConfig.getCurrentAccountAPIKey(getApplicationContext()), zoneNames);

        // Update the domains in the navigation drawer
        initDomainSpinner();
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:15,代码来源:MainActivity.java


示例8: showSnackBar

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
public static void showSnackBar(Activity activity, String message, SnackBar.OnHideListener onHideListener) {
    SnackBar snackBar = new SnackBar(activity, message);
    snackBar.show();
    if (onHideListener != null) {
        snackBar.setOnhideListener(onHideListener);
    }
}
 
开发者ID:zhenghuiy,项目名称:TodayThing,代码行数:8,代码来源:UIUtil.java


示例9: wrongCredentials

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
public void wrongCredentials(int returned) {
	if (MailMainActivity.this.getActivity() == null)
		return;
	Resources res = MailMainActivity.this.getActivity().getResources();
	if (password != null && login_button != null) {
		if (MailMainActivity.this.getActivity() != null)
			Toast.makeText(MailMainActivity.this.getActivity(),
					getResources().getString(R.string.facebook_login_incorrect_or_offline), Toast.LENGTH_SHORT)
					.show();
		password.setText("");
		login_button.getBackground().setColorFilter(null);
		login_button.setEnabled(true);

	} else {
		if (MailMainActivity.this.getActivity() != null) {
			final SnackBar snackbar = new SnackBar(MailMainActivity.this.getActivity(), res
					.getString(R.string.snackbar_cannot_load_mails), res.getString(R.string.snackbar_retry),
					new View.OnClickListener() {
						@Override
						public void onClick(View v) {
							if (MailMainActivity.this.getActivity() instanceof MainActivity) {
								MainActivity ac = (MainActivity) MailMainActivity.this.getActivity();
								ac.emailLogin(1);
							}
						}
					});
			snackbar.show();
		}
	}
	if (returned == 0) {
		prefs.edit().clear().apply();
		if (MailMainActivity.this.getActivity() != null) {
			((MainActivity) getActivity()).redrawMailFragment();
			((MainActivity) getActivity()).drawMailFragment();
		}
	}
}
 
开发者ID:manuelsc,项目名称:Raven-Messenger,代码行数:38,代码来源:MailMainActivity.java


示例10: toastMessage

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
public static void toastMessage(Context context, String text) {
    new SnackBar((Activity) context, text, null, null).show();
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:4,代码来源:DialogUtils.java


示例11: toastAction

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
public static void toastAction(Context context, String text, String buttonText, View.OnClickListener onClickListener) {
    new SnackBar((Activity) context, text, buttonText, onClickListener).show();
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:4,代码来源:DialogUtils.java


示例12: createItem

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@OnClick(R.id.button_create)
public void createItem(View view) {

    if (textType.getText().toString().equals(getString(R.string.type_error))
            || TextUtils.isEmpty(textType.getText())) {
        // there was an error, show it
        SnackBar snackBar = new SnackBar(getActivity(),
                "Please select another category or image.");
        snackBar.show();
    } else {
        // save the item
        FridgeItem fridgeItem = new FridgeItem();
        String name = autoCompleteTextView.getText().toString().trim();
        String type = textType.getText().toString().trim();
        fridgeItem.setName(name.length() > 0 ? name : type);
        fridgeItem.setType(type.equals(getString(R.string.type_camera)) ?
                mFileTemp.getAbsolutePath() : String.valueOf(ItemType.valueOf(type).ordinal()));
        fridgeItem.setItemId(fridgeItem.hashCode());
        fridgeItem.setEditTimestamp(Calendar.getInstance().getTimeInMillis());
        fridgeItem.save();

        // remove instance to saved file
        mFileTemp = null;

        // add the saved item to history
        HistoryItem historyItem = new HistoryItem(fridgeItem,
                Calendar.getInstance().getTimeInMillis() / 1000, ChangeType.ADD);
        historyItem.save();

        // hide the keyboard if shown
        KeyboardUtils.hideSoftKeyboard(autoCompleteTextView);

        // clear the text
        autoCompleteTextView.setText("");
        autoCompleteTextView.clearFocus();

        // restart the loader on DB change
        ((MainActivity) getActivity()).setDatabaseChanged(true);

        // set the screenshot
        takeScreenShot();
        ((MainActivity) getActivity()).setScreenshotable(this);

        Rect rect = new Rect();
        buttonCreate.getLocalVisibleRect(rect);

        Point buttonCenter = new Point((int) buttonCreate.getX() + buttonCreate.getWidth() / 2,
                (int) buttonCreate.getY() + buttonCreate.getHeight() / 2);
        mListener.onFragmentInteraction(false, buttonCenter,
                FridgeFragment.class.getCanonicalName());
    }
}
 
开发者ID:Drakuwa,项目名称:Fridge,代码行数:53,代码来源:AddItemFallbackFragment.java


示例13: createItem

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@OnClick(R.id.button_create)
public void createItem(View view) {

    if (textType.getText().toString().equals(getString(R.string.type_error))
            || TextUtils.isEmpty(textType.getText())) {
        // there was an error, show it
        SnackBar snackBar = new SnackBar(getActivity(),
                "Please select another category or image.");
        snackBar.show();
    } else {
        // save the item
        FridgeItem fridgeItem = new FridgeItem();
        String name = autoCompleteTextView.getText().toString().trim();
        String type = textType.getText().toString().trim();
        fridgeItem.setName(name.length() > 0 ? name : type);
        fridgeItem.setType(type.equals(getString(R.string.type_camera)) ?
                filePath : String.valueOf(ItemType.valueOf(type).ordinal()));
        fridgeItem.setItemId(fridgeItem.hashCode());
        fridgeItem.setEditTimestamp(Calendar.getInstance().getTimeInMillis());
        fridgeItem.save();

        // remove instance to saved file
        filePath = null;

        // add the saved item to history
        HistoryItem historyItem = new HistoryItem(fridgeItem,
                Calendar.getInstance().getTimeInMillis() / 1000, ChangeType.ADD);
        historyItem.save();

        // hide the keyboard if shown
        KeyboardUtils.hideSoftKeyboard(autoCompleteTextView);

        // clear the text
        autoCompleteTextView.setText("");
        autoCompleteTextView.clearFocus();

        // restart the loader on DB change
        ((MainActivity) getActivity()).setDatabaseChanged(true);

        // set the screenshot
        takeScreenShot();
        ((MainActivity) getActivity()).setScreenshotable(this);

        Rect rect = new Rect();
        buttonCreate.getLocalVisibleRect(rect);

        Point buttonCenter = new Point((int) buttonCreate.getX() + buttonCreate.getWidth() / 2,
                (int) buttonCreate.getY() + buttonCreate.getHeight() / 2);
        mListener.onFragmentInteraction(false, buttonCenter,
                FridgeFragment.class.getCanonicalName());
    }
}
 
开发者ID:Drakuwa,项目名称:Fridge,代码行数:53,代码来源:AddItemFragment.java


示例14: onCreate

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Debug logging
    Log.d("Shared preferences data", AccountConfig.getAllPreferenceData(getApplicationContext()).toString());

    // First determine if the user has an account logged in. If so, continue; otherwise, redirect the user to WelcomeActivity.class
    if (!AccountConfig.hasCurrentAccount(getApplicationContext())) {
        startActivity(new Intent(this, WelcomeActivity.class));
        return;
    }

    // Initialize all the views
    initViews();

    if (toolbar != null) {
        // Sets the title of the action bar
        toolbar.setTitle(R.string.app_name);
        setSupportActionBar(toolbar);
    }

    // Initialize the navigation drawer
    initDrawer();

    // Snackbar from DNS update activity
    boolean success = getIntent().getBooleanExtra("dnsRecordSuccess", false);
    if (success) {
        SnackBar snackBar = new SnackBar(MainActivity.this, "DNS record created or updated successfully!", null, null);
        snackBar.show();
    }

    // Set default page
    // Different depending on intent
    // First get the string representing the fragment to return to; if null, default to Analytics
    Fragment fragment = null;
    String returnToFragment = getIntent().getStringExtra("returnToFragment");
    if (returnToFragment == null)
        returnToFragment = "Analytics";
    // Initialize the fragment accordingly
    if (returnToFragment.equals("Analytics"))
        fragment = new AnalyticsFragment();
    if (returnToFragment.equals("Performance Settings"))
        fragment = new PerformanceSettingsFragment();
    if (returnToFragment.equals("Security Settings"))
        fragment = new SecuritySettingsFragment();
    if (returnToFragment.equals("DNS Records"))
        fragment = new DNSRecordsFragment();
    // Show the fragment
    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
    // Select the appropriate index in the navigation drawer
    leftDrawerList.setItemChecked(java.util.Arrays.asList(drawerSections).indexOf(returnToFragment) + 1, true);
    // Notify adapter of selected index, for background highlighting behavior
    adapter.setSelection(java.util.Arrays.asList(drawerSections).indexOf(returnToFragment) + 1);
    toolbar.setTitle(drawerSections[java.util.Arrays.asList(drawerSections).indexOf(returnToFragment)]);

    // Refresh the user's domains
    new findDomains().execute(AccountConfig.getCurrentAccountAPIKey(getApplicationContext()), AccountConfig.getCurrentAccountEmail(getApplicationContext()));
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:62,代码来源:MainActivity.java


示例15: onPostExecute

import com.gc.materialdesign.widgets.SnackBar; //导入依赖的package包/类
@Override
protected void onPostExecute(Void result) {
    // Dismiss loading circle
    swipeLayout.setRefreshing(false);

    if (error) {
        SnackBar snackBar = new SnackBar(getActivity(), "There was an error logging in. Ensure that you have network connectivity and that your API key and email are correct.", null, null);
        snackBar.show();
    }
    else if (getView() != null) {
        // Update UI elements
        if (developmentMode.equals("0"))
            ((Switch) getView().findViewById(R.id.development_mode_switch)).setChecked(false);
        else
            ((Switch) getView().findViewById(R.id.development_mode_switch)).setChecked(true);
        if (alwaysOnline.equals("0"))
            ((Switch) getView().findViewById(R.id.always_online_switch)).setChecked(false);
        else
            ((Switch) getView().findViewById(R.id.always_online_switch)).setChecked(true);

        try {
            if (spdy.equals("0") || spdy.equals(null))
                ((Switch) getView().findViewById(R.id.spdy_switch)).setChecked(false);
            else
                ((Switch) getView().findViewById(R.id.spdy_switch)).setChecked(true);
        } catch (Exception e) {
            //lazy programmer
        }

        if (ipv6.equals("0"))
            ((Switch) getView().findViewById(R.id.ipv6_switch)).setChecked(false);
        else
            ((Switch) getView().findViewById(R.id.ipv6_switch)).setChecked(true);

        if (cacheLevel.equals("agg"))
            ((Spinner) getView().findViewById(R.id.cache_level_spinner)).setSelection(0);
        if (cacheLevel.equals("iqs"))
            ((Spinner) getView().findViewById(R.id.cache_level_spinner)).setSelection(1);
        if (cacheLevel.equals("basic"))
            ((Spinner) getView().findViewById(R.id.cache_level_spinner)).setSelection(2);

        if (rocketLoader.equals("0"))
            ((Spinner) getView().findViewById(R.id.rocket_loader_spinner)).setSelection(0);
        if (rocketLoader.equals("a"))
            ((Spinner) getView().findViewById(R.id.rocket_loader_spinner)).setSelection(1);
        if (rocketLoader.equals("m"))
            ((Spinner) getView().findViewById(R.id.rocket_loader_spinner)).setSelection(2);

        ((Spinner) getView().findViewById(R.id.minification_spinner)).setSelection(Integer.parseInt(minify));

        ((TextView) getView().findViewById(R.id.challenge_ttl)).setText("Challenge TTL: " + challengeTTL + " seconds");
        ((TextView) getView().findViewById(R.id.expire_ttl)).setText("Expire TTL: " + expirationTTL + " seconds");
        ((TextView) getView().findViewById(R.id.cache_ttl)).setText("Cache TTL: " + cacheTTL + " seconds");

        // Disable Pro-only features, as necessary
        if (!AccountConfig.isCurrentDomainPro(getActivity())) {
            getView().findViewById(R.id.spdy_switch).setEnabled(false);
        }

        // Disable features that are not modifiable by the API
        getView().findViewById(R.id.always_online_switch).setEnabled(false);
    }
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:64,代码来源:PerformanceSettingsFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RegistryListener类代码示例发布时间:2022-05-22
下一篇:
Java Painter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap