@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    Activity activity = (Activity) getContext();
    LayoutInflater inflater = activity.getLayoutInflater();

    View rowView = inflater.inflate(R.layout.news, null);
    Article article = getItem(position);

    TextView textView = (TextView) rowView.findViewById(R.id.article_title_text);
    textView.setText(article.getTitle());

    TextView dateView = (TextView) rowView.findViewById(R.id.article_listing_smallprint);
    String pubDate = article.getPubDate();
    // SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss Z", Locale.ENGLISH);
    // Date pDate;
    //	pDate = (Date) df.parse(pubDate);
    pubDate = "published " + "by " + article.getAuthor();
    // pubDate = article.getGuid();
    // + DateUtils.getDateDifference(pDate) +
    dateView.setText(pubDate);

    if (!article.isRead()) {
      LinearLayout row = (LinearLayout) rowView.findViewById(R.id.article_row_layout);
      row.setBackgroundColor(Color.WHITE);
      textView.setTypeface(Typeface.DEFAULT_BOLD);
    }
    return rowView;
  }
Exemplo n.º 2
1
  public static void setCurWindowBrightness(Context context, int brightness) {

    // 如果开启自动亮度,则关闭。否则,设置了亮度值也是无效的
    if (IsAutoBrightness(context)) {
      stopAutoBrightness(context);
    }

    // context转换为Activity
    Activity activity = (Activity) context;
    WindowManager.LayoutParams lp = activity.getWindow().getAttributes();

    // 异常处理
    if (brightness < 1) {
      brightness = 1;
    }

    // 异常处理
    if (brightness > 255) {
      brightness = 255;
    }

    lp.screenBrightness = Float.valueOf(brightness) * (1f / 255f);

    activity.getWindow().setAttributes(lp);
  }
  public static String printKeyHash(Activity context) {
    PackageInfo packageInfo;
    String key = null;
    try {
      // getting application package name, as defined in manifest
      String packageName = context.getApplicationContext().getPackageName();

      // Retriving package info
      packageInfo =
          context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES);

      Log.e("Package Name=", context.getApplicationContext().getPackageName());

      for (Signature signature : packageInfo.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        key = new String(Base64.encode(md.digest(), 0));

        // String key = new String(Base64.encodeBytes(md.digest()));
        Log.e("Key Hash=", key);
      }
    } catch (PackageManager.NameNotFoundException e1) {
      Log.e("Name not found", e1.toString());
    } catch (NoSuchAlgorithmException e) {
      Log.e("No such an algorithm", e.toString());
    } catch (Exception e) {
      Log.e("Exception", e.toString());
    }

    return key;
  }
Exemplo n.º 4
1
  /**
   * 为 DrawerLayout 布局设置状态栏透明
   *
   * @param activity 需要设置的activity
   * @param drawerLayout DrawerLayout
   */
  public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
      return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else {
      activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
    // 内容布局不是 LinearLayout 时,设置padding top
    if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
      contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
    }

    // 设置属性
    ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
    drawerLayout.setFitsSystemWindows(false);
    contentLayout.setFitsSystemWindows(false);
    contentLayout.setClipToPadding(true);
    drawer.setFitsSystemWindows(false);
  }
Exemplo n.º 5
1
 /** 获取屏幕分辨率 */
 public static int getResolution(Activity act) {
   int Width = 0;
   int Height = 0;
   Width = act.getWindowManager().getDefaultDisplay().getWidth();
   Height = act.getWindowManager().getDefaultDisplay().getHeight();
   return Width * Height;
 }
  public static void showAuthErrorView(Activity activity, int titleResId, int messageResId) {
    final String ALERT_TAG = "alert_ask_credentials";
    if (activity.isFinishing()) {
      return;
    }

    // WP.com errors will show the sign in activity
    if (WordPress.getCurrentBlog() == null
        || (WordPress.getCurrentBlog() != null && WordPress.getCurrentBlog().isDotcomFlag())) {
      Intent signInIntent = new Intent(activity, SignInActivity.class);
      signInIntent.putExtra(SignInActivity.ARG_IS_AUTH_ERROR, true);
      signInIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
      activity.startActivityForResult(signInIntent, SignInActivity.REQUEST_CODE);
      return;
    }

    // abort if the dialog is already visible
    if (activity.getFragmentManager().findFragmentByTag(ALERT_TAG) != null) {
      return;
    }

    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    AuthErrorDialogFragment authAlert = new AuthErrorDialogFragment();
    authAlert.setWPComTitleMessage(titleResId, messageResId);
    ft.add(authAlert, ALERT_TAG);
    ft.commitAllowingStateLoss();
  }
Exemplo n.º 7
1
 public static void load(Activity a, int R_layout_yourXML) {
   a.setContentView(R_layout_yourXML);
   Views.inject(a); // butterknife injection
   String className = a.getClass().getCanonicalName() + "$$ViewInjector";
   try {
     Log.i(LOG_TAG, "Checking if butterknife injections exist" + ", className=" + className);
     Class.forName(className);
   } catch (ClassNotFoundException e) {
     // injection did not work show instructions:
     Log.e(
         LOG_TAG,
         "! Butterknife could not find injection classes "
             + "(see http://jakewharton.github.io/"
             + "butterknife/ide-eclipse.html )");
     Log.e(
         LOG_TAG,
         "! Right click on project -> "
             + "Head to Java Compiler -> Annotation "
             + "Processing -> CHECK 'Enable project "
             + "specific settings'");
     Log.e(
         LOG_TAG,
         "! Select 'Factory Path' -> "
             + "Check \"Enable project specific settings\" "
             + "-> click \"Add JARs\" -> Navigate to the "
             + "project's libs/ folder and select "
             + "the Butter Knife jar -> Click Ok");
     throw new RuntimeException(
         "Butterknife could not " + "find injection class '" + className + "'");
   }
 }
Exemplo n.º 8
1
  // Adds a reminder to the displayed list of reminders.
  // Returns true if successfully added reminder, false if no reminders can
  // be added.
  static boolean addReminder(
      Activity activity,
      View.OnClickListener listener,
      ArrayList<LinearLayout> items,
      ArrayList<Integer> values,
      ArrayList<String> labels,
      int minutes) {

    if (items.size() >= MAX_REMINDERS) {
      return false;
    }

    LayoutInflater inflater = activity.getLayoutInflater();
    LinearLayout parent = (LinearLayout) activity.findViewById(R.id.reminder_items_container);
    LinearLayout reminderItem = (LinearLayout) inflater.inflate(R.layout.edit_reminder_item, null);
    parent.addView(reminderItem);

    Spinner spinner = (Spinner) reminderItem.findViewById(R.id.reminder_value);
    Resources res = activity.getResources();
    spinner.setPrompt(res.getString(R.string.reminders_title));
    int resource = android.R.layout.simple_spinner_item;
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity, resource, labels);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    ImageButton reminderRemoveButton;
    reminderRemoveButton = (ImageButton) reminderItem.findViewById(R.id.reminder_remove);
    reminderRemoveButton.setOnClickListener(listener);

    int index = findMinutesInReminderList(values, minutes);
    spinner.setSelection(index);
    items.add(reminderItem);

    return true;
  }
  @Override
  public void start() {
    super.start();

    AbstractGameView gameView = GameManager.createGame(gameName, act);

    RelativeLayout mainContentHolder;
    LinearLayout dismissAlarmLayout;

    mainContentHolder = (RelativeLayout) act.findViewById(R.id.mainContentLayout);
    dismissAlarmLayout = (LinearLayout) act.findViewById(R.id.dismissAlarmLayout);

    // Make the holder for dismiss/snooze alarm buttons invisible while the game is running.
    dismissAlarmLayout.setVisibility(View.GONE);
    mainContentHolder.addView(gameView);

    // Adding all views that build the games UI after the surfaceView has been added.
    // Otherwise the UI views would all get stuck under the surface view.
    List<View> uiList = gameView.getUIComponents();
    if (uiList != null) {
      for (View v : uiList) {
        mainContentHolder.addView(v);
      }
    }
    gameView.resume();
  }
Exemplo n.º 10
0
 /**
  * Clears the distribution pref to return distribution state to STATE_UNKNOWN, and wipes the
  * in-memory referrer pigeonhole.
  */
 private void clearDistributionPref() {
   mAsserter.dumpLog("Clearing distribution pref.");
   SharedPreferences settings = mActivity.getSharedPreferences("GoannaApp", Activity.MODE_PRIVATE);
   String keyName = mActivity.getPackageName() + ".distribution_state";
   settings.edit().remove(keyName).commit();
   TestableDistribution.clearReferrerDescriptorForTesting();
 }
