mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Clarify fragment code
This commit is contained in:
parent
d62fd565b6
commit
f5d448285f
3 changed files with 14 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
|
@ -32,11 +33,19 @@ public class NearbyActivity extends AppCompatActivity {
|
||||||
|
|
||||||
registerLocationManager();
|
registerLocationManager();
|
||||||
|
|
||||||
|
// Begin the transaction
|
||||||
|
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||||
|
NearbyListFragment fragment = new NearbyListFragment();
|
||||||
|
ft.add(R.id.container, fragment);
|
||||||
|
ft.commit();
|
||||||
|
|
||||||
|
/*
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.add(R.id.container, new NearbyListFragment())
|
.add(R.id.container, new NearbyListFragment())
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -64,12 +64,9 @@ public class NearbyListFragment extends ListFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This event is triggered soon after onCreateView().
|
|
||||||
// Any view setup should occur here. E.g., view lookups and attaching view listeners.
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
// Setup any handles to view objects here
|
|
||||||
// EditText etFoo = (EditText) view.findViewById(R.id.etFoo);
|
|
||||||
final ListView listview = (ListView) view.findViewById(R.id.listview);
|
final ListView listview = (ListView) view.findViewById(R.id.listview);
|
||||||
|
|
||||||
mAdapter = new NearbyAdapter(getActivity(), places);
|
mAdapter = new NearbyAdapter(getActivity(), places);
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<fragment android:name="fr.free.nrw.commons.nearby.NearbyListFragment"
|
<FrameLayout
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_weight="1"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="0dp"
|
android:layout_height="match_parent">
|
||||||
android:layout_height="match_parent" />
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue