Android: filtering intents with an URL to Docs is not possible

The Android platform forces to specify a full hostname which is variable in our case
This commit is contained in:
jendib 2014-11-30 22:02:07 +01:00
parent 551c10e7a3
commit 13e8b828ac
5 changed files with 8 additions and 13 deletions

View File

@ -18,14 +18,12 @@
android:label="@string/app_name" > android:label="@string/app_name" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.MainActivity" android:name=".activity.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:logo="@drawable/ic_launcher"
android:launchMode="singleTop"> android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
@ -33,14 +31,12 @@
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /> <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
</activity> </activity>
<activity <activity
android:name=".activity.DocumentActivity" android:name=".activity.DocumentViewActivity"
android:label="" android:label="">
android:logo="@drawable/ic_launcher">
</activity> </activity>
<activity <activity
android:name=".activity.DocumentEditActivity" android:name=".activity.DocumentEditActivity"
android:label="@string/new_document" android:label="@string/new_document">
android:logo="@drawable/ic_launcher">
</activity> </activity>
<provider android:name=".provider.RecentSuggestionsProvider" <provider android:name=".provider.RecentSuggestionsProvider"
android:exported="false" android:exported="false"

View File

@ -20,7 +20,6 @@ public class MainApplication extends Application {
JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON); JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON);
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json); ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
// TODO Catch view intents pointing to a share and display it
// TODO Fullscreen preview // TODO Fullscreen preview
// TODO Caching preferences // TODO Caching preferences
// TODO Documents adding/editing // TODO Documents adding/editing

View File

@ -43,7 +43,7 @@ import de.greenrobot.event.EventBus;
* *
* @author bgamard * @author bgamard
*/ */
public class DocumentActivity extends ActionBarActivity { public class DocumentViewActivity extends ActionBarActivity {
/** /**
* File view pager. * File view pager.
*/ */
@ -91,7 +91,7 @@ public class DocumentActivity extends ActionBarActivity {
} }
// Setup the activity // Setup the activity
setContentView(R.layout.document_activity); setContentView(R.layout.document_view_activity);
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
@ -162,7 +162,7 @@ public class DocumentActivity extends ActionBarActivity {
@Override @Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) { public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
JSONArray files = response.optJSONArray("files"); JSONArray files = response.optJSONArray("files");
filePagerAdapter = new FilePagerAdapter(DocumentActivity.this, files); filePagerAdapter = new FilePagerAdapter(DocumentViewActivity.this, files);
fileViewPager.setAdapter(filePagerAdapter); fileViewPager.setAdapter(filePagerAdapter);
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);

View File

@ -14,8 +14,8 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.sismics.docs.R; import com.sismics.docs.R;
import com.sismics.docs.activity.DocumentActivity;
import com.sismics.docs.activity.DocumentEditActivity; import com.sismics.docs.activity.DocumentEditActivity;
import com.sismics.docs.activity.DocumentViewActivity;
import com.sismics.docs.adapter.DocListAdapter; import com.sismics.docs.adapter.DocListAdapter;
import com.sismics.docs.event.SearchEvent; import com.sismics.docs.event.SearchEvent;
import com.sismics.docs.listener.JsonHttpResponseHandler; import com.sismics.docs.listener.JsonHttpResponseHandler;
@ -86,7 +86,7 @@ public class DocListFragment extends Fragment {
public void onItemClick(View view, int position) { public void onItemClick(View view, int position) {
JSONObject document = adapter.getItemAt(position); JSONObject document = adapter.getItemAt(position);
if (document != null) { if (document != null) {
Intent intent = new Intent(getActivity(), DocumentActivity.class); Intent intent = new Intent(getActivity(), DocumentViewActivity.class);
intent.putExtra("document", document.toString()); intent.putExtra("document", document.toString());
startActivity(intent); startActivity(intent);
} }