Exemplo n.º 11
0
 /** ����ָ�������Activity */
 public void finishActivity(Class<?> cls) {
   for (Activity activity : activityStack) {
     if (activity.getClass().equals(cls)) {
       finishActivity(activity);
     }
   }
 }
      /** If the update was successful restart the MainActivity */
      @Override
      protected void onPostExecute(String result) {
        super.onPostExecute(result);

        progr_dlg.dismiss();

        // After all the update is (succesfully) done we have to restart
        // the main activity

        if (DONE.equals(result)) {
          // either we were started tru intent (return to main)
          if (context instanceof PreferencesActivity) {
            Activity a = (Activity) context;
            a.setResult(PreferencesActivity.RESULT_DATA_UPDATED);
            // this will call on activity result
            a.finish();
          }

          // or directly by passing context: restart directly
          if (context instanceof MainActivity) {
            MainActivity mainActivity = (MainActivity) context;
            mainActivity.restartActivity(0);
          }
        }
      }
  private void updateWifiState(int state) {
    Activity activity = getActivity();
    if (activity != null) {
      activity.invalidateOptionsMenu();
    }

    switch (state) {
      case WifiManager.WIFI_STATE_ENABLED:
        // this function only returns valid results in enabled state
        mIbssSupported = mWifiManager.isIbssSupported();
        mSupportedChannels = mWifiManager.getSupportedChannels();

        mScanner.resume();
        return; // not break, to avoid the call to pause() below

      case WifiManager.WIFI_STATE_ENABLING:
        addMessagePreference(R.string.wifi_starting);
        break;

      case WifiManager.WIFI_STATE_DISABLED:
        setOffMessage();
        break;
    }

    mLastInfo = null;
    mLastState = null;
    mScanner.pause();
  }
Exemplo n.º 14
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // 防止第三方跳转时出现双实例
    Activity aty = AppManager.getActivity(MainActivity.class);
    if (aty != null && !aty.isFinishing()) {
      finish();
    }

    final View view = View.inflate(this, R.layout.app_start, null);
    setContentView(view);
    // 渐变展示启动屏
    AlphaAnimation aa = new AlphaAnimation(0.5f, 1.0f);
    aa.setDuration(800);
    view.startAnimation(aa);
    aa.setAnimationListener(
        new Animation.AnimationListener() {
          @Override
          public void onAnimationEnd(Animation arg0) {
            redirectTo();
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationStart(Animation animation) {}
        });
  }
  public static void dlg_register_main(Activity actv) {
    /*----------------------------
    * Steps
    * 1. Get a dialog
    * 2. List view
    * 3. Set listener => list
    * 9. Show dialog
    ----------------------------*/

    Dialog dlg =
        dlg_template_cancel(
            actv,
            R.layout.dlg_register_main,
            R.string.generic_register,
            R.id.dlg_register_main_btn_cancel,
            Methods.DialogButtonTags.dlg_generic_dismiss);

    /*----------------------------
    * 2. List view
    * 		1. Get view
    * 		2. Prepare list data
    * 		3. Prepare adapter
    * 		4. Set adapter
    ----------------------------*/
    ListView lv = (ListView) dlg.findViewById(R.id.dlg_register_main_lv_list);

    /*----------------------------
    * 2.2. Prepare list data
    ----------------------------*/
    List<String> registerItems = new ArrayList<String>();

    registerItems.add(actv.getString(R.string.dlg_register_main_items));
    registerItems.add(actv.getString(R.string.dlg_register_main_stores));
    registerItems.add(actv.getString(R.string.dlg_register_main_genres));

    /** ******************************* 2.3. Prepare adapter ******************************* */
    ArrayAdapter<String> adp =
        new ArrayAdapter<String>(
            actv,
            android.R.layout.simple_list_item_1,
            //				R.layout.list_row_dlg_register_main,
            registerItems);

    /*----------------------------
    * 2.4. Set adapter
    ----------------------------*/
    lv.setAdapter(adp);

    lv.setTag(Methods.DialogItemTags.dlg_register_main);

    /*----------------------------
    * 3. Set listener => list
    ----------------------------*/
    lv.setOnItemClickListener(new DialogOnItemClickListener(actv, dlg));

    /*----------------------------
    * 9. Show dialog
    ----------------------------*/
    dlg.show();
  } // public static void dlg_register_main(Activity actv)
  @SuppressWarnings("unused")
  public Bitmap getThumbnail(Uri uri, int THUMBNAIL_SIZE)
      throws FileNotFoundException, IOException {
    InputStream input = context.getContentResolver().openInputStream(uri);

    BitmapFactory.Options onlyBoundsOptions = new BitmapFactory.Options();
    onlyBoundsOptions.inJustDecodeBounds = true;
    onlyBoundsOptions.inDither = true; // optional
    onlyBoundsOptions.inPreferredConfig = Config.ARGB_8888; // optional
    BitmapFactory.decodeStream(input, null, onlyBoundsOptions);
    input.close();
    if ((onlyBoundsOptions.outWidth == -1) || (onlyBoundsOptions.outHeight == -1)) return null;
    int originalSize =
        (onlyBoundsOptions.outHeight > onlyBoundsOptions.outWidth)
            ? onlyBoundsOptions.outHeight
            : onlyBoundsOptions.outWidth;
    double ratio = (originalSize > THUMBNAIL_SIZE) ? (originalSize / THUMBNAIL_SIZE) : 1.0;
    BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
    bitmapOptions.inSampleSize = getPowerOfTwoForSampleRatio(ratio);
    bitmapOptions.inDither = true; // optional
    bitmapOptions.inPreferredConfig = Config.ARGB_8888; // optional
    input = context.getContentResolver().openInputStream(uri);
    Bitmap bitmap = BitmapFactory.decodeStream(input, null, bitmapOptions);
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    input.close();
    return bitmap;
  }
Exemplo n.º 17
0
 public static boolean needPermissions(Activity activity) {
   Log.d(TAG, "needPermissions: ");
   return activity.checkSelfPermission(Manifest.permission.CAMERA)
           != PackageManager.PERMISSION_GRANTED
       || activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
           != PackageManager.PERMISSION_GRANTED;
 }
Exemplo n.º 18
0
  protected void initializeAlertDialog() {
    alertDialog = new AlertDialog.Builder(act);
    alertDialog.setCancelable(false);
    // Setting Dialog Title
    alertDialog.setTitle(act.getString(R.string.conex));

    // Setting Dialog Message
    alertDialog.setMessage(act.getString(R.string.conex_question));
    // Setting Icon to Dialog
    // alertDialog.setIcon(R.drawable.delete);

    // Setting Positive "Yes" Button
    alertDialog.setPositiveButton(
        act.getString(R.string.yes),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            act.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
            dialog.cancel();
          }
        });

    // Setting Negative "NO" Button
    alertDialog.setNegativeButton(
        act.getString(R.string.no),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
            act.finish();
          }
        });
  }
Exemplo n.º 19
0
 public static void finishAll() {
   for (Activity activity : activities) {
     if (!activity.isFinishing()) {
       activity.finish();
     }
   }
 }
Exemplo n.º 20
0
  @Override
  public FREObject call(FREContext arg0, FREObject[] arg1) {

    Activity a = arg0.getActivity();
    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(a);

    try {
      if (adapter == null) {
        return FREObject.newObject(false);
      }
    } catch (Exception e) {
    }
    NfcNdefManager.getInstance().adapter = NfcAdapter.getDefaultAdapter(a);
    NfcNdefManager.getInstance().pIntent =
        PendingIntent.getActivity(
            a, 0, new Intent(a, a.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

    IntentFilter ndefFilter = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
    try {
      ndefFilter.addDataType("text/plain");
    } catch (MalformedMimeTypeException mmte) {
    }
    NfcNdefManager.getInstance().ndefFilters = new IntentFilter[] {ndefFilter};

    IntentFilter tagFilter = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED);
    NfcNdefManager.getInstance().tagFilters = new IntentFilter[] {tagFilter};

    try {
      return FREObject.newObject(true);
    } catch (Exception e) {
    }
    return null;
  }
Exemplo n.º 21
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (DEBUG) Log.e(TAG, "onCreate");
    setHasOptionsMenu(true);
    setRetainInstance(false);
    mThreadLoaderCallback = new ThreadDataCallback();

    final Activity activity = getActivity();
    mContentResolver = activity.getContentResolver();
    Intent intent = activity.getIntent();

    mReplyType = intent.getIntExtra(Constants.EDITING, -999);
    mPostId = intent.getIntExtra(Constants.REPLY_POST_ID, 0);
    mThreadId = intent.getIntExtra(Constants.REPLY_THREAD_ID, 0);

    boolean badRequest = false;
    if (mReplyType < 0 || mThreadId == 0) {
      // we always need a valid type and thread ID
      badRequest = true;
    } else if (mPostId == 0
        && (mReplyType == AwfulMessage.TYPE_EDIT || mReplyType == AwfulMessage.TYPE_QUOTE)) {
      // edits and quotes always need a post ID too
      badRequest = true;
    }

    if (badRequest) {
      activity.finish();
    } else {
      loadReply(mReplyType, mThreadId, mPostId);
    }
  }
