Android Open Source - digital-ocean-swimmer Domain Details Dialog Fragment From Project Back to project page digital-ocean-swimmer .
License The source code is released under:
MIT License
If you think the Android project digital-ocean-swimmer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.yassirh.digitalocean.ui;
/ / f r o m w w w . j a v a 2 s . c o m
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBar.LayoutParams;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView;
import android.widget.TextView;
import com.yassirh.digitalocean.R;
import com.yassirh.digitalocean.model.Domain;
import com.yassirh.digitalocean.model.Record;
import com.yassirh.digitalocean.service.DomainService;
import com.yassirh.digitalocean.service.RecordService;
public class DomainDetailsDialogFragment extends DialogFragment {
DomainService domainService;
RecordService recordService;
public DomainDetailsDialogFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View vi = inflater.inflate(R.layout.dialog_domain_details, container);
String domainName = getArguments().getString("domainName" );
domainService = new DomainService(getActivity());
recordService = new RecordService(getActivity());
Domain domain = domainService.findByDomainName(domainName);
RecordAdapter recordAdapter = new RecordAdapter(getActivity(), domain.getRecords());
getDialog().setTitle(domain.getName());
TextView domainTextView = (TextView)vi.findViewById(R.id.domainTextView);
TextView ttlTextView = (TextView)vi.findViewById(R.id.ttlTextView);
ListView recordsListView = (ListView)vi.findViewById(R.id.recordsListView);
domainTextView.setText(domain.getName());
ttlTextView.setText("ttl : " + domain.getTtl());
recordsListView.setAdapter(recordAdapter);
registerForContextMenu(recordsListView);
return vi;
}
private Record record;
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
if (v.getId() == R.id.recordsListView) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
record = new RecordService(getActivity()).findById(info.id);
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.record_context, menu);
OnMenuItemClickListener listener = new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
onContextItemSelected(item);
return true;
}
};
for (int i = 0, n = menu.size(); i < n; i++)
menu.getItem(i).setOnMenuItemClickListener(listener);
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_edit_record:
Bundle args = new Bundle();
args.putLong("id" , record.getId());
args.putString("domain_name" , record.getDomain().getName());
FragmentManager fm = getActivity().getSupportFragmentManager();
RecordCreateDialogFragment recordCreateDialogFragment = new RecordCreateDialogFragment();
recordCreateDialogFragment.setArguments(args);
recordCreateDialogFragment.show(fm, "create_record" );
return true;
case R.id.action_destroy:
recordService.deleteDomainRecord(record.getDomain().getName(), record.getId(), true);
this.dismiss();
return true;
}
return false;
}
@Override
public void onStart() {
super.onStart();
getDialog().getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
}
Java Source Code List android.support.v4.preference.PreferenceFragment.java android.support.v4.preference.PreferenceManagerCompat.java com.yassirh.digitalocean.data.AccountDao.java com.yassirh.digitalocean.data.AccountTable.java com.yassirh.digitalocean.data.DatabaseHelper.java com.yassirh.digitalocean.data.DomainDao.java com.yassirh.digitalocean.data.DomainTable.java com.yassirh.digitalocean.data.DropletDao.java com.yassirh.digitalocean.data.DropletTable.java com.yassirh.digitalocean.data.ImageDao.java com.yassirh.digitalocean.data.ImageTable.java com.yassirh.digitalocean.data.NetworkDao.java com.yassirh.digitalocean.data.NetworkTable.java com.yassirh.digitalocean.data.RecordDao.java com.yassirh.digitalocean.data.RecordTable.java com.yassirh.digitalocean.data.RegionDao.java com.yassirh.digitalocean.data.RegionTable.java com.yassirh.digitalocean.data.SSHKeyDao.java com.yassirh.digitalocean.data.SSHKeyTable.java com.yassirh.digitalocean.data.SizeDao.java com.yassirh.digitalocean.data.SizeTable.java com.yassirh.digitalocean.data.SqlDao.java com.yassirh.digitalocean.data.TableHelper.java com.yassirh.digitalocean.model.Account.java com.yassirh.digitalocean.model.Action.java com.yassirh.digitalocean.model.Domain.java com.yassirh.digitalocean.model.Droplet.java com.yassirh.digitalocean.model.Image.java com.yassirh.digitalocean.model.Network.java com.yassirh.digitalocean.model.Record.java com.yassirh.digitalocean.model.Region.java com.yassirh.digitalocean.model.SSHKey.java com.yassirh.digitalocean.model.Size.java com.yassirh.digitalocean.service.AccountService.java com.yassirh.digitalocean.service.ActionService.java com.yassirh.digitalocean.service.DomainService.java com.yassirh.digitalocean.service.DropletService.java com.yassirh.digitalocean.service.ImageService.java com.yassirh.digitalocean.service.NotificationsIndexes.java com.yassirh.digitalocean.service.RecordService.java com.yassirh.digitalocean.service.RegionService.java com.yassirh.digitalocean.service.SSHKeyService.java com.yassirh.digitalocean.service.SizeService.java com.yassirh.digitalocean.ui.AccountAdapter.java com.yassirh.digitalocean.ui.AddAccountActivity.java com.yassirh.digitalocean.ui.DomainAdapter.java com.yassirh.digitalocean.ui.DomainDetailsDialogFragment.java com.yassirh.digitalocean.ui.DomainsFragment.java com.yassirh.digitalocean.ui.DrawerPositions.java com.yassirh.digitalocean.ui.DropletAdapter.java com.yassirh.digitalocean.ui.DropletDetailsDialogFragment.java com.yassirh.digitalocean.ui.DropletResizeDialogFragment.java com.yassirh.digitalocean.ui.DropletsFragment.java com.yassirh.digitalocean.ui.ImageAdapter.java com.yassirh.digitalocean.ui.ImagesFragment.java com.yassirh.digitalocean.ui.MainActivity.java com.yassirh.digitalocean.ui.NavigationDrawerAdapter.java com.yassirh.digitalocean.ui.NewDropletActivity.java com.yassirh.digitalocean.ui.PrefsFragment.java com.yassirh.digitalocean.ui.RecordAdapter.java com.yassirh.digitalocean.ui.RecordCreateDialogFragment.java com.yassirh.digitalocean.ui.RecordTypeAdapter.java com.yassirh.digitalocean.ui.RegionAdapter.java com.yassirh.digitalocean.ui.RegionsFragment.java com.yassirh.digitalocean.ui.SSHKeyAdapter.java com.yassirh.digitalocean.ui.SSHKeyCreateDialogFragment.java com.yassirh.digitalocean.ui.SSHKeyFragment.java com.yassirh.digitalocean.ui.SettingsActivity.java com.yassirh.digitalocean.ui.SizeAdapter.java com.yassirh.digitalocean.ui.SizesFragment.java com.yassirh.digitalocean.ui.SwitchAccountDialogFragment.java com.yassirh.digitalocean.ui.Updatable.java com.yassirh.digitalocean.ui.widget.MultiSelectSpinner.java com.yassirh.digitalocean.utils.ApiHelper.java com.yassirh.digitalocean.utils.AppRater.java com.yassirh.digitalocean.utils.MyApplication.java com.yassirh.digitalocean.utils.MyBroadcastReceiver.java com.yassirh.digitalocean.utils.PreferencesHelper.java