@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_edit_location);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setTitle("Edit Locations");

    LinearLayout add_location = (LinearLayout) findViewById(R.id.linear_layout_add_location);
    add_location.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            startActivity(new Intent(EditLocationActivity.this, AddLocationActivity.class));
          }
        });

    LinearLayout add_location_map =
        (LinearLayout) findViewById(R.id.linear_layout_add_location_map);
    add_location_map.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            startActivity(new Intent(EditLocationActivity.this, AddLocationMapActivity.class));
          }
        });

    dragSortListView = (DragSortListView) findViewById(R.id.dragable_list_view);
    editLocationListAdapter =
        new EditLocationListAdapter(EditLocationActivity.this, MainActivity.appDataModel.city_list);
    dragSortListView.setAdapter(editLocationListAdapter);
    dragSortListView.setDropListener(
        new DragSortListView.DropListener() {
          @Override
          public void drop(int from, int to) {
            LocationWeatherInfo item = editLocationListAdapter.listModels.get(from);
            editLocationListAdapter.listModels.remove(from);
            if (from > to) --from;
            editLocationListAdapter.listModels.add(to, item);
            editLocationListAdapter.notifyDataSetChanged();
            MainActivity.navigationMenuListAdapter.notifyDataSetChanged();
          }
        });
  }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   setHasOptionsMenu(true);
   final FragmentActivity activity = getActivity();
   mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
   mPreferences.registerOnSharedPreferenceChangeListener(this);
   mAdapter = new AccountsAdapter(activity);
   Utils.configBaseAdapter(activity, mAdapter);
   mAdapter.setSortEnabled(true);
   mListView.setAdapter(mAdapter);
   mListView.setDragEnabled(true);
   mListView.setDropListener(this);
   mListView.setOnCreateContextMenuListener(this);
   mListView.setEmptyView(mEmptyView);
   mEmptyText.setText(R.string.no_account);
   mEmptyIcon.setImageResource(R.drawable.ic_info_error_generic);
   getLoaderManager().initLoader(0, null, this);
   setListShown(false);
 }
Ejemplo n.º 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_bookmark);
    setTitle(R.string.judul_bukmak_activity);

    adapter = new BookmarkFilterAdapter();
    adapter.reload();

    lv = V.get(this, android.R.id.list);
    lv.setDropListener(adapter);
    lv.setOnItemClickListener(lv_click);
    lv.setAdapter(adapter);

    BookmarkFilterController c = new BookmarkFilterController(lv, adapter);
    lv.setFloatViewManager(c);
    lv.setOnTouchListener(c);

    registerForContextMenu(lv);

    Intent intent = getIntent();
    if (U.equals(intent.getAction(), Intent.ACTION_VIEW)) {
      Uri data = intent.getData();
      if (data != null
          && (U.equals(data.getScheme(), "content")
              || U.equals(data.getScheme(), "file"))) { // $NON-NLS-1$ //$NON-NLS-2$
        try {
          final InputStream inputStream = getContentResolver().openInputStream(data);

          final AlertDialog[] dialog = {null};
          dialog[0] =
              new AlertDialog.Builder(BookmarkActivity.this)
                  .setMessage(R.string.apakah_anda_mau_menumpuk_pembatas_buku_dan_catatan_tanya)
                  .setNegativeButton(R.string.cancel, null)
                  .setNeutralButton(
                      R.string.no,
                      new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog_, int which) {
                          dialog[0].setOnDismissListener(null);
                          importBookmarks(inputStream, false, true);
                        }
                      })
                  .setPositiveButton(
                      R.string.yes,
                      new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog_, int which) {
                          dialog[0].setOnDismissListener(null);
                          importBookmarks(inputStream, true, true);
                        }
                      })
                  .show();
          dialog[0].setOnDismissListener(finishActivityListener);

        } catch (FileNotFoundException e) {
          msgbox(getString(R.string.bl_file_not_found_filename, data.toString()))
              .setOnDismissListener(finishActivityListener);
        }
      }
    }
  }