Exemplo n.º 22
0
 public ChartListAdapter(Activity activity) {
   this.setDownloadInfos(new ArrayList<AppStats>());
   this.layoutInflater = activity.getLayoutInflater();
   this.activity = activity;
   this.scale = activity.getResources().getDisplayMetrics().density;
   this.dateFormat = new SimpleDateFormat(Preferences.getDateFormatShort(activity));
 }
Exemplo n.º 23
0
  public static void startViewActivity(
      final Activity activity, final String path, final String mimeType, boolean useDefaultViewer) {
    if (useDefaultViewer) {
      ComponentName componentName =
          AppPickerUtils.getDefaultViewerComponentName(activity, path, mimeType);
      Intent intent =
          getAppIntentFromMimeType(activity.getPackageManager(), path, componentName, mimeType);

      // use default saved viewer
      if (intent != null) {
        activity.startActivity(intent);
        return;
      }
    }

    final AppPickerDialog appPickerDialog = new AppPickerDialog(activity, path, mimeType);
    appPickerDialog.setOpenAppClickListener(
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            ActivityInfo activityInfo = appPickerDialog.getSelectedApp().activityInfo;
            ComponentName componentName1 =
                new ComponentName(activityInfo.applicationInfo.packageName, activityInfo.name);
            activity.startActivity(createViewIntent(path, componentName1, mimeType));
          }
        });
    appPickerDialog.show();
  }
  public kehu_gengxinshijianPopWindow(final Activity context) {
    this.context = context;
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    conentView = inflater.inflate(R.layout.crm_kehu_gengxinshijian, null);
    int h = context.getWindowManager().getDefaultDisplay().getHeight();
    int w = context.getWindowManager().getDefaultDisplay().getWidth();
    // 设置SelectPicPopupWindow的View
    this.setContentView(conentView);
    // 设置SelectPicPopupWindow弹出窗体的宽
    // this.setWidth(w / 2 + 50);
    this.setWidth(w / 2);
    // 设置SelectPicPopupWindow弹出窗体的高
    this.setHeight(LayoutParams.WRAP_CONTENT);
    // 设置SelectPicPopupWindow弹出窗体可点击
    this.setFocusable(true);
    this.setOutsideTouchable(true);
    // 刷新状态
    this.update();
    // 实例化一个ColorDrawable颜色为半透明
    ColorDrawable dw = new ColorDrawable(0000000000);
    // 点back键和其他地方使其消失,设置了这个才能触发OnDismisslistener ,设置其他控件变化等操作
    this.setBackgroundDrawable(dw);
    // mPopupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
    // 设置SelectPicPopupWindow弹出窗体动画效果

    // this.setAnimationStyle(R.style.AnimationPreview);
    l1 = (LinearLayout) conentView.findViewById(R.id.l1);
    l2 = (LinearLayout) conentView.findViewById(R.id.l2);
    l3 = (LinearLayout) conentView.findViewById(R.id.l3);
    l1.setOnTouchListener(this);
    l2.setOnTouchListener(this);
    l3.setOnTouchListener(this);
  }
