List of usage examples for android.widget GridView setAdapter
@Override public void setAdapter(ListAdapter adapter)
From source file:com.cm.android.displayingbitmaps.ui.ImageGridFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.image_grid_fragment, container, false); final GridView mGridView = (GridView) v.findViewById(R.id.gridView); mGridView.setAdapter(mAdapter); mGridView.setOnItemClickListener(this); mGridView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override/*from w ww .ja v a 2 s. com*/ public void onScrollStateChanged(AbsListView absListView, int scrollState) { // Pause fetcher to ensure smoother scrolling when flinging if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) { // Before Honeycomb pause image loading on scroll to help with performance if (!Utils.hasHoneycomb()) { mImageFetcher.setPauseWork(true); } } else { mImageFetcher.setPauseWork(false); } } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); // This listener is used to get the final width of the GridView and then calculate the // number of columns and the width of each column. The width of each column is variable // as the GridView has stretchMode=columnWidth. The column width is used to set the height // of each view so we get nice square thumbnails. mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @TargetApi(VERSION_CODES.JELLY_BEAN) @Override public void onGlobalLayout() { if (mAdapter.getNumColumns() == 0) { final int numColumns = (int) Math .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing)); if (numColumns > 0) { final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing; mAdapter.setNumColumns(numColumns); mAdapter.setItemHeight(columnWidth); if (BuildConfig.DEBUG) { Log.d(TAG, "onCreateView - numColumns set to " + numColumns); } if (Utils.hasJellyBean()) { mGridView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { mGridView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } } } }); //@author anshu final ImageView mAddImage = (ImageView) v.findViewById(R.id.add_image); mAddImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { takePhoto(); } catch (IOException ex) { // Error occurred while creating the File Log.e("takePhoto", ex.toString()); } } }); //Admob mAdView = (AdView) v.findViewById(R.id.adView); return v; }
From source file:com.almalence.opencam.ui.AlmalenceStore.java
public void showStore() { LayoutInflater inflater = LayoutInflater.from(MainScreen.getInstance()); List<RelativeLayout> pages = new ArrayList<RelativeLayout>(); // <!-- -+- final boolean unlocked = false; //-+- -->//from w ww. ja va 2s . co m /* <!-- +++ final boolean unlocked = true; +++ --> */ // page 1 RelativeLayout page = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_pager_fragment, null); initStoreList(); RelativeLayout store = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_store, null); final ImageView imgStoreNext = (ImageView) store.findViewById(R.id.storeWhatsNew); GridView gridview = (GridView) store.findViewById(R.id.storeGrid); gridview.setAdapter(storeAdapter); if (!unlocked) { page.addView(store); pages.add(page); } // page 2 page = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_pager_fragment, null); RelativeLayout features = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_features, null); final ImageView imgFeaturesPrev = (ImageView) features.findViewById(R.id.storeWhatsNew); imgFeaturesPrev.setVisibility(View.INVISIBLE); WebView wv = (WebView) features.findViewById(R.id.text_features); wv.loadUrl("file:///android_asset/www/features.html"); page.addView(features); pages.add(page); SamplePagerAdapter pagerAdapter = new SamplePagerAdapter(pages); final ViewPager viewPager = new ViewPager(MainScreen.getInstance()); viewPager.setAdapter(pagerAdapter); if (!unlocked) viewPager.setCurrentItem(0); else viewPager.setCurrentItem(1); viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { switch (position) { case 0: // 0 imgStoreNext.setVisibility(View.VISIBLE); // 1 imgFeaturesPrev.setVisibility(View.INVISIBLE); break; case 1: // 0 imgStoreNext.setVisibility(View.INVISIBLE); // 1 if (!unlocked) imgFeaturesPrev.setVisibility(View.VISIBLE); else imgFeaturesPrev.setVisibility(View.INVISIBLE); break; default: break; } } }); imgStoreNext.setOnClickListener(new OnClickListener() { public void onClick(View v) { viewPager.setCurrentItem(1); } }); imgFeaturesPrev.setOnClickListener(new OnClickListener() { public void onClick(View v) { viewPager.setCurrentItem(0); } }); guiView.findViewById(R.id.buttonGallery).setEnabled(false); guiView.findViewById(R.id.buttonShutter).setEnabled(false); guiView.findViewById(R.id.buttonSelectMode).setEnabled(false); PluginManager.getInstance().sendMessage(ApplicationInterface.MSG_BROADCAST, ApplicationInterface.MSG_CONTROL_LOCKED); MainScreen.getGUIManager().lockControls = true; // <!-- -+- if (MainScreen.getInstance().showPromoRedeemed) { Toast.makeText(MainScreen.getInstance(), "The promo code has been successfully redeemed. All PRO-Features are unlocked", Toast.LENGTH_LONG).show(); MainScreen.getInstance().showPromoRedeemed = false; } if (MainScreen.getInstance().showPromoRedeemedJulius) { Toast.makeText(MainScreen.getInstance(), MainScreen.getInstance().getResources().getString(R.string.promoRedeemedJulius), Toast.LENGTH_LONG).show(); MainScreen.getInstance().showPromoRedeemedJulius = false; } //-+- --> final RelativeLayout pagerLayout = ((RelativeLayout) guiView.findViewById(R.id.viewPagerLayout)); pagerLayout.addView(viewPager); final RelativeLayout pagerLayoutMain = ((RelativeLayout) guiView.findViewById(R.id.viewPagerLayoutMain)); pagerLayoutMain.setVisibility(View.VISIBLE); pagerLayoutMain.bringToFront(); // We need this timer, to show store on top, after we return from google // play. // In MainScreen there is timer, which brings main buttons on top, // after MainScreen activity resumed. // So this timer "blocks" timer from MainScreen if we want to show // store. new CountDownTimer(600, 10) { public void onTick(long millisUntilFinished) { pagerLayoutMain.bringToFront(); } public void onFinish() { pagerLayoutMain.bringToFront(); } }.start(); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display the list of Spotlight web apps: * https://www.google.com/tv/spotlight-gallery.html Allow the user to launch * a web app in the browser.//from w w w . j a va 2s . c om * * @param context */ public static void displayAllSpotlight(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.spotlight_grid); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); final ArrayList<SpotlightInfo> spotlights = SpotlightTable.getAllSpotlights(context); gridView.setAdapter(new AllSpotlightAdapter(context, spotlights)); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SpotlightInfo spotlightInfo = (SpotlightInfo) parent.getAdapter().getItem(position); spotlightInfo.invoke(context); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.INVOKE_SPOTLIGHT_WEB_APP); } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_SPOTLIGHT_WEB_APPS); }
From source file:com.laer.easycast.ImagePane.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = new View(getActivity()); root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.setBackgroundColor(Color.WHITE); root = inflater.inflate(R.layout.imagepane, container, false); setHasOptionsMenu(true);/*from w w w . jav a 2s .c o m*/ myViewGroup = container; cursor = getActivity().getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, // Which columns to return null, // Return all rows null, MediaStore.Images.Media.DEFAULT_SORT_ORDER); GridView gridView = (GridView) root.findViewById(R.id.gridView1); gridView.setAdapter(new ImageAdapter(getActivity())); gridView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToPosition(position); // Get image filename String imagePath = cursor.getString(columnIndex); Bitmap image = BitmapFactory.decodeFile(imagePath); Log.i("ImagePath=", imagePath); Log.d(TAG, "Image decoded"); photoRaw(image, NONE); // Use this path to do further processing, i.e. full screen // display } }); return root; }
From source file:com.example.camera360.ui.ImageGridFragment.java
public void initializeGridView(boolean flag) { mFrameLayout.setVisibility(View.GONE); final GridView mGridView = (GridView) gridView.findViewById(R.id.gridView); if (flag) {//from w w w .ja v a 2 s . c om mGridView.setOnItemClickListener(this); mGridView.setAdapter(mAdapter); mGridView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int scrollState) { // Pause fetcher to ensure smoother scrolling when flinging if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) { mImageFetcher.setPauseWork(true); } else { mImageFetcher.setPauseWork(false); } } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); // This listener is used to get the final width of the GridView and then // calculate the // number of columns and the width of each column. The width of each // column is variable // as the GridView has stretchMode=columnWidth. The column width is used // to set the height // of each view so we get nice square thumbnails. mGridView.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mAdapter.getNumColumns() == 0) { final int numColumns = (int) Math .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing)); if (numColumns > 0) { final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing; mAdapter.setNumColumns(numColumns); mAdapter.setItemHeight(columnWidth); if (BuildConfig.DEBUG) { Log.d(TAG, "onCreateView - numColumns set to " + numColumns); } } } } }); gridView.setOnHeaderRefreshListener(this); gridView.setOnFooterRefreshListener(this); } else { gridView.onFooterRefreshComplete(); mAdapter.notifyDataSetChanged(); } }
From source file:com.leo.runningman.ui.ImageGridFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Window window = getActivity().getWindow(); window.setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.layout_title); final View v = inflater.inflate(R.layout.image_grid_fragment, container, false); TextView txt_title = (TextView) this.getActivity().findViewById(R.id.txt_title); txt_title.setText(getActivity().getResources().getString(R.string.app_name)); Button btn_delete = (Button) this.getActivity().findViewById(R.id.btn_delete); TextView txt_delete_confirm = (TextView) this.getActivity().findViewById(R.id.txt_delete_confirm); btn_delete.setVisibility(View.GONE); txt_delete_confirm.setVisibility(View.GONE); layout_bottom = (RelativeLayout) v.findViewById(R.id.layout_bottom); autoHideview(4000);//from www. j av a 2s .co m final GridView mGridView = (GridView) v.findViewById(R.id.gridView); mGridView.setAdapter(mAdapter); mGridView.setOnItemClickListener(this); // This listener is used to get the final width of the GridView and then calculate the // number of columns and the width of each column. The width of each column is variable // as the GridView has stretchMode=columnWidth. The column width is used to set the height // of each view so we get nice square thumbnails. mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mAdapter.getNumColumns() == 0) { final int numColumns = (int) Math .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing)); if (numColumns > 0) { final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing; mAdapter.setNumColumns(numColumns); mAdapter.setItemHeight(columnWidth); if (BuildConfig.DEBUG) { Log.d(TAG, "onCreateView - numColumns set to " + numColumns); } } } } }); mGridView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case OnScrollListener.SCROLL_STATE_IDLE: if (loadMore) { new HttpGetTask(1000L).execute(); } break; case OnScrollListener.SCROLL_STATE_FLING: break; case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL: break; } hideBottomLayout(); cancelAutoHideview(); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { Log.i(TAG, "firstVisibleItem:--->" + firstVisibleItem + "visibleItemCount:----->" + visibleItemCount + "totalItemCount:" + totalItemCount); loadMore = firstVisibleItem + visibleItemCount >= totalItemCount; start = totalItemCount; autoShowview(2000); } }); adview_first = (AdView) v.findViewById(R.id.adview_first); //TODO return v; }
From source file:com.yahala.ui.Views.EmojiView.java
private void init() { setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < Emoji.data.length; i++) { GridView gridView = new GridView(getContext()); gridView.setColumnWidth(OSUtilities.dpf(45.0f)); gridView.setNumColumns(-1);/*from w ww. ja v a2 s . c o m*/ views.add(gridView); EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]); gridView.setAdapter(localEmojiGridAdapter); adapters.add(localEmojiGridAdapter); } setBackgroundDrawable( new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 })); pager = new ViewPager(getContext()); pager.setAdapter(new EmojiPagesAdapter()); PagerSlidingTabStripEmoji tabs = new PagerSlidingTabStripEmoji(getContext()); tabs.setViewPager(pager); tabs.setShouldExpand(true); tabs.setIndicatorColor(0xff33b5e5); tabs.setIndicatorHeight(OSUtilities.dpf(2.0f)); tabs.setUnderlineHeight(OSUtilities.dpf(2.0f)); tabs.setUnderlineColor(1711276032); tabs.setTabBackground(0); LinearLayout localLinearLayout = new LinearLayout(getContext()); localLinearLayout.setOrientation(LinearLayout.HORIZONTAL); localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f)); ImageView localImageView = new ImageView(getContext()); localImageView.setImageResource(R.drawable.ic_emoji_backspace); localImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); localImageView.setBackgroundResource(R.drawable.bg_emoji_bs); localImageView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (EmojiView.this.listener != null) { EmojiView.this.listener.onBackspace(); } } }); localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(OSUtilities.dpf(61.0f), LayoutParams.MATCH_PARENT)); recentsWrap = new FrameLayout(getContext()); recentsWrap.addView(views.get(0)); TextView localTextView = new TextView(getContext()); localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent)); localTextView.setTextSize(18.0f); localTextView.setTextColor(-7829368); localTextView.setGravity(17); recentsWrap.addView(localTextView); views.get(0).setEmptyView(localTextView); addView(localLinearLayout, new LinearLayout.LayoutParams(-1, OSUtilities.dpf(48.0f))); addView(pager); loadRecents(); if (Emoji.data[0] == null || Emoji.data[0].length == 0) { pager.setCurrentItem(1); } }
From source file:org.mareatlantica.ui.Views.EmojiView.java
private void init() { setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < Emoji.data.length; i++) { GridView gridView = new GridView(getContext()); gridView.setColumnWidth(AndroidUtilities.dpf(45.0f)); gridView.setNumColumns(-1);//w w w . j a v a2 s .c o m views.add(gridView); EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]); gridView.setAdapter(localEmojiGridAdapter); adapters.add(localEmojiGridAdapter); } setBackgroundDrawable( new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 })); pager = new ViewPager(getContext()); pager.setAdapter(new EmojiPagesAdapter()); PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext()); tabs.setViewPager(pager); tabs.setShouldExpand(true); tabs.setIndicatorColor(0xff33b5e5); tabs.setIndicatorHeight(AndroidUtilities.dpf(2.0f)); tabs.setUnderlineHeight(AndroidUtilities.dpf(2.0f)); tabs.setUnderlineColor(1711276032); tabs.setTabBackground(0); LinearLayout localLinearLayout = new LinearLayout(getContext()); localLinearLayout.setOrientation(LinearLayout.HORIZONTAL); localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f)); ImageView localImageView = new ImageView(getContext()); localImageView.setImageResource(R.drawable.ic_emoji_backspace); localImageView.setScaleType(ImageView.ScaleType.CENTER); localImageView.setBackgroundResource(R.drawable.bg_emoji_bs); localImageView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (EmojiView.this.listener != null) { EmojiView.this.listener.onBackspace(); } } }); localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(AndroidUtilities.dpf(61.0f), LayoutParams.MATCH_PARENT)); recentsWrap = new FrameLayout(getContext()); recentsWrap.addView(views.get(0)); TextView localTextView = new TextView(getContext()); localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent)); localTextView.setTextSize(18.0f); localTextView.setTextColor(-7829368); localTextView.setGravity(17); recentsWrap.addView(localTextView); views.get(0).setEmptyView(localTextView); addView(localLinearLayout, new LinearLayout.LayoutParams(-1, AndroidUtilities.dpf(48.0f))); addView(pager); loadRecents(); if (Emoji.data[0] == null || Emoji.data[0].length == 0) { pager.setCurrentItem(1); } }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display dialog to the user for the Spotlight web apps: * https://www.google.com/tv/spotlight-gallery.html Allow the user to add a * web app to an existing row or a new row. * // www . j a va2 s .c o m * @param context */ public static void displayAddSpotlight(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.add_apps_grid); final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName); final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio); currentRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // hide the row name edit field if the current row radio button // is selected nameEditText.setVisibility(View.GONE); } }); final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio); newRadioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // show the row name edit field if the new radio button is // selected nameEditText.setVisibility(View.VISIBLE); nameEditText.requestFocus(); } }); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); final ArrayList<SpotlightInfo> spotlights = SpotlightTable.getAllSpotlights(context); gridView.setAdapter(new AllSpotlightAdapter(context, spotlights)); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if the new row radio button is selected, the user must enter // a name for the new row String name = nameEditText.getText().toString().trim(); if (newRadioButton.isChecked() && name.length() == 0) { nameEditText.requestFocus(); displayAlert(context, context.getString(R.string.dialog_new_row_name_alert)); return; } ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position); boolean currentRow = !newRadioButton.isChecked(); context.addItem(itemInfo, currentRow ? null : name); context.showCover(false); dialog.dismiss(); if (currentRow) { Analytics.logEvent(Analytics.ADD_SPOTLIGHT_WEB_APP); } else { Analytics.logEvent(Analytics.ADD_SPOTLIGHT_WEB_APP_WITH_ROW); } } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_ADD_SPOTLIGHT_WEB_APP); }
From source file:com.filemanager.free.fragments.preference_fragments.Preffrag.java
@Override public boolean onPreferenceClick(final Preference preference) { if (preferences != null) preferences.changed = 1;//ww w. j a v a 2 s .c om final MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); a.positiveText(R.string.cancel); a.title(R.string.choose_color); if (theme == 1) a.theme(Theme.DARK); a.autoDismiss(true); int fab_skin_pos = sharedPref.getInt("fab_skin_color_position", 1); int fab_skin = Color.parseColor(PreferenceUtils.getFabColor(fab_skin_pos)); a.positiveColor(fab_skin); a.neutralColor(fab_skin); a.neutralText(R.string.defualt); a.onNeutral(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { sharedPref.edit().remove(preference.getKey()); sharedPref.edit().apply(); } }); ColorAdapter adapter = null; String[] colors = PreferenceUtils.colors; List<String> arrayList = Arrays.asList(colors); switch (preference.getKey()) { case "skin": adapter = new ColorAdapter(getActivity(), arrayList, "skin_color_position", sharedPref.getInt("skin_color_position", 9)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getResources().getString(R.string.confirm)); builder.setMessage(getResources().getString(R.string.themeRestart)); builder.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { restartPC(getActivity()); } }); builder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setCancelable(true); builder.show(); break; case "fab_skin": adapter = new ColorAdapter(getActivity(), arrayList, "fab_skin_color_position", fab_skin_pos); break; case "icon_skin": adapter = new ColorAdapter(getActivity(), arrayList, "icon_skin_color_position", sharedPref.getInt("icon_skin_color_position", 9)); break; case "zippath": zipPath(); break; case "extractpath": zipPath(); break; default: break; } if (!preference.getKey().equals("zippath") && !preference.getKey().equals("extractpath")) { @SuppressLint("InflateParams") GridView v = (GridView) getActivity().getLayoutInflater().inflate(R.layout.dialog_grid, null); v.setAdapter(adapter); a.customView(v, false); MaterialDialog x = a.build(); assert (adapter) != null; adapter.updateMatDialog(x); x.show(); } return false; }