List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.geoffreybuttercrumbs.arewethereyet.DrawerFragment.java
@Override public void onClick(View v) { SharedPreferences prefs = getActivity().getSharedPreferences("AreWeThereYet", Context.MODE_WORLD_WRITEABLE); Intent intent = getActivity().getIntent(); intent.setClass(getActivity(), ZonePicker.class); ZonePicker sfa = (ZonePicker) getActivity(); switch (((View) v.getParent()).getId()) { case R.id.group_pinned: intent.putExtra(RADIUS, prefs.getInt(SAVED_RADIUS_KEY + v.findViewById(R.id.saveCB).getTag(), 2000)); intent.putExtra(LOC, retrieveSaved((Integer) v.findViewById(R.id.saveCB).getTag())); getActivity().setResult(Activity.RESULT_OK, intent); sfa.setNewAlarmZone(intent.getExtras()); sfa.showContent();/*from w w w .j a va 2 s . com*/ break; case R.id.group_recent: intent.putExtra(RADIUS, prefs.getInt(POINT_RADIUS_KEY + v.findViewById(R.id.saveCB).getTag(), 2000)); intent.putExtra(LOC, retrieveRecent((Integer) v.findViewById(R.id.saveCB).getTag())); getActivity().setResult(Activity.RESULT_OK, intent); sfa.setNewAlarmZone(intent.getExtras()); sfa.showContent(); break; } }
From source file:com.miz.mizuu.fragments.SearchWebMoviesFragment.java
protected void showMovie(int arg2) { DbAdapterMovies db = MizuuApplication.getMovieAdapter(); if (db.movieExists(mResults.get(arg2).getId())) { Intent intent = new Intent(); intent.setClass(getActivity(), MovieDetails.class); intent.putExtra("tmdbId", mResults.get(arg2).getId()); // Start the Intent for result startActivityForResult(intent, 0); } else {/*from www . j a v a2 s . co m*/ Intent i = new Intent(Intent.ACTION_VIEW); i.setClass(getActivity(), TMDbMovieDetails.class); i.putExtra("tmdbId", mResults.get(arg2).getId()); i.putExtra("title", mResults.get(arg2).getName()); startActivity(i); } }
From source file:com.cssweb.android.common.FairyUI.java
public static Intent genIntent(int paramInt, Context paramContext) { Intent localIntent = new Intent(); if (paramInt >= 0) { if (paramInt == Global.NJZQ_WTJY) { localIntent = genIsLoginIntent(paramInt, paramInt, paramContext); if (null != localIntent) { localIntent.putExtra("menu_id", Global.NJZQ_WTJY); localIntent.putExtra("isChangeBtn", true); }/* w ww. j a va2s . com*/ } else if (paramInt == Global.NJZQ_JLP_SZ) { localIntent.setClass(paramContext, Setting.class); } else if (paramInt == Global.NJZQ_JLP_JYYH) { localIntent = genIsLoginIntent(paramInt, paramInt, paramContext); if (null != localIntent) { localIntent.putExtra("menu_id", Global.NJZQ_JLP_JYYH); } } else if (paramInt == Global.NJZQ_JLP_TYYH) { localIntent.setClass(paramContext, ExperienceUsers.class); } else if (paramInt == Global.NJZQ_JLP_LLYH) { } else if (paramInt == Global.NJZQ_JLP_YYKH) { localIntent.setClass(paramContext, Setting.class); } else if (paramInt == Global.NJZQ_HQBJ_QQSC_WHSC) { localIntent.setClass(paramContext, GlobalMarket.class); } else if (paramInt == Global.NJZQ_HQBJ_GGHQ) { localIntent.putExtra("menu_id", Global.NJZQ_HQBJ_GGHQ); localIntent.setClass(paramContext, GGHQActivity.class); } else if (paramInt == Global.NJZQ_JFSC) { localIntent.putExtra("pos", Global.NJZQ_JFSC); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_JLP_WDZQTAG) {// localIntent.putExtra("pos", Global.NJZQ_JLP_WDZQTAG); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_JLP_YYKHTAG) {// localIntent.putExtra("pos", Global.NJZQ_JLP_YYKHTAG); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_JLP_TYKTAG) { localIntent.putExtra("pos", Global.NJZQ_JLP_TYKTAG); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_FIND_PASSWORD) {// ? localIntent.putExtra("pos", Global.NJZQ_FIND_PASSWORD); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_SQTYK) {// ? localIntent.putExtra("pos", Global.NJZQ_SQTYK); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_RESET_SERVIR_PASSWORD) {// ??? localIntent.putExtra("pos", Global.NJZQ_RESET_SERVIR_PASSWORD); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_TYYH_FIND_PASSWORD) { localIntent.putExtra("pos", Global.NJZQ_TYYH_FIND_PASSWORD); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_NZBD_JXZQC_JCC) { localIntent.putExtra("pos", Global.NJZQ_NZBD_JXZQC); localIntent.putExtra("position", 0); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_NZBD_JXZQC_HXC) { localIntent.putExtra("pos", Global.NJZQ_NZBD_JXZQC); localIntent.putExtra("position", 1); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_NZBD_CFPD_JTPX) { localIntent.putExtra("pos", Global.NJZQ_NZBD_CFPD); localIntent.putExtra("position", 2); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_NZBD_CFPD_MRJP) { localIntent.putExtra("pos", Global.NJZQ_NZBD_CFPD); localIntent.putExtra("position", 0); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt == Global.NJZQ_NZBD_CFPD_TZLT) { localIntent.putExtra("pos", Global.NJZQ_NZBD_CFPD); localIntent.putExtra("position", 1); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } else { localIntent.putExtra("menu_id", paramInt); localIntent.setClass(paramContext, JlpActivity.class); } } else if (paramInt == -1) { localIntent.putExtra("menu_id", paramInt); localIntent.setClass(paramContext, LoginActivity.class); } else { localIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); localIntent.setClass(paramContext, MainActivity.class); } return localIntent; }
From source file:de.evilbrain.sendtosftp.Main.java
public void serverAdd() { Intent intent = new Intent(); intent.setClass(Main.this, addServer.class); conf.putSettingsToIntent(intent);/*from w w w. j a v a2 s . c om*/ startActivityForResult(intent, 1); }
From source file:com.redhorse.quickstart.AppConfig.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case ITEM_ID_SETTING: break;/*from w w w.j a va2s . c o m*/ case ITEM_ID_ABOUT: Intent setting = new Intent(); setting.setClass(AppConfig.this, Feedback.class); startActivity(setting); break; } return super.onOptionsItemSelected(item); }
From source file:com.anthonykeane.speedzone.ActivityRecognitionIntentService.java
/** * Called when a new activity detection update is available. *///from w w w .j ava 2 s . co m @Override protected void onHandleIntent(Intent intent) { // Get a handle to the repository mPrefs = getApplicationContext().getSharedPreferences(ActivityUtils.SHARED_PREFERENCES, Context.MODE_PRIVATE); // Get a date formatter, and catch errors in the returned timestamp try { mDateFormat = (SimpleDateFormat) DateFormat.getDateTimeInstance(); } catch (Exception e) { Log.e(ActivityUtils.APPTAG, getString(R.string.date_format_error)); } // Format the timestamp according to the pattern, then localize the pattern mDateFormat.applyPattern(DATE_FORMAT_PATTERN); mDateFormat.applyLocalizedPattern(mDateFormat.toLocalizedPattern()); // If the intent contains an update if (ActivityRecognitionResult.hasResult(intent)) { // Get the update ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent); // Log the update logActivityRecognitionResult(result); // Get the most probable activity from the list of activities in the update DetectedActivity mostProbableActivity = result.getMostProbableActivity(); // Get the confidence percentage for the most probable activity int confidence = mostProbableActivity.getConfidence(); // Get the type of activity int activityType = mostProbableActivity.getType(); // Check to see if the repository contains a previous activity if (!mPrefs.contains(ActivityUtils.KEY_PREVIOUS_ACTIVITY_TYPE)) { // This is the first type an activity has been detected. Store the type SharedPreferences.Editor editor = mPrefs.edit(); editor.putInt(ActivityUtils.KEY_PREVIOUS_ACTIVITY_TYPE, activityType); editor.commit(); // If the repository contains a type } else if (activityChanged(activityType) // The activity has changed from the previous activity && (confidence >= 80)) // The confidence level for the current activity is > 50% { switch (activityType) { case DetectedActivity.IN_VEHICLE: Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); callIntent.setClass(getApplicationContext(), MainActivity.class); // todo callIntent.putExtra("bZoneError",bZoneError); startActivity(callIntent); break; //case DetectedActivity.STILL: //case DetectedActivity.ON_BICYCLE: case DetectedActivity.ON_FOOT: //sendNotification(); break; } } } }
From source file:com.lihu.myscreenengine.Services.Impl.ScreenService.java
public boolean show(Class<? extends Fragment> cls, String id, boolean isFullScreen, Intent mIntent, Bundle bundle) {//w ww . j a va2 s . c om final Main mainActivity = (Main) Engine.getInstance().getMainActivity(); String screen_id = (id == null) ? cls.getCanonicalName() : id; Log.v(TAG, screen_id); Intent intent = new Intent(mainActivity, cls); if (mIntent != null) { intent = mIntent; intent.setClass(mainActivity, cls); } if (bundle != null) { intent.putExtras(bundle); } intent.putExtra("id", screen_id); // final Window window = mainActivity.getLocalActivityManager().startActivity(screen_id, intent); // if (window != null) { // View view = mainActivity.getLocalActivityManager().startActivity(screen_id, intent).getDecorView(); // InputMethodManager imm = (InputMethodManager)mainActivity.getSystemService(Context.INPUT_METHOD_SERVICE); // boolean isOpen=imm.isActive(view); // if(isOpen) // imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY); // center.removeAllViews(); // center.addView(view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); //// center.showNext(); // if (isFullScreen) { // top.setVisibility(View.GONE); // bottom.setVisibility(View.GONE); // } else { // top.setVisibility(View.VISIBLE); // bottom.setVisibility(View.VISIBLE); // } // this.mLastScreens[(++this.mLastScreensIndex % this.mLastScreens.length)] = screen_id; // this.mLastScreensIndex %= this.mLastScreens.length; // return true; // } return false; }
From source file:com.digitalobstaclecourse.bluefinder.FindCar.java
@Override public boolean onOptionsItemSelected(MenuItem item) { //Log.d("MENU", (String) item.getTitle()); Intent intent = new Intent(); intent.setClass(FindCar.this, SettingsActivity.class); startActivityForResult(intent, REQUEST_CODE_SETTINGS_ACTIVITY); //Log.d("MENU", "MENU finished"); return true;// www.ja v a 2s . co m }
From source file:com.cssweb.android.common.FairyUI.java
public static Intent genIntent(int paramInt1, int paramInt2, String paramString2, String paramString3, Context paramContext) {//from www . j a v a2s . c o m Intent localIntent = new Intent(); if (paramInt1 == Global.NJZQ_WTJY) { localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); // ? switch (paramInt2) { case 0: localIntent.setClass(paramContext, AccountManage.class); break; case 1: localIntent.putExtra("type", 0); localIntent.putExtra("bsname", ""); localIntent.putExtra("stkcode", paramString2); localIntent.setClass(paramContext, StockTrading.class); break; case 2: localIntent.putExtra("type", 1); localIntent.putExtra("bsname", "?"); localIntent.putExtra("stkcode", paramString2); localIntent.setClass(paramContext, StockTrading.class); break; case 3: localIntent.setClass(paramContext, StockCancel.class); break; case 4: localIntent.putExtra("menu_id", Global.NJZQ_WTJY_FIVE); localIntent.setClass(paramContext, BankActivity.class); break; case 5: localIntent.putExtra("type", Global.QUERY_STOCK_DRWT); localIntent.setClass(paramContext, TodayEntrust.class); break; case 6: localIntent.putExtra("type", Global.QUERY_STOCK_DRCJ); localIntent.setClass(paramContext, TodayDeal.class); break; case 7: localIntent.setClass(paramContext, GetPosition.class); break; case 8: localIntent.setClass(paramContext, AssetQuery.class); break; } } else if (paramInt1 == Global.NJZQ_WTJY_TWO) { localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); // ? switch (paramInt2) { case 0: localIntent.putExtra("menuid", Global.OPEN_GP); localIntent.putExtra("menudetail", Global.QUERY_STOCK_DZD); localIntent.setClass(paramContext, DateRange.class); break; case 1: localIntent.putExtra("menuid", Global.OPEN_GP); localIntent.putExtra("menudetail", Global.QUERY_STOCK_LSWT); localIntent.setClass(paramContext, DateRange.class); break; case 2: localIntent.putExtra("menu_id", Global.NJZQ_WTJY_GP_THREE); localIntent.setClass(paramContext, FundActivity.class); break; case 3: localIntent.putExtra("menu_id", Global.NJZQ_WTJY_GP_ONE); localIntent.setClass(paramContext, CnjjActivity.class); break; case 4: localIntent.putExtra("pos", Global.NJZQ_WTJY_SZLC); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 5: localIntent.putExtra("pos", Global.NJZQ_WTJY_RZRQ); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 6: localIntent.putExtra("menuid", Global.OPEN_GP); localIntent.putExtra("menudetail", Global.QUERY_NEW_STOCK_MATCH); localIntent.setClass(paramContext, DateRange.class); break; case 7: localIntent.setClass(paramContext, ModifyPassword.class); break; case 8: localIntent.setClass(paramContext, ShareholderList.class); break; } } else if (paramInt1 == Global.NJZQ_WTJY_THREE) { localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); switch (paramInt2) { case 0: localIntent.setClass(paramContext, ModifyContactInfo.class); break; } } else if (paramInt1 == Global.NJZQ_HQBJ) { if (!isNetworkErrorGoInActivity(paramContext)) { // localIntent.putExtra("restart", 2); // localIntent.setClass(paramContext, RestartDialog.class); loadAllStock(paramInt1, paramInt2, paramString2, paramString3, paramContext); localIntent = null; } else { localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); switch (paramInt2) { case 0: localIntent = genIsLoginIntent(Global.NJZQ_HQBJ_HQYJ, Global.NJZQ_HQBJ_HQYJ, paramContext); break; case 1: // // localIntent.putExtra("requestType", 1); // localIntent.setClass(paramContext, PersonalStock.class); if (TradeUser.getInstance().getLoginType() == 3) { localIntent.putExtra("requestType", 1); localIntent.setClass(paramContext, PersonalStock.class); } else localIntent = genIsLoginIntent(Global.QUOTE_USERSTK, Global.QUOTE_USERSTK, paramContext); break; case 2: localIntent.putExtra("requestType", 2); localIntent.setClass(paramContext, DaPan.class); break; case 3: localIntent.putExtra("requestType", 0); localIntent.setClass(paramContext, PaiMing.class); break; case 4: localIntent.putExtra("menuid", Global.QUOTE_FENSHI); localIntent.setClass(paramContext, QueryStock.class); break; case 5: localIntent.putExtra("requestType", 2); localIntent.setClass(paramContext, FenLei.class); break; case 6: localIntent.putExtra("menu_id", Global.NJZQ_HQBJ_EGHT); localIntent.setClass(paramContext, OTCFundActivity.class); break; case 7: localIntent.putExtra("menu_id", Global.NJZQ_HQBJ_FIVE); localIntent.setClass(paramContext, GlobalMarketActivity.class); break; case 8: localIntent.putExtra("menu_id", Global.NJZQ_HQBJ_QHHQ); localIntent.setClass(paramContext, QHHQActivity.class); break; } } } else if (paramInt1 == Global.NJZQ_ZXHD) { switch (paramInt2) { case 0:// localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("pos", Global.NJZQ_ZXHD_ZJJP); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 1:// localIntent = genIsLoginIntent(Global.NJZQ_ZXHD_TZGW, Global.NJZQ_ZXHD_TZGW, paramContext); break; case 2://?? if (TradeUser.getInstance().getLoginType() == 3) { localIntent.putExtra("pos", Global.NJZQ_ZXHD_KHJL); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setClass(paramContext, WebViewDisplay.class); } else localIntent = genIsLoginIntent(Global.NJZQ_ZXHD_KHJL, Global.NJZQ_ZXHD_KHJL, paramContext); break; case 3:// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("pos", Global.NJZQ_ZXHD_ZXKF);// ? localIntent.setClass(paramContext, WebViewDisplay.class); break; case 4:// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("pos", Global.NJZQ_ZXHD_KFRX);// ? localIntent.setClass(paramContext, WebViewDisplay.class); break; case 5:// localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("pos", Global.NJZQ_ZXHD_GNLY);// localIntent.setClass(paramContext, WebViewDisplay.class); break; case 6:// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.putExtra("pos", Global.NJZQ_ZXHD_CJWT);// ? localIntent.setClass(paramContext, WebViewDisplay.class); break; case 7: localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.putExtra("menu_id", Global.NJZQ_ZXHD_EGHT);// localIntent.setClass(paramContext, VistualTrade.class); break; default: localIntent = null; break; } } else if (paramInt1 == Global.NJZQ_NZFC) {// ?? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); switch (paramInt2) { case 0: localIntent.putExtra("pos", Global.NJZQ_NZFC_NZDT); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 1: localIntent.putExtra("pos", Global.NJZQ_NZFC_ZJNZ); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 2: localIntent.putExtra("pos", Global.NJZQ_NZFC_JYH); localIntent.setClass(paramContext, WebViewDisplay.class); break; default: localIntent = null; break; } } else if (paramInt1 == Global.NJZQ_NZBD) {// ??? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); switch (paramInt2) { case 0:// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.putExtra("menu_id", Global.NJZQ_NZBD_JXZQC); localIntent.setClass(paramContext, JxgpcActivity.class); break; case 1: localIntent.putExtra("pos", Global.NJZQ_NZBD_TZZH); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 2: localIntent.putExtra("pos", Global.NJZQ_NZBD_ZQYJ); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 3: localIntent.putExtra("pos", Global.NJZQ_NZBD_QHYJ); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 4:// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.putExtra("menu_id", Global.NJZQ_NZBD_CFPD); localIntent.setClass(paramContext, CfpdActivity.class); break; default: localIntent = null; break; } } else if (paramInt1 == Global.NJZQ_ZXLP) {// localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); switch (paramInt2) { case 0: localIntent.putExtra("pos", Global.NJZQ_ZXLP_CPBD); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 1: localIntent.putExtra("pos", Global.NJZQ_ZXLP_YWZJ); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 2: localIntent.putExtra("pos", Global.NJZQ_ZXLP_PMHH); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 3: localIntent.putExtra("pos", Global.NJZQ_ZXLP_TGLC); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 4: // localIntent.putExtra("pos", Global.NJZQ_ZXLP_ZJLX); // localIntent.setClass(paramContext, WebViewDisplay.class); localIntent.putExtra("pos", Global.NJZQ_ZXLP_ZJLX); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 5: localIntent.putExtra("pos", Global.NJZQ_ZXLP_GG); localIntent.setClass(paramContext, WebViewDisplay.class); break; default: localIntent = null; break; } } else if (paramInt1 == Global.NJZQ_JFSC) {// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // localIntent = genIsLoginIntent(Global.NJZQ_JFSC, // Global.NJZQ_JFSC, paramContext); localIntent.putExtra("pos", Global.NJZQ_JFSC); localIntent.setClass(paramContext, WebViewDisplay.class); } else if (paramInt1 == Global.NJZQ_ZSYYT) {// ? localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); switch (paramInt2) { case 0:// localIntent.putExtra("pos", Global.NJZQ_ZSYYT_YYKH); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 1: localIntent.putExtra("pos", Global.NJZQ_ZSYYT_YYTGG); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 2: localIntent.putExtra("pos", Global.NJZQ_ZSYYT_YYWD); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 3: localIntent.putExtra("pos", Global.NJZQ_ZSYYT_YWZX); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 4: localIntent.putExtra("pos", Global.NJZQ_ZSYYT_TZZJY); localIntent.setClass(paramContext, WebViewDisplay.class); break; case 5: localIntent.putExtra("pos", Global.NJZQ_ZSYYT_TJKH); localIntent.setClass(paramContext, WebViewDisplay.class); break; default: localIntent = null; break; } } return localIntent; }
From source file:com.miz.mizuu.fragments.RelatedMoviesFragment.java
public void onViewCreated(View v, Bundle savedInstanceState) { super.onViewCreated(v, savedInstanceState); v.findViewById(R.id.container)// w w w. j a v a 2 s. c om .setBackgroundResource(MizuuApplication.getBackgroundColorResource(getActivity())); MizLib.addActionBarPadding(getActivity(), v.findViewById(R.id.container)); pbar = (ProgressBar) v.findViewById(R.id.progress); if (pics_sources.size() > 0) pbar.setVisibility(View.GONE); // Hack to remove the ProgressBar on orientation change mAdapter = new ImageAdapter(getActivity()); mGridView = (GridView) v.findViewById(R.id.gridView); mGridView.setAdapter(mAdapter); // Calculate the total column width to set item heights by factor 1.5 mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { final int numColumns = (int) Math .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing)); if (numColumns > 0) { mGridView.setNumColumns(numColumns); } } }); mGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (movieMap.get(Integer.valueOf(pics_sources.get(arg2).getId()))) { Intent intent = new Intent(); intent.setClass(getActivity(), MovieDetails.class); intent.putExtra("tmdbId", pics_sources.get(arg2).getId()); // Start the Intent for result startActivityForResult(intent, 0); } else { Intent i = new Intent(Intent.ACTION_VIEW); i.setClass(getActivity(), TMDbMovieDetails.class); i.putExtra("tmdbid", pics_sources.get(arg2).getId()); i.putExtra("title", pics_sources.get(arg2).getTitle()); startActivity(i); } } }); if (getArguments().containsKey("json")) { json = getArguments().getString("json"); loadJson(getArguments().getString("baseUrl")); } else { new GetMovies().execute(getArguments().getString("tmdbId")); } }