Exemplo n.º 25
0
  /**
   * Constructor
   *
   * @param activity This will be used to fetch string contants for file storage and displaying
   *     toasts. Also, if this is a MainActivity, then this activity's .updateDataSyncLabel() will
   *     be called when a Drive connection either suceeds or fails.
   */
  public FileUtils(Activity activity) {
    mActivity = activity;
    m_me = this;

    // store string constants and preferences in member variables just for cleanliness
    // (since the strings are `static`, when any instances of FileUtils update these, all instances
    // will get the updates)
    SharedPreferences SP =
        PreferenceManager.getDefaultSharedPreferences(mActivity.getBaseContext());
    mRemoteToplevelFolderName = activity.getString(R.string.FILE_TOPLEVEL_DIR);
    mRemoteTeamFolderName =
        SP.getString(
            mActivity.getResources().getString(R.string.PROPERTY_googledrive_teamname),
            "<Not Set>");
    mRemoteEventFolderName =
        SP.getString(
            mActivity.getResources().getString(R.string.PROPERTY_googledrive_event), "<Not Set>");
    mRemoteTeamPhotosFolderName = "Team Photos";

    mLocalToplevelFilePath = "/sdcard/" + mRemoteToplevelFolderName;
    mLocalTeamFilePath = mLocalToplevelFilePath + "/" + mRemoteTeamFolderName;
    mLocalEventFilePath = mLocalTeamFilePath + "/" + mRemoteEventFolderName;
    mLocalTeamPhotosFilePath = mLocalTeamFilePath + "/" + mRemoteTeamPhotosFolderName;

    checkLocalFileStructure();
    reset_mGoogleApiClient();
  }
Exemplo n.º 26
0
 /**
  * 显示发帖页面
  *
  * @param context
  */
 public static void showMessagePub(Activity context, int catalog) {
   Intent intent = new Intent();
   intent.setClass(context, MessagePub.class);
   intent.putExtra("catalog", catalog);
   context.startActivity(intent);
   context.overridePendingTransition(R.anim.workbook_in, R.anim.none);
 }
Exemplo n.º 27
0
 /** ����ǰActivity����ջ�����һ��ѹ��ģ� */
 public void finishActivity() {
   Activity activity = activityStack.lastElement();
   if (activity != null) {
     activity.finish();
     activity = null;
   }
 }
Exemplo n.º 28
0
 public static void hideSoftKeyboard(Activity activity) {
   InputMethodManager inputMethodManager =
       (InputMethodManager)
           activity.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
   inputMethodManager.hideSoftInputFromWindow(
       activity.getWindow().getDecorView().getRootView().getWindowToken(), 0);
 }
Exemplo n.º 29
0
  @Override
  protected void onPostExecute(Comment result) {
    super.onPostExecute(result);

    if (isShowDialog && dialog != null) {
      try {
        dialog.dismiss();
      } catch (Exception e) {
      }
    }

    if (newComment != null) {
      if (isShowDialog) {
        Toast.makeText(context, R.string.msg_comment_success, Toast.LENGTH_LONG).show();
        Intent intent = new Intent();
        intent.putExtra("RESULT_COMMENT", newComment);
        ((Activity) context).setResult(Constants.RESULT_CODE_SUCCESS, intent);
        ((Activity) context).finish();
      }
    } else {
      if (isShowDialog) {
        Button btnSend = (Button) ((Activity) context).findViewById(R.id.btnOperate);
        btnSend.setEnabled(true);
      }
      Toast.makeText(context, resultMsg, Toast.LENGTH_LONG).show();
    }
  }
 /**
  * 获取状态栏高度
  *
  * @param activity
  * @return
  */
 public int getStatusHeight(Activity activity) {
   int statusHeight = 0;
   Rect localRect = new Rect();
   activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect);
   statusHeight = localRect.top;
   if (0 == statusHeight) {
     Class<?> localClass;
     try {
       localClass = Class.forName("com.android.internal.R$dimen");
       Object localObject = localClass.newInstance();
       int i5 =
           Integer.parseInt(localClass.getField("status_bar_height").get(localObject).toString());
       statusHeight = activity.getResources().getDimensionPixelSize(i5);
     } catch (ClassNotFoundException e) {
       e.printStackTrace();
     } catch (IllegalAccessException e) {
       e.printStackTrace();
     } catch (InstantiationException e) {
       e.printStackTrace();
     } catch (NumberFormatException e) {
       e.printStackTrace();
     } catch (IllegalArgumentException e) {
       e.printStackTrace();
     } catch (SecurityException e) {
       e.printStackTrace();
     } catch (NoSuchFieldException e) {
       e.printStackTrace();
     }
   }
   return statusHeight;
 }