Skip to content

Commit 49f4562

Browse files
committed
Revert "force it into landscape mode for now until I can fix tunnel display in portrait mode"
This reverts commit 96bb2cf.
1 parent ca6031a commit 49f4562

5 files changed

Lines changed: 13 additions & 34 deletions

File tree

app/src/main/java/net/i2p/android/I2PActivity.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package net.i2p.android;
22

3-
import android.app.Activity;
43
import android.content.BroadcastReceiver;
54
import android.content.Context;
65
import android.content.Intent;
76
import android.content.IntentFilter;
8-
import android.content.pm.ActivityInfo;
97
import android.os.Bundle;
108
//import android.support.v4.app.Fragment;
119
import androidx.fragment.app.Fragment;
@@ -59,7 +57,6 @@ public class I2PActivity extends I2PActivityBase implements
5957
@Override
6058
protected void onCreate(Bundle savedInstanceState) {
6159
super.onCreate(savedInstanceState);
62-
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
6360
setContentView(R.layout.activity_viewpager);
6461

6562
Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);

app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntryAdapter.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import androidx.core.view.ViewCompat;
99
//import android.support.v7.widget.RecyclerView;
1010
import androidx.recyclerview.widget.RecyclerView;
11-
12-
import android.util.Log;
1311
import android.view.Gravity;
1412
import android.view.LayoutInflater;
1513
import android.view.View;
@@ -75,7 +73,6 @@ public TunnelEntryAdapter(Context context, boolean clientTunnels,
7573

7674
public void setTunnels(List<TunnelEntry> tunnels) {
7775
mTunnels = tunnels;
78-
Log.d("TunnelEntryAdapter", "setTunnels: size=" + (tunnels != null ? tunnels.size() : "null"));
7976
notifyDataSetChanged();
8077
}
8178

@@ -151,8 +148,6 @@ private void setClipboard(Context context, String text) {
151148
// Replace the contents of a view (invoked by the layout manager)
152149
@Override
153150
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
154-
Log.d("TunnelEntryAdapter", "onBindViewHolder: position=" + position +
155-
" viewType=" + holder.getItemViewType());
156151
switch (holder.getItemViewType()) {
157152
case R.string.router_not_running:
158153
((TextView) holder.itemView).setText(
@@ -230,11 +225,9 @@ public boolean onLongClick(View view) {
230225
// Return the size of the dataset (invoked by the layout manager)
231226
@Override
232227
public int getItemCount() {
233-
if (mTunnels == null || mTunnels.isEmpty()) {
234-
Log.d("TunnelEntryAdapter", "getItemCount: returning 1 for empty/null state");
228+
if (mTunnels == null || mTunnels.isEmpty())
235229
return 1;
236-
}
237-
Log.d("TunnelEntryAdapter", "getItemCount: returning " + mTunnels.size());
230+
238231
return mTunnels.size();
239232
}
240233
}

app/src/main/java/net/i2p/android/i2ptunnel/TunnelListFragment.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
120120
@Override
121121
public void onActivityCreated(Bundle savedInstanceState) {
122122
super.onActivityCreated(savedInstanceState);
123-
//mClientTunnels = getArguments().getBoolean(SHOW_CLIENT_TUNNELS);
124-
mClientTunnels = true;
123+
mClientTunnels = getArguments().getBoolean(SHOW_CLIENT_TUNNELS);
125124

126-
//mRecyclerView.setHasFixedSize(true);
125+
mRecyclerView.setHasFixedSize(true);
127126
mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
128127

129128
// use a linear layout manager

app/src/main/java/net/i2p/android/i2ptunnel/TunnelsContainer.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ public void onActivityCreated(Bundle savedInstanceState) {
134134
// Initialize ViewPager and adapter
135135
mFragPagerAdapter = new TunnelsPagerAdapter(getChildFragmentManager());
136136
mViewPager.setAdapter(mFragPagerAdapter);
137-
// Make sure the ViewPager has proper height
138-
/*mViewPager.setLayoutParams(new ViewGroup.LayoutParams(
139-
ViewGroup.LayoutParams.MATCH_PARENT,
140-
ViewGroup.LayoutParams.MATCH_PARENT));*/
141137

142138
setupMagicIndicator();
143139

@@ -305,19 +301,19 @@ public final void onTunnelSelected(int tunnelId, Pair<View, String>[] pairs) {
305301
.replace(R.id.detail_fragment, detailFrag)
306302
.commitNow(); // Use commitNow() to execute synchronously
307303
} catch (Exception e) {
308-
// This exception might occur if the fragment transaction fails due to an invalid state.
309-
// It is handled by logging the error to help with debugging.
310304
Log.e("TunnelsContainer", "Failed to update detail fragment", e);
311305
}
312306
} else {
313307
// In single-pane mode, simply start the detail activity
314308
// for the selected item ID.
315309
Intent detailIntent = new Intent(getActivity(), TunnelDetailActivity.class);
316-
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pairs);
317-
detailIntent.putExtra("tunnel_id", tunnelId);
318-
ActivityCompat.startActivity(getActivity().getApplicationContext(), detailIntent, options.toBundle());
310+
detailIntent.putExtra(TunnelDetailFragment.TUNNEL_ID, tunnelId);
311+
312+
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
313+
getActivity(), pairs);
314+
ActivityCompat.startActivity(getActivity(), detailIntent, options.toBundle());
319315
}
320-
}
316+
}
321317

322318
// TunnelDetailFragment.TunnelDetailListener
323319

app/src/main/res/layout/listitem_i2ptunnel.xml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent"
4-
android:layout_height="wrap_content"
5-
android:minHeight="?android:attr/listPreferredItemHeight">
4+
android:layout_height="wrap_content">
65

7-
<RelativeLayout
8-
style="@style/ListItem.TwoLines"
9-
android:layout_width="match_parent"
10-
android:layout_height="wrap_content">
6+
<RelativeLayout style="@style/ListItem.TwoLines">
117

128
<!-- Tunnel status -->
139
<ImageView
@@ -59,7 +55,5 @@
5955
<View
6056
android:layout_width="match_parent"
6157
android:layout_height="match_parent"
62-
android:background="?attr/selectableItemBackground"
63-
android:clickable="true"
64-
android:focusable="true" />
58+
android:background="?attr/selectableItemBackground" />
6559
</FrameLayout>

0 commit comments

Comments
 (0)